src/feature/ffmpeg/ffmpeg-decoder.h (view raw)
1/* Copyright (c) 2013-2020 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef FFMPEG_DECODER
7#define FFMPEG_DECODER
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/interface.h>
14
15#include "feature/ffmpeg/ffmpeg-common.h"
16
17#define FFMPEG_DECODER_BUFSIZE 4096
18
19struct FFmpegDecoder {
20 struct mAVStream* out;
21 struct AVFormatContext* context;
22
23 int audioStream;
24 AVFrame* audioFrame;
25 struct AVCodecContext* audio;
26
27 int videoStream;
28 AVFrame* videoFrame;
29 struct AVCodecContext* video;
30 struct SwsContext* scaleContext;
31
32 int width;
33 int height;
34 uint8_t* pixels;
35};
36
37void FFmpegDecoderInit(struct FFmpegDecoder*);
38bool FFmpegDecoderOpen(struct FFmpegDecoder*, const char* infile);
39void FFmpegDecoderClose(struct FFmpegDecoder*);
40bool FFmpegDecoderIsOpen(struct FFmpegDecoder*);
41bool FFmpegDecoderRead(struct FFmpegDecoder*);
42
43CXX_GUARD_END
44
45#endif