summaryrefslogtreecommitdiff
path: root/drivers/theoraplayer/src/FFmpeg/TheoraVideoClip_FFmpeg.h
blob: 03f9a3d9647523bdb8e8425975a86dddfc607850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/************************************************************************************
This source file is part of the Theora Video Playback Library
For latest info, see http://libtheoraplayer.googlecode.com
*************************************************************************************
Copyright (c) 2008-2014 Kresimir Spes (kspes@cateia.com)
This program is free software; you can redistribute it and/or modify it under
the terms of the BSD license: http://opensource.org/licenses/BSD-3-Clause
*************************************************************************************/
#if defined(__FFMPEG) && !defined(_TheoraVideoClip_FFmpeg_h)
#define _TheoraVideoClip_FFmpeg_h

#include "TheoraAudioPacketQueue.h"
#include "TheoraVideoClip.h"

struct AVFormatContext;
struct AVCodecContext;
struct AVCodec;
struct AVFrame;
struct AVIOContext;

class TheoraVideoClip_FFmpeg : public TheoraVideoClip, public TheoraAudioPacketQueue
{
protected:
	bool mLoaded;
	
	AVFormatContext* mFormatContext;
	AVCodecContext* mCodecContext;
	AVIOContext* mAvioContext;
	AVCodec* mCodec;
	AVFrame* mFrame;
	unsigned char* mInputBuffer;
	int mVideoStreamIndex;
	int mFrameNumber;
	
	void unload();
	void doSeek();
public:
	TheoraVideoClip_FFmpeg(TheoraDataSource* data_source,
								 TheoraOutputMode output_mode,
								 int nPrecachedFrames,
								 bool usePower2Stride);
	~TheoraVideoClip_FFmpeg();
	
	bool _readData();
	bool decodeNextFrame();
	void _restart();
	void load(TheoraDataSource* source);
	float decodeAudio();
	void decodedAudioCheck();
	std::string getDecoderName() { return "FFmpeg"; }
};

#endif