From: <sl...@ke...> - 2008-02-22 06:19:49
|
CVS Root: /cvs/gstreamer Module: gst-plugins-ugly Changes by: slomo Date: Fri Feb 22 2008 06:19:56 UTC Log message: 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. Modified files: . : ChangeLog gst/asfdemux : gstasfdemux.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/ChangeLog.diff?r1=1.2333&r2=1.2334 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/gst/asfdemux/gstasfdemux.c.diff?r1=1.138&r2=1.139 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-ugly/ChangeLog,v retrieving revision 1.2333 retrieving revision 1.2334 diff -u -d -r1.2333 -r1.2334 --- ChangeLog 21 Feb 2008 23:54:24 -0000 1.2333 +++ ChangeLog 22 Feb 2008 06:19:40 -0000 1.2334 @@ -1,3 +1,15 @@ +2008-02-22 Sebastian Dröge <sl...@ci...> + + 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...@su...> * configure.ac: Index: gstasfdemux.c RCS file: /cvs/gstreamer/gst-plugins-ugly/gst/asfdemux/gstasfdemux.c,v retrieving revision 1.138 retrieving revision 1.139 diff -u -d -r1.138 -r1.139 --- gstasfdemux.c 8 Jan 2008 16:31:29 -0000 1.138 +++ gstasfdemux.c 22 Feb 2008 06:19:41 -0000 1.139 @@ -498,19 +498,35 @@ /* 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; - packet = (guint) gst_util_uint64_scale (demux->num_packets, - seek_time, demux->play_time); + 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; + } - 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 = %" |