On 18. 10. 24 16:16, Amadeusz Sławiński wrote:
Our use case is to:
Inlined my proposal:
1. Program DSP with all pipelines it needs to implement whole scenario
(hw_params)
SNDRV_PCM_IOCTL_HW_PARAMS
2. Perform additional configuration from usespace
Can be done using control API (/dev/snd/controlC*). E.g. We have already:
numid=19,iface=PCM,name='ELD',device=3
numid=32,iface=PCM,name='Playback Channel Map',device=3
Those controls can be R/W as you like.
3. Start detection pipelines
SNDRV_PCM_IOCTL_PREPARE
4. Wait for event to happen (it can take however long necessary, for
example hours)
Can be done using control API (/dev/snd/controlC*). There is a mechanism for
event handling already.
Something like (boolean type):
iface=PCM,device=2,name="Event X" # first event type
iface=PCM,device=2,name="Event Y" # second event type ...
The PCM stream may be active only when at least one event from the above set
is active.
5. When event happens start drain pipelines and process data in
userspace likes in standard capture scenario
SNDRV_PCM_IOCTL_START
The driver may set the correct timestamp when the capturing was started. The
sample buffers are already allocated and ready for transfers, so we can assume
that the time window between the event notification (event) and START ioctl is
small, so no samples should be lost.
6. When no more data is needed, either stop drain pipelines and go back
to 3 or just close stream
SNDRV_PCM_IOCTL_STOP / DRAIN, SNDRV_PCM_IOCTL_HW_PARAMS or close(fd)
Basically, I think that this extension can be implemented with minimal changes
to the PCM API - it's just about to slightly extend existing APIs.
Jaroslav
--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]