[vlc-devel] Re: Doing an lseek() with VOB files ...

Jean-Paul Saman saman at natlab.research.philips.com
Thu Aug 14 16:18:02 CEST 2003

John Michael Zorko wrote:

> The fopen / fprintf / fclose I put in there wasn't trying to find where 
> the bit it set, but rather to see if the bit was set by the server VLC 
> whenever it did a seek (since the code that looks to see if it is is on 
> the client VLC).  My tests indicate that it's not, so now i'm trying to 
> find out where it would be / should be.  So far, my best guess is a 
> function in vlc_root/modules/mux/mpeg/ts.c called PEStoTS() or something 
> like that.  This function seems to fill out the TS header (found it by 
> grepping for the sync byte code), so this is what i'm endeavoring to do 
> right now:
Indeed it looks like it is doing just that.

> 1. figure out how to set the discontinuity bit here -- can you help with 
> this?

At line 1307 of modules/demux/system.c you find this code that detects a 
  TS discontinuity, which is good.

      /* discontinuity_indicator */
                     if( p[5] & 0x80 )

> 2. set this bit whenever the server VLC does a seel

Which functions do you use to perform a ff/rewind? And in which files do 
you use them?

Somehow the muxer should get the indication that we are in ff/rewind 
mode and that a timer discontinuity has happend so the bit can be set there.

In the attached patches I coded the setting of the discontinuity bit in 
the TS header when it reaches the muxer. Now you must follow the path 
backwards of the PES data to the input and also pass over the 
discontinuity flag where appropriate.

Also where a discontinuity is detected after a ff/rewind seek jump it 
must be set in the structure (input, demux, etc.). Or right after the jump.

> 3. see if this bit gets over to the client in the TS header

If it is set on the right PID's this will be done automatically ;-)

> 4. see if this fixes the jumbled video problem

That depends on what frame type you begin with streaming a I-Frame iso 
of a P-Frame or B-Frame. Why?

An P frame needs an I frame to be decoded
An B frame needs an P frame or another B-frame to be decode
Only the I-Frame is standalone and can be jumped to easily without 

There is one caveat the stream should contain I-Frames at regular intervals.

>> Can you tell which scenario you were using when this fopen/fprint/fclose
>> gets triggered?
> The test scenario is a VLC acting as a server, and another VLC acting as 
> a client (same or different machine -- i'm currently using a Mac dual G4 
> running OSX 10.2.6 as the server, and a Mac iBook 900 as the client, but 
> I also see the issue on RedHat Linux 9).  Using the rc interface or the 
> GUI on the server VLC, I do the seek, and see what the client behavior 
> is (if the video is jumbled for a bit after the seek).


Kind greetings,

Jean-Paul Saman
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: include_stream_output.h.diff
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20030814/f2a98359/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: modules_mux_mpeg_ts.diff
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20030814/f2a98359/attachment-0001.ksh>

More information about the vlc-devel mailing list