video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-09-29 e878e92811a2dbfb6b4d3f7b2c357435f56e28db
csrc/worker/rec.hpp
@@ -2,12 +2,13 @@
#define _cffmpeg_rec_hpp_
#include <string>
#include <memory>
#include <unordered_map>
#include <list>
#include <mutex>
#include "../buz/recorder.hpp"
struct AVPacket;
namespace ffwrapper
{
@@ -41,7 +42,7 @@
        std::mutex mtx_recInfo_;
        // 缓存的视频帧,等待firerecsignal触发开始录像
        std::list<buz::CPacket> list_pkt_;
        std::list<CPacket> list_pkt_;
        // 多线程,生产者线程reader push pkt,消费者,录像线程pop
        std::mutex mtx_pkt_;
@@ -53,11 +54,11 @@
        // 丢弃缓存
        int shrinkCache();
        // 创建录像实例开始录像
        std::unique_ptr<buz::Recorder> startRec(std::string id, std::string dir, const int mind, const int maxd);
        std::unique_ptr<buz::Recorder> startRec(std::string id, std::string dir, const int mind, const int maxd, const bool audio);
        // 清除缓存,断线重连时需要
        void clear();
    public:
        void NewRec(const char* id, const char *output, const int mindur, const int maxdur);
        void NewRec(const char* id, const char *output, const int mindur, const int maxdur, const bool audio);
        // 准备好录像
        void Load(ffwrapper::FormatIn *in);