xvimagesink: configure colorimetry

Use the XV_ITURBT_709 attribute to configure the 601 or 709 matrix
depending on the color matrix of the input video frame.
diff --git a/sys/xvimage/xvcontext.c b/sys/xvimage/xvcontext.c
index b524644..d89ea48 100644
--- a/sys/xvimage/xvcontext.c
+++ b/sys/xvimage/xvcontext.c
@@ -884,6 +884,32 @@
   return -1;
 }
 
+void
+gst_xvcontext_set_colorimetry (GstXvContext * context,
+    GstVideoColorimetry * colorimetry)
+{
+  Atom prop_atom;
+  int xv_value;
+
+  switch (colorimetry->matrix) {
+    case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
+    case GST_VIDEO_COLOR_MATRIX_BT709:
+      xv_value = 1;
+      break;
+    default:
+      xv_value = 0;
+      break;
+  }
+
+  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);
+  }
+  g_mutex_unlock (&context->lock);
+}
+
 GstXWindow *
 gst_xvcontext_create_xwindow (GstXvContext * context, gint width, gint height)
 {
diff --git a/sys/xvimage/xvcontext.h b/sys/xvimage/xvcontext.h
index 2289787..1bd0d97 100644
--- a/sys/xvimage/xvcontext.h
+++ b/sys/xvimage/xvcontext.h
@@ -198,6 +198,8 @@
                                                          gboolean synchronous);
 void            gst_xvcontext_update_colorbalance       (GstXvContext * xvcontext,
                                                          GstXvContextConfig * config);
+void            gst_xvcontext_set_colorimetry           (GstXvContext * xvcontext,
+                                                         GstVideoColorimetry *colorimetry);
 
 
 typedef struct _GstXWindow GstXWindow;
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index d62f111..de1c1f9 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -693,6 +693,8 @@
   if (im_format == -1)
     goto invalid_format;
 
+  gst_xvcontext_set_colorimetry (context, &info.colorimetry);
+
   size = info.size;
 
   /* get aspect ratio from caps if it's present, and