videodecoder: only copy known colorimetry values
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 4 Jun 2012 16:17:42 +0000 (18:17 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 4 Jun 2012 16:17:42 +0000 (18:17 +0200)
Avoid overriding the default colorimetry values.

gst-libs/gst/video/gstvideodecoder.c

index ad72aa9..fb3c8d6 100644 (file)
@@ -550,7 +550,16 @@ _new_output_state (GstVideoFormat fmt, guint width, guint height,
     tgt->interlace_mode = ref->interlace_mode;
     tgt->flags = ref->flags;
     tgt->chroma_site = ref->chroma_site;
-    tgt->colorimetry = ref->colorimetry;
+    /* only copy values that are not unknown so that we don't override the
+     * defaults. subclasses should really fill these in when they know. */
+    if (ref->colorimetry.range)
+      tgt->colorimetry.range = ref->colorimetry.range;
+    if (ref->colorimetry.matrix)
+      tgt->colorimetry.matrix = ref->colorimetry.matrix;
+    if (ref->colorimetry.transfer)
+      tgt->colorimetry.transfer = ref->colorimetry.transfer;
+    if (ref->colorimetry.primaries)
+      tgt->colorimetry.primaries = ref->colorimetry.primaries;
     GST_DEBUG ("reference par %d/%d fps %d/%d",
         ref->par_n, ref->par_d, ref->fps_n, ref->fps_d);
     tgt->par_n = ref->par_n;