ALSA Compress Offload support

Qais Yousef qais.yousef at imgtec.com
Tue Jan 13 02:04:50 PST 2015


On 01/13/2015 09:15 AM, Sebastian Dröge wrote:
> On Di, 2015-01-13 at 08:40 +0000, Qais Yousef wrote:
>> On 01/09/2015 09:28 AM, Qais Yousef wrote:
>>> On 01/09/2015 09:12 AM, Sebastian Dröge wrote:
>>>> Search for "MPEG" in
>>>> http://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/ext/alsa/gstalsasink.c
>>>>
>>>>
>>>> At the sink pad template all the compressed formats that are supported
>>>> are in the PASSTHROUGH_CAPS #define.
>>> OK that's awesome! I'll try it out.
>>>
>>>
>> OK so I'm on gst v1.4.5, when I run this pipeline
>>
>>
>>        gst-launch-1.0 -v filesrc location=$mp3_file ! mpegaudioparse !
>> alsasink
>>
>> I get the following error:
>> Setting pipeline to PAUSED ...
>> Pipeline is PREROLLING ...
>> /GstPipeline:pipeline0/GstMpegAudioParse:mpegaudioparse0.GstPad:src:
>> caps = "audio/mpeg\,\ mpegversion\=\(int\)1\,\
>> mpegaudioversion\=\(int\)1\,\ layer\=\(int\)3\,\ rate\=\(int\)44100\,\
>> channels\=\(int\)2\,\ parsed\=\(boolean\)true"
>> ERROR: from element
>> /GstPipeline:pipeline0/GstMpegAudioParse:mpegaudioparse0: GStreamer
>> encountered a general stream error.
>> Additional debug info:
>> gstbaseparse.c(3264): gst_base_parse_loop ():
>> /GstPipeline:pipeline0/GstMpegAudioParse:mpegaudioparse0:
>> streaming stopped, reason not-negotiated
>> ERROR: pipeline doesn't want to preroll.
>> Setting pipeline to NULL ...
>> /GstPipeline:pipeline0/GstMpegAudioParse:mpegaudioparse0.GstPad:src:
>> caps = "NULL"
>> Freeing pipeline ...
>>
>>
>> Looking at PASSTHROUGH_CAPS #define alsasink should support these caps,
>> no? Do I need to insert something else into the pipeline?
> No, AFAIK that should just work. If your driver and hardware supports
> MP3 passthrough. You might also need to select a different device on
> alsasink.
>
> If you get a debug log that might help.
>
>

My driver is work in progress, but it works with cplay from tinycompress[1].

I changed my pipeline to specify the correct device

    gst-launch-1.0 --gst-debug=3 -v filesrc location=$file ! 
mpegaudioparse ! alsasink device="hw:0,1"

now I get this:

Setting pipeline to PAUSED ...
0:00:01.104003406   136 0x10070340 WARN                    alsa 
pcm_hw.c:1557:snd_pcm_hw_open: alsalib error: open '/dev/snd/pcmC0D1p' 
failed (-2): No such file or directory
0:00:01.110231370   136 0x10070340 WARN                    alsa 
gstalsasink.c:846:gst_alsasink_open:<alsasink0> Error -2 (No such file 
or directory) calling snd_pcm_open (&alsa->handle, alsa->device, 
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)
0:00:01.115911458   136 0x10070340 WARN                    alsa 
gstalsasink.c:863:gst_alsasink_open:<alsasink0> error: Could not open 
audio device for playback.
0:00:01.120933494   136 0x10070340 WARN                    alsa 
gstalsasink.c:863:gst_alsasink_open:<alsasink0> error: Playback open 
error on device 'hw:0,1': No such file or directory
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstAlsaSink:alsasink0: Could 
not open audio device for playback.
Additional debug info:
gstalsasink.c(863): gst_alsasink_open (): 
/GstPipeline:pipeline0/GstAlsaSink:alsasink0:
Playback open error on device 'hw:0,1': No such file or directory
Setting pipeline to NULL ...
Freeing pipeline ...


which is wrong because it tries to open pcmC0D1 instead of comprC0D1

    # ls /dev/snd/
    comprC0D1  controlC0  pcmC0D0p   timer

Maybe I specified the wrong name. In tinycompress they open the 
compressed device using open()[2]. I'm not familiar with alsalib and how 
it should handle this.

[1] http://git.alsa-project.org/?p=tinycompress.git;a=summary
[2] 
http://git.alsa-project.org/?p=tinycompress.git;a=blob;f=compress.c;h=15dfdb74137ed0d1c7d65d8318391ac75ae79ee4;hb=HEAD#l240



More information about the gstreamer-devel mailing list