aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorMatthew Hoops2012-07-25 11:19:36 -0400
committerMatthew Hoops2012-07-25 11:19:36 -0400
commitc0cece8d1335a3397ea980d9a2abc4075656068c (patch)
tree0d828be183b80256a76bd2d1444b2ea564cca36e /video
parent714c6ae1195ac372998c3d5b6f3739725554bf85 (diff)
downloadscummvm-rg350-c0cece8d1335a3397ea980d9a2abc4075656068c.tar.gz
scummvm-rg350-c0cece8d1335a3397ea980d9a2abc4075656068c.tar.bz2
scummvm-rg350-c0cece8d1335a3397ea980d9a2abc4075656068c.zip
VIDEO: Add functions for default high color PixelFormat
To be used by video that converts from YUV to RGB
Diffstat (limited to 'video')
-rw-r--r--video/video_decoder.cpp6
-rw-r--r--video/video_decoder.h20
2 files changed, 25 insertions, 1 deletions
diff --git a/video/video_decoder.cpp b/video/video_decoder.cpp
index 80a208fda3..8b9a009b98 100644
--- a/video/video_decoder.cpp
+++ b/video/video_decoder.cpp
@@ -101,6 +101,12 @@ AdvancedVideoDecoder::AdvancedVideoDecoder() {
_audioVolume = Audio::Mixer::kMaxChannelVolume;
_audioBalance = 0;
_pauseLevel = 0;
+
+ // Find the best format for output
+ _defaultHighColorFormat = g_system->getScreenFormat();
+
+ if (_defaultHighColorFormat.bytesPerPixel == 1)
+ _defaultHighColorFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 8, 16, 24, 0);
}
void AdvancedVideoDecoder::close() {
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 0848ad09c7..a6dbed8fc5 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -27,6 +27,7 @@
#include "audio/timestamp.h" // TODO: Move this to common/ ?
#include "common/array.h"
#include "common/str.h"
+#include "graphics/pixelformat.h"
namespace Audio {
class AudioStream;
@@ -40,7 +41,6 @@ class SeekableReadStream;
}
namespace Graphics {
-struct PixelFormat;
struct Surface;
}
@@ -370,6 +370,16 @@ public:
*/
bool addStreamFileTrack(const Common::String &baseName);
+ /**
+ * Set the default high color format for videos that convert from YUV.
+ *
+ * By default, AdvancedVideoDecoder will attempt to use the screen format
+ * if it's >8bpp and use a 32bpp format when not.
+ *
+ * This must be set before calling loadStream().
+ */
+ void setDefaultHighColorFormat(const Graphics::PixelFormat &format) { _defaultHighColorFormat = format; }
+
// Future API
//void setRate(const Common::Rational &rate);
//Common::Rational getRate() const;
@@ -664,6 +674,11 @@ protected:
*/
bool endOfVideoTracks() const;
+ /**
+ * Get the default high color format
+ */
+ Graphics::PixelFormat getDefaultHighColorFormat() const { return _defaultHighColorFormat; }
+
private:
// Tracks owned by this AdvancedVideoDecoder
typedef Common::Array<Track *> TrackList;
@@ -679,6 +694,9 @@ private:
mutable bool _dirtyPalette;
const byte *_palette;
+ // Default PixelFormat settings
+ Graphics::PixelFormat _defaultHighColorFormat;
+
// Internal helper functions
void stopAllTracks();
void startAllTracks();