video analysis2.0拆分,ffmpeg封装go接口库
554325746@qq.com
2020-03-09 52b0ef0b8d617de555808f6e2dbeffa311711155
local file quit signal
2个文件已修改
31 ■■■■■ 已修改文件
csrc/wrapper.cpp 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csrc/wrapper.hpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
csrc/wrapper.cpp
@@ -55,6 +55,7 @@
    ,rec_(new rec)
    ,logit_(false)
    ,fps_(25)
    ,file_finished_(false)
    {
        makeTheWorld();
    }
@@ -73,6 +74,8 @@
    ,decoder_(nullptr)
    ,rec_(new rec)
    ,logit_(true)
    ,fps_(25)
    ,file_finished_(false)
    {
        makeTheWorld();
        logif::CreateLogger(logfile, true);
@@ -199,9 +202,12 @@
            fps_ = in->getFPS();
            
            int wTime = 1000000.0 / in->getFPS() ;
            if (fps_ < 1 || fps_ > 200){
                fps_ = 25;
            }
            int wTime = 1000000.0 / fps_ ;
            wTime >>= 1;
            logIt("WAIT TIME PER FRAME: %d", wTime);
            init_worker(in.get());
@@ -210,6 +216,11 @@
            int64_t a_id = id;
            bool exist = access(input_url_.c_str(), 0) == 0;
            if (exist){
                wTime <<= 1;
            }
            logIt("WAIT TIME PER FRAME: %d", wTime);
            while(!stop_stream_.load()){
                auto data(std::make_shared<CodedData>());
@@ -248,7 +259,11 @@
            }
            deinit_worker();
            if (exist) break;
            if (exist) {
                logIt("local file exist");
                file_finished_ = true;
                break;
            }
        }
    }
@@ -289,6 +304,15 @@
    }
    void Wrapper::GetPicDecoder(unsigned char **data, int *w, int *h, int *format, int *length, int64_t *id){
        if (file_finished_){
            *data = (unsigned char*)this;
            *w = 1080;
            *h = 720;
            *format = 23;
            *length = 12;
            *id = -10802020;
            return;
        }
        if (decoder_){
            decoder_->GetFrame(data, w, h, format, length, id);
        }
csrc/wrapper.hpp
@@ -82,6 +82,7 @@
        std::function<void()> fn_rec_lazy_;
        bool logit_;
        int fps_;
        bool file_finished_;
    };
    void *CreateEncoder(const int w, const int h, const int fps, const int br,