Theora Playback Library
1.0.0
Main Page
Classes
Files
File List
File Members
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
theoraplayer
include
theoraplayer
TheoraVideoClip.h
Go to the documentation of this file.
1
/************************************************************************************
2
This source file is part of the Theora Video Playback Library
3
For latest info, see http://libtheoraplayer.sourceforge.net/
4
*************************************************************************************
5
Copyright (c) 2008-2013 Kresimir Spes (kspes@cateia.com)
6
This program is free software; you can redistribute it and/or modify it under
7
the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php
8
*************************************************************************************/
9
10
#ifndef _TheoraVideoClip_h
11
#define _TheoraVideoClip_h
12
13
#include <string>
14
#include "
TheoraExport.h
"
15
16
// forward class declarations
17
class
TheoraMutex
;
18
class
TheoraFrameQueue
;
19
class
TheoraTimer
;
20
class
TheoraAudioInterface
;
21
class
TheoraWorkerThread
;
22
class
TheoraDataSource
;
23
class
TheoraVideoFrame
;
24
28
enum
TheoraOutputMode
29
{
30
// A = full alpha (255), order of letters represents the byte order for a pixel
31
// A means the image is treated as if it contains an alpha channel, while X formats
32
// just mean that RGB frame is transformed to a 4 byte format
33
TH_UNDEFINED
= 0,
34
TH_RGB
= 1,
35
TH_RGBA
= 2,
36
TH_RGBX
= 3,
37
TH_ARGB
= 4,
38
TH_XRGB
= 5,
39
TH_BGR
= 6,
40
TH_BGRA
= 7,
41
TH_BGRX
= 8,
42
TH_ABGR
= 9,
43
TH_XBGR
= 10,
44
TH_GREY
= 11,
45
TH_GREY3
= 12,
46
TH_GREY3A
= 13,
47
TH_GREY3X
= 14,
48
TH_AGREY3
= 15,
49
TH_XGREY3
= 16,
50
TH_YUV
= 17,
51
TH_YUVA
= 18,
52
TH_YUVX
= 19,
53
TH_AYUV
= 20,
54
TH_XYUV
= 21
55
};
56
61
class
TheoraPlayerExport
TheoraVideoClip
62
{
63
friend
class
TheoraWorkerThread
;
64
friend
class
TheoraVideoFrame
;
65
friend
class
TheoraVideoManager
;
66
protected
:
67
TheoraFrameQueue
*
mFrameQueue
;
68
TheoraAudioInterface
*
mAudioInterface
;
69
TheoraDataSource
*
mStream
;
70
71
TheoraTimer
*
mTimer
, *mDefaultTimer;
72
73
TheoraWorkerThread
*
mAssignedWorkerThread
;
74
75
bool
mUseAlpha
;
76
77
bool
mWaitingForCache
;
78
79
// benchmark vars
80
int
mNumDroppedFrames, mNumDisplayedFrames,
mNumPrecachedFrames
;
81
82
int
mThreadAccessCount
;
83
84
int
mSeekFrame
;
85
float
mDuration,
mFrameDuration
, mFPS;
86
float
mPriority
;
87
std::string
mName
;
88
int
mWidth
, mHeight, mStride;
89
int
mNumFrames
;
90
91
float
mAudioGain
;
92
93
TheoraOutputMode
mOutputMode,
mRequestedOutputMode
;
94
bool
mAutoRestart
;
95
bool
mEndOfFile,
mRestarted
;
96
int
mIteration,
mLastIteration
;
97
98
TheoraMutex
*
mAudioMutex
;
99
TheoraMutex
*
mThreadAccessMutex
;
100
109
int
calculatePriority();
110
void
readTheoraVorbisHeaders();
111
virtual
void
doSeek() = 0;
112
virtual
bool
_readData() = 0;
113
bool
isBusy();
114
121
virtual
float
decodeAudio() = 0;
122
123
virtual
void
load(
TheoraDataSource
* source) = 0;
124
125
virtual
void
_restart() = 0;
// resets the decoder and stream but leaves the frame queue intact
126
public
:
127
TheoraVideoClip
(
TheoraDataSource
* data_source,
128
TheoraOutputMode
output_mode,
129
int
nPrecachedFrames,
130
bool
usePower2Stride);
131
virtual
~
TheoraVideoClip
();
132
133
std::string getName();
135
virtual
std::string getDecoderName() = 0;
136
138
int
getNumDisplayedFrames
() {
return
mNumDisplayedFrames; }
140
int
getNumDroppedFrames
() {
return
mNumDroppedFrames; }
141
143
int
getWidth();
145
int
getHeight();
155
int
getStride
() {
return
mStride; }
156
158
TheoraTimer
* getTimer();
160
void
setTimer(
TheoraTimer
* timer);
161
163
virtual
bool
decodeNextFrame() = 0;
164
166
void
update
(
float
time_increase);
173
float
updateToNextFrame();
174
175
176
TheoraFrameQueue
* getFrameQueue();
177
183
void
popFrame();
184
190
TheoraVideoFrame
* getNextFrame();
196
virtual
void
decodedAudioCheck() = 0;
197
198
void
setAudioInterface(
TheoraAudioInterface
* iface);
199
TheoraAudioInterface
* getAudioInterface();
200
206
void
setNumPrecachedFrames(
int
n);
208
int
getNumPrecachedFrames();
210
int
getNumReadyFrames();
211
213
void
setAudioGain(
float
gain);
214
float
getAudioGain();
215
217
void
setAutoRestart(
bool
value);
218
bool
getAutoRestart
() {
return
mAutoRestart; }
219
220
221
225
void
setPriority(
float
priority);
226
float
getPriority();
227
229
float
getPriorityIndex();
230
232
float
getTimePosition();
234
float
getDuration();
236
float
getFPS();
238
int
getNumFrames
() {
return
mNumFrames; }
239
241
TheoraOutputMode
getOutputMode();
247
void
setOutputMode(
TheoraOutputMode
mode);
248
249
bool
isDone();
250
void
play();
251
void
pause();
252
void
restart();
253
bool
isPaused();
254
void
stop();
255
void
setPlaybackSpeed(
float
speed);
256
float
getPlaybackSpeed();
258
void
seek(
float
time);
260
void
seekToFrame(
int
frame);
262
void
waitForCache(
float
desired_cache_factor = 0.5f,
float
max_wait_time = 1.0f);
263
};
264
265
#endif
Generated by
1.8.3.1