From 0c98249d381d6e56c78d6e752a49e768a4c4d22e Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 27 九月 2019 12:46:29 +0800 Subject: [PATCH] lib log fix --- csrc/buz/recorder.hpp | 41 ++++++++++++++++++++++++----------------- 1 files changed, 24 insertions(+), 17 deletions(-) diff --git a/csrc/buz/recorder.hpp b/csrc/buz/recorder.hpp index 3e12d81..4b22af8 100644 --- a/csrc/buz/recorder.hpp +++ b/csrc/buz/recorder.hpp @@ -13,39 +13,40 @@ #include "../common/callback.hpp" +#include "../common.hpp" + +struct AVPacket; + namespace ffwrapper{ class FormatIn; class FormatOut; - - class CodedData; } namespace cffmpeg_wrap{ namespace buz{ - struct avpacket{ - std::shared_ptr<ffwrapper::CodedData> data; - int64_t id; - }; class Recorder{ public: - explicit Recorder(ffwrapper::FormatIn *in); + Recorder(ffwrapper::FormatIn *in, const std::string &id); ~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){ func_rec_info_ = cb; } + + 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(); @@ -58,19 +59,25 @@ int end_frame; int cur_frame; - std::list<avpacket> list_pkt_; + std::list<CPacket> list_pkt_; - std::unique_ptr<std::thread> thread_; std::atomic_bool stop_recorder_; std::mutex mutex_pkt_; - std::condition_variable cv_; + std::condition_variable cv_; + std::unique_ptr<std::thread> thrd_; + std::string dir_; + std::string id_; - int64_t id_frame_; - int file_frame_index_; + int64_t id_frame_; + int id_frame_in_file_; std::string file_path_; FUNC_REC_INFO func_rec_info_; + + bool error_occured_; + + bool audio_; }; } } -- Gitblit v1.8.0