From be9c1d1f659b0ff31f656424c478e83a4f7c53b5 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 20 九月 2019 11:44:19 +0800 Subject: [PATCH] update ffmpeg --- csrc/buz/recorder.hpp | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/csrc/buz/recorder.hpp b/csrc/buz/recorder.hpp index ba9cea4..f044907 100644 --- a/csrc/buz/recorder.hpp +++ b/csrc/buz/recorder.hpp @@ -22,10 +22,12 @@ namespace cffmpeg_wrap{ namespace buz{ - struct avpacket{ + // 缂撳瓨鐨勮棰戝抚,绛夊緟fire瑙﹀彂寮�濮嬪綍鍍� + typedef struct _cache_pkt{ std::shared_ptr<ffwrapper::CodedData> data; int64_t id; - }; + }CPacket; + class Recorder{ public: @@ -33,8 +35,9 @@ ~Recorder(); public: - int Run(const char* output, const int mind, const int maxd); - int CachePacket(const avpacket &pkt); + int Run(const char* output, const int mind, const int maxd, const bool audio); + int PushPacket(const CPacket &pkt); + int PushPackets(std::list<CPacket> &lst); int FireRecorder(const int64_t &id); void SetCallback(FUNC_REC_INFO cb){ @@ -42,12 +45,12 @@ } const bool ErrorOcurred(){return error_occured_;} + const std::string& RecID()const{return id_;} private: void run_thread(); - int init_writer(); - void start_writer(); - int write_correctly(const avpacket &pkt); + int init_writer(const bool audio); + int write_correctly(const CPacket &pkt); void end_writer(); void maybe_dump_gop(); @@ -60,7 +63,7 @@ int end_frame; int cur_frame; - std::list<avpacket> list_pkt_; + std::list<CPacket> list_pkt_; std::atomic_bool stop_recorder_; std::mutex mutex_pkt_; @@ -72,11 +75,13 @@ std::string id_; int64_t id_frame_; - int file_frame_index_; + int id_frame_in_file_; std::string file_path_; FUNC_REC_INFO func_rec_info_; bool error_occured_; + + bool audio_; }; } } -- Gitblit v1.8.0