| | |
| | | #define _cffmpeg_rec_hpp_ |
| | | |
| | | #include <string> |
| | | #include <memory> |
| | | #include <unordered_map> |
| | | #include <list> |
| | | #include <mutex> |
| | | |
| | | #include "../buz/recorder.hpp" |
| | | |
| | | struct AVPacket; |
| | | |
| | | namespace ffwrapper |
| | | { |
| | |
| | | { |
| | | 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_; |
| | | // 多线程添加任务实例,在读流线程使用录像,但是添加在另一个线程 |
| | |
| | | std::mutex mtx_recInfo_; |
| | | |
| | | // 缓存的视频帧,等待firerecsignal触发开始录像 |
| | | std::list<buz::CPacket> list_pkt_; |
| | | std::list<CPacket> list_pkt_; |
| | | // 多线程,生产者线程reader push pkt,消费者,录像线程pop |
| | | std::mutex mtx_pkt_; |
| | | |
| | |
| | | // 获取录像文件路径和帧id |
| | | void GetRecInfo(std::string &recID, int &index, std::string &path); |
| | | |
| | | // 设置录制时长作为缓存 |
| | | void SetRecMinCacheTime(const int min); |
| | | public: |
| | | rec(); |
| | | ~rec(); |