| | |
| | | |
| | | #include "../common/callback.hpp" |
| | | |
| | | #include "../common.hpp" |
| | | |
| | | struct AVPacket; |
| | | |
| | | namespace ffwrapper{ |
| | | class FormatIn; |
| | | class FormatOut; |
| | | |
| | | class CodedData; |
| | | } |
| | | |
| | | namespace cffmpeg_wrap{ |
| | | namespace buz{ |
| | | // 缓存的视频帧,等待fire触发开始录像 |
| | | typedef struct _cache_pkt{ |
| | | std::shared_ptr<ffwrapper::CodedData> data; |
| | | int64_t id; |
| | | }CPacket; |
| | | |
| | | |
| | | class Recorder{ |
| | | public: |
| | |
| | | ~Recorder(); |
| | | |
| | | public: |
| | | int Run(const char* output, const int mind, const int maxd); |
| | | int Run(const char* output, const int mind, const int maxd, const bool audio); |
| | | int PushPacket(const CPacket &pkt); |
| | | int PushPackets(std::list<CPacket> &lst); |
| | | int FireRecorder(const int64_t &id); |
| | |
| | | private: |
| | | void run_thread(); |
| | | |
| | | int init_writer(); |
| | | int init_writer(const bool audio); |
| | | int write_correctly(const CPacket &pkt); |
| | | void end_writer(); |
| | | |
| | | void maybe_dump_gop(); |
| | | |
| | | int init_write_h264(const bool audio); |
| | | int write_h264(const CPacket &pkt); |
| | | int end_write_h264(); |
| | | |
| | | int init_write_hevc(const bool audio); |
| | | int write_hevc(const CPacket &pkt); |
| | | int end_write_hevc(); |
| | | int mux_hevc(FILE *fp, const char *outfile); |
| | | private: |
| | | ffwrapper::FormatIn *in_; |
| | | ffwrapper::FormatOut *out_; |
| | |
| | | int minduration; |
| | | int end_frame; |
| | | int cur_frame; |
| | | int cur_frame_a; |
| | | |
| | | std::list<CPacket> list_pkt_; |
| | | |
| | |
| | | FUNC_REC_INFO func_rec_info_; |
| | | |
| | | bool error_occured_; |
| | | |
| | | bool audio_; |
| | | |
| | | FILE *fp_; |
| | | }; |
| | | } |
| | | } |