[vlc-devel] Re: packetizing data

Gildas Bazin gbazin at altern.org
Thu May 20 11:49:22 CEST 2004


On Thursday 20 May 2004 11:21, Matthew Romaine wrote:
> 
> 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?...
> 

Well, quite a few codecs in VLC are in fact more like parsers than real 
codecs (codec/a52.c, codec/mpeg_audio.c, etc..), the real decoding being 
implemented in an audio fitler (this design allows on-the-fly switching 
between software decoding, S/PDIF forwarding, channels downmixing implemted 
in the decoder filter, etc...). Other decoder will do the decoding directly 
in the decoder because there isn't any benefit in doing it in an audio 
filter (vorbis, speex, faad, etc...).

This is why the codec and packetizer actually share a lot of code (the codec 
in that cases is actually more a packetizer). They should even be identical 
but the audio output api currently doesn't allow that (that will likely 
change in the near future).

As for the faad.c codec, it relies on already packetized data (libfaad 
limitation) and this is why it sets the b_need_packetize flag.
When input_dec.c opens the decoder it checks for this flag and if it is set, 
it will insert a packetizer before the decoder.
The aac packetizer is not part of the faad.c decoder because they are 
completely different due to the fact that faad.c is only a wrapper around 
libfaad. This packetizer can be found in modules/packetizer/mpeg4audio.c.

If you need to implement both a packetizer and a decoder and they will share 
a lot of code, do it like it is done in codec/a52.c for instance. If they 
don't share code then just do 2 separate modules.

--
Gildas

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