all repos — mgba @ eab30ebf0583df2e2fc388e3b03481b3f87bd281

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 <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	enum AVSampleFormat sampleFormat;
23	int sampleRate;
24	uint16_t* audioBuffer;
25	size_t audioBufferSize;
26	uint16_t* postaudioBuffer;
27	size_t postaudioBufferSize;
28	AVFrame* audioFrame;
29	size_t currentAudioSample;
30	int64_t currentAudioFrame;
31	int64_t nextAudioPts;
32	struct AVAudioResampleContext* resampleContext;
33	AVStream* audioStream;
34
35	AVCodecContext* video;
36	enum AVPixelFormat pixFormat;
37	AVFrame* videoFrame;
38	int64_t currentVideoFrame;
39	struct SwsContext* scaleContext;
40	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