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

[email protected]
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-bad
Changes by:     slomo
Date:           Mon Nov 24 2008  10:41:27 UTC

Log message:
* gst/mxf/mxfdemux.c: (gst_mxf_demux_pull_klv_packet),
(gst_mxf_demux_handle_klv_packet), (gst_mxf_demux_chain):
* gst/mxf/mxfparse.c: (mxf_product_version_parse),
(mxf_metadata_identification_parse),
(mxf_metadata_content_storage_parse):
Allow non-MXF KLV packets and just drop them instead of throwing
an error and handle 9 byte product versions as written by Avid.
This doesn't add support for the non-standard Avid MXF files
but at least makes it possible to parse their header metadata.
Fix a copy&paste error in debug output.

Modified files:
    .               : ChangeLog
    gst/mxf         : mxfdemux.c mxfparse.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3733&r2=1.3734
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfdemux.c.diff?r1=1.4&r2=1.5
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/mxf/mxfparse.c.diff?r1=1.3&r2=1.4

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3733
retrieving revision 1.3734
diff -u -d -r1.3733 -r1.3734
--- ChangeLog	23 Nov 2008 17:50:06 -0000	1.3733
+++ ChangeLog	24 Nov 2008 10:41:11 -0000	1.3734
@@ -1,3 +1,17 @@
+2008-11-24  Sebastian Dröge  <[email protected]>
+
+	* gst/mxf/mxfdemux.c: (gst_mxf_demux_pull_klv_packet),
+	(gst_mxf_demux_handle_klv_packet), (gst_mxf_demux_chain):
+	* gst/mxf/mxfparse.c: (mxf_product_version_parse),
+	(mxf_metadata_identification_parse),
+	(mxf_metadata_content_storage_parse):
+	Allow non-MXF KLV packets and just drop them instead of throwing
+	an error and handle 9 byte product versions as written by Avid.
+	This doesn't add support for the non-standard Avid MXF files
+	but at least makes it possible to parse their header metadata.
+	Fix a copy&paste error in debug output.
 2008-11-23  Stefan Kost  <[email protected]>
 
 	* ext/jack/gstjackaudiosink.c:
Index: mxfdemux.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfdemux.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mxfdemux.c	23 Nov 2008 11:25:30 -0000	1.4
+++ mxfdemux.c	24 Nov 2008 10:41:12 -0000	1.5
@@ -1127,8 +1127,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;
         }
@@ -1982,7 +1983,6 @@
   const guint8 *data;
   guint64 data_offset = 0;
   guint64 length;
-  gchar key_str[48];
   GstFlowReturn ret = GST_FLOW_OK;
   memset (key, 0, sizeof (MXFUL));
@@ -1994,13 +1994,6 @@
   data = GST_BUFFER_DATA (buffer);
-  if (!mxf_is_mxf_packet ((const MXFUL *) data)) {
-    GST_ERROR_OBJECT (demux, "Not an MXF packet, skipping. Key: %s",
-        mxf_ul_to_string ((const MXFUL *) data, key_str));
-    ret = GST_FLOW_ERROR;
-    goto beach;
-  }
-
   memcpy (key, GST_BUFFER_DATA (buffer), 16);
   /* Decode BER encoded packet length */
@@ -2243,7 +2236,12 @@
       goto beach;
   }
-  if (mxf_is_partition_pack (key)) {
+  if (!mxf_is_mxf_packet (key)) {
+    GST_WARNING_OBJECT (demux,
+        "Skipping non-MXF packet of size %u at offset %"
+        G_GUINT64_FORMAT ", key: %s", GST_BUFFER_SIZE (buffer), demux->offset,
+        mxf_ul_to_string (key, key_str));
+  } else if (mxf_is_partition_pack (key)) {
     ret = gst_mxf_demux_handle_partition_pack (demux, key, buffer);
   } else if (mxf_is_primer_pack (key)) {
     ret = gst_mxf_demux_handle_primer_pack (demux, key, buffer);
@@ -2414,7 +2412,6 @@
   guint64 length = 0;
   guint64 offset = 0;
   GstBuffer *buffer = NULL;
   demux = GST_MXF_DEMUX (gst_pad_get_parent (pad));
@@ -2488,13 +2485,6 @@
     /* Pull 16 byte key and first byte of BER encoded length */
     data = gst_adapter_peek (demux->adapter, 17);
-    if (!mxf_is_mxf_packet ((const MXFUL *) data)) {
-      GST_ERROR_OBJECT (demux, "Not an MXF packet, skipping. Key: %s",
-          mxf_ul_to_string ((const MXFUL *) data, key_str));
-      ret = GST_FLOW_ERROR;
-      break;
-    }
     memcpy (&key, data, 16);
     /* Decode BER encoded packet length */
Index: mxfparse.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/mxf/mxfparse.c,v
retrieving revision 1.3
diff -u -d -r1.3 -r1.4
--- mxfparse.c	22 Nov 2008 14:51:06 -0000	1.3
+++ mxfparse.c	24 Nov 2008 10:41:13 -0000	1.4
@@ -376,14 +376,19 @@
   memset (product_version, 0, sizeof (MXFProductVersion));
-  if (size < 10)
+  if (size < 9)
     return FALSE;
   product_version->major = GST_READ_UINT16_BE (data);
   product_version->minor = GST_READ_UINT16_BE (data + 2);
   product_version->patch = GST_READ_UINT16_BE (data + 4);
   product_version->build = GST_READ_UINT16_BE (data + 6);
-  product_version->release = GST_READ_UINT16_BE (data + 8);
+  /* Avid writes a 9 byte product version */
+  if (size == 9)
+    product_version->release = GST_READ_UINT8 (data + 8);
+  else
+    product_version->release = GST_READ_UINT16_BE (data + 8);
   return TRUE;
 }
@@ -921,8 +926,6 @@
         break;
       case 0x3c03:
         GST_WRITE_UINT16_BE (data, 0x0000);
-        if (tag_size != 10)
-          goto error;
         if (!mxf_product_version_parse (&identification->product_version,
                 tag_data, tag_size))
           goto error;
@@ -939,16 +942,12 @@
       case 0x3c06:
-        if (tag_size != 8)
         if (!mxf_timestamp_parse (&identification->modification_date, tag_data,
                 tag_size))
       case 0x3c07:
         if (!mxf_product_version_parse (&identification->toolkit_version,
@@ -1126,7 +1125,7 @@
   for (i = 0; i < content_storage->n_packages; i++)
     GST_DEBUG ("  package %u = %s", i,
         mxf_ul_to_string (&content_storage->packages_uids[i], str));
-  for (i = 0; i < content_storage->n_packages; i++)
+  for (i = 0; i < content_storage->n_essence_container_data; i++)
     GST_DEBUG ("  essence container data %u = %s", i,
         mxf_ul_to_string (&content_storage->essence_container_data_uids[i],
             str));

-------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.