GNOME Bugzilla – Bug 321001
[matroskademux] should seek to nearest preceding index entry, not nearest in any direction
Last modified: 2005-11-15 19:42:54 UTC
with a filesrc, a decodebin and a fakesink in a pipeline, I want to seek to some frame number, get the frame data and then display it. With an mkv file, the seek is not accurate. It seems to go to the next key frame, and not the previous one, before doing the seek. The video that I use are here : http://www.iecn.u-nancy.fr/~torri/files/gstreamer_pb/ the video stream has been encoded with xvid. Below is the test program that I use to test the seek and to retrieve the data
Created attachment 54479 [details] test program Test program that shows the problem when seeking to a specific frame Usage : ./seek video_file frame_number
Created attachment 54481 [details] [review] simple fix simple fix for the seek with mkv : i loop over the indexes until the current position is between the current index and the next one.
Looks good, but: - the patch needs to handle the case demux->num_indexes == 0 as well (currently it would loop from 0 to (guint)-1 and then crash at some point, wouldn't it?) - the patch assumes the index is sorted by time (ascending). It's probably a fairly good assumption, but I wouldn't rely on that and make sure it is sorted when adding index entries. Cheers -Tim
Created attachment 54510 [details] [review] fix the case demux->num_indexes == 0 if demux->num_indexes == 0 I return NULL Indeed, I assumed that the list of index is sorted. I don't know if it is the case or not, but it was the most straightforward thing to me :)
Thanks, applied: 2005-11-15 Vincent Torri <torri at iecn dot u-nancy dot fr> * 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). Cheers -Tim