Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC Browser Plugins
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
VideoLAN
VLC Browser Plugins
Commits
2cc1db80
Commit
2cc1db80
authored
Apr 16, 2016
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowsless Mac: best-effort color space support
Will need a re-iteration once libvlc API advanced
parent
792e7f77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
3 deletions
+25
-3
vlcwindowless_mac.cpp
npapi/vlcwindowless_mac.cpp
+25
-3
No files found.
npapi/vlcwindowless_mac.cpp
View file @
2cc1db80
...
...
@@ -25,6 +25,7 @@
#include "vlcwindowless_mac.h"
#define SHOW_BRANDING 1
#define OSX_EL_CAPITAN (NSAppKitVersionNumber >= 1404)
CGImageRef
createImageNamed
(
CFStringRef
);
...
...
@@ -51,8 +52,6 @@ CGImageRef createImageNamed(CFStringRef name)
VlcWindowlessMac
::
VlcWindowlessMac
(
NPP
instance
,
NPuint16_t
mode
)
:
VlcWindowlessBase
(
instance
,
mode
)
{
colorspace
=
CGColorSpaceCreateDeviceRGB
();
const
char
*
userAgent
=
NPN_UserAgent
(
this
->
getBrowser
());
if
(
strstr
(
userAgent
,
"Safari"
)
&&
strstr
(
userAgent
,
"Version/5"
))
{
legacy_drawing_mode
=
true
;
...
...
@@ -64,7 +63,8 @@ VlcWindowlessMac::~VlcWindowlessMac()
{
if
(
lastFrame
)
CGImageRelease
(
lastFrame
);
CGColorSpaceRelease
(
colorspace
);
if
(
colorspace
!=
nil
)
CGColorSpaceRelease
(
colorspace
);
}
void
VlcWindowlessMac
::
drawNoPlayback
(
CGContextRef
cgContext
)
...
...
@@ -274,6 +274,28 @@ bool VlcWindowlessMac::handle_event(void *event)
left
=
(
npwindow
.
width
-
m_media_width
)
/
2.
;
top
=
(
npwindow
.
height
-
m_media_height
)
/
2.
;
if
(
colorspace
==
nil
)
{
/* 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
)
{
fprintf
(
stderr
,
"Guessing color space based on video dimensions (height: %i)"
,
cached_height
);
if
(
cached_height
>=
2000
||
cached_width
>=
3800
)
{
fprintf
(
stderr
,
"Should use BT.2020 color space, but in reality it's BT.709"
);
colorspace
=
CGColorSpaceCreateWithName
(
kCGColorSpaceITUR_709
);
}
else
if
(
cached_height
>
576
)
{
fprintf
(
stderr
,
"Using BT.709 color space"
);
colorspace
=
CGColorSpaceCreateWithName
(
kCGColorSpaceITUR_709
);
}
else
{
fprintf
(
stderr
,
"SD content, using linear RGB color space"
);
colorspace
=
CGColorSpaceCreateWithName
(
kCGColorSpaceSRGB
);
}
}
else
{
fprintf
(
stderr
,
"OS does not support BT.709 or BT.2020 color spaces, output may vary"
);
colorspace
=
CGColorSpaceCreateWithName
(
kCGColorSpaceGenericRGBLinear
);
}
}
/* fetch frame */
CFDataRef
dataRef
=
CFDataCreateWithBytesNoCopy
(
kCFAllocatorDefault
,
(
const
uint8_t
*
)
&
m_frame_buf
[
0
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment