aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2012-07-21 12:40:16 -0400
committerMatthew Hoops2012-07-21 12:40:16 -0400
commitfb1edcd4fef7fd750b4af18745ca7b3151b56aae (patch)
tree3a069218374ee0deec5ade66b1b90da55feb83b9
parenta12b3ea2dde9db348424f401a35fca3167120011 (diff)
downloadscummvm-rg350-fb1edcd4fef7fd750b4af18745ca7b3151b56aae.tar.gz
scummvm-rg350-fb1edcd4fef7fd750b4af18745ca7b3151b56aae.tar.bz2
scummvm-rg350-fb1edcd4fef7fd750b4af18745ca7b3151b56aae.zip
VIDEO: Add getWidth()/getHeight()/getPixelFormat() functions to VideoTrack
The default implementations of those functions in AdvancedVideoDecoder now call into them.
-rw-r--r--engines/sci/video/seq_decoder.h17
-rw-r--r--video/video_decoder.cpp24
-rw-r--r--video/video_decoder.h8
3 files changed, 38 insertions, 11 deletions
diff --git a/engines/sci/video/seq_decoder.h b/engines/sci/video/seq_decoder.h
index c07bcd748b..ac801d3f19 100644
--- a/engines/sci/video/seq_decoder.h
+++ b/engines/sci/video/seq_decoder.h
@@ -47,21 +47,15 @@ public:
bool loadStream(Common::SeekableReadStream *stream);
- uint16 getWidth() const { return SEQ_SCREEN_WIDTH; }
- uint16 getHeight() const { return SEQ_SCREEN_HEIGHT; }
- Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
-
private:
- enum {
- SEQ_SCREEN_WIDTH = 320,
- SEQ_SCREEN_HEIGHT = 200
- };
-
class SEQVideoTrack : public FixedRateVideoTrack, public FixedLengthVideoTrack {
public:
SEQVideoTrack(Common::SeekableReadStream *stream, uint frameDelay);
~SEQVideoTrack();
+ uint16 getWidth() const { return SEQ_SCREEN_WIDTH; }
+ uint16 getHeight() const { return SEQ_SCREEN_HEIGHT; }
+ Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); }
int getCurFrame() const { return _curFrame; }
int getFrameCount() const { return _frameCount; }
const Graphics::Surface *decodeNextFrame();
@@ -72,6 +66,11 @@ private:
Common::Rational getFrameRate() const { return Common::Rational(60, _frameDelay); }
private:
+ enum {
+ SEQ_SCREEN_WIDTH = 320,
+ SEQ_SCREEN_HEIGHT = 200
+ };
+
void readPaletteChunk(uint16 chunkSize);
bool decodeFrame(byte *rleData, int rleSize, byte *litData, int litSize, byte *dest, int left, int width, int height, int colorKey);
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index ef2aeae94f..a8cf32575a 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -119,6 +119,30 @@ bool AdvancedVideoDecoder::isVideoLoaded() const {
return !_tracks.empty();
}
+uint16 AdvancedVideoDecoder::getWidth() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ return ((VideoTrack *)*it)->getWidth();
+
+ return 0;
+}
+
+uint16 AdvancedVideoDecoder::getHeight() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ return ((VideoTrack *)*it)->getHeight();
+
+ return 0;
+}
+
+Graphics::PixelFormat AdvancedVideoDecoder::getPixelFormat() const {
+ for (TrackList::const_iterator it = _tracks.begin(); it != _tracks.end(); it++)
+ if ((*it)->getTrackType() == Track::kTrackTypeVideo)
+ return ((VideoTrack *)*it)->getPixelFormat();
+
+ return Graphics::PixelFormat();
+}
+
const Graphics::Surface *AdvancedVideoDecoder::decodeNextFrame() {
readNextPacket();
VideoTrack *track = findNextVideoTrack();
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 1c359591b3..ede2872c6a 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -287,13 +287,14 @@ public:
// Old API Non-changing
// loadFile()
// loadStream()
- // getWidth()
- // getHeight()
// needsUpdate()
// Old API Changing
virtual void close();
bool isVideoLoaded() const;
+ virtual uint16 getWidth() const;
+ virtual uint16 getHeight() const;
+ virtual Graphics::PixelFormat getPixelFormat() const;
virtual const Graphics::Surface *decodeNextFrame();
const byte *getPalette();
bool hasDirtyPalette() const { return _dirtyPalette; }
@@ -468,6 +469,9 @@ protected:
TrackType getTrackType() const { return kTrackTypeVideo; }
// TODO: Document
+ virtual uint16 getWidth() const = 0;
+ virtual uint16 getHeight() const = 0;
+ virtual Graphics::PixelFormat getPixelFormat() const = 0;
virtual int getCurFrame() const = 0;
virtual int getFrameCount() const { return 0; }
virtual uint32 getNextFrameStartTime() const = 0;