[vlc-devel] VLC and ff / rewind, again ...

j.zorko at att.net j.zorko at att.net
Sun May 4 03:11:52 CEST 2003


Hello, all ...

I am tasked to make VLC, while acting as a media server (not decoding / playing the media), able 
to respond to fast-forward and rewind commands, and do the right thing.  It was easy enough 
adding this functionality on a purely temporal basis ... rewind seeks back n seconds, fast-forward 
seeks forward n seconds, and this keeps happening until told to stop, and I merely changed the 
remote control interface to call input_Seek( p_input, i_new_pos, INPUT_SEEK_SECONDS) in between 
the calls to select().  This way the input thread gets the chance to read some data, the FIFO gets 
filled, the output module gets to send this data out to the network, and the end result is that any 
client VLCs tuning in to the server will hear something representative of the fast-forward or rewind 
action happening.

Now, this is all cool, but for video it really stinks -- seeking to some arbitrary time in the media 
file tends to a.) produce some really jerky or bad video artifacts in any client VLCs tuned in to the 
server VLC, and sometimes the client VLCs even crash (decoder fed data it wasn't expecting, 
perhaps).  So I need to extend this server-based rewind / ff mechanism to rewind not based on 
time, but (for video at least) based on a start code (I frames / GOPs perhaps).

VLC is not built for this, evidently -- the decoder is not instantiated in a VLC acting only as a 
server, the decoder lives on the other side of the FIFO wall, etc.  So i'm implementing a new way to 
seek on the input stream, by calling input_Seek( p_input, i_new_pos, INPUT_SEEK_STARTCODE).  
I've got the plumbing all in there so far, using the VLC ways of doing things, and i've added a 
Seek_Special() method to modules/access/file.c that gets called when I want it to.  This function 
will basically to a lseek() backwards or forwards, read some data, find the start code it's looking for 
(or the nth occurence of the start code it's looking for), do one final lseek() to that point, and 
return.  Everything is done and working except the last (lseek()) part (the Seek_Special() function 
basically seeks forward or backward 1000 bytes at a time and returns, it doesn't do the read and 
look for the start code yet, but this is simple enough to add).

OK ... you know, this feels wrong, though.  This is basically duplicating a bit of the functionality of 
the decoder stuff that lives on the other side of the FIFO, but only enough to decode the media 
down to a specific start code.  Since neither VLC nor VLS does RTSP, for instance, this seems like 
the only way I can do it, after studying the VLC source for a few days.  Can anyone who is 
intimately familiar with VLC tell me if there is a cleaner way to do this?

Regards,

John, VLC hacker (who wants to do it right)

--
Falling You - exploring the beauty 
of voice and sound
http://www.mp3.com/fallingyou








-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>



More information about the vlc-devel mailing list