Byte-accurate seeking in VLC?

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Cybermutant
New Cone
New Cone
Posts: 2
Joined: 08 Nov 2006 10:20

Byte-accurate seeking in VLC?

Postby Cybermutant » 09 Nov 2006 22:28

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?

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Postby The DJ » 10 Nov 2006 02:46

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.
Don't use PMs for support questions.

Cybermutant
New Cone
New Cone
Posts: 2
Joined: 08 Nov 2006 10:20

Postby Cybermutant » 10 Nov 2006 10:46

Thank you sir. I posted a follow-up to the vlc-devel list.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 15 guests