src/platform/ffmpeg/ffmpeg-encoder.h (view raw)
1#ifndef FFMPEG_ENCODER
2#define FFMPEG_ENCODER
3
4#include "gba-thread.h"
5
6#include <libavcodec/avcodec.h>
7#include <libavformat/avformat.h>
8
9struct FFmpegEncoder {
10 struct GBAAVStream d;
11 AVFormatContext* context;
12
13 unsigned audioBitrate;
14 const char* audioCodec;
15
16 unsigned videoBitrate;
17 const char* videoCodec;
18
19 const char* containerFormat;
20
21 AVCodecContext* audio;
22 uint16_t* audioBuffer;
23 size_t audioBufferSize;
24 AVFrame* audioFrame;
25 size_t currentAudioSample;
26 int64_t currentAudioFrame;
27 AVStream* audioStream;
28
29 AVCodecContext* video;
30 enum AVPixelFormat pixFormat;
31 AVFrame* videoFrame;
32 int64_t currentVideoFrame;
33 AVStream* videoStream;
34};
35
36void FFmpegEncoderInit(struct FFmpegEncoder*);
37bool FFmpegEncoderSetAudio(struct FFmpegEncoder*, const char* acodec, unsigned abr);
38bool FFmpegEncoderSetVideo(struct FFmpegEncoder*, const char* vcodec, unsigned vbr);
39bool FFmpegEncoderSetContainer(struct FFmpegEncoder*, const char* container);
40bool FFmpegEncoderVerifyContainer(struct FFmpegEncoder*);
41bool FFmpegEncoderOpen(struct FFmpegEncoder*, const char* outfile);
42void FFmpegEncoderClose(struct FFmpegEncoder*);
43
44#endif