summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-02-25 02:56:25 (GMT)
committerDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2010-02-25 03:00:20 (GMT)
commit9a8a35d829ff62fa7ea213ff31f52f0dee00ec78 (patch)
tree391334362cb21abfb70c3f80d3f73290bad90c78 /src/plugins
parent190ec169dd6f5455115e5164cfbacdad214de00a (diff)
downloadQt-9a8a35d829ff62fa7ea213ff31f52f0dee00ec78.zip
Qt-9a8a35d829ff62fa7ea213ff31f52f0dee00ec78.tar.gz
Qt-9a8a35d829ff62fa7ea213ff31f52f0dee00ec78.tar.bz2
Use the monitor color space for video output.
Currently the main monitor color space is used. Colorspace correction is disabled by default for renderer video output, since video frames can on any output device, not only on the main monitor. Reviewed-by: Justin McPherson
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/mediaservices/qt7/qt7movierenderer.mm21
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.mm17
2 files changed, 34 insertions, 4 deletions
diff --git a/src/plugins/mediaservices/qt7/qt7movierenderer.mm b/src/plugins/mediaservices/qt7/qt7movierenderer.mm
index 6b9fd21..1c1f5e4 100644
--- a/src/plugins/mediaservices/qt7/qt7movierenderer.mm
+++ b/src/plugins/mediaservices/qt7/qt7movierenderer.mm
@@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE
+//#define USE_MAIN_MONITOR_COLOR_SPACE 1
+
class CVGLTextureVideoBuffer : public QAbstractVideoBuffer
{
public:
@@ -233,7 +235,24 @@ bool QT7MovieRenderer::createPixelBufferVisualContext()
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(visualContextOptions, kQTVisualContextPixelBufferAttributesKey, pixelBufferOptions);
- CFDictionarySetValue(visualContextOptions, kQTVisualContextWorkingColorSpaceKey, CGColorSpaceCreateDeviceRGB());
+
+ CGColorSpaceRef colorSpace = NULL;
+
+#if USE_MAIN_MONITOR_COLOR_SPACE
+ CMProfileRef sysprof = NULL;
+
+ // Get the Systems Profile for the main display
+ if (CMGetSystemProfile(&sysprof) == noErr) {
+ // Create a colorspace with the systems profile
+ colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof);
+ CMCloseProfile(sysprof);
+ }
+#endif
+
+ if (!colorSpace)
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
+ CFDictionarySetValue(visualContextOptions, kQTVisualContextOutputColorSpaceKey, colorSpace);
OSStatus err = QTPixelBufferContextCreate(kCFAllocatorDefault,
visualContextOptions,
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
index 4043330..00ceffc 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
@@ -199,7 +199,6 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
}
}
-
bool QT7MovieVideoWidget::createVisualContext()
{
#ifdef QUICKTIME_C_API_AVAILABLE
@@ -210,8 +209,20 @@ bool QT7MovieVideoWidget::createVisualContext()
NSOpenGLPixelFormat *nsglPixelFormat = [NSOpenGLView defaultPixelFormat];
CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>([nsglPixelFormat CGLPixelFormatObj]);
- CFTypeRef keys[] = { kQTVisualContextWorkingColorSpaceKey };
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+ CFTypeRef keys[] = { kQTVisualContextOutputColorSpaceKey };
+ CGColorSpaceRef colorSpace = NULL;
+ CMProfileRef sysprof = NULL;
+
+ // Get the Systems Profile for the main display
+ if (CMGetSystemProfile(&sysprof) == noErr) {
+ // Create a colorspace with the systems profile
+ colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof);
+ CMCloseProfile(sysprof);
+ }
+
+ if (!colorSpace)
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
CFDictionaryRef textureContextAttributes = CFDictionaryCreate(kCFAllocatorDefault,
(const void **)keys,
(const void **)&colorSpace, 1,