slomo gst-plugins-bad: gst-plugins-bad/ gst-plugins-bad/gst/mxf/

[email protected] Mon, 1 Dec 2008 07:24:51 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-bad
Changes by:     slomo
Date:           Mon Dec 01 2008  15:24:51 UTC

Log message:
* gst/mxf/mxfaes-bwf.c: (mxf_bwf_create_caps):
* gst/mxf/mxfalaw.c: (mxf_alaw_create_caps):
* gst/mxf/mxfdemux.c:
(gst_mxf_demux_handle_generic_container_essence_element):
* gst/mxf/mxfdv-dif.c: (mxf_dv_dif_create_caps):
* gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps):
* gst/mxf/mxfmpeg.c: (mxf_mpeg_es_create_caps),
(mxf_mpeg_create_caps):
Add the codec name, and if possible the avg bitrate, to the pad's taglist.

Modified files:
    .               : ChangeLog
    gst/mxf         : mxfaes-bwf.c mxfalaw.c mxfdemux.c mxfdv-dif.c
                      mxfjpeg2000.c mxfmpeg.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3772&r2=1.3773
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfaes-bwf.c.diff?r1=1.5&r2=1.6
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfalaw.c.diff?r1=1.2&r2=1.3
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfdemux.c.diff?r1=1.21&r2=1.22
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfdv-dif.c.diff?r1=1.1&r2=1.2
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfjpeg2000.c.diff?r1=1.3&r2=1.4
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfmpeg.c.diff?r1=1.7&r2=1.8

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3772
retrieving revision 1.3773
diff -u -d -r1.3772 -r1.3773
--- ChangeLog	1 Dec 2008 14:25:16 -0000	1.3772
+++ ChangeLog	1 Dec 2008 15:24:35 -0000	1.3773
@@ -1,5 +1,17 @@
 2008-12-01  Sebastian Dröge  <[email protected]>
 
+	* gst/mxf/mxfaes-bwf.c: (mxf_bwf_create_caps):
+	* gst/mxf/mxfalaw.c: (mxf_alaw_create_caps):
+	* gst/mxf/mxfdemux.c:
+	(gst_mxf_demux_handle_generic_container_essence_element):
+	* gst/mxf/mxfdv-dif.c: (mxf_dv_dif_create_caps):
+	* gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps):
+	* gst/mxf/mxfmpeg.c: (mxf_mpeg_es_create_caps),
+	(mxf_mpeg_create_caps):
+	Add the codec name, and if possible the avg bitrate, to the pad's taglist.
+
+2008-12-01  Sebastian Dröge  <[email protected]>
 	* gst/mxf/mxfdemux.c: (gst_mxf_demux_choose_package):
 	If the preface references a primary package use this as the default
 	playback package unless one was specified by the "package" property.
Index: mxfaes-bwf.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfaes-bwf.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mxfaes-bwf.c	28 Nov 2008 18:13:29 -0000	1.5
+++ mxfaes-bwf.c	1 Dec 2008 15:24:36 -0000	1.6
@@ -258,6 +258,7 @@
   GstCaps *ret = NULL;
   MXFMetadataWaveAudioEssenceDescriptor *wa_descriptor = NULL;
   gchar str[48];
+  gchar *codec_name = NULL;
   if (((MXFMetadataGenericDescriptor *) descriptor)->type ==
       MXF_METADATA_WAVE_AUDIO_ESSENCE_DESCRIPTOR)
@@ -293,6 +294,10 @@
         (block_align != 1), "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, "depth",
         G_TYPE_INT, (block_align / descriptor->channel_count) * 8, "width",
         G_TYPE_INT, (block_align / descriptor->channel_count) * 8, NULL);
+    codec_name =
+        g_strdup_printf ("Uncompressed %u-bit little endian integer PCM audio",
+        (block_align / descriptor->channel_count) * 8);
   } else if (mxf_ul_is_equal (&descriptor->sound_essence_compression,
           &mxf_sound_essence_compression_aiff)) {
     guint block_align;
@@ -318,6 +323,10 @@
         (block_align != 1), "endianness", G_TYPE_INT, G_BIG_ENDIAN, "depth",
+        g_strdup_printf ("Uncompressed %u-bit big endian integer PCM audio",
           &mxf_sound_essence_compression_alaw)) {
@@ -331,11 +340,25 @@
         (gint) (((gdouble) descriptor->audio_sampling_rate.n) /
             ((gdouble) descriptor->audio_sampling_rate.d) + 0.5),
         "channels", G_TYPE_INT, descriptor->channel_count);
+    codec_name = g_strdup ("A-law encoded audio");
   } else {
     GST_ERROR ("Unsupported sound essence compression: %s",
         mxf_ul_to_string (&descriptor->sound_essence_compression, str));
   }
+  if (!*tags)
+    *tags = gst_tag_list_new ();
+  if (codec_name) {
+    gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
+        codec_name, NULL);
+    g_free (codec_name);
+  }
+  if (wa_descriptor && wa_descriptor->avg_bps)
+    gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_BITRATE,
+        wa_descriptor->avg_bps * 8, NULL);
   *handler = mxf_bwf_handle_essence_element;
   return ret;
Index: mxfalaw.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfalaw.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mxfalaw.c	30 Nov 2008 17:42:29 -0000	1.2
+++ mxfalaw.c	1 Dec 2008 15:24:37 -0000	1.3
@@ -80,7 +80,6 @@
     MXFMetadataTrack * track, GstTagList ** tags,
     MXFEssenceElementHandler * handler, gpointer * mapping_data)
 {
-  MXFMetadataFileDescriptor *f = NULL;
   MXFMetadataGenericSoundEssenceDescriptor *s = NULL;
   guint i;
   GstCaps *caps = NULL;
@@ -97,37 +96,32 @@
     if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
         MXF_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR) {
       s = (MXFMetadataGenericSoundEssenceDescriptor *) track->descriptor[i];
-      f = track->descriptor[i];
       break;
-    } else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->
-        is_file_descriptor
-        && ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type !=
-        MXF_METADATA_MULTIPLE_DESCRIPTOR) {
     }
-  if (!f) {
-    GST_ERROR ("No descriptor found for this track");
+  if (!s) {
+    GST_ERROR ("No generic sound essence descriptor found for this track");
     return NULL;
   *handler = mxf_alaw_handle_essence_element;
-  caps = gst_caps_new_simple ("audio/x-alaw", NULL);
-  if (s) {
-    if (s->audio_sampling_rate.n != 0 && s->audio_sampling_rate.d != 0)
-      gst_caps_set_simple (caps, "rate", G_TYPE_INT,
-          (gint) (((gdouble) s->audio_sampling_rate.n) /
-              ((gdouble) s->audio_sampling_rate.d) + 0.5), NULL);
+  if (s && s->audio_sampling_rate.n != 0 && s->audio_sampling_rate.d != 0 &&
+      s->channel_count != 0) {
-    if (s->channel_count != 0)
-      gst_caps_set_simple (caps, "channels", G_TYPE_INT, s->channel_count,
-          NULL);
+    caps = gst_caps_new_simple ("audio/x-alaw", "rate", G_TYPE_INT,
+        (gint) (((gdouble) s->audio_sampling_rate.n) /
+            ((gdouble) s->audio_sampling_rate.d) + 0.5),
+        "channels", G_TYPE_INT, s->channel_count, NULL);
     /* TODO: Handle channel layout somehow? */
-  } else {
-    GST_WARNING ("Only a generic sound essence descriptor found");
+    if (!*tags)
+      *tags = gst_tag_list_new ();
+        "A-law encoded audio", NULL);
   return caps;
Index: mxfdemux.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfdemux.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mxfdemux.c	1 Dec 2008 14:25:19 -0000	1.21
+++ mxfdemux.c	1 Dec 2008 15:24:37 -0000	1.22
@@ -1305,8 +1305,9 @@
           MXFMetadataEssenceContainerData, i);
       for (j = 0; j < demux->content_storage.n_essence_container_data; j++) {
-        if (mxf_ul_is_equal (&demux->content_storage.
-                essence_container_data_uids[j], &data->instance_uid)) {
+        if (mxf_ul_is_equal (&demux->
+                content_storage.essence_container_data_uids[j],
+                &data->instance_uid)) {
           demux->content_storage.essence_container_data[j] = data;
           break;
         }
@@ -2152,13 +2153,18 @@
     return GST_FLOW_OK;
-  /* TODO: Use a better start value */
   if (pad->need_segment) {
     gst_pad_push_event (GST_PAD_CAST (pad),
         gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0));
     pad->need_segment = FALSE;
+  if (pad->tags) {
+    gst_element_found_tags_for_pad (GST_ELEMENT_CAST (demux),
+        GST_PAD_CAST (pad), pad->tags);
+    pad->tags = NULL;
   /* Create subbuffer to be able to change metadata */
   inbuf = gst_buffer_create_sub (buffer, 0, GST_BUFFER_SIZE (buffer));
@@ -2197,6 +2203,7 @@
   if (outbuf) {
+    /* TODO: handle timestamp gaps */
     ret = gst_pad_push (GST_PAD_CAST (pad), outbuf);
     ret = gst_mxf_demux_combine_flows (demux, pad, ret);
Index: mxfdv-dif.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfdv-dif.c,v
retrieving revision 1.1
diff -u -d -r1.1 -r1.2
--- mxfdv-dif.c	27 Nov 2008 10:09:53 -0000	1.1
+++ mxfdv-dif.c	1 Dec 2008 15:24:37 -0000	1.2
@@ -91,8 +91,8 @@
   for (i = 0; i < track->n_descriptor; i++) {
-    if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->
+    if (((MXFMetadataGenericDescriptor *) track->
+            descriptor[i])->is_file_descriptor
         && ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type !=
         MXF_METADATA_MULTIPLE_DESCRIPTOR) {
       f = track->descriptor[i];
@@ -116,6 +116,12 @@
     caps =
         gst_caps_new_simple ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE,
         NULL);
+    gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_CODEC, "DV-DIF",
+        NULL);
Index: mxfjpeg2000.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfjpeg2000.c,v
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mxfjpeg2000.c	30 Nov 2008 17:42:30 -0000	1.3
+++ mxfjpeg2000.c	1 Dec 2008 15:24:37 -0000	1.4
@@ -106,8 +106,8 @@
       p = (MXFMetadataGenericPictureEssenceDescriptor *) track->descriptor[i];
+    } else if (((MXFMetadataGenericDescriptor *) track->
@@ -129,5 +129,10 @@
     GST_WARNING ("Only a generic file descriptor found");
+  gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
+      "JPEG 2000", NULL);
 }
Index: mxfmpeg.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfmpeg.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mxfmpeg.c	30 Nov 2008 17:42:30 -0000	1.7
+++ mxfmpeg.c	1 Dec 2008 15:24:37 -0000	1.8
@@ -254,6 +254,7 @@
     MXFMetadataMPEGVideoDescriptor * d)
+  const gchar *codec_name = NULL;
   /* SMPTE RP224 */
   if (!p || mxf_ul_is_zero (&p->picture_essence_coding)) {
@@ -262,6 +263,7 @@
         gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 2,
         "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
+    codec_name = "MPEG-2 Video";
   } else if (p->picture_essence_coding.u[0] != 0x06
       || p->picture_essence_coding.u[1] != 0x0e
       || p->picture_essence_coding.u[2] != 0x2b
@@ -280,9 +282,11 @@
       p->picture_essence_coding.u[13] <= 0x08) {
     caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 2,
   } else if (p->picture_essence_coding.u[13] == 0x10) {
     caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
+    codec_name = "MPEG-1 Video";
   } else if (p->picture_essence_coding.u[13] == 0x20) {
     MXFLocalTag *local_tag =
         (((MXFMetadataGenericDescriptor *) f)->other_tags) ?
@@ -300,15 +304,21 @@
           NULL);
       gst_buffer_unref (codec_data);
-
+    codec_name = "MPEG-4 Video";
     GST_ERROR ("Unsupported MPEG picture essence coding 0x%02x",
         p->picture_essence_coding.u[13]);
     caps = NULL;
-  if (caps)
+  if (caps) {
     *handler = mxf_mpeg_video_handle_essence_element;
+    if (codec_name)
+      gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
+          codec_name, NULL);
@@ -378,9 +388,19 @@
     GST_DEBUG ("Found MPEG PS stream");
         "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
+    gst_tag_list_add (*tags, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
+        "MPEG PS", NULL);
   } else if (f->essence_container.u[13] == 0x09) {
     GST_DEBUG ("Found MPEG TS stream");
     caps = gst_caps_new_simple ("video/mpegts", NULL);
+        "MPEG TS", NULL);
   if (p)

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose