video: Add color-matrix handling to caps
authorDavid Schleef <ds@schleef.org>
Tue, 9 Mar 2010 21:05:23 +0000 (13:05 -0800)
committerDavid Schleef <ds@schleef.org>
Tue, 9 Mar 2010 21:17:34 +0000 (13:17 -0800)
gst-libs/gst/video/video.c
gst-libs/gst/video/video.h

index f4dc70b..bf7b454 100644 (file)
@@ -250,6 +250,41 @@ gst_video_format_parse_caps_interlaced (GstCaps * caps, gboolean * interlaced)
 }
 
 /**
+ * gst_video_parse_caps_color_matrix:
+ * @caps: the fixed #GstCaps to parse
+ *
+ * Extracts the color matrix used by the caps.  Possible values are
+ * "sdtv" for the standard definition color matrix (as specified in
+ * Rec. ITU-R BT.470-6) or "hdtv" for the high definition color
+ * matrix (as specified in Rec. ITU-R BT.709)
+ *
+ * Since: 0.10.29
+ *
+ * Returns: TRUE if @caps was parsed correctly.
+ */
+const char *
+gst_video_parse_caps_color_matrix (GstCaps * caps)
+{
+  GstStructure *structure;
+  const char *s;
+
+  if (!gst_caps_is_fixed (caps))
+    return NULL;
+
+  structure = gst_caps_get_structure (caps, 0);
+
+  s = gst_structure_get_string (structure, "color-matrix");
+  if (s)
+    return s;
+
+  if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
+    return "sdtv";
+  }
+
+  return NULL;
+}
+
+/**
  * gst_video_format_parse_caps:
  * @caps: the #GstCaps to parse
  * @format: the #GstVideoFormat of the video represented by @caps (output)
index 20946dc..f968066 100644 (file)
@@ -291,6 +291,7 @@ gboolean gst_video_parse_caps_framerate (GstCaps *caps,
     int *fps_n, int *fps_d);
 gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps *caps,
     int *par_n, int *par_d);
+const char *gst_video_parse_caps_color_matrix (GstCaps * caps);
 GstCaps * gst_video_format_new_caps (GstVideoFormat format,
     int width, int height, int framerate_n, int framerate_d,
     int par_n, int par_d);