all repos — mgba @ 3ad2047855d038006998af37fcf9f957ec450a5a

mGBA Game Boy Advance Emulator

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 <libavformat/avformat.h>
 7
 8struct FFmpegEncoder {
 9	struct GBAAVStream d;
10	struct AVFormatContext* context;
11
12	unsigned audioBitrate;
13	const char* audioCodec;
14
15	unsigned videoBitrate;
16	const char* videoCodec;
17
18	const char* containerFormat;
19
20	struct AVCodecContext* audio;
21	enum AVSampleFormat sampleFormat;
22	int sampleRate;
23	uint16_t* audioBuffer;
24	size_t audioBufferSize;
25	uint16_t* postaudioBuffer;
26	size_t postaudioBufferSize;
27	AVFrame* audioFrame;
28	size_t currentAudioSample;
29	int64_t currentAudioFrame;
30	int64_t nextAudioPts;
31	struct AVAudioResampleContext* resampleContext;
32	struct AVBitStreamFilterContext* absf; // Needed for AAC in MP4
33	struct AVStream* audioStream;
34
35	struct AVCodecContext* video;
36	enum AVPixelFormat pixFormat;
37	struct AVFrame* videoFrame;
38	int64_t currentVideoFrame;
39	struct SwsContext* scaleContext;
40	struct AVStream* videoStream;
41};
42
43void FFmpegEncoderInit(struct FFmpegEncoder*);
44bool FFmpegEncoderSetAudio(struct FFmpegEncoder*, const char* acodec, unsigned abr);
45bool FFmpegEncoderSetVideo(struct FFmpegEncoder*, const char* vcodec, unsigned vbr);
46bool FFmpegEncoderSetContainer(struct FFmpegEncoder*, const char* container);
47bool FFmpegEncoderVerifyContainer(struct FFmpegEncoder*);
48bool FFmpegEncoderOpen(struct FFmpegEncoder*, const char* outfile);
49void FFmpegEncoderClose(struct FFmpegEncoder*);
50
51#endif