[alsa-devel] question application playback

Wang Xingchao wangxingchao2011 at gmail.com
Mon Jan 30 03:25:25 CET 2012


thanks your comments, gabriel.

在 2012年1月29日 上午10:51,Gabriel M. Beddingfield <gabrbedd at gmail.com> 写道:
> On 01/29/2012 12:31 AM, Wang Xingchao wrote:
>> i used tool "aplay" to "play" mp3 files sucessfully. :)
>> well, in this scenario, alsa is used as data transfer interface, there
>> must be mp3 decode interface in kernel layer to receive mp3 data and
>> do the post work.  mp3 data is regarded as pcm data during transfer,
>> so the format and rate must be specified with aplay.
>
> 1. There is no DSP done in the kernel.  That includes
>    MP3 decode.  This is a hard and fast rule.  Decode
>    must either be done by the hardware or userspace.
>    Never in the kernel.

A misunderstanding here. It's DSP interface in kernel, which send
compress audio data to DSP for post process. The decoding is done
by HW, that's true. :)
>
> 2. Some audio hardware is able to decode the MP3
>    directly.  Since I've never seen/used one, I
>    don't know how its driver would work or how
>    to set the hw_params... or if ALSA even supports
>    passing this format to the audio device.

The interface can receive compressed format data such as MP3,
so ALSA is only a transfer channel.  ALSA is able to send MP3 data as faked
PCM format.

>
> 3. aplay is able to do some format conversion. For
>    example, `man aplay` shows that it supports MPEG
>    decode.

exactly.  :)

>
> Conclusion:  If you can set your hw_params to do SND_PCM_FORMAT_MPEG,
> then the hardware is doing the MPEG decode.  Most cards/drivers will
> reject this, though... in which case you have to do the decode yourself
> with something like liblame or libmpg123.

That's true. Take Intel's Medfield platform for example, It has DSP
which handle HW decoding. And the DSP FW varies on different platform,
it's able to receive compressed audio data(Mp3, DTS, AAC, etc) and
what kernel layer done is the transfer work.

thanks
--xingchao
>
> -gabriel
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


More information about the Alsa-devel mailing list