From a2d19baaa3996bc63edc042230074fb84a2433a1 Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期二, 03 十二月 2019 19:57:03 +0800 Subject: [PATCH] 修改bug --- csrc/worker/decoder.hpp | 38 ++++++++++++-------------------------- 1 files changed, 12 insertions(+), 26 deletions(-) diff --git a/csrc/worker/decoder.hpp b/csrc/worker/decoder.hpp index 3bb3a18..7f87180 100644 --- a/csrc/worker/decoder.hpp +++ b/csrc/worker/decoder.hpp @@ -9,53 +9,39 @@ #include <atomic> #include <condition_variable> -#include "../common.hpp" - struct AVFrame; +struct AVCodecContext; + +class CPacket; namespace ffwrapper { class FormatIn; - class cvbridge; - + class CodedData; } // namespace ffwrapper namespace cffmpeg_wrap { - typedef struct _pic_bgr24{ - unsigned char *data; - int w; - int h; - - int64_t id; - }BGR24; - class decoder { private: - ffwrapper::cvbridge *conv_; - int conv_w_, conv_h_, conv_flag_; ffwrapper::FormatIn *decRef_; - - std::list<BGR24> list_pic_; - std::mutex mutex_pic_; - - std::unique_ptr<std::thread> thread_; - std::atomic_bool stop_; - + std::list<CPacket> list_pkt_; std::mutex mutex_pkt_; - std::condition_variable cv_; + + int64_t next_idx_; + private: int initDecoder(); - int saveFrame(AVFrame *frame, int64_t &id); public: void Start(); - int SetFrame(std::shared_ptr<ffwrapper::CodedData> data, int64_t &id); - void GetFrame(unsigned char **data, int *w, int *h, int64_t *id); + int SetFrame(const CPacket &pkt); + void GetFrame(unsigned char **data, int *w, int *h, int *format, int *length, int64_t *id); + public: - decoder(ffwrapper::FormatIn *dec, const int w, const int h, const int f); + explicit decoder(ffwrapper::FormatIn *dec); ~decoder(); }; -- Gitblit v1.8.0