mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 15:56:42 +00:00
gst/matroska/matroska-demux.c: When seeking, seek to closest index entry at or before the requested seek position, no...
Original commit message from CVS: Reviewed by: Tim-Philipp Müller <tim at centricular dot net> * gst/matroska/matroska-demux.c: (gst_matroskademux_do_index_seek): When seeking, seek to closest index entry at or before the requested seek position, not just the closest one (#321001).
This commit is contained in:
parent
12aed9b96e
commit
7f63b50f3f
2 changed files with 19 additions and 16 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-11-15 Vincent Torri <torri at iecn dot u-nancy dot fr>
|
||||
|
||||
Reviewed by: Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/matroska/matroska-demux.c: (gst_matroskademux_do_index_seek):
|
||||
When seeking, seek to closest index entry at or before the requested
|
||||
seek position, not just the closest one (#321001).
|
||||
|
||||
2005-11-15 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/avi/gstavidemux.c: (swap_line), (gst_avi_demux_invert),
|
||||
|
|
|
@ -992,27 +992,22 @@ gst_matroska_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
|||
static GstMatroskaIndex *
|
||||
gst_matroskademux_do_index_seek (GstMatroskaDemux * demux, guint64 seek_pos)
|
||||
{
|
||||
guint entry = (guint) - 1;
|
||||
guint n;
|
||||
guint entry = demux->num_indexes - 1;
|
||||
guint n = 0;
|
||||
|
||||
for (n = 0; n < demux->num_indexes; n++) {
|
||||
if (entry == (guint) - 1) {
|
||||
if (!demux->num_indexes)
|
||||
return NULL;
|
||||
|
||||
while (n < demux->num_indexes - 1) {
|
||||
if ((demux->index[n].time <= seek_pos) &&
|
||||
(demux->index[n + 1].time > seek_pos)) {
|
||||
entry = n;
|
||||
} else {
|
||||
gfloat diff_old = fabs (1. * (demux->index[entry].time - seek_pos)),
|
||||
diff_new = fabs (1. * (demux->index[n].time - seek_pos));
|
||||
|
||||
if (diff_new < diff_old) {
|
||||
entry = n;
|
||||
}
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
|
||||
if (entry != (guint) - 1) {
|
||||
return &demux->index[entry];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return &demux->index[entry];
|
||||
}
|
||||
|
||||
/* takes ownership of the passed event! */
|
||||
|
|
Loading…
Reference in a new issue