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 AVCodecContext* audio;
20 uint16_t* audioBuffer;
21 size_t audioBufferSize;
22 AVFrame* audioFrame;
23 size_t currentAudioSample;
24 int64_t currentAudioFrame;
25 AVStream* audioStream;
26
27 AVCodecContext* video;
28 enum AVPixelFormat pixFormat;
29 AVFrame* videoFrame;
30 int64_t currentVideoFrame;
31 AVStream* videoStream;
32};
33
34void FFmpegEncoderInit(struct FFmpegEncoder*);
35bool FFmpegEncoderSetAudio(struct FFmpegEncoder*, const char* acodec, unsigned abr);
36bool FFmpegEncoderSetVideo(struct FFmpegEncoder*, const char* vcodec, unsigned vbr);
37bool FFmpegEncoderOpen(struct FFmpegEncoder*, const char* outfile);
38void FFmpegEncoderClose(struct FFmpegEncoder*);
39
40#endif