Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:X0F:HSF
mpv
mpv_PR6206.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mpv_PR6206.patch of Package mpv
From 87b35687c2b435a7ff2d91645f32cd9904a3c68c Mon Sep 17 00:00:00 2001 From: slatchurie <slatchurie@gmail.com> Date: Thu, 11 Oct 2018 14:19:19 +0200 Subject: [PATCH 1/2] x11: retrieve the icc profile from colord Most desktop environments do not support the _ICC_PROFILE Atom well, especially if there are multiple displays. Retrieving and using the icc profile from the colord server, if available. --- video/out/x11_common.c | 65 +++++++++++++++++++++++++++++++++++++----- wscript | 3 +- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 25325e760c..5c32ee8c54 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -24,6 +24,7 @@ #include <poll.h> #include <string.h> #include <assert.h> +#include <colord.h> #include <X11/Xmd.h> #include <X11/Xlib.h> @@ -1751,6 +1752,52 @@ static void vo_x11_fullscreen(struct vo *vo) vo_x11_update_composition_hint(vo); } +static bool vo_x11_get_icc_profile_colord(struct vo *vo, int screen, + bstr *out_icc) +{ + struct vo_x11_state *x11 = vo->x11; + bool ret_loaded = false; + CdDevice *dev = NULL; + CdProfile *prof = NULL; + CdIcc *icc = NULL; + GBytes *icc_bytes = NULL; + CdClient *cli = cd_client_new(); + if (!cli || !cd_client_connect_sync(cli, NULL, NULL)) + goto out; + dev = cd_client_find_device_by_property_sync(cli, + CD_DEVICE_METADATA_XRANDR_NAME, + x11->displays[screen].name, + NULL, NULL); + if (!dev || !cd_device_connect_sync(dev, NULL, NULL)) + goto out; + prof = cd_device_get_default_profile(dev); + if (!prof || !cd_profile_connect_sync(prof, NULL, NULL)) + goto out; + icc = cd_profile_load_icc(prof, CD_ICC_LOAD_FLAGS_NONE, NULL, NULL); + if (!icc) + goto out; + MP_VERBOSE(x11, "Using profile %s\n", g_strdup(cd_icc_get_filename(icc))); + icc_bytes = cd_icc_save_data(icc, CD_ICC_SAVE_FLAGS_NONE, NULL); + if (!icc_bytes) + goto out; + int len = g_bytes_get_size(icc_bytes); + char *data = (char *)g_bytes_get_data(icc_bytes, NULL); + *out_icc = bstrdup(NULL, (bstr){data, len}); + ret_loaded = true; +out: + if (icc_bytes) + g_bytes_unref(icc_bytes); + if (icc) + g_object_unref(icc); + if (prof) + g_object_unref(prof); + if (dev) + g_object_unref(dev); + if (cli) + g_object_unref(cli); + return ret_loaded; +} + int vo_x11_control(struct vo *vo, int *events, int request, void *arg) { struct mp_vo_opts *opts = vo->opts; @@ -1844,14 +1891,18 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) if (screen > 0) mp_snprintf_cat(prop, sizeof(prop), "_%d", screen); x11->icc_profile_property = XAs(x11, prop); - int len; MP_VERBOSE(x11, "Retrieving ICC profile for display: %d\n", screen); - void *icc = x11_get_property(x11, x11->rootwin, x11->icc_profile_property, - XA_CARDINAL, 8, &len); - if (!icc) - return VO_FALSE; - *(bstr *)arg = bstrdup(NULL, (bstr){icc, len}); - XFree(icc); + bstr icc_data; + if (!vo_x11_get_icc_profile_colord(vo, screen, &icc_data)) { + int len; + void *icc = x11_get_property(x11, x11->rootwin, x11->icc_profile_property, + XA_CARDINAL, 8, &len); + if (!icc) + return VO_FALSE; + icc_data = bstrdup(NULL, (bstr){icc, len}); + XFree(icc); + } + *(bstr *)arg = icc_data; // Watch x11->icc_profile_property XSelectInput(x11->display, x11->rootwin, PropertyChangeMask); return VO_TRUE; diff --git a/wscript b/wscript index b299a27a1a..271d90dd94 100644 --- a/wscript +++ b/wscript @@ -587,7 +587,8 @@ video_output_features = [ 'xscrnsaver', '>= 1.0.0', 'xext', '>= 1.0.0', 'xinerama', '>= 1.0.0', - 'xrandr', '>= 1.2.0'), + 'xrandr', '>= 1.2.0', + 'colord', '>= 1.0.2'), } , { 'name': '--xv', 'desc': 'Xv video output', From 6c61e66d626ada0cfae87c5bc1b42cb95558f9ef Mon Sep 17 00:00:00 2001 From: slatchurie <slatchurie@gmail.com> Date: Fri, 12 Oct 2018 16:42:58 +0200 Subject: [PATCH 2/2] x11: make colord optional at build time --- video/out/x11_common.c | 20 ++++++++++++-------- wscript | 8 ++++++-- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 5c32ee8c54..ebeec79484 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -15,6 +15,7 @@ * with mpv. If not, see <http://www.gnu.org/licenses/>. */ +#include "config.h" #include <stdio.h> #include <stdlib.h> #include <math.h> @@ -24,7 +25,9 @@ #include <poll.h> #include <string.h> #include <assert.h> +#if HAVE_COLORD #include <colord.h> +#endif #include <X11/Xmd.h> #include <X11/Xlib.h> @@ -39,7 +42,6 @@ #include <X11/extensions/Xinerama.h> #include <X11/extensions/Xrandr.h> -#include "config.h" #include "misc/bstr.h" #include "options/options.h" #include "options/m_config.h" @@ -1752,11 +1754,11 @@ static void vo_x11_fullscreen(struct vo *vo) vo_x11_update_composition_hint(vo); } -static bool vo_x11_get_icc_profile_colord(struct vo *vo, int screen, - bstr *out_icc) +#if HAVE_COLORD +static void vo_x11_get_icc_profile_colord(struct vo *vo, int screen, + struct bstr *out_icc) { struct vo_x11_state *x11 = vo->x11; - bool ret_loaded = false; CdDevice *dev = NULL; CdProfile *prof = NULL; CdIcc *icc = NULL; @@ -1783,7 +1785,6 @@ static bool vo_x11_get_icc_profile_colord(struct vo *vo, int screen, int len = g_bytes_get_size(icc_bytes); char *data = (char *)g_bytes_get_data(icc_bytes, NULL); *out_icc = bstrdup(NULL, (bstr){data, len}); - ret_loaded = true; out: if (icc_bytes) g_bytes_unref(icc_bytes); @@ -1795,8 +1796,8 @@ static bool vo_x11_get_icc_profile_colord(struct vo *vo, int screen, g_object_unref(dev); if (cli) g_object_unref(cli); - return ret_loaded; } +#endif int vo_x11_control(struct vo *vo, int *events, int request, void *arg) { @@ -1892,8 +1893,11 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg) mp_snprintf_cat(prop, sizeof(prop), "_%d", screen); x11->icc_profile_property = XAs(x11, prop); MP_VERBOSE(x11, "Retrieving ICC profile for display: %d\n", screen); - bstr icc_data; - if (!vo_x11_get_icc_profile_colord(vo, screen, &icc_data)) { + bstr icc_data = {0}; +#if HAVE_COLORD + vo_x11_get_icc_profile_colord(vo, screen, &icc_data); +#endif + if (!icc_data.len) { int len; void *icc = x11_get_property(x11, x11->rootwin, x11->icc_profile_property, XA_CARDINAL, 8, &len); diff --git a/wscript b/wscript index 271d90dd94..4d43fb607a 100644 --- a/wscript +++ b/wscript @@ -587,8 +587,12 @@ video_output_features = [ 'xscrnsaver', '>= 1.0.0', 'xext', '>= 1.0.0', 'xinerama', '>= 1.0.0', - 'xrandr', '>= 1.2.0', - 'colord', '>= 1.0.2'), + 'xrandr', '>= 1.2.0'), + } , { + 'name': '--colord', + 'desc': 'colord', + 'deps': 'x11', + 'func': check_pkg_config('colord', '>= 1.0.2'), } , { 'name': '--xv', 'desc': 'Xv video output',
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor