avcodecmap: exclude avc3 stream format from AV_CODEC_ID_H264
authorAlex Ashley <bugzilla@ashley-family.net>
Fri, 30 Aug 2013 10:48:51 +0000 (11:48 +0100)
committerSebastian Dröge <slomo@circular-chaos.org>
Wed, 4 Sep 2013 11:34:00 +0000 (13:34 +0200)
As part of the changes to support the "avc3" variant of the ISO-BMFF
(see bug #702004) a new stream-format has been created
(video/x-h264, stream-format="avc3", alignment="au") that requires
changes to gstavcodecmap to exclude this format because avdec_h264
expects the SPS and PPS to be in the codec_data.

Amendment 2 of ISO/IEC 14496-15 (AVC file format) is defining a new
structure for fragmented MP4 called "avc3". The principal difference
between AVC1 and AVC3 is the location of the codec initialisation data
(e.g. SPS, PPS). In AVC1 this data is placed in the initial MOOV box
(moov.trak.mdia.minf.stbl.stsd.avc1) but in AVC3 this data goes in the
first sample of every fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=702004

ext/libav/gstavcodecmap.c

index 395ea36..1a2f515 100644 (file)
@@ -1142,6 +1142,19 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
       caps =
           gst_ff_vid_caps_new (context, NULL, codec_id, encode, "video/x-h264",
           "alignment", G_TYPE_STRING, "au", NULL);
+      if (!encode) {
+        GValue arr = { 0, };
+        GValue item = { 0, };
+        g_value_init (&arr, GST_TYPE_LIST);
+        g_value_init (&item, G_TYPE_STRING);
+        g_value_set_string (&item, "avc");
+        gst_value_list_append_value (&arr, &item);
+        g_value_set_string (&item, "byte-stream");
+        gst_value_list_append_value (&arr, &item);
+        g_value_unset (&item);
+        gst_caps_set_value (caps, "stream-format", &arr);
+        g_value_unset (&arr);
+      }
       break;
 
     case AV_CODEC_ID_INDEO5: