video-info: use default colorimetry on error
authorWim Taymans <wtaymans@redhat.com>
Mon, 9 Mar 2015 14:58:50 +0000 (15:58 +0100)
committerWim Taymans <wtaymans@redhat.com>
Mon, 9 Mar 2015 15:02:17 +0000 (16:02 +0100)
When we fail to parse the colorimetry property, fall back to the default
colorimetry for the format and dimension instead of leaving things
undefined.

gst-libs/gst/video/video-info.c

index c8e2038..9686e83 100644 (file)
@@ -243,9 +243,10 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
   else
     info->chroma_site = GST_VIDEO_CHROMA_SITE_UNKNOWN;
 
-  if ((s = gst_structure_get_string (structure, "colorimetry")))
-    gst_video_colorimetry_from_string (&info->colorimetry, s);
-  else
+  if ((s = gst_structure_get_string (structure, "colorimetry"))) {
+    if (!gst_video_colorimetry_from_string (&info->colorimetry, s))
+      set_default_colorimetry (info);
+  } else
     set_default_colorimetry (info);
 
   if (gst_structure_get_fraction (structure, "pixel-aspect-ratio",