summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2020-11-25 23:54:08 +1100
committerJan Schmidt <thaytan@noraisin.net>2020-11-25 12:58:48 +0000
commitc1f91ba004000e6e97ec736796089c829f86ad9f (patch)
tree1e583e6828a95bfe561113a4aa3bb6abc0d03dd6 /sys
parent0dc419197f95d8e1b7f8f5685d07fdeb21da3ea7 (diff)
downloadgstreamer-plugins-base-c1f91ba004000e6e97ec736796089c829f86ad9f.tar.gz
xvimagesink: Add support for the XV_COLORSPACE attribute.
The XV_COLORSPACE attribute exists on some Xv adapters, with the same semantics as the XV_ITURBT_709 attribute that was already supported. A value of 0 is bt601, and 1 is for bt709 colorspace. Fixes color shifting issues displaying bt709 content on some Xv adapters. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/941>
Diffstat (limited to 'sys')
-rw-r--r--sys/xvimage/xvcontext.c25
-rw-r--r--sys/xvimage/xvcontext.h1
2 files changed, 21 insertions, 5 deletions
diff --git a/sys/xvimage/xvcontext.c b/sys/xvimage/xvcontext.c
index 7b2cc4490..152746e53 100644
--- a/sys/xvimage/xvcontext.c
+++ b/sys/xvimage/xvcontext.c
@@ -159,6 +159,7 @@ gst_xvcontext_get_xv_support (GstXvContext * context,
static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
static const char colorkey[] = "XV_COLORKEY";
static const char iturbt709[] = "XV_ITURBT_709";
+ static const char *xv_colorspace = "XV_COLORSPACE";
GST_DEBUG ("Checking %d Xv port attributes", count);
@@ -166,6 +167,7 @@ gst_xvcontext_get_xv_support (GstXvContext * context,
context->have_double_buffer = FALSE;
context->have_colorkey = FALSE;
context->have_iturbt709 = FALSE;
+ context->have_xvcolorspace = FALSE;
for (i = 0; ((i < count) && todo); i++) {
GST_DEBUG ("Got attribute %s", attr[i].name);
@@ -234,6 +236,9 @@ gst_xvcontext_get_xv_support (GstXvContext * context,
} else if (!strcmp (attr[i].name, iturbt709)) {
todo--;
context->have_iturbt709 = TRUE;
+ } else if (!strcmp (attr[i].name, xv_colorspace)) {
+ context->have_xvcolorspace = TRUE;
+ todo--;
}
}
@@ -905,7 +910,7 @@ gst_xvcontext_set_colorimetry (GstXvContext * context,
Atom prop_atom;
int xv_value;
- if (!context->have_iturbt709)
+ if (!context->have_iturbt709 && !context->have_xvcolorspace)
return;
switch (colorimetry->matrix) {
@@ -919,10 +924,20 @@ gst_xvcontext_set_colorimetry (GstXvContext * context,
}
g_mutex_lock (&context->lock);
- prop_atom = XInternAtom (context->disp, "XV_ITURBT_709", True);
- if (prop_atom != None) {
- XvSetPortAttribute (context->disp,
- context->xv_port_id, prop_atom, xv_value);
+ if (context->have_iturbt709) {
+ prop_atom = XInternAtom (context->disp, "XV_ITURBT_709", True);
+ if (prop_atom != None) {
+ XvSetPortAttribute (context->disp,
+ context->xv_port_id, prop_atom, xv_value);
+ }
+ }
+
+ if (context->have_xvcolorspace) {
+ prop_atom = XInternAtom (context->disp, "XV_COLORSPACE", True);
+ if (prop_atom != None) {
+ XvSetPortAttribute (context->disp,
+ context->xv_port_id, prop_atom, xv_value);
+ }
}
g_mutex_unlock (&context->lock);
}
diff --git a/sys/xvimage/xvcontext.h b/sys/xvimage/xvcontext.h
index 4efe3f009..68cbdb747 100644
--- a/sys/xvimage/xvcontext.h
+++ b/sys/xvimage/xvcontext.h
@@ -160,6 +160,7 @@ struct _GstXvContext
gboolean have_colorkey;
gboolean have_double_buffer;
gboolean have_iturbt709;
+ gboolean have_xvcolorspace;
GList *formats_list;