GRAPHICS: Change signature of VideoDecoder::load()

Now takes a pointer to a stream, instead of a reference.
The rational is that in all instances, callers have a pointer
(and dereference it to call load), and all load implementations
turn the reference back into a pointer.

svn-id: r51725
This commit is contained in:
Max Horn 2010-08-04 08:25:05 +00:00
parent 154c589f18
commit 0e2807dc27
20 changed files with 38 additions and 42 deletions

View File

@ -73,7 +73,7 @@ bool VideoPlayer::Video::open(const char *fileName, Type which, int16 width, int
return false;
}
if (!_video->load(*_stream)) {
if (!_video->load(_stream)) {
warning("While loading video \"%s\"", fileName);
close();
return false;

View File

@ -342,7 +342,7 @@ VideoHandle VideoManager::createVideoHandle(uint16 id, uint16 x, uint16 y, bool
entry.loop = loop;
entry.enabled = true;
entry->setChunkBeginOffset(_vm->getResourceOffset(ID_TMOV, id));
entry->load(*_vm->getRawData(ID_TMOV, id));
entry->load(_vm->getRawData(ID_TMOV, id));
// Search for any deleted videos so we can take a formerly used slot
for (uint32 i = 0; i < _videoStreams.size(); i++)
@ -378,7 +378,7 @@ VideoHandle VideoManager::createVideoHandle(Common::String filename, uint16 x, u
return NULL_VID_HANDLE;
}
entry->load(*file);
entry->load(file);
// Search for any deleted videos so we can take a formerly used slot
for (uint32 i = 0; i < _videoStreams.size(); i++)

View File

@ -55,10 +55,10 @@ SeqDecoder::~SeqDecoder() {
close();
}
bool SeqDecoder::load(Common::SeekableReadStream &stream) {
bool SeqDecoder::load(Common::SeekableReadStream *stream) {
close();
_fileStream = &stream;
_fileStream = stream;
_surface = new Graphics::Surface();
_surface->create(SEQ_SCREEN_WIDTH, SEQ_SCREEN_HEIGHT, 1);

View File

@ -38,7 +38,7 @@ public:
SeqDecoder();
virtual ~SeqDecoder();
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void close();
void setFrameDelay(int frameDelay) { _frameDelay = frameDelay; }

View File

@ -50,13 +50,13 @@ VMDDecoder::~VMDDecoder() {
close();
}
bool VMDDecoder::load(Common::SeekableReadStream &stream) {
bool VMDDecoder::load(Common::SeekableReadStream *stream) {
close();
if (!_vmdDecoder->load(stream))
return false;
_fileStream = &stream;
_fileStream = stream;
if (_vmdDecoder->getFeatures() & Graphics::CoktelVideo::kFeaturesPalette)
loadPaletteFromVMD();

View File

@ -56,7 +56,7 @@ public:
uint32 getFrameWaitTime();
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void close();
bool isVideoLoaded() const { return _fileStream != 0; }

View File

@ -211,10 +211,10 @@ void AviDecoder::handleStreamHeader() {
}
}
bool AviDecoder::load(Common::SeekableReadStream &stream) {
bool AviDecoder::load(Common::SeekableReadStream *stream) {
close();
_fileStream = &stream;
_fileStream = stream;
_decodedHeader = false;
// Read chunks until we have decoded the header

View File

@ -178,7 +178,7 @@ public:
Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
virtual ~AviDecoder();
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void close();
bool isVideoLoaded() const { return _fileStream != 0; }

View File

@ -127,14 +127,14 @@ Common::MemoryReadStream *PreImd::getExtraData(const char *fileName) {
return 0;
}
bool PreImd::load(Common::SeekableReadStream &stream) {
bool PreImd::load(Common::SeekableReadStream *stream) {
// Since PreIMDs don't have any width and height values stored,
// we need them to be specified in the constructor
assert((_forcedWidth > 0) && (_forcedHeight > 0));
unload();
_stream = &stream;
_stream = stream;
_stream->seek(0);
@ -564,10 +564,10 @@ bool Imd::loadFrameTables(uint32 framesPosPos, uint32 framesCoordsPos) {
return true;
}
bool Imd::load(Common::SeekableReadStream &stream) {
bool Imd::load(Common::SeekableReadStream *stream) {
unload();
_stream = &stream;
_stream = stream;
uint16 handle;
@ -1656,10 +1656,10 @@ void Vmd::readExtraData() {
}
}
bool Vmd::load(Common::SeekableReadStream &stream) {
bool Vmd::load(Common::SeekableReadStream *stream) {
unload();
_stream = &stream;
_stream = stream;
uint16 headerLength;
uint16 handle;

View File

@ -23,12 +23,8 @@
*
*/
// Currently, only GOB and SCI32 games play IMDs and VMDs, so skip compiling if GOB and SCI32 is disabled.
#if !(defined(ENABLE_GOB) || defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES))
// Do not compile the CoktelVideo code
#else
// Currently, only GOB and SCI32 games play IMDs and VMDs
#if defined(ENABLE_GOB) || defined(ENABLE_SCI32) || defined(DYNAMIC_MODULES)
#ifndef GRAPHICS_VIDEO_COKTELVIDEO_H
#define GRAPHICS_VIDEO_COKTELVIDEO_H
@ -153,7 +149,7 @@ public:
virtual Common::MemoryReadStream *getExtraData(const char *fileName) = 0;
/** Load a video out of a stream. */
virtual bool load(Common::SeekableReadStream &stream) = 0;
virtual bool load(Common::SeekableReadStream *stream) = 0;
/** Unload the currently loaded video. */
virtual void unload() = 0;
@ -243,7 +239,7 @@ public:
bool hasExtraData(const char *fileName) const;
Common::MemoryReadStream *getExtraData(const char *fileName);
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void unload();
void setXY(int16 x, int16 y);
@ -322,7 +318,7 @@ public:
uint32 getSyncLag() const;
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void unload();
void setXY(int16 x, int16 y);
@ -451,7 +447,7 @@ public:
bool hasExtraData(const char *fileName) const;
Common::MemoryReadStream *getExtraData(const char *fileName);
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void unload();
int16 getWidth() const;

View File

@ -66,10 +66,10 @@ DXADecoder::~DXADecoder() {
close();
}
bool DXADecoder::load(Common::SeekableReadStream &stream) {
bool DXADecoder::load(Common::SeekableReadStream *stream) {
close();
_fileStream = &stream;
_fileStream = stream;
uint32 tag = _fileStream->readUint32BE();
assert(tag == MKID_BE('DEXA'));

View File

@ -43,7 +43,7 @@ public:
DXADecoder();
virtual ~DXADecoder();
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void close();
bool isVideoLoaded() const { return _fileStream != 0; }

View File

@ -41,10 +41,10 @@ FlicDecoder::~FlicDecoder() {
close();
}
bool FlicDecoder::load(Common::SeekableReadStream &stream) {
bool FlicDecoder::load(Common::SeekableReadStream *stream) {
close();
_fileStream = &stream;
_fileStream = stream;
/* uint32 frameSize = */ _fileStream->readUint32LE();
uint16 frameType = _fileStream->readUint16LE();

View File

@ -51,7 +51,7 @@ public:
* Load a video file
* @param stream the stream to load
*/
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void close();
/**

View File

@ -308,8 +308,8 @@ bool QuickTimeDecoder::loadFile(const Common::String &filename) {
return true;
}
bool QuickTimeDecoder::load(Common::SeekableReadStream &stream) {
_fd = &stream;
bool QuickTimeDecoder::load(Common::SeekableReadStream *stream) {
_fd = stream;
_foundMOOV = _foundMDAT = false;
_numStreams = 0;
_partial = 0;

View File

@ -89,7 +89,7 @@ public:
* Load a QuickTime video file from a SeekableReadStream
* @param stream the stream to load
*/
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
/**
* Close a QuickTime encoded video file

View File

@ -367,10 +367,10 @@ uint32 SmackerDecoder::getElapsedTime() const {
return VideoDecoder::getElapsedTime();
}
bool SmackerDecoder::load(Common::SeekableReadStream &stream) {
bool SmackerDecoder::load(Common::SeekableReadStream *stream) {
close();
_fileStream = &stream;
_fileStream = stream;
// Seek to the first frame
_header.signature = _fileStream->readUint32BE();

View File

@ -57,7 +57,7 @@ public:
Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
virtual ~SmackerDecoder();
bool load(Common::SeekableReadStream &stream);
bool load(Common::SeekableReadStream *stream);
void close();
bool isVideoLoaded() const { return _fileStream != 0; }

View File

@ -42,7 +42,7 @@ bool VideoDecoder::loadFile(const Common::String &filename) {
return false;
}
return load(*file);
return load(file);
}
uint32 VideoDecoder::getElapsedTime() const {

View File

@ -93,7 +93,7 @@ public:
* Load a video file
* @param stream the stream to load
*/
virtual bool load(Common::SeekableReadStream &stream) = 0;
virtual bool load(Common::SeekableReadStream *stream) = 0;
/**
* Close a video file