[Ffmpeg-devel] alsa input / output

Vladimir Mosgalin mosgalin
Sat Mar 24 11:22:29 CET 2007


Hi Luca Barbato!

 On 2007.03.24 at 09:57:15 +0100, Luca Barbato wrote next:

> > True. But 1) there is no sound server as advanced as alsa and
> 
> pulse-audio, jack...

jack provides low-latency sound output and can do simple multi-channel
routing, but can't do sample rate conversion, advanced routing (well you
can use some external jack client that changes your stream, but this
is way to complicated for this task), AC3 conversion and other stuff.
And that's good - when I use jack, I want things to be as simple and as
pure as possible.

As about pulse-audio - it still doesn't provide all these features, and
after spending a few hours, I never managed to get it working in my
configuration (outputting sound to jack). Though probably
(application->pulse->jack->alsa) should work nicer than
(application->alsa->jack->alsa) due to the way jack works, with rate
conversion and most other stuff done by pulseaudio instead of alsa, the
problem is that most application don't support pulse-audio - even though
it's clearly the nicest all-around sound server, it's not supported even
by mplayer, which has nearly all sound drivers in existence..

> > 2) sound server means library interface. Since most users need
> > some of these features, it means that end-user applications should
> > always use library interfaces and never devices (otherwise they are
> > broken and don't fit into the system).
> 
> I can use xlib, xcb, or directly write on the frame buffer, having the
> same options for audio looks sane...

Sure, good analogy - that's exactly what you get with alsa. You can use
alsa-lib directly, you can use it though wrapper library like openal
which can do some advanced processing (possibly even
hardware-accelerated), and on the other hand you can access raw device,
which is like using DGA in X11. But then you'll probably have to support
some strange output format, and just like you lose hardware acceleration
and interfere with all other user application when you are using DGA,
you'll mess up user's desktop. DGA has some uses, but everyone hates
DGA-using application on desktop, because it renders using all other
applications impossible. And, just like alsa raw devices being
impossible to access when you have sound server running (and using them
will do no good when you have some complex .asoundrc setup which must be
used), DGA is unavaliable when you have some kind virtual X server or
server running on top of something else, so applications can't rely on
both kinds of raw access.

PS note that all sound servers, even pulse and jack don't use alsa raw
devices, they use alsa-lib and access only regular hw/plughw/etc user
configured device.

-- 

Vladimir




More information about the ffmpeg-devel mailing list