[Flac-users] Extending mp3/ogg application to play flac

Josh Coalson xflac at yahoo.com
Thu Sep 2 14:46:08 PDT 2004


--- Lars von Wedel <vonwedel at web.de> wrote:
> However there are two issues I'm unsure about:
> 
>  - Do I need to convert the decoded audio data delivered to the
>    FileDecoderWriteCallback to be compatible with mad_pcm/mad_fixed_t
> data?

not sure about the mad_fixed_t format, but probably.  all samples
coming out of the FLAC decoder are linear PCM 32-bit signed ints.
e.g. a sample from CD audio will be in the range -32768 (0xFFFF8000)
to 32767 (0x00007FFF)

>  - The mad_pcm structure expects 1152 samples per channel.
>    How Do I obtain 1152 samples from the Flac decoder?

since the write callback will be called once for each frame, and
the number of samples in a FLAC frame can vary, your write callback
will probably have to write to an intermediate buffer.  the same
thing has to happen in the winamp2 plugin, so you can look at that
code for an example (search for reservoir_ and SAMPLES_PER_WRITE).

http://cvs.sourceforge.net/viewcvs.py/flac/flac/src/plugin_winamp2/in_flac.c?view=markup

Josh



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail




More information about the Flac mailing list