From 1229f0a149bb4d9dc989832650e6b019ffbcc5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 9 Feb 2009 17:55:05 +0100 Subject: mxfdemux: When trying to find an essence track position try to find position+1 too By searching for the following position we will add the complete generic container (i.e. all tracks) at the same position to the index which should make finding positions for more than one track a bit faster. --- gst/mxf/mxfdemux.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 9704b9fe..957d853e 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -2443,20 +2443,20 @@ from_index: } } - if (G_UNLIKELY (ret != GST_FLOW_OK)) { + if (G_UNLIKELY (ret != GST_FLOW_OK) && etrack->position <= *position) { demux->offset = old_offset; demux->current_partition = old_partition; break; + } else if (G_UNLIKELY (ret == GST_FLOW_OK)) { + ret = gst_mxf_demux_handle_klv_packet (demux, &key, buffer, TRUE); + gst_buffer_unref (buffer); } - ret = gst_mxf_demux_handle_klv_packet (demux, &key, buffer, TRUE); - - gst_buffer_unref (buffer); - /* If we found the position read it from the index again */ - if (ret == GST_FLOW_OK && etrack->position == *position + 1 && - etrack->offsets && etrack->offsets->len > *position && - g_array_index (etrack->offsets, GstMXFDemuxIndex, + if (((ret == GST_FLOW_OK && etrack->position == *position + 2) || + (ret == GST_FLOW_UNEXPECTED && etrack->position == *position + 1)) + && etrack->offsets && etrack->offsets->len > *position + && g_array_index (etrack->offsets, GstMXFDemuxIndex, *position).offset != 0) { GST_DEBUG_OBJECT (demux, "Found at offset %" G_GUINT64_FORMAT, demux->offset); -- cgit v1.2.1