read_thread.h 794 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef AVPLAYER2_READ_THREAD_H
  2. #define AVPLAYER2_READ_THREAD_H
  3. #pragma once
  4. #include "ThreadBase.h"
  5. #include "packets_sync.h"
  6. class ReadThread : public ThreadBase
  7. {
  8. public:
  9. explicit ReadThread(VideoState* pState = nullptr);
  10. ~ReadThread();
  11. ReadThread(const ReadThread&) = delete;
  12. ReadThread& operator=(const ReadThread&) = delete;
  13. ReadThread(ReadThread&&) = delete;
  14. ReadThread& operator=(ReadThread&&) = delete;
  15. void set_video_state(VideoState* pState = nullptr); // call before start
  16. void stop() override;
  17. protected:
  18. int stream_component_open(int stream_index);
  19. void stream_component_close(VideoState* is, int stream_index);
  20. int loop_read();
  21. void run() override;
  22. private:
  23. VideoState* m_pPlayData;
  24. };
  25. #endif // AVPLAYER2_READ_THREAD_H