mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-08 13:30:03 -05:00
pcm: dshare: allow missing bindings
allow opening the device and start the audio clock without blocking any channel this is required if the audio clock has to be available all the time, even when application is not streaming audio data Signed-off-by: Andreas Pape <apape@de.adit-jv.com> Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3bf780dcc3
commit
845243bcc2
1 changed files with 18 additions and 12 deletions
|
|
@ -508,7 +508,8 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm)
|
|||
|
||||
if (dshare->timer)
|
||||
snd_timer_close(dshare->timer);
|
||||
do_silence(pcm);
|
||||
if (dshare->bindings)
|
||||
do_silence(pcm);
|
||||
snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;
|
||||
snd_pcm_close(dshare->spcm);
|
||||
|
|
@ -621,6 +622,12 @@ static void snd_pcm_dshare_dump(snd_pcm_t *pcm, snd_output_t *out)
|
|||
snd_pcm_dump(dshare->spcm, out);
|
||||
}
|
||||
|
||||
static const snd_pcm_ops_t snd_pcm_dshare_dummy_ops = {
|
||||
.close = snd_pcm_dshare_close,
|
||||
};
|
||||
|
||||
static const snd_pcm_fast_ops_t snd_pcm_dshare_fast_dummy_ops;
|
||||
|
||||
static const snd_pcm_ops_t snd_pcm_dshare_ops = {
|
||||
.close = snd_pcm_dshare_close,
|
||||
.info = snd_pcm_direct_info,
|
||||
|
|
@ -713,12 +720,6 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (ret < 0)
|
||||
goto _err_nosem;
|
||||
|
||||
if (!dshare->bindings) {
|
||||
SNDERR("dshare: specify bindings!!!");
|
||||
ret = -EINVAL;
|
||||
goto _err_nosem;
|
||||
}
|
||||
|
||||
dshare->ipc_key = opts->ipc_key;
|
||||
dshare->ipc_perm = opts->ipc_perm;
|
||||
dshare->ipc_gid = opts->ipc_gid;
|
||||
|
|
@ -752,8 +753,13 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
goto _err;
|
||||
}
|
||||
|
||||
pcm->ops = &snd_pcm_dshare_ops;
|
||||
pcm->fast_ops = &snd_pcm_dshare_fast_ops;
|
||||
if (!dshare->bindings) {
|
||||
pcm->ops = &snd_pcm_dshare_dummy_ops;
|
||||
pcm->fast_ops = &snd_pcm_dshare_fast_dummy_ops;
|
||||
} else {
|
||||
pcm->ops = &snd_pcm_dshare_ops;
|
||||
pcm->fast_ops = &snd_pcm_dshare_fast_ops;
|
||||
}
|
||||
pcm->private_data = dshare;
|
||||
dshare->state = SND_PCM_STATE_OPEN;
|
||||
dshare->slowptr = opts->slowptr;
|
||||
|
|
@ -843,7 +849,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
dshare->spcm = spcm;
|
||||
}
|
||||
|
||||
for (chn = 0; chn < dshare->channels; chn++) {
|
||||
for (chn = 0; dshare->bindings && (chn < dshare->channels); chn++) {
|
||||
unsigned int dchn = dshare->bindings ? dshare->bindings[chn] : chn;
|
||||
if (dchn != UINT_MAX)
|
||||
dshare->u.dshare.chn_mask |= (1ULL << dchn);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue