Page 1 of 1

Byte-accurate seeking in VLC?

Posted: 09 Nov 2006 22:28
by Cybermutant
I'm trying to put together an access module for VLC 0.8.5, but I'm currently stuck at a point where I cannot seem to find how to perform a seek to a specific byte position within a media file.

From within the Seek function for my module, I have tried setting p_access->info.i_pos to the byte position I want to seek to, but it didn't work and VLC kept jumping back to the old file position. I thought that maybe some upper level module is keeping the real position value and info.i_pos is just that, information only.

So I started examining the VLC source, looking at the bookmarks code, jump forward and backward routines, other modules' seek functions, etc. I saw the input_Seek() function mentioned at a few places, but later found out that it was deprecated. The best I can do now is using the float value of (desired_position/file_size) in a set_Var("position") call. However, although VLC does seek properly when I use set_Var, the accuracy is not that good; it seems VLC can only seek in 1% steps ('file_size/100' bytes). I ask for "position x", but VLC seeks to "x + several megabytes".

Is it possible to seek to a specific byte in VLC, and which function do I have to call to accomplish that?

Posted: 10 Nov 2006 02:46
by The DJ
You need to use stream_Seek()

input == and instance of a input (fully abstracted)
access == the modules that retrieve raw data (file, http etc)
stream == the bytestream between access->demux
demux == the module that parses data


So if you are writing an access module. Then YOU are the person who should implement the seek. If you are seeking in a file then it's lseek( filedescriptor, offset, whence)
In the dvd module, we call the seek of the dvd library. same for vcd.

etc etc etc.
BTW: these questions are usually better off on the VLC-devel mailinglist.

Posted: 10 Nov 2006 10:46
by Cybermutant
Thank you sir. I posted a follow-up to the vlc-devel list.