[vlc-devel] Re: Question about sout_buffer_t ...

Jean-Paul Saman saman at natlab.research.philips.com
Mon Sep 8 14:27:06 CEST 2003


j.zorko at att.net wrote:
> So, the experiment I tried yesterday did not work, but I think I know why.  A lot of what you 
> wrote before makes sense now.  Anyway, i've a question about sout_buffer_t and the new 
> b_discontinuity field within it: Basically, how do I set it?
I have been looking in the stream out code, and think the best place 
could be in the packetiser (not the stream out). Basically, you need to 
set it in the packet that is being formed, but you need to know when to 
set it. The right place  is where the old pes/es structs are still 
accessible for this packet.
Look into modules/packetiser/*.{c,h} to see what I mean. (I am not 
familiar with this code .. you are warned ;-))

> Scenario: User does a seek with the GUI ... src/input/input.c calls pf_seek(), then it sets a 
> mystical, magical discontinuity flag somewhere to VLC_TRUE.  When pf_demux() is called, it calls 
> pf_read_ps(), which I suppose is going to look at this flag to determine if it should set the 
> b_discontinuity flag in the pes_packet_t's it makes via input_NewPES().  These pes_packet_t's are 
> what ends up in the decoder FIFO, I think.
At least set it in the pes_packet_t struct, then the packetiser could 
pick it up and set it in the TS header field.

> Now, the muxer module's PacketizeThread() is happily looking in the decoder FIFO and making 
> sout_buffer_t's out of what it finds in preparation for PEStoTS() to make TS packets out of them.  
> However, PacketizeThread() sees the decoder FIFO as a stream of bits, and i'm not sure how to 
> make it identify the b_discontinuity flag in this bitstream, so it can set the flag in the 
> sout_buffer_t.

In the PacketizeThread() something like this:

p_sout_buffer->b_discontinuity = p_pack->sp_pack->p_first->b_discontinuity;

at the appropriate place(s) ;-)

> So, my questions are:
> 
> Server VLC:
> 
> 1. input thread: How to make pf_demux() aware of the discontinuity caused by the pf_seek() ... 
> pass it in as an argument, and change every module's Demux() function?
> 
Put it in the pes_packet_t struct (b_discontinuity)

> 2. demux module(s): How to set the b_discontinuity flag in pes_packet_t's created ... pass it as 
> an argument to input_NewPES() and change every call to this function in the entire code?
input_NewPES() itself is the wrong place. It just allocates a new 
buffer. But when the buffer is filled with the data, then the 
p_sout_buffer pointer could be set with the b_discontinuity flag. There 
is one problem though I do not know how the bitstream approach relates 
to p_packet->p_first pointers. If the position in pes_packet_t list can 
be obtained then the b_discontinuity flag can be copied. Maybe someone 
else can comment on this (Meeuh, Sam?)?


> 3. mux module(s): How to identify the b_discontinuity flag in the pes_packet_t, when the whole 
> string is presented as a bitstream?

Well my thought exactly, See previous remark ! I just did some more 
digging in the code and see in the bitstream_t struct there is a pointer 
to the current PES packet.
This will give you enough information to carry on all information you'd 
like to:

p_sout_buffer->b_discontinuity = 
p_packet->bitstream->p_pes->b_discontinuity;

Eh voila, you have the discontinuity information in the sout_buffer_t 
struct.

-- 
Kind greetings,

Jean-Paul Saman


-- 
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