mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-24 23:42:05 +08:00
c5d5c5d1f3
date: 2025-10-24T00:30:59 master commit: 405631baf9685e171a0dd19547cb763f1b163d18
35 lines
752 B
C++
35 lines
752 B
C++
#pragma once
|
|
|
|
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
#include <libavcodec/avcodec.h>
|
|
#include <libavformat/avformat.h>
|
|
#include <libavutil/imgutils.h>
|
|
}
|
|
|
|
#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<uint8_t> convert_buf;
|
|
std::vector<uint8_t> downscale_buf;
|
|
};
|