FLVProcessor.h 887 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <bfc/platform/types.h>
  3. #include "FLVStreamHeader.h"
  4. #include "FLVHeader.h"
  5. struct FrameData
  6. {
  7. FLVStreamHeader header;
  8. uint64_t location;
  9. bool keyFrame;
  10. };
  11. enum
  12. {
  13. FLV_OK=0,
  14. FLV_NEED_MORE_DATA=1,
  15. FLV_ERROR=-1,
  16. FLVPROCESSOR_WRITE_OK=0,
  17. FLVPROCESSOR_WRITE_ERROR=1,
  18. FLVPROCESSOR_WRITE_WAIT=2,
  19. };
  20. class FLVProcessor
  21. {
  22. public:
  23. virtual ~FLVProcessor() {}
  24. virtual int Write(void *data, size_t datalen, size_t *written) = 0;
  25. virtual int Process()=0;
  26. virtual uint64_t Seek(uint64_t position)=0;
  27. virtual size_t Read(void *data, size_t bytes)=0;
  28. virtual uint64_t GetProcessedPosition()=0;
  29. virtual bool GetFrame(size_t frameIndex, FrameData &frameData)=0;
  30. virtual uint32_t GetMaxTimestamp()=0;
  31. virtual bool GetPosition(int time_in_ms, size_t *frameIndex, bool needsVideoKeyFrame)=0;
  32. virtual bool IsStreaming()=0;
  33. virtual FLVHeader *GetHeader() = 0;
  34. };