| | |
| | | #define _cffmpeg_rec_hpp_ |
| | | |
| | | #include <string> |
| | | #include <memory> |
| | | #include <unordered_map> |
| | | #include <list> |
| | | #include <mutex> |
| | | |
| | | #include "../buz/recorder.hpp" |
| | | |
| | | struct AVPacket; |
| | | |
| | | namespace ffwrapper |
| | | { |
| | |
| | | std::mutex mtx_recInfo_; |
| | | |
| | | // 缓存的视频帧,等待firerecsignal触发开始录像 |
| | | std::list<buz::CPacket> list_pkt_; |
| | | std::list<CPacket> list_pkt_; |
| | | // 多线程,生产者线程reader push pkt,消费者,录像线程pop |
| | | std::mutex mtx_pkt_; |
| | | |
| | |
| | | // 丢弃缓存 |
| | | 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); |