openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
693 B

#ifndef FFMPEG_ENCODER_H
#define FFMPEG_ENCODER_H
4 months ago
#include <QImage>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
class FFmpegEncoder {
public:
4 months ago
FFmpegEncoder(const std::string& outputFile, int width, int height, int fps);
4 months ago
~FFmpegEncoder();
bool writeFrame(const QImage& image);
private:
bool initialized = false;
int64_t frame_count = 0;
4 months ago
AVFormatContext* format_ctx = nullptr;
AVStream* stream = nullptr;
AVCodecContext* codec_ctx = nullptr;
4 months ago
AVFrame* frame = nullptr;
AVPacket* packet = nullptr;
SwsContext* sws_ctx = nullptr;
bool encodeFrame(AVFrame* input_frame);
};
#endif // FFMPEG_ENCODER_H