mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-22 05:52:08 +08:00
ad522f8444
* initial codex * remove ISP delay from encode ms * try something simpler * not allowing increase bug * decrease bitrate increase rate * upsample only on consecutive good checks * rearrange * clean * Revert frame timing processing time change * clean * remove bitrate option and just do it on --stream * make set_bitrate a lot more simple * clean default impl * further cleaning * struct for bitrate to pass ci * refactor a bit * add comment * small clean * add init() * increase bitrate * update ffmpeg message * remove unnecessary include * modify set_bitrate * change to Param * remove getInt helper; add back in diff pr * reword unclear error message * move webrtcd change to new branch
36 lines
785 B
C++
36 lines
785 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();
|
|
void set_bitrate(int bitrate);
|
|
|
|
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;
|
|
};
|