#pragma once #include #include #include #include extern "C" { #include #include #include } #include "system/loggerd/encoder/encoder.h" #include "system/loggerd/loggerd.h" class FfmpegEncoder : public VideoEncoder { public: FfmpegEncoder(const EncoderInfo &encoder_info, int in_width, int in_height); ~FfmpegEncoder(); int encode_frame(VisionBuf* buf, VisionIpcBufExtra *extra); void encoder_open(); void encoder_close(); private: int segment_num = -1; int counter = 0; bool is_open = false; AVCodecContext *codec_ctx; AVFrame *frame = NULL; std::vector convert_buf; std::vector downscale_buf; };