gst/asfdemux/gstasfdemux.c: If we don't have the position to seek to in our index first try to convert from TIME to B...

Original commit message from CVS:
Patch by:
Hans de Goede <j dot w dot r dot degoede at hhs dot nl>
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_handle_seek_event):
If we don't have the position to seek to in our index first try
to convert from TIME to BYTES upstream and only if that fails
too use the old hack to simply seek to an earlier position
and let the sink drop everything before segment start.
Partially fixes bug #469930.
This commit is contained in:
Sebastian Dröge 2008-02-22 06:19:41 +00:00
parent f740e36226
commit 269a9706fc
2 changed files with 40 additions and 12 deletions

View file

@ -1,3 +1,15 @@
2008-02-22 Sebastian Dröge <slomo@circular-chaos.org>
Patch by:
Hans de Goede <j dot w dot r dot degoede at hhs dot nl>
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_handle_seek_event):
If we don't have the position to seek to in our index first try
to convert from TIME to BYTES upstream and only if that fails
too use the old hack to simply seek to an earlier position
and let the sink drop everything before segment start.
Partially fixes bug #469930.
2008-02-21 Jan Schmidt <jan.schmidt@sun.com>
* configure.ac:

View file

@ -498,19 +498,35 @@ gst_asf_demux_handle_seek_event (GstASFDemux * demux, GstEvent * event)
/* FIXME: should check the KEY_UNIT flag; need to adjust last_stop to
* real start of data and segment_start to indexed time for key unit seek*/
if (!gst_asf_demux_seek_index_lookup (demux, &packet, seek_time, &idx_time)) {
/* Hackety hack, this sucks. We just seek to an earlier position
* and let the sinks throw away the stuff before the segment start */
if (flush && (accurate || keyunit_sync)) {
seek_time -= 5 * GST_SECOND;
if (seek_time < 0)
seek_time = 0;
/* First try to query our source to see if it can convert for us. This is
the case when our source is an mms stream, notice that in this case
gstmms will do a time based seek to get the byte offset, this is not a
problem as the seek to this offset needs to happen anway. */
gint64 offset;
GstFormat dest_format = GST_FORMAT_BYTES;
if (gst_pad_query_peer_convert (demux->sinkpad, GST_FORMAT_TIME, seek_time,
&dest_format, &offset) && dest_format == GST_FORMAT_BYTES) {
packet = (offset - demux->data_offset) / demux->packet_size;
GST_LOG_OBJECT (demux, "convert %" GST_TIME_FORMAT
" to bytes query result: %lld, data_ofset: %llu, packet_size: %u,"
" resulting packet: %u\n", GST_TIME_ARGS (seek_time), offset,
demux->data_offset, demux->packet_size, packet);
} else {
/* Hackety hack, this sucks. We just seek to an earlier position
* and let the sinks throw away the stuff before the segment start */
if (flush && (accurate || keyunit_sync)) {
seek_time -= 5 * GST_SECOND;
if (seek_time < 0)
seek_time = 0;
}
packet = (guint) gst_util_uint64_scale (demux->num_packets,
seek_time, demux->play_time);
if (packet > demux->num_packets)
packet = demux->num_packets;
}
packet = (guint) gst_util_uint64_scale (demux->num_packets,
seek_time, demux->play_time);
if (packet > demux->num_packets)
packet = demux->num_packets;
} else {
if (keyunit_sync) {
GST_DEBUG_OBJECT (demux, "key unit seek, adjust seek_time = %"