[vlc-devel] Byte-accurate seeking in VLC

Utku Altunkaya utkualtunkaya at gmail.com
Fri Nov 10 11:12:51 CET 2006


Gmail has somehow split my previous post into two, so I'm trying again from 
Mozilla. Excuse me for the double post.

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.

 From reading the VLC source code, I know that the stream class can do 
byte-seeks using stream_Seek(), but can you please clarify a few points for me:

(1) Do all upper level modules (demux, codec, etc) also obey the new file 
position when set with stream_Seek()?
(2) Am I allowed to call stream functions from within an access module?
(3) If #2 above is allowed, how do I get a handle to the stream functions? For 
example, to access the input structure I call vlc_object_find( p_access, 
VLC_OBJECT_INPUT, FIND_PARENT ). Can I do something similar for the stream 
structure?

Thank you for your help.

Sincerely,
Utku Altunkaya

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list