mxfmetadata: Add workaround for ffmpeg only writing one Video Line Map value
authorSebastian Dröge <sebastian@centricular.com>
Thu, 28 Jan 2016 14:29:01 +0000 (15:29 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 28 Jan 2016 14:29:44 +0000 (15:29 +0100)
https://ffmpeg.org/pipermail/ffmpeg-devel/2016-January/188202.html

gst/mxf/mxfmetadata.c

index 758d0e33183add1fbedded5a5ac35b454af9b07b..786a6769fc5b7fbb889738ba6438208115278b20 100644 (file)
@@ -4424,15 +4424,25 @@ mxf_metadata_generic_picture_essence_descriptor_handle_tag (MXFMetadataBase *
       if (GST_READ_UINT32_BE (tag_data) == 0)
         return TRUE;
 
-      if (GST_READ_UINT32_BE (tag_data) != 2 &&
-          GST_READ_UINT32_BE (tag_data + 4) != 4)
+      if (GST_READ_UINT32_BE (tag_data + 4) != 4)
         goto error;
 
-      if (tag_size != 16)
+      if (GST_READ_UINT32_BE (tag_data) != 1 &&
+          GST_READ_UINT32_BE (tag_data) != 2)
+        goto error;
+
+      if ((GST_READ_UINT32_BE (tag_data) == 1 && tag_size != 12) ||
+          (GST_READ_UINT32_BE (tag_data) == 2 && tag_size != 16))
         goto error;
 
       self->video_line_map[0] = GST_READ_UINT32_BE (tag_data + 8);
-      self->video_line_map[1] = GST_READ_UINT32_BE (tag_data + 12);
+
+      /* Workaround for files created by ffmpeg */
+      if (GST_READ_UINT32_BE (tag_data) == 1)
+        self->video_line_map[0] = 0;
+      else
+        self->video_line_map[1] = GST_READ_UINT32_BE (tag_data + 12);
+
       GST_DEBUG ("  video line map = {%i, %i}", self->video_line_map[0],
           self->video_line_map[1]);
       break;