22 #include "common/scummsys.h" 26 #ifndef VIDEO_THEORA_DECODER_H 27 #define VIDEO_THEORA_DECODER_H 29 #include "common/rational.h" 30 #include "video/video_decoder.h" 31 #include "audio/mixer.h" 32 #include "graphics/surface.h" 34 #include <theora/theoradec.h> 37 #include <tremor/ivorbiscodec.h> 39 #include <vorbis/codec.h> 43 class SeekableReadStream;
48 class QueuingAudioStream;
61 class TheoraDecoder :
public VideoDecoder {
64 virtual ~TheoraDecoder();
77 void readNextPacket();
80 class TheoraVideoTrack :
public VideoTrack {
82 TheoraVideoTrack(th_info &theoraInfo, th_setup_info *theoraSetup);
85 bool endOfTrack()
const {
return _endOfVideo; }
86 uint16 getWidth()
const {
return _width; }
87 uint16 getHeight()
const {
return _height; }
92 _pixelFormat = format;
96 int getCurFrame()
const {
return _curFrame; }
98 uint32 getNextFrameStartTime()
const {
return (uint32)(_nextFrameStartTime * 1000); }
101 bool decodePacket(ogg_packet &oggPacket);
102 void setEndOfVideo() { _endOfVideo =
true; }
108 double _nextFrameStartTime;
117 uint16 _surfaceWidth;
118 uint16 _surfaceHeight;
120 th_dec_ctx *_theoraDecode;
121 th_pixel_fmt _theoraPixelFormat;
123 void translateYUVtoRGBA(th_ycbcr_buffer &YUVBuffer);
126 class VorbisAudioTrack :
public AudioTrack {
131 bool decodeSamples();
132 bool hasAudio()
const;
133 bool needsAudio()
const;
134 void synthesizePacket(ogg_packet &oggPacket);
135 void setEndOfAudio() { _endOfAudio =
true; }
142 int _audioBufferFill;
143 ogg_int16_t *_audioBuffer;
147 vorbis_block _vorbisBlock;
148 vorbis_dsp_state _vorbisDSP;
153 void queuePage(ogg_page *page);
156 void ensureAudioBufferSize();
160 ogg_sync_state _oggSync;
162 ogg_packet _oggPacket;
164 ogg_stream_state _theoraOut, _vorbisOut;
165 bool _hasVideo, _hasAudio;
167 vorbis_info _vorbisInfo;
169 TheoraVideoTrack *_videoTrack;
170 VorbisAudioTrack *_audioTrack;
Definition: rational.h:40
SoundType
Definition: mixer.h:62
Definition: algorithm.h:29
Definition: audiostream.h:50
Definition: audiostream.h:370
Definition: avi_frames.h:36