xvimagesink: only try to set XV_ITURBT_709 port attribute if it exists

Don't try to set port attribute that's not advertised by the
adaptor. Fixes videotestsrc ! xvimagesink aborting with

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  151 (XVideo)
  Minor opcode of failed request:  13 ()

on intel HD4600 graphics with kernel 3.16, xserver 1.15,
intel driver 2.21.15.
This commit is contained in:
Tim-Philipp Müller 2014-09-11 22:19:05 +01:00
parent 3657929e1f
commit 7e78fe0d1e
2 changed files with 10 additions and 1 deletions

View file

@ -153,18 +153,20 @@ gst_xvcontext_get_xv_support (GstXvContext * context,
/* Set XV_AUTOPAINT_COLORKEY and XV_DOUBLE_BUFFER and XV_COLORKEY */
{
int count, todo = 3;
int count, todo = 4;
XvAttribute *const attr = XvQueryPortAttributes (context->disp,
context->xv_port_id, &count);
static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
static const char colorkey[] = "XV_COLORKEY";
static const char iturbt709[] = "XV_ITURBT_709";
GST_DEBUG ("Checking %d Xv port attributes", count);
context->have_autopaint_colorkey = FALSE;
context->have_double_buffer = FALSE;
context->have_colorkey = FALSE;
context->have_iturbt709 = FALSE;
for (i = 0; ((i < count) && todo); i++) {
GST_DEBUG ("Got attribute %s", attr[i].name);
@ -230,6 +232,9 @@ gst_xvcontext_get_xv_support (GstXvContext * context,
}
todo--;
context->have_colorkey = TRUE;
} else if (!strcmp (attr[i].name, iturbt709)) {
todo--;
context->have_iturbt709 = TRUE;
}
}
@ -891,6 +896,9 @@ gst_xvcontext_set_colorimetry (GstXvContext * context,
Atom prop_atom;
int xv_value;
if (!context->have_iturbt709)
return;
switch (colorimetry->matrix) {
case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
case GST_VIDEO_COLOR_MATRIX_BT709:

View file

@ -156,6 +156,7 @@ struct _GstXvContext
gboolean have_autopaint_colorkey;
gboolean have_colorkey;
gboolean have_double_buffer;
gboolean have_iturbt709;
GList *formats_list;