video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-10-19 87fea24e8bba1bfbee707cdaa6f7979451531acc
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
{
@@ -22,9 +23,9 @@
    {
    private:
        ffwrapper::FormatIn *recRef_;
        int     maxduration_;
        int     minduration_;
        int min_cache_len_;
        // 整个流程耗时补偿录制时间,2s默认
        const int time_offset_;
        // 录像的实例,对应任务
        std::unordered_map<std::string, std::unique_ptr<buz::Recorder> > map_rec_;
        // 多线程添加任务实例,在读流线程使用录像,但是添加在另一个线程
@@ -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_;
@@ -70,6 +71,8 @@
        // 获取录像文件路径和帧id
        void GetRecInfo(std::string &recID, int &index, std::string &path);
        
        // 设置录制时长作为缓存
        void SetRecMinCacheTime(const int min);
    public:
        rec();
        ~rec();