[vlc-devel] Byte-accurate seeking in VLC

Utku Altunkaya utkualtunkaya at gmail.com
Fri Nov 10 10:44:22 CET 2006


This post is a follow-up to the VideoLAN Forums thread
http://forum.videolan.org/viewtopic.php?t=28344

Since the subject was development related, I am moving the discussion to the
vlc-devel list here in accordance with Mr. Derk-Jan Hartman's advice.

Mr. Hartman, thank you for the explanations in your reply. I did indeed try
to implement the seeks in my own access module, but it didn't quite work.
Let me explain:

VLC starts playing a video file using my access module. When the file
position reaches, say, 15MB I want the playback to continue from the 40MB
position, because my access module knows that there's corrupt data or a gap
in the 15MB-40MB range of the file. The first thing I tried was, as soon as
the file read pointer reached the 15MB boundary, or when a seek was
requested by VLC to a position that fell within this gap, I performed an
lseek() to 40MB in my own access module's Seek() function and also updated
the "info.i_pos" variable (this is identical to what the file access module
does, in fact I'm modifying file.c for writing my module). What happened
was, an upper level module (probably the demux or the codec) kept asking for
the old location, and my seek operation was basically ignored. So I realized
that I need to force the seek from an upper level module, but the best
method I have yet been able to find is setting the "position" variable of
the input class, which accomplishes a proper seek (even the time slider is
updated), but that only gives me "1% of file size" resolution. For large
files, this amounts to over 10MB of data getting skipped over.


More information about the vlc-devel mailing list