diff options
author | Matthew Hoops | 2012-07-21 12:40:16 -0400 |
---|---|---|
committer | Matthew Hoops | 2012-07-21 12:40:16 -0400 |
commit | fb1edcd4fef7fd750b4af18745ca7b3151b56aae (patch) | |
tree | 3a069218374ee0deec5ade66b1b90da55feb83b9 /video | |
parent | a12b3ea2dde9db348424f401a35fca3167120011 (diff) | |
download | scummvm-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.
Diffstat (limited to 'video')
-rw-r--r-- | video/video_decoder.cpp | 24 | ||||
-rw-r--r-- | video/video_decoder.h | 8 |
2 files changed, 30 insertions, 2 deletions
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; |