From 0560a8fce4c9d005655fce5025bc0fda8c58bff8 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期一, 02 十二月 2019 16:15:47 +0800 Subject: [PATCH] update --- csrc/worker/decoder.hpp | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-) diff --git a/csrc/worker/decoder.hpp b/csrc/worker/decoder.hpp index 0f3f76a..7f87180 100644 --- a/csrc/worker/decoder.hpp +++ b/csrc/worker/decoder.hpp @@ -5,42 +5,43 @@ #include <memory> #include <list> #include <mutex> +#include <thread> +#include <atomic> +#include <condition_variable> + +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::list<CPacket> list_pkt_; + std::mutex mutex_pkt_; + + int64_t next_idx_; private: int initDecoder(); public: - int SetFrame(std::shared_ptr<ffwrapper::CodedData> data, int64_t &id); - void GetFrame(unsigned char **data, int *w, int *h, int64_t *id); + void Start(); + 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