#ifndef __DEMUXER_H__ #define __DEMUXER_H__ #include #include #include struct AVFormatContext; struct AVCodec; struct AVCodecParameters; struct AVPacket; enum Stream : uint32_t { Video, Audio, Size, }; class Demuxer { public: using CodecInformation = std::pair; using Callback = std::function &)>; Demuxer(); ~Demuxer(); void open(const std::string &path); CodecInformation codecInformation(Stream type) const; void setStreamPacketCallback(Stream type, const Callback &callback); void start(); protected: void run(); private: bool m_exit; std::thread m_thread; AVFormatContext *m_context; int m_streams[Stream::Size]; CodecInformation m_codecInformations[Stream::Size]; Callback m_callback[Stream::Size]; }; #endif // __DEMUXER_H__