gst/mxf/mxfdemux.c: Make sure that demux->offset has the correct value before calling any gst_mxf_demux_handle_* func...

Original commit message from CVS:
* gst/mxf/mxfdemux.c: (gst_mxf_demux_pull_random_index_pack):
Make sure that demux->offset has the correct value before
calling any gst_mxf_demux_handle_* functions.
This commit is contained in:
Sebastian Dröge 2008-11-30 16:21:42 +00:00
parent 8128aef461
commit 2657c73024
2 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2008-11-30 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfdemux.c: (gst_mxf_demux_pull_random_index_pack):
Make sure that demux->offset has the correct value before
calling any gst_mxf_demux_handle_* functions.
2008-11-30 Sebastian Dröge <sebastian.droege@collabora.co.uk> 2008-11-30 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps): * gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps):

View file

@ -1293,9 +1293,8 @@ gst_mxf_demux_handle_header_metadata_resolve_references (GstMXFDemux * demux)
MXFMetadataEssenceContainerData, i); MXFMetadataEssenceContainerData, i);
for (j = 0; j < demux->content_storage.n_essence_container_data; j++) { for (j = 0; j < demux->content_storage.n_essence_container_data; j++) {
if (mxf_ul_is_equal (&demux-> if (mxf_ul_is_equal (&demux->content_storage.
content_storage.essence_container_data_uids[j], essence_container_data_uids[j], &data->instance_uid)) {
&data->instance_uid)) {
demux->content_storage.essence_container_data[j] = data; demux->content_storage.essence_container_data[j] = data;
break; break;
} }
@ -2301,6 +2300,7 @@ gst_mxf_demux_pull_random_index_pack (GstMXFDemux * demux)
gint64 filesize = -1; gint64 filesize = -1;
GstFormat fmt = GST_FORMAT_BYTES; GstFormat fmt = GST_FORMAT_BYTES;
guint32 pack_size; guint32 pack_size;
guint64 old_offset = demux->offset;
MXFUL key; MXFUL key;
if (!gst_pad_query_peer_duration (demux->sinkpad, &fmt, &filesize) || if (!gst_pad_query_peer_duration (demux->sinkpad, &fmt, &filesize) ||
@ -2323,10 +2323,10 @@ gst_mxf_demux_pull_random_index_pack (GstMXFDemux * demux)
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
if (pack_size < 20) { if (pack_size < 20) {
GST_DEBUG_OBJECT (demux, "Too small pack size"); GST_DEBUG_OBJECT (demux, "Too small pack size (%u bytes)", pack_size);
goto out; goto out;
} else if (pack_size > filesize - 20) { } else if (pack_size > filesize - 20) {
GST_DEBUG_OBJECT (demux, "Too large pack size"); GST_DEBUG_OBJECT (demux, "Too large pack size (%u bytes)", pack_size);
goto out; goto out;
} }
@ -2345,6 +2345,7 @@ gst_mxf_demux_pull_random_index_pack (GstMXFDemux * demux)
goto out; goto out;
} }
demux->offset = filesize - pack_size;
if ((ret = if ((ret =
gst_mxf_demux_pull_klv_packet (demux, filesize - pack_size, &key, gst_mxf_demux_pull_klv_packet (demux, filesize - pack_size, &key,
&buffer, NULL)) != GST_FLOW_OK) { &buffer, NULL)) != GST_FLOW_OK) {
@ -2352,9 +2353,9 @@ gst_mxf_demux_pull_random_index_pack (GstMXFDemux * demux)
goto out; goto out;
} }
gst_mxf_demux_handle_random_index_pack (demux, &key, buffer); gst_mxf_demux_handle_random_index_pack (demux, &key, buffer);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
demux->offset = old_offset;
out: out:
if (!demux->partition_index) if (!demux->partition_index)