[vlc-devel] packetizing data

Matthew Romaine Matthew.Romaine at jp.sony.com
Thu May 20 11:21:39 CEST 2004


Hi,

Is there an example of a codec using the b_need_packetize flag?  
Looking at some of the other codecs, I'm getting confused between 
pre-decoded data that is being packetized, and post-decoded data that 
is being packetized (or looks like it, anyways...)

The demuxer I wrote is supposed to send data in chunks of a fixed size, 
but apparently that's not happening so it looks like I need a 
packetizer that receives p_blocks until I have a certain amount, which 
will then send the chunk to the decoder.  flac.c uses some SYNC enums, 
and it wasn't recommended that I use that as a model, so I'm not sure 
how much of it to follow.  I was initially following faad.c, which 
seems to use a temporary buffer that I thought was for holding data 
until complete (not-yet-decoded) frames were received...

I guess part of my confusion arises because a lot of the codecs have an 
OpenPacketizer function that simply calls their OpenDecoder, but why is 
that?...

tia,
matt



On 2004/05/17, at 16:11, Gildas Bazin wrote:

> On Monday 17 May 2004 06:22, Matthew Romaine wrote:
>>
>> I'm a little bit confused in how "packetizers" and "blocks" are used.
>> In poking around the other decoders (mpeg_audio.c and flac.c), I've
>> noticed extensive code in handling different states (STATE_NOSYNC,
>> etc.).  The questions that (I think) will help me along are:
>>
>> 1) are packetizers used for creating "frames" of audio for network
>> transmission?
>
> Basically the packetizers are used to re-assemble complete frames of 
> data
> (audio, video, etc...) and to timestamp them. All this is needed by the
> stream output layer for muxing and sending the data.
>
>> 2) is flac.c's PacketizeBlock used to ensure a decode-able frame of
>> data is received before actually decoding the data?
>
> Packetizers can also be used before the decoding stage if the decoder
> requires complete frames and the demuxer sends truncated ones.
> This is what is done in the case of Flac (libFlac requires complete 
> frames).
>
> All you need in this case is provide a decoder and a packetizer and 
> set the
> p_dec->b_need_packetized in the open function of your decoder. VLC core
> will automatically spawn the packetizer for you before running the 
> decoder
> (the Flac decoder doesn't do that because it was done before this flag 
> was
> introduced... and I wouldn't recommend it for learning purposes).
>
>> In a hypothetical situation for the decoder I am working with, I need
>> to have a certain fixed-size frame of raw data before I can send it
>> along to the decoder.  I'm still trying to get my head wrapped around
>> the pipeline, but would someone kindly fill in the blanks below? :
>>
>> (blank - who calls OpenDecoder?)  -->  flac.c's DecodeBlock gets 
>> called
>> -->  (blank - where does the buffer go?)
>>
>
> The decoder is opened by the demuxer and the decoded data is sent to 
> the
> (video/audio) outputs.
> All this is managed by the core in src/input/input_dec.c.

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