mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-16 08:56:42 -05:00
Added name support
This commit is contained in:
parent
5b3e5e6c74
commit
66df4a7e65
13 changed files with 77 additions and 47 deletions
|
|
@ -73,6 +73,8 @@ int snd_pcm_close(snd_pcm_t *pcm)
|
||||||
if ((err = pcm->ops->close(pcm->op_arg)) < 0)
|
if ((err = pcm->ops->close(pcm->op_arg)) < 0)
|
||||||
ret = err;
|
ret = err;
|
||||||
pcm->valid_setup = 0;
|
pcm->valid_setup = 0;
|
||||||
|
if (pcm->name)
|
||||||
|
free(pcm->name);
|
||||||
free(pcm);
|
free(pcm);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -552,7 +552,7 @@ struct snd_pcm_ops snd_pcm_adpcm_ops = {
|
||||||
munmap_data: snd_pcm_plugin_munmap_data,
|
munmap_data: snd_pcm_plugin_munmap_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_adpcm_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave)
|
int snd_pcm_adpcm_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave)
|
||||||
{
|
{
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
snd_pcm_adpcm_t *adpcm;
|
snd_pcm_adpcm_t *adpcm;
|
||||||
|
|
@ -577,6 +577,8 @@ int snd_pcm_adpcm_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int c
|
||||||
free(adpcm);
|
free(adpcm);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_ADPCM;
|
handle->type = SND_PCM_TYPE_ADPCM;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_adpcm_ops;
|
handle->ops = &snd_pcm_adpcm_ops;
|
||||||
|
|
@ -643,7 +645,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_adpcm_open(pcmp, sformat, spcm, 1);
|
err = snd_pcm_adpcm_open(pcmp, name, sformat, spcm, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_pcm_close(spcm);
|
snd_pcm_close(spcm);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -420,7 +420,7 @@ struct snd_pcm_ops snd_pcm_alaw_ops = {
|
||||||
munmap_data: snd_pcm_plugin_munmap_data,
|
munmap_data: snd_pcm_plugin_munmap_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_alaw_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave)
|
int snd_pcm_alaw_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave)
|
||||||
{
|
{
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
snd_pcm_alaw_t *alaw;
|
snd_pcm_alaw_t *alaw;
|
||||||
|
|
@ -444,6 +444,8 @@ int snd_pcm_alaw_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int cl
|
||||||
free(alaw);
|
free(alaw);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_ALAW;
|
handle->type = SND_PCM_TYPE_ALAW;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_alaw_ops;
|
handle->ops = &snd_pcm_alaw_ops;
|
||||||
|
|
@ -510,7 +512,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_alaw_open(pcmp, sformat, spcm, 1);
|
err = snd_pcm_alaw_open(pcmp, name, sformat, spcm, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_pcm_close(spcm);
|
snd_pcm_close(spcm);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ struct snd_pcm_fast_ops snd_pcm_file_fast_ops = {
|
||||||
mmap_forward: snd_pcm_file_mmap_forward,
|
mmap_forward: snd_pcm_file_mmap_forward,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_file_open(snd_pcm_t **handlep, char *fname, int fd, snd_pcm_t *slave, int close_slave)
|
int snd_pcm_file_open(snd_pcm_t **handlep, char *name, char *fname, int fd, snd_pcm_t *slave, int close_slave)
|
||||||
{
|
{
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
snd_pcm_file_t *file;
|
snd_pcm_file_t *file;
|
||||||
|
|
@ -395,6 +395,8 @@ int snd_pcm_file_open(snd_pcm_t **handlep, char *fname, int fd, snd_pcm_t *slave
|
||||||
free(file);
|
free(file);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_FILE;
|
handle->type = SND_PCM_TYPE_FILE;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_file_ops;
|
handle->ops = &snd_pcm_file_ops;
|
||||||
|
|
@ -463,7 +465,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_file_open(pcmp, fname, fd, spcm, 1);
|
err = snd_pcm_file_open(pcmp, name, fname, fd, spcm, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_pcm_close(spcm);
|
snd_pcm_close(spcm);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -576,6 +576,16 @@ int snd_pcm_hw_open_device(snd_pcm_t **handlep, int card, int device, int stream
|
||||||
return snd_pcm_hw_open_subdevice(handlep, card, device, -1, stream, mode);
|
return snd_pcm_hw_open_subdevice(handlep, card, device, -1, stream, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int snd_pcm_hw_open(snd_pcm_t **handlep, char *name, int card, int device, int subdevice, int stream, int mode)
|
||||||
|
{
|
||||||
|
int err = snd_pcm_hw_open_subdevice(handlep, card, device, subdevice, stream, mode);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
if (name)
|
||||||
|
(*handlep)->name = strdup(name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int _snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
int _snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
||||||
int stream, int mode)
|
int stream, int mode)
|
||||||
{
|
{
|
||||||
|
|
@ -619,6 +629,6 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
||||||
}
|
}
|
||||||
if (card < 0)
|
if (card < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return snd_pcm_hw_open_subdevice(pcmp, card, device, subdevice, stream, mode);
|
return snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ struct snd_pcm_ops snd_pcm_linear_ops = {
|
||||||
munmap_data: snd_pcm_plugin_munmap_data,
|
munmap_data: snd_pcm_plugin_munmap_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_linear_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave)
|
int snd_pcm_linear_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave)
|
||||||
{
|
{
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
snd_pcm_linear_t *linear;
|
snd_pcm_linear_t *linear;
|
||||||
|
|
@ -286,6 +286,8 @@ int snd_pcm_linear_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int
|
||||||
free(linear);
|
free(linear);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_LINEAR;
|
handle->type = SND_PCM_TYPE_LINEAR;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_linear_ops;
|
handle->ops = &snd_pcm_linear_ops;
|
||||||
|
|
@ -351,7 +353,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_linear_open(pcmp, sformat, spcm, 1);
|
err = snd_pcm_linear_open(pcmp, name, sformat, spcm, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_pcm_close(spcm);
|
snd_pcm_close(spcm);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ struct snd_pcm_fast_ops {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct snd_pcm {
|
struct snd_pcm {
|
||||||
|
char *name;
|
||||||
snd_pcm_type_t type;
|
snd_pcm_type_t type;
|
||||||
int stream;
|
int stream;
|
||||||
int mode;
|
int mode;
|
||||||
|
|
@ -143,7 +144,6 @@ static inline size_t snd_pcm_mmap_avail(snd_pcm_t *pcm)
|
||||||
return snd_pcm_mmap_playback_avail(pcm);
|
return snd_pcm_mmap_playback_avail(pcm);
|
||||||
else
|
else
|
||||||
return snd_pcm_mmap_capture_avail(pcm);
|
return snd_pcm_mmap_capture_avail(pcm);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ssize_t snd_pcm_mmap_playback_hw_avail(snd_pcm_t *pcm)
|
static inline ssize_t snd_pcm_mmap_playback_hw_avail(snd_pcm_t *pcm)
|
||||||
|
|
@ -170,7 +170,6 @@ static inline ssize_t snd_pcm_mmap_hw_avail(snd_pcm_t *pcm)
|
||||||
return snd_pcm_mmap_playback_hw_avail(pcm);
|
return snd_pcm_mmap_playback_hw_avail(pcm);
|
||||||
else
|
else
|
||||||
return snd_pcm_mmap_capture_hw_avail(pcm);
|
return snd_pcm_mmap_capture_hw_avail(pcm);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define snd_pcm_mmap_playback_delay snd_pcm_mmap_playback_hw_avail
|
#define snd_pcm_mmap_playback_delay snd_pcm_mmap_playback_hw_avail
|
||||||
|
|
@ -182,7 +181,6 @@ static inline ssize_t snd_pcm_mmap_delay(snd_pcm_t *pcm)
|
||||||
return snd_pcm_mmap_playback_delay(pcm);
|
return snd_pcm_mmap_playback_delay(pcm);
|
||||||
else
|
else
|
||||||
return snd_pcm_mmap_capture_delay(pcm);
|
return snd_pcm_mmap_capture_delay(pcm);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *snd_pcm_channel_area_addr(snd_pcm_channel_area_t *area, size_t offset)
|
static inline void *snd_pcm_channel_area_addr(snd_pcm_channel_area_t *area, size_t offset)
|
||||||
|
|
|
||||||
|
|
@ -437,7 +437,7 @@ struct snd_pcm_ops snd_pcm_mulaw_ops = {
|
||||||
munmap_data: snd_pcm_plugin_munmap_data,
|
munmap_data: snd_pcm_plugin_munmap_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_mulaw_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave)
|
int snd_pcm_mulaw_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave)
|
||||||
{
|
{
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
snd_pcm_mulaw_t *mulaw;
|
snd_pcm_mulaw_t *mulaw;
|
||||||
|
|
@ -461,6 +461,8 @@ int snd_pcm_mulaw_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int c
|
||||||
free(mulaw);
|
free(mulaw);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_MULAW;
|
handle->type = SND_PCM_TYPE_MULAW;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_mulaw_ops;
|
handle->ops = &snd_pcm_mulaw_ops;
|
||||||
|
|
@ -527,7 +529,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_mulaw_open(pcmp, sformat, spcm, 1);
|
err = snd_pcm_mulaw_open(pcmp, name, sformat, spcm, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_pcm_close(spcm);
|
snd_pcm_close(spcm);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -49,17 +49,17 @@ typedef struct {
|
||||||
static int snd_pcm_multi_close(snd_pcm_t *pcm)
|
static int snd_pcm_multi_close(snd_pcm_t *pcm)
|
||||||
{
|
{
|
||||||
snd_pcm_multi_t *multi = pcm->private;
|
snd_pcm_multi_t *multi = pcm->private;
|
||||||
unsigned int i;
|
size_t i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
for (i = 0; i < multi->slaves_count; ++i) {
|
for (i = 0; i < multi->slaves_count; ++i) {
|
||||||
int err;
|
int err;
|
||||||
snd_pcm_multi_slave_t *slave = &multi->slaves[i];
|
snd_pcm_multi_slave_t *slave = &multi->slaves[i];
|
||||||
if (slave->close_slave) {
|
if (slave->close_slave)
|
||||||
err = snd_pcm_close(slave->pcm);
|
err = snd_pcm_close(slave->pcm);
|
||||||
|
else
|
||||||
|
err = snd_pcm_unlink(slave->pcm);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
ret = err;
|
ret = err;
|
||||||
} else
|
|
||||||
snd_pcm_unlink(slave->pcm);
|
|
||||||
}
|
}
|
||||||
free(multi->slaves);
|
free(multi->slaves);
|
||||||
free(multi->channels);
|
free(multi->channels);
|
||||||
|
|
@ -532,7 +532,8 @@ struct snd_pcm_fast_ops snd_pcm_multi_fast_ops = {
|
||||||
mmap_forward: snd_pcm_multi_mmap_forward,
|
mmap_forward: snd_pcm_multi_mmap_forward,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_multi_create(snd_pcm_t **handlep, size_t slaves_count,
|
int snd_pcm_multi_open(snd_pcm_t **handlep, char *name,
|
||||||
|
size_t slaves_count,
|
||||||
snd_pcm_t **slaves_handle, size_t *schannels_count,
|
snd_pcm_t **slaves_handle, size_t *schannels_count,
|
||||||
size_t channels_count,
|
size_t channels_count,
|
||||||
int *sidxs, unsigned int *schannels,
|
int *sidxs, unsigned int *schannels,
|
||||||
|
|
@ -587,6 +588,8 @@ int snd_pcm_multi_create(snd_pcm_t **handlep, size_t slaves_count,
|
||||||
free(multi);
|
free(multi);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_MULTI;
|
handle->type = SND_PCM_TYPE_MULTI;
|
||||||
handle->stream = stream;
|
handle->stream = stream;
|
||||||
handle->mode = multi->slaves[0].pcm->mode;
|
handle->mode = multi->slaves[0].pcm->mode;
|
||||||
|
|
@ -761,7 +764,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto _free;
|
goto _free;
|
||||||
}
|
}
|
||||||
err = snd_pcm_multi_create(pcmp, slaves_count, slaves_pcm,
|
err = snd_pcm_multi_open(pcmp, name, slaves_count, slaves_pcm,
|
||||||
slaves_channels,
|
slaves_channels,
|
||||||
channels_count,
|
channels_count,
|
||||||
channels_sidx, channels_schannel,
|
channels_sidx, channels_schannel,
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ static int snd_pcm_plug_change_rate(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_for
|
||||||
assert(snd_pcm_format_linear(slv->sfmt));
|
assert(snd_pcm_format_linear(slv->sfmt));
|
||||||
if (clt->rate == slv->rate)
|
if (clt->rate == slv->rate)
|
||||||
return 0;
|
return 0;
|
||||||
err = snd_pcm_rate_open(new, slv->sfmt, slv->rate, plug->slave, plug->slave != plug->req_slave);
|
err = snd_pcm_rate_open(new, NULL, slv->sfmt, slv->rate, plug->slave, plug->slave != plug->req_slave);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
slv->rate = clt->rate;
|
slv->rate = clt->rate;
|
||||||
|
|
@ -378,7 +378,7 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
|
||||||
s = 0;
|
s = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = snd_pcm_route_open(new, slv->sfmt, slv->channels, ttable, tt_ssize, tt_cused, tt_sused, plug->slave, plug->slave != plug->req_slave);
|
err = snd_pcm_route_open(new, NULL, slv->sfmt, slv->channels, ttable, tt_ssize, tt_cused, tt_sused, plug->slave, plug->slave != plug->req_slave);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
slv->channels = clt->channels;
|
slv->channels = clt->channels;
|
||||||
|
|
@ -391,7 +391,7 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_f
|
||||||
{
|
{
|
||||||
snd_pcm_plug_t *plug = pcm->private;
|
snd_pcm_plug_t *plug = pcm->private;
|
||||||
int err, cfmt;
|
int err, cfmt;
|
||||||
int (*f)(snd_pcm_t **handle, int sformat, snd_pcm_t *slave, int close_slave);
|
int (*f)(snd_pcm_t **handle, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
||||||
if (snd_pcm_format_linear(slv->sfmt)) {
|
if (snd_pcm_format_linear(slv->sfmt)) {
|
||||||
/* Conversion is done in another plugin */
|
/* Conversion is done in another plugin */
|
||||||
if (clt->sfmt == slv->sfmt ||
|
if (clt->sfmt == slv->sfmt ||
|
||||||
|
|
@ -442,7 +442,7 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_f
|
||||||
else
|
else
|
||||||
cfmt = SND_PCM_SFMT_S16;
|
cfmt = SND_PCM_SFMT_S16;
|
||||||
}
|
}
|
||||||
err = f(new, slv->sfmt, plug->slave, plug->slave != plug->req_slave);
|
err = f(new, NULL, slv->sfmt, plug->slave, plug->slave != plug->req_slave);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
slv->sfmt = cfmt;
|
slv->sfmt = cfmt;
|
||||||
|
|
@ -667,6 +667,7 @@ struct snd_pcm_ops snd_pcm_plug_ops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_plug_open(snd_pcm_t **handlep,
|
int snd_pcm_plug_open(snd_pcm_t **handlep,
|
||||||
|
char *name,
|
||||||
ttable_entry_t *ttable,
|
ttable_entry_t *ttable,
|
||||||
unsigned int tt_ssize,
|
unsigned int tt_ssize,
|
||||||
unsigned int tt_cused, unsigned int tt_sused,
|
unsigned int tt_cused, unsigned int tt_sused,
|
||||||
|
|
@ -691,6 +692,8 @@ int snd_pcm_plug_open(snd_pcm_t **handlep,
|
||||||
free(plug);
|
free(plug);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_PLUG;
|
handle->type = SND_PCM_TYPE_PLUG;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_plug_ops;
|
handle->ops = &snd_pcm_plug_ops;
|
||||||
|
|
@ -716,10 +719,10 @@ int snd_pcm_plug_open_subdevice(snd_pcm_t **handlep, int card, int device, int s
|
||||||
err = snd_pcm_hw_open_subdevice(&slave, card, device, subdevice, stream, mode);
|
err = snd_pcm_hw_open_subdevice(&slave, card, device, subdevice, stream, mode);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
return snd_pcm_plug_open(handlep, 0, 0, 0, 0, slave, 1);
|
return snd_pcm_plug_open(handlep, NULL, 0, 0, 0, 0, slave, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int snd_pcm_plug_open_card(snd_pcm_t **handlep, int card, int device, int stream, int mode)
|
int snd_pcm_plug_open_device(snd_pcm_t **handlep, int card, int device, int stream, int mode)
|
||||||
{
|
{
|
||||||
return snd_pcm_plug_open_subdevice(handlep, card, device, -1, stream, mode);
|
return snd_pcm_plug_open_subdevice(handlep, card, device, -1, stream, mode);
|
||||||
}
|
}
|
||||||
|
|
@ -777,7 +780,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_plug_open(pcmp, ttable, MAX_CHANNELS, cused, sused, spcm, 1);
|
err = snd_pcm_plug_open(pcmp, name, ttable, MAX_CHANNELS, cused, sused, spcm, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_pcm_close(spcm);
|
snd_pcm_close(spcm);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -87,19 +87,19 @@ typedef int ttable_entry_t;
|
||||||
#define FULL ROUTE_PLUGIN_RESOLUTION
|
#define FULL ROUTE_PLUGIN_RESOLUTION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int snd_pcm_linear_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave);
|
int snd_pcm_linear_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
||||||
int snd_pcm_mulaw_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave);
|
int snd_pcm_mulaw_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
||||||
int snd_pcm_alaw_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave);
|
int snd_pcm_alaw_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
||||||
int snd_pcm_adpcm_open(snd_pcm_t **handlep, int sformat, snd_pcm_t *slave, int close_slave);
|
int snd_pcm_adpcm_open(snd_pcm_t **handlep, char *name, int sformat, snd_pcm_t *slave, int close_slave);
|
||||||
int snd_pcm_route_load_ttable(snd_config_t *tt, ttable_entry_t *ttable,
|
int snd_pcm_route_load_ttable(snd_config_t *tt, ttable_entry_t *ttable,
|
||||||
unsigned int tt_csize, unsigned int tt_ssize,
|
unsigned int tt_csize, unsigned int tt_ssize,
|
||||||
unsigned int *tt_cused, unsigned int *tt_sused,
|
unsigned int *tt_cused, unsigned int *tt_sused,
|
||||||
int schannels);
|
int schannels);
|
||||||
int snd_pcm_route_open(snd_pcm_t **handlep,
|
int snd_pcm_route_open(snd_pcm_t **handlep, char *name,
|
||||||
int sformat, unsigned int schannels,
|
int sformat, unsigned int schannels,
|
||||||
ttable_entry_t *ttable,
|
ttable_entry_t *ttable,
|
||||||
unsigned int tt_ssize,
|
unsigned int tt_ssize,
|
||||||
unsigned int tt_cused, unsigned int tt_sused,
|
unsigned int tt_cused, unsigned int tt_sused,
|
||||||
snd_pcm_t *slave, int close_slave);
|
snd_pcm_t *slave, int close_slave);
|
||||||
int snd_pcm_rate_open(snd_pcm_t **handlep, int sformat, int srate, snd_pcm_t *slave, int close_slave);
|
int snd_pcm_rate_open(snd_pcm_t **handlep, char *name, int sformat, int srate, snd_pcm_t *slave, int close_slave);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -584,7 +584,7 @@ struct snd_pcm_ops snd_pcm_rate_ops = {
|
||||||
munmap_data: snd_pcm_plugin_munmap_data,
|
munmap_data: snd_pcm_plugin_munmap_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_pcm_rate_open(snd_pcm_t **handlep, int sformat, int srate, snd_pcm_t *slave, int close_slave)
|
int snd_pcm_rate_open(snd_pcm_t **handlep, char *name, int sformat, int srate, snd_pcm_t *slave, int close_slave)
|
||||||
{
|
{
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
snd_pcm_rate_t *rate;
|
snd_pcm_rate_t *rate;
|
||||||
|
|
@ -610,6 +610,8 @@ int snd_pcm_rate_open(snd_pcm_t **handlep, int sformat, int srate, snd_pcm_t *sl
|
||||||
free(rate);
|
free(rate);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_RATE;
|
handle->type = SND_PCM_TYPE_RATE;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_rate_ops;
|
handle->ops = &snd_pcm_rate_ops;
|
||||||
|
|
@ -682,7 +684,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_rate_open(pcmp, sformat, srate, spcm, 1);
|
err = snd_pcm_rate_open(pcmp, name, sformat, srate, spcm, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_pcm_close(spcm);
|
snd_pcm_close(spcm);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -775,7 +775,7 @@ int route_load_ttable(route_params_t *params, int stream,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int snd_pcm_route_open(snd_pcm_t **handlep,
|
int snd_pcm_route_open(snd_pcm_t **handlep, char *name,
|
||||||
int sformat, unsigned int schannels,
|
int sformat, unsigned int schannels,
|
||||||
ttable_entry_t *ttable,
|
ttable_entry_t *ttable,
|
||||||
unsigned int tt_ssize,
|
unsigned int tt_ssize,
|
||||||
|
|
@ -804,6 +804,8 @@ int snd_pcm_route_open(snd_pcm_t **handlep,
|
||||||
free(route);
|
free(route);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
if (name)
|
||||||
|
handle->name = strdup(name);
|
||||||
handle->type = SND_PCM_TYPE_ROUTE;
|
handle->type = SND_PCM_TYPE_ROUTE;
|
||||||
handle->stream = slave->stream;
|
handle->stream = slave->stream;
|
||||||
handle->ops = &snd_pcm_route_ops;
|
handle->ops = &snd_pcm_route_ops;
|
||||||
|
|
@ -952,7 +954,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
||||||
free(sname);
|
free(sname);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
err = snd_pcm_route_open(pcmp, sformat, schannels,
|
err = snd_pcm_route_open(pcmp, name, sformat, schannels,
|
||||||
ttable, MAX_CHANNELS,
|
ttable, MAX_CHANNELS,
|
||||||
cused, sused,
|
cused, sused,
|
||||||
spcm, 1);
|
spcm, 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue