FFmpegPlayer/VideoDecoder.h
2024-01-18 22:22:26 +08:00

29 lines
619 B
C++

#ifndef __VIDEODECODER_H__
#define __VIDEODECODER_H__
#include <memory>
#include <mutex>
#include <queue>
struct AVPacket;
struct AVCodec;
struct AVCodecContext;
struct AVCodecParameters;
class VideoDecoder {
public:
VideoDecoder(const AVCodec *codec, const AVCodecParameters *parameters);
void start();
void push(const std::shared_ptr<AVPacket> &packet);
protected:
void run();
private:
bool m_exit;
std::thread m_thread;
AVCodecContext *m_context;
std::mutex m_mutex;
std::queue<std::shared_ptr<AVPacket>> m_packets;
};
#endif // __VIDEODECODER_H__