ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Decoder for AVI videos. More...

#include <avi_decoder.h>

Inheritance diagram for Video::AVIDecoder:
Collaboration diagram for Video::AVIDecoder:

List of all members.

Classes

class  AVIAudioTrack
struct  AVIHeader
struct  AVIStreamHeader
class  AVIVideoTrack
struct  BitmapInfoHeader
class  IndexEntries
struct  OldIndex
struct  PCMWaveFormat
struct  TrackStatus
struct  WaveFormat
struct  WaveFormatEX

Public Member Functions

 AVIDecoder ()
 AVIDecoder (const Common::Rational &frameRateOverride)
virtual ~AVIDecoder ()
bool loadStream (Common::SeekableReadStream *stream)
 Load a video from a generic read stream.
void close ()
 Close the active video stream and free any associated resources.
uint16 getWidth () const
 Returns the width of the video's frames.
uint16 getHeight () const
 Returns the height of the video's frames.
bool rewind ()
 Rewind a video to its beginning.
bool isRewindable () const
 Returns if a video is rewindable or not.
bool isSeekable () const
 Returns if a video is seekable or not.
virtual const Graphics::SurfacedecodeNextFrame ()
 Decode the next frame into a surface and return the latter.
const Graphics::SurfacedecodeNextTransparency ()
 Decodes the next transparency track frame.
virtual AVIAudioTrackcreateAudioTrack (AVIStreamHeader sHeader, PCMWaveFormat wvInfo)
virtual bool seekToFrame (uint frame)
 Seek to a given frame.

Protected Types

enum  IndexFlags { AVIIF_INDEX = 0x10 }
enum  AVIFlags {
  AVIF_HASINDEX = 0x00000010, AVIF_MUSTUSEINDEX = 0x00000020, AVIF_ISINTERLEAVED = 0x00000100, AVIF_TRUSTCKTYPE = 0x00000800,
  AVIF_WASCAPTUREFILE = 0x00010000, AVIF_WASCOPYRIGHTED = 0x00020000
}

Protected Member Functions

void readNextPacket ()
 Decode enough data for the next frame and enough audio to last that long.
bool seekIntern (const Audio::Timestamp &time)
 The internal seek function that does the actual seeking.
bool supportsAudioTrackSwitching () const
 Does this video format support switching between audio tracks?
AudioTrackgetAudioTrack (int index)
 Get the audio track for the given index.
void addTrack (Track *track, bool isExternal=false)
 Define a track to be used by this class.
void readOldIndex (uint32 size)
void initCommon ()
bool parseNextChunk ()
void skipChunk (uint32 size)
void handleList (uint32 listSize)
void handleStreamHeader (uint32 size)
void readStreamName (uint32 size)
uint16 getStreamType (uint32 tag) const
void checkTruemotion1 ()
uint getVideoTrackOffset (uint trackIndex, uint frameNumber=0)
void handleNextPacket (TrackStatus &status)
bool shouldQueueAudio (TrackStatus &status)
void seekTransparencyFrame (int frame)

Static Protected Member Functions

static byte getStreamIndex (uint32 tag)

Protected Attributes

AVIHeader _header
IndexEntries _indexEntries
Common::SeekableReadStream_fileStream
bool _decodedHeader
bool _foundMovieList
uint32 _movieListStart
uint32 _movieListEnd
Common::Rational _frameRateOverride
int _videoTrackCounter
int _audioTrackCounter
Track_lastAddedTrack
Common::Array< TrackStatus_videoTracks
Common::Array< TrackStatus_audioTracks
TrackStatus _transparencyTrack

Detailed Description

Decoder for AVI videos.

Video decoder used in engines:

  • sci
  • sword1
  • sword2
  • titanic
  • zvision

Definition at line 63 of file avi_decoder.h.


Member Enumeration Documentation

enum Video::AVIDecoder::AVIFlags [protected]
Enumerator:
AVIF_HASINDEX 
AVIF_MUSTUSEINDEX 
AVIF_ISINTERLEAVED 
AVIF_TRUSTCKTYPE 
AVIF_WASCAPTUREFILE 
AVIF_WASCOPYRIGHTED 

Definition at line 174 of file avi_decoder.h.

Enumerator:
AVIIF_INDEX 

Definition at line 155 of file avi_decoder.h.


Constructor & Destructor Documentation

Video::AVIDecoder::AVIDecoder (  ) 

Definition at line 79 of file avi_decoder.cpp.

Video::AVIDecoder::AVIDecoder ( const Common::Rational frameRateOverride  ) 

Definition at line 84 of file avi_decoder.cpp.

Video::AVIDecoder::~AVIDecoder (  )  [virtual]

Definition at line 89 of file avi_decoder.cpp.


Member Function Documentation

void Video::AVIDecoder::addTrack ( Track track,
bool  isExternal = false 
) [protected]

Define a track to be used by this class.

The pointer is then owned by this base class.

Parameters:
track The track to add
isExternal Is this an external track not found by loadStream()?

Reimplemented from Video::VideoDecoder.

Definition at line 357 of file avi_decoder.cpp.

void Video::AVIDecoder::checkTruemotion1 (  )  [protected]

Definition at line 863 of file avi_decoder.cpp.

void Video::AVIDecoder::close (  )  [virtual]

Close the active video stream and free any associated resources.

All subclasses that need to close their own resources should still call the base class' close() function at the start of their function.

Reimplemented from Video::VideoDecoder.

Definition at line 454 of file avi_decoder.cpp.

AVIDecoder::AVIAudioTrack * Video::AVIDecoder::createAudioTrack ( AVIStreamHeader  sHeader,
PCMWaveFormat  wvInfo 
) [virtual]

Definition at line 93 of file avi_decoder.cpp.

const Graphics::Surface * Video::AVIDecoder::decodeNextFrame (  )  [virtual]

Decode the next frame into a surface and return the latter.

A subclass may override this, but must still call this function. As an example, a subclass may do this to apply some global video scale to individual track's frame.

Note that this will call readNextPacket() internally first before calling the next video track's decodeNextFrame() function.

Returns:
a surface containing the decoded frame, or 0
Note:
Ownership of the returned surface stays with the VideoDecoder, hence the caller must *not* free it.
this may return 0, in which case the last frame should be kept on screen

Reimplemented from Video::VideoDecoder.

Definition at line 132 of file avi_decoder.cpp.

const Graphics::Surface * Video::AVIDecoder::decodeNextTransparency (  ) 

Decodes the next transparency track frame.

Definition at line 165 of file avi_decoder.cpp.

VideoDecoder::AudioTrack * Video::AVIDecoder::getAudioTrack ( int  index  )  [protected, virtual]

Get the audio track for the given index.

This is used only if supportsAudioTrackSwitching() returns true.

Parameters:
index The index of the track, whose meaning is dependent on the container
Returns:
The audio track for the index, or 0 if not found

Reimplemented from Video::VideoDecoder.

Definition at line 892 of file avi_decoder.cpp.

uint16 Video::AVIDecoder::getHeight (  )  const [inline, virtual]

Returns the height of the video's frames.

By default, this finds the largest height between all of the loaded tracks. However, a subclass may override this if it does any kind of post-processing on it.

Returns:
the height of the video's frames

Reimplemented from Video::VideoDecoder.

Definition at line 72 of file avi_decoder.h.

byte Video::AVIDecoder::getStreamIndex ( uint32  tag  )  [static, protected]

Definition at line 813 of file avi_decoder.cpp.

uint16 Video::AVIDecoder::getStreamType ( uint32  tag  )  const [inline, protected]

Definition at line 350 of file avi_decoder.h.

uint Video::AVIDecoder::getVideoTrackOffset ( uint  trackIndex,
uint  frameNumber = 0 
) [protected]

Definition at line 614 of file avi_decoder.cpp.

uint16 Video::AVIDecoder::getWidth (  )  const [inline, virtual]

Returns the width of the video's frames.

By default, this finds the largest width between all of the loaded tracks. However, a subclass may override this if it does any kind of post-processing on it.

Returns:
the width of the video's frames

Reimplemented from Video::VideoDecoder.

Definition at line 71 of file avi_decoder.h.

void Video::AVIDecoder::handleList ( uint32  listSize  )  [protected]

Definition at line 231 of file avi_decoder.cpp.

void Video::AVIDecoder::handleNextPacket ( TrackStatus status  )  [protected]

Definition at line 492 of file avi_decoder.cpp.

void Video::AVIDecoder::handleStreamHeader ( uint32  size  )  [protected]

Definition at line 264 of file avi_decoder.cpp.

void Video::AVIDecoder::initCommon (  )  [protected]

Definition at line 114 of file avi_decoder.cpp.

bool Video::AVIDecoder::isRewindable (  )  const [inline, virtual]

Returns if a video is rewindable or not.

The default implementation polls each track for rewindability.

Reimplemented from Video::VideoDecoder.

Definition at line 75 of file avi_decoder.h.

bool Video::AVIDecoder::isSeekable (  )  const [virtual]

Returns if a video is seekable or not.

The default implementation polls each track for seekability.

Reimplemented from Video::VideoDecoder.

Definition at line 126 of file avi_decoder.cpp.

bool Video::AVIDecoder::loadStream ( Common::SeekableReadStream stream  )  [virtual]

Load a video from a generic read stream.

The ownership of the stream object transfers to this VideoDecoder instance, which is hence also responsible for eventually deleting it.

Implementations of this function are required to call addTrack() for each track in the video upon success.

Parameters:
stream the stream to load
Returns:
whether loading the stream succeeded

Implements Video::VideoDecoder.

Definition at line 384 of file avi_decoder.cpp.

bool Video::AVIDecoder::parseNextChunk (  )  [protected]

Definition at line 173 of file avi_decoder.cpp.

void Video::AVIDecoder::readNextPacket (  )  [protected, virtual]

Decode enough data for the next frame and enough audio to last that long.

This function is used by this class' decodeNextFrame() function. A subclass of a Track may decide to just have its decodeNextFrame() function read and decode the frame, but only if it is the only track in the video.

Reimplemented from Video::VideoDecoder.

Definition at line 474 of file avi_decoder.cpp.

void Video::AVIDecoder::readOldIndex ( uint32  size  )  [protected]

Definition at line 820 of file avi_decoder.cpp.

void Video::AVIDecoder::readStreamName ( uint32  size  )  [protected]

Definition at line 362 of file avi_decoder.cpp.

bool Video::AVIDecoder::rewind (  )  [virtual]

Rewind a video to its beginning.

If the video is playing, it will continue to play. The default implementation will rewind each track.

Returns:
true on success, false otherwise

Reimplemented from Video::VideoDecoder.

Definition at line 601 of file avi_decoder.cpp.

bool Video::AVIDecoder::seekIntern ( const Audio::Timestamp time  )  [protected, virtual]

The internal seek function that does the actual seeking.

See also:
seek()
Returns:
true on success, false otherwise

Reimplemented from Video::VideoDecoder.

Definition at line 623 of file avi_decoder.cpp.

bool Video::AVIDecoder::seekToFrame ( uint  frame  )  [virtual]

Seek to a given frame.

This only works when the video track(s) supports getFrameTime(). This calls seek() internally.

Reimplemented from Video::VideoDecoder.

Definition at line 97 of file avi_decoder.cpp.

void Video::AVIDecoder::seekTransparencyFrame ( int  frame  )  [protected]

Definition at line 775 of file avi_decoder.cpp.

bool Video::AVIDecoder::shouldQueueAudio ( TrackStatus status  )  [protected]

Definition at line 586 of file avi_decoder.cpp.

void Video::AVIDecoder::skipChunk ( uint32  size  )  [protected]

Definition at line 226 of file avi_decoder.cpp.

bool Video::AVIDecoder::supportsAudioTrackSwitching (  )  const [inline, protected, virtual]

Does this video format support switching between audio tracks?

Returning true implies this format supports multiple audio tracks, can switch tracks, and defaults to playing the first found audio track.

Reimplemented from Video::VideoDecoder.

Definition at line 103 of file avi_decoder.h.


Member Data Documentation

Definition at line 340 of file avi_decoder.h.

Definition at line 334 of file avi_decoder.h.

Definition at line 335 of file avi_decoder.h.

Definition at line 328 of file avi_decoder.h.

Definition at line 331 of file avi_decoder.h.

Definition at line 341 of file avi_decoder.h.

Definition at line 336 of file avi_decoder.h.

Definition at line 336 of file avi_decoder.h.

Definition at line 360 of file avi_decoder.h.

Definition at line 340 of file avi_decoder.h.


The documentation for this class was generated from the following files:


Generated on Sat Jul 13 2019 05:05:14 for ResidualVM by doxygen 1.7.1
curved edge   curved edge