Commit 39d9311e authored by Victorien Le Couviour--Tuffet's avatar Victorien Le Couviour--Tuffet Committed by Jean-Baptiste Kempf

macosx: don't handle color primaries

The GL shader already does this job.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 74ea8d15
......@@ -49,14 +49,6 @@
#include <vlc_dialog.h>
#include "opengl/vout_helper.h"
#define OSX_EL_CAPITAN (NSAppKitVersionNumber >= 1404)
#if MAC_OS_X_VERSION_MIN_ALLOWED <= MAC_OS_X_VERSION_10_11
const CFStringRef kCGColorSpaceDCIP3 = CFSTR("kCGColorSpaceDCIP3");
const CFStringRef kCGColorSpaceITUR_709 = CFSTR("kCGColorSpaceITUR_709");
const CFStringRef kCGColorSpaceITUR_2020 = CFSTR("kCGColorSpaceITUR_2020");
#endif
/**
* Forward declarations
*/
......@@ -112,9 +104,6 @@ struct vout_display_sys_t
VLCOpenGLVideoView *glView;
id<VLCOpenGLVideoViewEmbedding> container;
CGColorSpaceRef cgColorSpace;
NSColorSpace *nsColorSpace;
vout_window_t *embed;
vlc_gl_t *gl;
vout_display_opengl_t *vgl;
......@@ -176,57 +165,6 @@ static int Open (vlc_object_t *this)
* main thread, after we are done using it. */
sys->container = [container retain];
/* support for BT.709 and BT.2020 color spaces was introduced with OS X 10.11
* on older OS versions, we can't show correct colors, so we fallback on linear RGB */
if (OSX_EL_CAPITAN) {
switch (vd->fmt.primaries) {
case COLOR_PRIMARIES_BT601_525:
case COLOR_PRIMARIES_BT601_625:
{
msg_Dbg(vd, "Using BT.601 color space");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
break;
}
case COLOR_PRIMARIES_BT709:
{
msg_Dbg(vd, "Using BT.709 color space");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
break;
}
case COLOR_PRIMARIES_BT2020:
{
msg_Dbg(vd, "Using BT.2020 color space");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
break;
}
case COLOR_PRIMARIES_DCI_P3:
{
msg_Dbg(vd, "Using DCI P3 color space");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceDCIP3);
break;
}
default:
{
msg_Dbg(vd, "Guessing color space based on video dimensions (%ix%i)", vd->fmt.i_visible_width, vd->fmt.i_visible_height);
if (vd->fmt.i_visible_height >= 2000 || vd->fmt.i_visible_width >= 3800) {
msg_Dbg(vd, "Using BT.2020 color space");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
} else if (vd->fmt.i_height > 576) {
msg_Dbg(vd, "Using BT.709 color space");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
} else {
msg_Dbg(vd, "SD content, using linear RGB color space");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
}
break;
}
}
} else {
msg_Dbg(vd, "OS does not support BT.709 or BT.2020 color spaces, output may vary");
sys->cgColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
}
sys->nsColorSpace = [[NSColorSpace alloc] initWithCGColorSpace:sys->cgColorSpace];
/* Get our main view*/
[VLCOpenGLVideoView performSelectorOnMainThread:@selector(getNewView:)
withObject:[NSValue valueWithPointer:&sys->glView]
......@@ -360,12 +298,6 @@ void Close (vlc_object_t *this)
[sys->glView release];
if (sys->cgColorSpace != nil)
CGColorSpaceRelease(sys->cgColorSpace);
if (sys->nsColorSpace != nil)
[sys->nsColorSpace release];
if (sys->embed)
vout_display_DeleteWindow (vd, sys->embed);
free (sys);
......@@ -904,23 +836,4 @@ static void OpenglSwap (vlc_gl_t *gl)
return YES;
}
- (void)viewWillMoveToWindow:(nullable NSWindow *)newWindow
{
[super viewWillMoveToWindow:newWindow];
if (newWindow == nil)
return;
@synchronized (self) {
@try {
if (vd) [newWindow setColorSpace:vd->sys->nsColorSpace];
}
@catch (NSException *exception) {
msg_Warn(vd, "Setting the window color space failed due to an Obj-C exception (%s, %s", [exception.name UTF8String], [exception.reason UTF8String]);
}
}
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment