#ifndef SRC_DECODER #define SRC_DECODER extern "C" { #include #include } #include #include #include "struct/video_buffer.h" #include "struct/atomic_queue.h" #include "struct/message.h" #include "helper/error.h" class Decoder { public: Decoder(); ~Decoder(); void start(AtomicQueue *data, VideoBuffer *vb, AVCodecID codecId); void stop(); void flush(); private: void runner(); void loop(AVCodecContext *context, AVCodecParserContext *parser, AVPacket *packet, AVFrame *frame); static AVCodecContext *load_codec(AVCodecID codec_id); std::thread _thread; AVCodecContext* _context; AVCodecID _codecId; Error _status; std::atomic _active = false; AtomicQueue *_data = nullptr; VideoBuffer *_vb = nullptr; }; #endif /* SRC_DECODER */