[alsa-devel] data write in alsa
perex at perex.cz
Fri Dec 2 08:16:21 CET 2011
Date 2.12.2011 08:12, Takashi Iwai wrote:
> At Fri, 02 Dec 2011 12:24:41 +0530,
> Vinod Koul wrote:
>> Hi Takashi,
>> For alsa pcm we have two ways to write data, either we use write()
>> system call or use ioctl SNDRV_PCM_IOCTL_WRITEI_FRAMES.
>> Is there any specific reason why we have two methods and which one is
>> preferred and why?
> Well, I only remember vaguely. IIRC, ioctl is used since it can pass
> the error code more directly without using errno. Maybe Jaroslav
> knows more exact reason.
The true reason was to avoid the audio frame <-> byte conversions.
> But, honestly speaking, I don't like this implementation. For a new
> interface, I'd suggest to stick with the normal read/write. Otherwise
> you'll get a mess of 32bit compat layer again.
I think that for compressed data, the standard r/w ops are fine, because
there are no "frames".
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
More information about the Alsa-devel