win32_avi_reader.h 1010 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "../nsavi/avi_reader.h"
  3. #include "../nu/ringbuffer.h"
  4. class AVIReaderWin32 : public nsavi::avi_reader, private Filler
  5. {
  6. public:
  7. AVIReaderWin32();
  8. ~AVIReaderWin32();
  9. int Open(const wchar_t *filename);
  10. void Close();
  11. /* avi_reader implementation */
  12. uint64_t GetContentLength();
  13. int Seek(uint64_t position);
  14. private:
  15. int Read(void *p_read_buffer, uint32_t read_length, uint32_t *bytes_read);
  16. int Peek(void *p_read_buffer, uint32_t read_length, uint32_t *bytes_read);
  17. void OverlappedHint(uint32_t read_length);
  18. uint64_t Tell();
  19. int Skip(uint32_t skip_bytes);
  20. void GetFilename(wchar_t *fn, size_t len);
  21. /* internal helpers */
  22. void DoRead();
  23. /* RingBuffer Filler implementation */
  24. size_t Read(void *dest, size_t len);
  25. HANDLE hFile; // i hate hungarian notation, but calling this hFile is a force of habit :)
  26. RingBuffer _ring_buffer;
  27. bool end_of_file;
  28. LARGE_INTEGER position; // since we read ahead, we need to keep track of this separately
  29. wchar_t *local_filename;
  30. };