[alsa-devel] data write in alsa
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?
This question is basically for compress API, should we add similar write method thru ioctls, if so why?
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.
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.
Takashi
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
On Fri, 2011-12-02 at 08:16 +0100, Jaroslav Kysela wrote:
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".
Thanks, I had the same assumptions as well, wanted to check before posting next version
participants (3)
-
Jaroslav Kysela
-
Takashi Iwai
-
Vinod Koul