Commit 7f63b50f authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

gst/matroska/matroska-demux.c: When seeking, seek to closest index entry at or...

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).
parent 12aed9b9
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) {
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 (!demux->num_indexes)
return NULL;
if (diff_new < diff_old) {
entry = n;
}
while (n < demux->num_indexes - 1) {
if ((demux->index[n].time <= seek_pos) &&
(demux->index[n + 1].time > seek_pos)) {
entry = n;
break;
}
n++;
}
if (entry != (guint) - 1) {
return &demux->index[entry];
}
return NULL;
return &demux->index[entry];
}
/* takes ownership of the passed event! */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment