FileProcessor.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "FLVProcessor.h"
  3. #include <windows.h>
  4. #include <vector>
  5. #include "../nu/AutoLock.h"
  6. class FileProcessor : public FLVProcessor
  7. {
  8. public:
  9. FileProcessor(const wchar_t *filename);
  10. ~FileProcessor();
  11. private:
  12. /* FLVProcessor virtual method overrides */
  13. int Write(void *data, size_t datalen, size_t *written) { return 1; }
  14. uint64_t GetProcessedPosition();
  15. uint32_t GetMaxTimestamp();
  16. bool GetPosition(int time_in_ms, size_t *frameIndex, bool needVideoKeyFrame);
  17. bool IsStreaming() { return false; }
  18. FLVHeader *GetHeader();
  19. public:
  20. /* FLVProcessor virtual method overrides, continued
  21. (these are public so FileProcessor can be used standalone */
  22. int Process();
  23. uint64_t Seek(uint64_t position);
  24. size_t Read(void *data, size_t bytes);
  25. bool GetFrame(size_t frameIndex, FrameData &frameData);
  26. protected:
  27. FileProcessor();
  28. uint64_t processedPosition;
  29. uint64_t writePosition;
  30. HANDLE processedCursor, readCursor;
  31. // file positions of samples
  32. std::vector<FrameData> frames;
  33. Nullsoft::Utility::LockGuard frameGuard;
  34. uint64_t flen;
  35. private:
  36. void Init();
  37. uint32_t maxTimeStamp;
  38. FLVHeader header;
  39. bool headerOK;
  40. };