qtdemux: Export MPEG-4 video profile and level in stream caps
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 22 Apr 2010 14:09:47 +0000 (19:39 +0530)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 1 Oct 2010 13:41:44 +0000 (14:41 +0100)
This uses gstpbutils to extract the profile and level from the video
object sequence and adds this to stream caps. This can be used as
metadata and for fine-grained decoder selection.

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

gst/qtdemux/qtdemux.c

index bd2e089..53571be 100644 (file)
@@ -7484,6 +7484,13 @@ gst_qtdemux_handle_esds (GstQTDemux * qtdemux, QtDemuxStream * stream,
    * codecs. */
   switch (object_type_id) {
     case 0x20:                 /* MPEG-4 */
+      /* 4 bytes for the visual_object_sequence_start_code and 1 byte for the
+       * profile_and_level_indication */
+      if (data_ptr != NULL && data_len >= 5 &&
+          GST_READ_UINT32_BE (data_ptr) == 0x000001b0) {
+        gst_codec_utils_mpeg4video_caps_set_level_and_profile (stream->caps,
+            data_ptr + 4, data_len - 4);
+      }
       break;                    /* Nothing special needed here */
     case 0x21:                 /* H.264 */
       codec_name = "H.264 / AVC";