video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-07-26 88c21b872799a1ae9dd7dd7d20f3811d749d9418
csrc/buz/recorder.cpp
@@ -17,7 +17,7 @@
namespace cffmpeg_wrap{
    namespace buz{
        Recorder::Recorder(FormatIn *in)
        Recorder::Recorder(FormatIn *in, const std::string &id)
        :in_(in)
        ,out_(NULL)
        ,maxduration(30 * 25)
@@ -26,6 +26,7 @@
        ,cur_frame(-1)
        ,thread_(nullptr)
        ,stop_recorder_(false)
        ,id_(id)
        ,id_frame_(0)
        ,file_frame_index_(-1)
        ,file_path_("")
@@ -59,6 +60,7 @@
        void Recorder::start_writer(){
            if (cur_frame == 0) {
                srandom(time(NULL));
                file_path_ = dir_ + "/" + std::to_string(random()) + ".mp4";
                out_->JustWriter(in_->getStream(), file_path_.c_str());
                logIt("start record %s", file_path_.c_str());
@@ -95,7 +97,7 @@
            }
            //callback to frame index and path
            if(func_rec_info_){
                func_rec_info_(file_frame_index_, file_path_);
                func_rec_info_(id_,file_frame_index_, file_path_);
                // logIt("recoder index %d, file name %s\n", file_frame_index_, file_path_.c_str());
            }else{
                // logIt("recorder has no func_rec_info");