summaryrefslogtreecommitdiffstats
path: root/gst/mxf/mxfparse.c
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-11-27 16:26:39 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-11-27 16:26:39 +0000
commita926db34ad8b983c95ef72ed9a5cb884c55430d1 (patch)
tree2b47b510a32a870e75251a402c4d231f3d11daec /gst/mxf/mxfparse.c
parent9e6654352e1e92664efad60f9a951cc2dd3c2a8a (diff)
downloadgst-plugins-bad-a926db34ad8b983c95ef72ed9a5cb884c55430d1.tar.gz
gst-plugins-bad-a926db34ad8b983c95ef72ed9a5cb884c55430d1.tar.bz2
gst-plugins-bad-a926db34ad8b983c95ef72ed9a5cb884c55430d1.zip
gst/mxf/: Implement parsing of the random index pack, which provides a seek table (including body sid) to the start o...
Original commit message from CVS: * gst/mxf/mxfdemux.c: (gst_mxf_demux_reset), (gst_mxf_demux_handle_random_index_pack), (gst_mxf_demux_pull_random_index_pack), (gst_mxf_demux_loop): * gst/mxf/mxfdemux.h: * gst/mxf/mxfparse.c: (mxf_random_index_pack_parse): * gst/mxf/mxfparse.h: * gst/mxf/mxftypes.h: Implement parsing of the random index pack, which provides a seek table (including body sid) to the start of partition packs. Later this will be used for reading all index table segments of the complete file efficiently.
Diffstat (limited to 'gst/mxf/mxfparse.c')
-rw-r--r--gst/mxf/mxfparse.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c
index 90fa6348..aceebc97 100644
--- a/gst/mxf/mxfparse.c
+++ b/gst/mxf/mxfparse.c
@@ -556,6 +556,46 @@ mxf_partition_pack_reset (MXFPartitionPack * pack)
memset (pack, 0, sizeof (MXFPartitionPack));
}
+/* SMPTE 377M 11.1 */
+gboolean
+mxf_random_index_pack_parse (const MXFUL * key, const guint8 * data, guint size,
+ GArray ** array)
+{
+ guint len, i;
+ MXFRandomIndexPackEntry entry;
+
+ g_return_val_if_fail (data != NULL, FALSE);
+ g_return_val_if_fail (array != NULL, FALSE);
+
+ if (size < 4)
+ return FALSE;
+
+ if ((size - 4) % 12 != 0)
+ return FALSE;
+
+ GST_DEBUG ("Parsing random index pack:");
+
+ len = (size - 4) / 12;
+
+ GST_DEBUG (" number of entries = %u", len);
+
+ *array =
+ g_array_sized_new (FALSE, FALSE, sizeof (MXFRandomIndexPackEntry), len);
+
+ for (i = 0; i < len; i++) {
+ entry.body_sid = GST_READ_UINT32_BE (data);
+ entry.offset = GST_READ_UINT64_BE (data + 4);
+ data += 12;
+
+ GST_DEBUG (" entry %u = body sid %u at offset %" G_GUINT64_FORMAT, i,
+ entry.body_sid, entry.offset);
+
+ g_array_append_val (*array, entry);
+ }
+
+ return TRUE;
+}
+
/* SMPTE 377M 8.2 Table 1 and 2 */
static void