aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Input/in_avi/win32_avi_reader.h
blob: f853fad8f4179640657012480d17b5035ebd8455 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include "../nsavi/avi_reader.h"
#include "../nu/ringbuffer.h"

class AVIReaderWin32 : public nsavi::avi_reader, private Filler
{
public:
	AVIReaderWin32();
	~AVIReaderWin32();
	int Open(const wchar_t *filename);
	void Close();

/* avi_reader implementation */
	uint64_t GetContentLength();
	int Seek(uint64_t position);

private:
	int Read(void *p_read_buffer, uint32_t read_length, uint32_t *bytes_read);
	int Peek(void *p_read_buffer, uint32_t read_length, uint32_t *bytes_read);
	void OverlappedHint(uint32_t read_length);
	uint64_t Tell();
	int Skip(uint32_t skip_bytes);
	void GetFilename(wchar_t *fn, size_t len);
	
	/* internal helpers */
	void DoRead();
/* RingBuffer Filler implementation */
		size_t Read(void *dest, size_t len);

	HANDLE hFile; // i hate hungarian notation, but calling this hFile is a force of habit :)
	RingBuffer _ring_buffer;
	bool end_of_file;
	LARGE_INTEGER position; // since we read ahead, we need to keep track of this separately
	wchar_t *local_filename;

};