mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-11 13:30:05 -05:00
Completed mixer API. Improved iterators. Renamed control values struct. Rewritten simple elements implementation
This commit is contained in:
parent
38033b49dd
commit
a2d3434961
54 changed files with 2081 additions and 1712 deletions
|
|
@ -32,6 +32,12 @@
|
|||
#include "pcm_local.h"
|
||||
#include "list.h"
|
||||
|
||||
const char *snd_pcm_name(snd_pcm_t *pcm)
|
||||
{
|
||||
assert(pcm);
|
||||
return pcm->name;
|
||||
}
|
||||
|
||||
snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm)
|
||||
{
|
||||
assert(pcm);
|
||||
|
|
@ -541,7 +547,7 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
const char *str;
|
||||
int err;
|
||||
snd_config_t *pcm_conf, *conf, *type_conf;
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *lib = NULL, *open = NULL;
|
||||
int (*open_func)(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
|
@ -569,25 +575,25 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
return snd_pcm_plug_open_hw(pcmp, name, card, dev, -1, stream, mode);
|
||||
err = sscanf(name, "shm:%256[^,],%256[^,]", socket, sname);
|
||||
if (err == 2)
|
||||
return snd_pcm_shm_open(pcmp, NULL, socket, sname, stream, mode);
|
||||
return snd_pcm_shm_open(pcmp, name, socket, sname, stream, mode);
|
||||
err = sscanf(name, "file:%256[^,],%16[^,]", file, format);
|
||||
if (err == 2) {
|
||||
snd_pcm_t *slave;
|
||||
err = snd_pcm_null_open(&slave, NULL, stream, mode);
|
||||
err = snd_pcm_null_open(&slave, name, stream, mode);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return snd_pcm_file_open(pcmp, NULL, file, -1, format, slave, 1);
|
||||
return snd_pcm_file_open(pcmp, name, file, -1, format, slave, 1);
|
||||
}
|
||||
err = sscanf(name, "file:%256[^,]", file);
|
||||
if (err == 1) {
|
||||
snd_pcm_t *slave;
|
||||
err = snd_pcm_null_open(&slave, NULL, stream, mode);
|
||||
err = snd_pcm_null_open(&slave, name, stream, mode);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return snd_pcm_file_open(pcmp, NULL, file, -1, "raw", slave, 1);
|
||||
return snd_pcm_file_open(pcmp, name, file, -1, "raw", slave, 1);
|
||||
}
|
||||
if (strcmp(name, "null") == 0)
|
||||
return snd_pcm_null_open(pcmp, NULL, stream, mode);
|
||||
return snd_pcm_null_open(pcmp, name, stream, mode);
|
||||
ERR("Unknown PCM %s", name);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
|
@ -610,7 +616,7 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
ERR("Unknown PCM type %s", str);
|
||||
return err;
|
||||
}
|
||||
snd_config_foreach(i, type_conf) {
|
||||
snd_config_for_each(i, next, type_conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
@ -830,7 +836,8 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t
|
|||
unsigned int samples, snd_pcm_format_t format)
|
||||
{
|
||||
/* FIXME: sub byte resolution and odd dst_offset */
|
||||
char *src, *dst;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int width;
|
||||
int src_step, dst_step;
|
||||
if (!src_area->addr)
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
|
|||
void *put = put16_labels[putidx];
|
||||
unsigned int channel;
|
||||
for (channel = 0; channel < channels; ++channel, ++states) {
|
||||
char *src;
|
||||
const char *src;
|
||||
int srcbit;
|
||||
char *dst;
|
||||
int src_step, srcbit_step, dst_step;
|
||||
|
|
@ -265,7 +265,7 @@ void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
|
|||
unsigned int channel;
|
||||
int16_t sample = 0;
|
||||
for (channel = 0; channel < channels; ++channel, ++states) {
|
||||
char *src;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int dstbit;
|
||||
int src_step, dst_step, dstbit_step;
|
||||
|
|
@ -314,7 +314,7 @@ void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
|
|||
|
||||
static int snd_pcm_adpcm_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
int err;
|
||||
snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_PLUGIN };
|
||||
err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -341,7 +341,7 @@ static int snd_pcm_adpcm_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
|
|||
|
||||
static int snd_pcm_adpcm_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -399,7 +399,7 @@ static int snd_pcm_adpcm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
int err = snd_pcm_hw_params_slave(pcm, params,
|
||||
snd_pcm_adpcm_hw_refine_cchange,
|
||||
snd_pcm_adpcm_hw_refine_sprepare,
|
||||
|
|
@ -433,7 +433,7 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
|
||||
static int snd_pcm_adpcm_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
if (adpcm->states) {
|
||||
free(adpcm->states);
|
||||
adpcm->states = 0;
|
||||
|
|
@ -443,7 +443,7 @@ static int snd_pcm_adpcm_hw_free(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_adpcm_init(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
unsigned int k;
|
||||
for (k = 0; k < pcm->channels; ++k) {
|
||||
adpcm->states[k].pred_val = 0;
|
||||
|
|
@ -458,7 +458,7 @@ static snd_pcm_sframes_t snd_pcm_adpcm_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
snd_pcm_t *slave = adpcm->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -493,7 +493,7 @@ static snd_pcm_sframes_t snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
snd_pcm_t *slave = adpcm->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -524,7 +524,7 @@ static snd_pcm_sframes_t snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
|
|||
|
||||
static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private;
|
||||
snd_pcm_adpcm_t *adpcm = pcm->private_data;
|
||||
snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(adpcm->sformat));
|
||||
if (pcm->setup) {
|
||||
|
|
@ -550,7 +550,7 @@ snd_pcm_ops_t snd_pcm_adpcm_ops = {
|
|||
munmap: snd_pcm_plugin_munmap,
|
||||
};
|
||||
|
||||
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_adpcm_t *adpcm;
|
||||
|
|
@ -583,7 +583,7 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, s
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_plugin_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = adpcm;
|
||||
pcm->private_data = adpcm;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = &adpcm->plug.hw_ptr;
|
||||
pcm->appl_ptr = &adpcm->plug.appl_ptr;
|
||||
|
|
@ -592,16 +592,16 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, s
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
|
|||
void *put = put16_labels[putidx];
|
||||
unsigned int channel;
|
||||
for (channel = 0; channel < channels; ++channel) {
|
||||
char *src;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
snd_pcm_uframes_t frames1;
|
||||
|
|
@ -178,7 +178,7 @@ void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
|
|||
unsigned int channel;
|
||||
int16_t sample = 0;
|
||||
for (channel = 0; channel < channels; ++channel) {
|
||||
char *src;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
snd_pcm_uframes_t frames1;
|
||||
|
|
@ -213,7 +213,7 @@ void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
|
|||
|
||||
static int snd_pcm_alaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_alaw_t *alaw = pcm->private;
|
||||
snd_pcm_alaw_t *alaw = pcm->private_data;
|
||||
int err;
|
||||
snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_PLUGIN };
|
||||
err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -239,7 +239,7 @@ static int snd_pcm_alaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *
|
|||
|
||||
static int snd_pcm_alaw_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_alaw_t *alaw = pcm->private;
|
||||
snd_pcm_alaw_t *alaw = pcm->private_data;
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -297,7 +297,7 @@ static int snd_pcm_alaw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_alaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
{
|
||||
snd_pcm_alaw_t *alaw = pcm->private;
|
||||
snd_pcm_alaw_t *alaw = pcm->private_data;
|
||||
int err = snd_pcm_hw_params_slave(pcm, params,
|
||||
snd_pcm_alaw_hw_refine_cchange,
|
||||
snd_pcm_alaw_hw_refine_sprepare,
|
||||
|
|
@ -332,7 +332,7 @@ static snd_pcm_sframes_t snd_pcm_alaw_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_alaw_t *alaw = pcm->private;
|
||||
snd_pcm_alaw_t *alaw = pcm->private_data;
|
||||
snd_pcm_t *slave = alaw->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -367,7 +367,7 @@ static snd_pcm_sframes_t snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_alaw_t *alaw = pcm->private;
|
||||
snd_pcm_alaw_t *alaw = pcm->private_data;
|
||||
snd_pcm_t *slave = alaw->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -398,7 +398,7 @@ static snd_pcm_sframes_t snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
|
|||
|
||||
static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_alaw_t *alaw = pcm->private;
|
||||
snd_pcm_alaw_t *alaw = pcm->private_data;
|
||||
snd_output_printf(out, "A-Law conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(alaw->sformat));
|
||||
if (pcm->setup) {
|
||||
|
|
@ -424,7 +424,7 @@ snd_pcm_ops_t snd_pcm_alaw_ops = {
|
|||
munmap: snd_pcm_plugin_munmap,
|
||||
};
|
||||
|
||||
int snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_alaw_t *alaw;
|
||||
|
|
@ -456,7 +456,7 @@ int snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, sn
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_plugin_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = alaw;
|
||||
pcm->private_data = alaw;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = &alaw->plug.hw_ptr;
|
||||
pcm->appl_ptr = &alaw->plug.appl_ptr;
|
||||
|
|
@ -465,16 +465,16 @@ int snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, sn
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ static snd_pcm_sframes_t snd_pcm_copy_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_copy_t *copy = pcm->private;
|
||||
snd_pcm_copy_t *copy = pcm->private_data;
|
||||
snd_pcm_t *slave = copy->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -131,7 +131,7 @@ static snd_pcm_sframes_t snd_pcm_copy_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_copy_t *copy = pcm->private;
|
||||
snd_pcm_copy_t *copy = pcm->private_data;
|
||||
snd_pcm_t *slave = copy->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -161,7 +161,7 @@ static snd_pcm_sframes_t snd_pcm_copy_read_areas(snd_pcm_t *pcm,
|
|||
|
||||
static void snd_pcm_copy_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_copy_t *copy = pcm->private;
|
||||
snd_pcm_copy_t *copy = pcm->private_data;
|
||||
snd_output_printf(out, "Copy conversion PCM\n");
|
||||
if (pcm->setup) {
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
|
|
@ -186,7 +186,7 @@ snd_pcm_ops_t snd_pcm_copy_ops = {
|
|||
munmap: snd_pcm_plugin_munmap,
|
||||
};
|
||||
|
||||
int snd_pcm_copy_open(snd_pcm_t **pcmp, char *name, snd_pcm_t *slave, int close_slave)
|
||||
int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int close_slave)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_copy_t *copy;
|
||||
|
|
@ -214,7 +214,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, char *name, snd_pcm_t *slave, int close_
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_plugin_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = copy;
|
||||
pcm->private_data = copy;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = ©->plug.hw_ptr;
|
||||
pcm->appl_ptr = ©->plug.appl_ptr;
|
||||
|
|
@ -223,15 +223,15 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, char *name, snd_pcm_t *slave, int close_
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_copy_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ typedef struct {
|
|||
|
||||
static void snd_pcm_file_write_bytes(snd_pcm_t *pcm, size_t bytes)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
assert(bytes <= file->wbuf_used_bytes);
|
||||
while (bytes > 0) {
|
||||
snd_pcm_sframes_t err;
|
||||
|
|
@ -72,7 +72,7 @@ static void snd_pcm_file_add_frames(snd_pcm_t *pcm,
|
|||
const snd_pcm_channel_area_t *areas,
|
||||
snd_pcm_uframes_t offset, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
while (frames > 0) {
|
||||
snd_pcm_uframes_t n = frames;
|
||||
snd_pcm_uframes_t cont = file->wbuf_size - file->appl_ptr;
|
||||
|
|
@ -97,7 +97,7 @@ static void snd_pcm_file_add_frames(snd_pcm_t *pcm,
|
|||
|
||||
static int snd_pcm_file_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
int err = 0;
|
||||
if (file->close_slave)
|
||||
err = snd_pcm_close(file->slave);
|
||||
|
|
@ -111,55 +111,55 @@ static int snd_pcm_file_close(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_file_nonblock(snd_pcm_t *pcm, int nonblock)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_nonblock(file->slave, nonblock);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_async(file->slave, sig, pid);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_info(file->slave, info);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_channel_info(file->slave, info);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_status(file->slave, status);
|
||||
}
|
||||
|
||||
static snd_pcm_state_t snd_pcm_file_state(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_state(file->slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_delay(file->slave, delayp);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_prepare(file->slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
int err = snd_pcm_reset(file->slave);
|
||||
if (err >= 0) {
|
||||
/* FIXME: Questionable here */
|
||||
|
|
@ -171,13 +171,13 @@ static int snd_pcm_file_reset(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_file_start(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_start(file->slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
int err = snd_pcm_drop(file->slave);
|
||||
if (err >= 0) {
|
||||
/* FIXME: Questionable here */
|
||||
|
|
@ -189,7 +189,7 @@ static int snd_pcm_file_drop(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_file_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
int err = snd_pcm_drain(file->slave);
|
||||
if (err >= 0) {
|
||||
snd_pcm_file_write_bytes(pcm, file->wbuf_used_bytes);
|
||||
|
|
@ -200,13 +200,13 @@ static int snd_pcm_file_drain(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_file_pause(snd_pcm_t *pcm, int enable)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_pause(file->slave, enable);
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
snd_pcm_sframes_t err = snd_pcm_rewind(file->slave, frames);
|
||||
if (err > 0) {
|
||||
snd_pcm_uframes_t n = snd_pcm_frames_to_bytes(pcm, frames);
|
||||
|
|
@ -222,7 +222,7 @@ static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_file_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t n = snd_pcm_writei(file->slave, buffer, size);
|
||||
if (n > 0) {
|
||||
|
|
@ -234,7 +234,7 @@ static snd_pcm_sframes_t snd_pcm_file_writei(snd_pcm_t *pcm, const void *buffer,
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_file_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t n = snd_pcm_writen(file->slave, bufs, size);
|
||||
if (n > 0) {
|
||||
|
|
@ -246,7 +246,7 @@ static snd_pcm_sframes_t snd_pcm_file_writen(snd_pcm_t *pcm, void **bufs, snd_pc
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t n = snd_pcm_readi(file->slave, buffer, size);
|
||||
if (n > 0) {
|
||||
|
|
@ -258,7 +258,7 @@ static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pc
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t n = snd_pcm_writen(file->slave, bufs, size);
|
||||
if (n > 0) {
|
||||
|
|
@ -270,7 +270,7 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_file_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
snd_pcm_uframes_t ofs = snd_pcm_mmap_offset(pcm);
|
||||
snd_pcm_sframes_t n = snd_pcm_mmap_forward(file->slave, size);
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
|
|
@ -292,19 +292,19 @@ static snd_pcm_sframes_t snd_pcm_file_mmap_forward(snd_pcm_t *pcm, snd_pcm_ufram
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_file_avail_update(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_avail_update(file->slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_hw_refine(file->slave, params);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
unsigned int channel;
|
||||
snd_pcm_t *slave = file->slave;
|
||||
int err = _snd_pcm_hw_params(slave, params);
|
||||
|
|
@ -328,7 +328,7 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
|
||||
static int snd_pcm_file_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
if (file->wbuf) {
|
||||
free(file->wbuf);
|
||||
free(file->wbuf_areas);
|
||||
|
|
@ -340,7 +340,7 @@ static int snd_pcm_file_hw_free(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_file_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
return snd_pcm_sw_params(file->slave, params);
|
||||
}
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ static int snd_pcm_file_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
|
||||
static void snd_pcm_file_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
if (file->fname)
|
||||
snd_output_printf(out, "File PCM (file=%s)\n", file->fname);
|
||||
else
|
||||
|
|
@ -450,7 +450,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_file_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = file;
|
||||
pcm->private_data = file;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = slave->hw_ptr;
|
||||
pcm->appl_ptr = slave->appl_ptr;
|
||||
|
|
@ -459,18 +459,18 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_file_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
const char *fname = NULL;
|
||||
const char *format = NULL;
|
||||
long fd = -1;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ typedef struct {
|
|||
static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
|
||||
{
|
||||
long flags;
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFL)) < 0) {
|
||||
|
|
@ -76,7 +76,7 @@ static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
|
|||
static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||
{
|
||||
long flags;
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFL)) < 0) {
|
||||
|
|
@ -110,7 +110,7 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
|||
|
||||
static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, info) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_INFO failed");
|
||||
|
|
@ -121,7 +121,7 @@ static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
|||
|
||||
static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_HW_REFINE, params) < 0) {
|
||||
// SYSERR("SNDRV_PCM_IOCTL_HW_REFINE failed");
|
||||
|
|
@ -132,7 +132,7 @@ static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_HW_PARAMS, params) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_HW_PARAMS failed");
|
||||
|
|
@ -143,7 +143,7 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
|
||||
static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_HW_FREE failed");
|
||||
|
|
@ -154,7 +154,7 @@ static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if ((snd_pcm_start_t) params->start_mode == pcm->start_mode &&
|
||||
(snd_pcm_xrun_t) params->xrun_mode == pcm->xrun_mode &&
|
||||
|
|
@ -176,7 +176,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
|
||||
static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
struct sndrv_pcm_channel_info i;
|
||||
int fd = hw->fd;
|
||||
i.channel = info->channel;
|
||||
|
|
@ -199,7 +199,7 @@ static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info
|
|||
|
||||
static int snd_pcm_hw_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS, status) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_STATUS failed");
|
||||
|
|
@ -210,13 +210,13 @@ static int snd_pcm_hw_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
|
||||
static snd_pcm_state_t snd_pcm_hw_state(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
return (snd_pcm_state_t) hw->mmap_status->state;
|
||||
}
|
||||
|
||||
static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_DELAY failed");
|
||||
|
|
@ -227,7 +227,7 @@ static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
|
||||
static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_PREPARE) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_PREPARE failed");
|
||||
|
|
@ -238,7 +238,7 @@ static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_RESET) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_RESET failed");
|
||||
|
|
@ -249,7 +249,7 @@ static int snd_pcm_hw_reset(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_start(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
#if 0
|
||||
assert(pcm->stream != SND_PCM_STREAM_PLAYBACK ||
|
||||
|
|
@ -264,7 +264,7 @@ static int snd_pcm_hw_start(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_DROP) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_DROP failed");
|
||||
|
|
@ -275,7 +275,7 @@ static int snd_pcm_hw_drop(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_DRAIN) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_DRAIN failed");
|
||||
|
|
@ -286,7 +286,7 @@ static int snd_pcm_hw_drain(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_PAUSE, enable) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_PAUSE failed");
|
||||
|
|
@ -297,7 +297,7 @@ static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable)
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_REWIND, &frames) < 0) {
|
||||
SYSERR("SNDRV_PCM_IOCTL_REWIND failed");
|
||||
|
|
@ -309,7 +309,7 @@ static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fra
|
|||
static snd_pcm_sframes_t snd_pcm_hw_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_sframes_t result;
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
struct sndrv_xferi xferi;
|
||||
xferi.buf = (char*) buffer;
|
||||
|
|
@ -323,7 +323,7 @@ static snd_pcm_sframes_t snd_pcm_hw_writei(snd_pcm_t *pcm, const void *buffer, s
|
|||
static snd_pcm_sframes_t snd_pcm_hw_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_sframes_t result;
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
struct sndrv_xfern xfern;
|
||||
xfern.bufs = bufs;
|
||||
|
|
@ -337,7 +337,7 @@ static snd_pcm_sframes_t snd_pcm_hw_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_
|
|||
static snd_pcm_sframes_t snd_pcm_hw_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_sframes_t result;
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
struct sndrv_xferi xferi;
|
||||
xferi.buf = buffer;
|
||||
|
|
@ -351,7 +351,7 @@ static snd_pcm_sframes_t snd_pcm_hw_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_
|
|||
snd_pcm_sframes_t snd_pcm_hw_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_sframes_t result;
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int fd = hw->fd;
|
||||
struct sndrv_xfern xfern;
|
||||
xfern.bufs = bufs;
|
||||
|
|
@ -364,7 +364,7 @@ snd_pcm_sframes_t snd_pcm_hw_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_
|
|||
|
||||
static int snd_pcm_hw_mmap_status(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
void *ptr;
|
||||
ptr = mmap(NULL, PAGE_ALIGN(sizeof(struct sndrv_pcm_mmap_status)), PROT_READ, MAP_FILE|MAP_SHARED,
|
||||
hw->fd, SND_PCM_MMAP_OFFSET_STATUS);
|
||||
|
|
@ -379,7 +379,7 @@ static int snd_pcm_hw_mmap_status(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_mmap_control(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
void *ptr;
|
||||
ptr = mmap(NULL, PAGE_ALIGN(sizeof(struct sndrv_pcm_mmap_control)), PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED,
|
||||
hw->fd, SND_PCM_MMAP_OFFSET_CONTROL);
|
||||
|
|
@ -394,7 +394,7 @@ static int snd_pcm_hw_mmap_control(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_munmap_status(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
if (munmap((void*)hw->mmap_status, PAGE_ALIGN(sizeof(*hw->mmap_status))) < 0) {
|
||||
SYSERR("status munmap failed");
|
||||
return -errno;
|
||||
|
|
@ -404,7 +404,7 @@ static int snd_pcm_hw_munmap_status(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_munmap_control(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
if (munmap(hw->mmap_control, PAGE_ALIGN(sizeof(*hw->mmap_control))) < 0) {
|
||||
SYSERR("control munmap failed");
|
||||
return -errno;
|
||||
|
|
@ -414,7 +414,7 @@ static int snd_pcm_hw_munmap_control(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_mmap(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
if (!(pcm->info & SND_PCM_INFO_MMAP)) {
|
||||
snd_pcm_uframes_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size);
|
||||
int id = shmget(IPC_PRIVATE, size, 0666);
|
||||
|
|
@ -429,7 +429,7 @@ static int snd_pcm_hw_mmap(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_munmap(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
if (!(pcm->info & SND_PCM_INFO_MMAP)) {
|
||||
if (shmctl(hw->shmid, IPC_RMID, 0) < 0) {
|
||||
SYSERR("shmctl IPC_RMID failed");
|
||||
|
|
@ -441,7 +441,7 @@ static int snd_pcm_hw_munmap(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_hw_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
if (close(hw->fd)) {
|
||||
SYSERR("close failed\n");
|
||||
return -errno;
|
||||
|
|
@ -494,7 +494,7 @@ static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm)
|
|||
|
||||
static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
char *name = "Unknown";
|
||||
snd_card_get_name(hw->card, &name);
|
||||
snd_output_printf(out, "Hardware PCM card %d '%s' device %d subdevice %d\n",
|
||||
|
|
@ -632,7 +632,7 @@ int snd_pcm_hw_open_subdevice(snd_pcm_t **pcmp, int card, int device, int subdev
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_hw_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = hw;
|
||||
pcm->private_data = hw;
|
||||
pcm->poll_fd = fd;
|
||||
*pcmp = pcm;
|
||||
ret = snd_pcm_hw_mmap_status(pcm);
|
||||
|
|
@ -673,14 +673,14 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, int card, int device, in
|
|||
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, const char *name, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
long card = -1, device = 0, subdevice = -1;
|
||||
const char *str;
|
||||
int err;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_ufr
|
|||
void *conv = conv_labels[convidx];
|
||||
unsigned int channel;
|
||||
for (channel = 0; channel < channels; ++channel) {
|
||||
char *src;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
snd_pcm_uframes_t frames1;
|
||||
|
|
@ -152,7 +152,7 @@ static int snd_pcm_linear_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, sn
|
|||
|
||||
static int snd_pcm_linear_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_linear_t *linear = pcm->private;
|
||||
snd_pcm_linear_t *linear = pcm->private_data;
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -210,7 +210,7 @@ static int snd_pcm_linear_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_linear_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_linear_t *linear = pcm->private;
|
||||
snd_pcm_linear_t *linear = pcm->private_data;
|
||||
int err = snd_pcm_hw_params_slave(pcm, params,
|
||||
snd_pcm_linear_hw_refine_cchange,
|
||||
snd_pcm_linear_hw_refine_sprepare,
|
||||
|
|
@ -233,7 +233,7 @@ static snd_pcm_sframes_t snd_pcm_linear_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_linear_t *linear = pcm->private;
|
||||
snd_pcm_linear_t *linear = pcm->private_data;
|
||||
snd_pcm_t *slave = linear->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -267,7 +267,7 @@ static snd_pcm_sframes_t snd_pcm_linear_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_linear_t *linear = pcm->private;
|
||||
snd_pcm_linear_t *linear = pcm->private_data;
|
||||
snd_pcm_t *slave = linear->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -297,7 +297,7 @@ static snd_pcm_sframes_t snd_pcm_linear_read_areas(snd_pcm_t *pcm,
|
|||
|
||||
static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_linear_t *linear = pcm->private;
|
||||
snd_pcm_linear_t *linear = pcm->private_data;
|
||||
snd_output_printf(out, "Linear conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(linear->sformat));
|
||||
if (pcm->setup) {
|
||||
|
|
@ -323,7 +323,7 @@ snd_pcm_ops_t snd_pcm_linear_ops = {
|
|||
munmap: snd_pcm_plugin_munmap,
|
||||
};
|
||||
|
||||
int snd_pcm_linear_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_linear_t *linear;
|
||||
|
|
@ -354,7 +354,7 @@ int snd_pcm_linear_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat,
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_plugin_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = linear;
|
||||
pcm->private_data = linear;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = &linear->plug.hw_ptr;
|
||||
pcm->appl_ptr = &linear->plug.appl_ptr;
|
||||
|
|
@ -363,16 +363,16 @@ int snd_pcm_linear_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ struct _snd_pcm {
|
|||
snd_pcm_fast_ops_t *fast_ops;
|
||||
snd_pcm_t *op_arg;
|
||||
snd_pcm_t *fast_op_arg;
|
||||
void *private;
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
int snd_pcm_hw_open(snd_pcm_t **pcm, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ snd_pcm_sframes_t snd_pcm_write_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
|||
case SND_PCM_ACCESS_MMAP_INTERLEAVED:
|
||||
{
|
||||
const snd_pcm_channel_area_t *a = snd_pcm_mmap_areas(pcm);
|
||||
char *buf = snd_pcm_channel_area_addr(a, offset);
|
||||
const char *buf = snd_pcm_channel_area_addr(a, offset);
|
||||
err = _snd_pcm_writei(pcm, buf, size);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
|
|||
void *put = put16_labels[putidx];
|
||||
unsigned int channel;
|
||||
for (channel = 0; channel < channels; ++channel) {
|
||||
char *src;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
snd_pcm_uframes_t frames1;
|
||||
|
|
@ -195,7 +195,7 @@ void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
|
|||
unsigned int channel;
|
||||
int16_t sample = 0;
|
||||
for (channel = 0; channel < channels; ++channel) {
|
||||
char *src;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
snd_pcm_uframes_t frames1;
|
||||
|
|
@ -230,7 +230,7 @@ void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
|
|||
|
||||
static int snd_pcm_mulaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private;
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private_data;
|
||||
int err;
|
||||
snd_pcm_access_mask_t access_mask = { SND_PCM_ACCBIT_PLUGIN };
|
||||
err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -254,7 +254,7 @@ static int snd_pcm_mulaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
|
|||
|
||||
static int snd_pcm_mulaw_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private;
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private_data;
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -312,7 +312,7 @@ static int snd_pcm_mulaw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_mulaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
{
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private;
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private_data;
|
||||
int err = snd_pcm_hw_params_slave(pcm, params,
|
||||
snd_pcm_mulaw_hw_refine_cchange,
|
||||
snd_pcm_mulaw_hw_refine_sprepare,
|
||||
|
|
@ -347,7 +347,7 @@ static snd_pcm_sframes_t snd_pcm_mulaw_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private;
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private_data;
|
||||
snd_pcm_t *slave = mulaw->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -382,7 +382,7 @@ static snd_pcm_sframes_t snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private;
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private_data;
|
||||
snd_pcm_t *slave = mulaw->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -413,7 +413,7 @@ static snd_pcm_sframes_t snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
|
|||
|
||||
static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private;
|
||||
snd_pcm_mulaw_t *mulaw = pcm->private_data;
|
||||
snd_output_printf(out, "Mu-Law conversion PCM (%s)\n",
|
||||
snd_pcm_format_name(mulaw->sformat));
|
||||
if (pcm->setup) {
|
||||
|
|
@ -439,7 +439,7 @@ snd_pcm_ops_t snd_pcm_mulaw_ops = {
|
|||
munmap: snd_pcm_plugin_munmap,
|
||||
};
|
||||
|
||||
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_mulaw_t *mulaw;
|
||||
|
|
@ -471,7 +471,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, s
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_plugin_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = mulaw;
|
||||
pcm->private_data = mulaw;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = &mulaw->plug.hw_ptr;
|
||||
pcm->appl_ptr = &mulaw->plug.appl_ptr;
|
||||
|
|
@ -480,16 +480,16 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, s
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ typedef struct {
|
|||
|
||||
static int snd_pcm_multi_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int i;
|
||||
int ret = 0;
|
||||
for (i = 0; i < multi->slaves_count; ++i) {
|
||||
|
|
@ -72,14 +72,14 @@ static int snd_pcm_multi_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock
|
|||
|
||||
static int snd_pcm_multi_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave_0 = multi->slaves[0].pcm;
|
||||
return snd_pcm_async(slave_0, sig, pid);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
if (multi->slaves_count == 1)
|
||||
return snd_pcm_info(multi->slaves[0].pcm, info);
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
|
@ -94,7 +94,7 @@ static int snd_pcm_multi_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
|
|||
|
||||
static int snd_pcm_multi_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_access_mask_t access_mask;
|
||||
int err;
|
||||
snd_pcm_access_mask_any(&access_mask);
|
||||
|
|
@ -114,7 +114,7 @@ static int snd_pcm_multi_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
|
|||
static int snd_pcm_multi_hw_refine_sprepare(snd_pcm_t *pcm, int slave_idx,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_multi_slave_t *slave = &multi->slaves[slave_idx];
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
|
|
@ -197,14 +197,14 @@ static int snd_pcm_multi_hw_refine_slave(snd_pcm_t *pcm,
|
|||
int slave_idx,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave = multi->slaves[slave_idx].pcm;
|
||||
return snd_pcm_hw_refine(slave, sparams);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int k;
|
||||
snd_pcm_hw_params_t sparams[multi->slaves_count];
|
||||
int err;
|
||||
|
|
@ -247,7 +247,7 @@ static int snd_pcm_multi_hw_params_slave(snd_pcm_t *pcm,
|
|||
int slave_idx,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave = multi->slaves[slave_idx].pcm;
|
||||
int err = snd_pcm_hw_refine(slave, sparams);
|
||||
if (err < 0)
|
||||
|
|
@ -265,7 +265,7 @@ static int snd_pcm_multi_hw_params_slave(snd_pcm_t *pcm,
|
|||
|
||||
static int snd_pcm_multi_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int k;
|
||||
snd_pcm_hw_params_t sparams[multi->slaves_count];
|
||||
int err;
|
||||
|
|
@ -285,7 +285,7 @@ static int snd_pcm_multi_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_multi_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int i;
|
||||
int err = 0;
|
||||
for (i = 0; i < multi->slaves_count; ++i) {
|
||||
|
|
@ -299,7 +299,7 @@ static int snd_pcm_multi_hw_free(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_multi_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int i;
|
||||
int err;
|
||||
for (i = 0; i < multi->slaves_count; ++i) {
|
||||
|
|
@ -313,71 +313,71 @@ static int snd_pcm_multi_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|||
|
||||
static int snd_pcm_multi_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave = multi->slaves[0].pcm;
|
||||
return snd_pcm_status(slave, status);
|
||||
}
|
||||
|
||||
static snd_pcm_state_t snd_pcm_multi_state(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave = multi->slaves[0].pcm;
|
||||
return snd_pcm_state(slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave = multi->slaves[0].pcm;
|
||||
return snd_pcm_delay(slave, delayp);
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_multi_avail_update(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave = multi->slaves[0].pcm;
|
||||
return snd_pcm_avail_update(slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
return snd_pcm_prepare(multi->slaves[0].pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
return snd_pcm_reset(multi->slaves[0].pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_start(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
return snd_pcm_start(multi->slaves[0].pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
return snd_pcm_drop(multi->slaves[0].pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
return snd_pcm_drain(multi->slaves[0].pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_pause(snd_pcm_t *pcm, int enable)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
return snd_pcm_pause(multi->slaves[0].pcm, enable);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int channel = info->channel;
|
||||
snd_pcm_multi_channel_t *c = &multi->channels[channel];
|
||||
int err;
|
||||
|
|
@ -391,7 +391,7 @@ static int snd_pcm_multi_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *in
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_multi_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int i;
|
||||
snd_pcm_uframes_t pos[multi->slaves_count];
|
||||
memset(pos, 0, sizeof(pos));
|
||||
|
|
@ -415,7 +415,7 @@ static snd_pcm_sframes_t snd_pcm_multi_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_multi_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < multi->slaves_count; ++i) {
|
||||
|
|
@ -445,14 +445,14 @@ static int snd_pcm_multi_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
|
||||
int snd_pcm_multi_poll_descriptor(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
snd_pcm_t *slave = multi->slaves[0].pcm;
|
||||
return snd_pcm_poll_descriptor(slave);
|
||||
}
|
||||
|
||||
static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_multi_t *multi = pcm->private_data;
|
||||
unsigned int k;
|
||||
snd_output_printf(out, "Multi PCM\n");
|
||||
snd_output_printf(out, "\nChannel bindings:\n");
|
||||
|
|
@ -507,7 +507,7 @@ snd_pcm_fast_ops_t snd_pcm_multi_fast_ops = {
|
|||
mmap_forward: snd_pcm_multi_mmap_forward,
|
||||
};
|
||||
|
||||
int snd_pcm_multi_open(snd_pcm_t **pcmp, char *name,
|
||||
int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
||||
unsigned int slaves_count,
|
||||
snd_pcm_t **slaves_pcm, unsigned int *schannels_count,
|
||||
unsigned int channels_count,
|
||||
|
|
@ -572,7 +572,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, char *name,
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_multi_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = multi;
|
||||
pcm->private_data = multi;
|
||||
pcm->poll_fd = multi->slaves[0].pcm->poll_fd;
|
||||
pcm->hw_ptr = multi->slaves[0].pcm->hw_ptr;
|
||||
pcm->appl_ptr = multi->slaves[0].pcm->appl_ptr;
|
||||
|
|
@ -580,15 +580,15 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, char *name,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
||||
int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i, j;
|
||||
snd_config_iterator_t i, inext, j, jnext;
|
||||
snd_config_t *slave = NULL;
|
||||
snd_config_t *binding = NULL;
|
||||
int err;
|
||||
unsigned int idx;
|
||||
char **slaves_id = NULL;
|
||||
const char **slaves_id = NULL;
|
||||
char **slaves_name = NULL;
|
||||
snd_pcm_t **slaves_pcm = NULL;
|
||||
unsigned int *slaves_channels = NULL;
|
||||
|
|
@ -596,7 +596,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
unsigned int *channels_schannel = NULL;
|
||||
unsigned int slaves_count = 0;
|
||||
unsigned int channels_count = 0;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, inext, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
@ -630,10 +630,10 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
ERR("binding is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_foreach(i, slave) {
|
||||
snd_config_for_each(i, inext, slave) {
|
||||
++slaves_count;
|
||||
}
|
||||
snd_config_foreach(i, binding) {
|
||||
snd_config_for_each(i, inext, binding) {
|
||||
int cchannel = -1;
|
||||
char *p;
|
||||
snd_config_t *m = snd_config_iterator_entry(i);
|
||||
|
|
@ -661,12 +661,12 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
for (idx = 0; idx < channels_count; ++idx)
|
||||
channels_sidx[idx] = -1;
|
||||
idx = 0;
|
||||
snd_config_foreach(i, slave) {
|
||||
snd_config_for_each(i, inext, slave) {
|
||||
snd_config_t *m = snd_config_iterator_entry(i);
|
||||
const char *name = NULL;
|
||||
long channels = -1;
|
||||
slaves_id[idx] = snd_config_get_id(m);
|
||||
snd_config_foreach(j, m) {
|
||||
snd_config_for_each(j, jnext, m) {
|
||||
snd_config_t *n = snd_config_iterator_entry(j);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
@ -706,7 +706,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
++idx;
|
||||
}
|
||||
|
||||
snd_config_foreach(i, binding) {
|
||||
snd_config_for_each(i, inext, binding) {
|
||||
snd_config_t *m = snd_config_iterator_entry(i);
|
||||
long cchannel = -1;
|
||||
long schannel = -1;
|
||||
|
|
@ -720,7 +720,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
snd_config_foreach(j, m) {
|
||||
snd_config_for_each(j, jnext, m) {
|
||||
snd_config_t *n = snd_config_iterator_entry(j);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ typedef struct {
|
|||
|
||||
static int snd_pcm_null_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
close(null->poll_fd);
|
||||
free(null);
|
||||
return 0;
|
||||
|
|
@ -66,13 +66,13 @@ static int snd_pcm_null_info(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_info_t * i
|
|||
|
||||
static int snd_pcm_null_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
return snd_pcm_channel_info_shm(pcm, info, null->shmid);
|
||||
}
|
||||
|
||||
static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
memset(status, 0, sizeof(*status));
|
||||
status->state = snd_enum_to_int(null->state);
|
||||
status->trigger_tstamp = null->trigger_tstamp;
|
||||
|
|
@ -84,7 +84,7 @@ static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
|
||||
static snd_pcm_state_t snd_pcm_null_state(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
return null->state;
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ static int snd_pcm_null_delay(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sframes_t
|
|||
|
||||
static int snd_pcm_null_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
null->state = SND_PCM_STATE_PREPARED;
|
||||
null->appl_ptr = 0;
|
||||
null->hw_ptr = 0;
|
||||
|
|
@ -105,7 +105,7 @@ static int snd_pcm_null_prepare(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_null_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
null->appl_ptr = 0;
|
||||
null->hw_ptr = 0;
|
||||
return 0;
|
||||
|
|
@ -113,7 +113,7 @@ static int snd_pcm_null_reset(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_null_start(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
assert(null->state == SND_PCM_STATE_PREPARED);
|
||||
null->state = SND_PCM_STATE_RUNNING;
|
||||
if (pcm->stream == SND_PCM_STREAM_CAPTURE)
|
||||
|
|
@ -123,7 +123,7 @@ static int snd_pcm_null_start(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_null_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
assert(null->state != SND_PCM_STATE_OPEN);
|
||||
null->state = SND_PCM_STATE_SETUP;
|
||||
return 0;
|
||||
|
|
@ -131,7 +131,7 @@ static int snd_pcm_null_drop(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_null_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
assert(null->state != SND_PCM_STATE_OPEN);
|
||||
null->state = SND_PCM_STATE_SETUP;
|
||||
return 0;
|
||||
|
|
@ -139,7 +139,7 @@ static int snd_pcm_null_drain(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_null_pause(snd_pcm_t *pcm, int enable)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (enable) {
|
||||
if (null->state != SND_PCM_STATE_RUNNING)
|
||||
return -EBADFD;
|
||||
|
|
@ -151,7 +151,7 @@ static int snd_pcm_null_pause(snd_pcm_t *pcm, int enable)
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_null_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
switch (snd_enum_to_int(null->state)) {
|
||||
case SND_PCM_STATE_PREPARED:
|
||||
case SND_PCM_STATE_RUNNING:
|
||||
|
|
@ -165,7 +165,7 @@ static snd_pcm_sframes_t snd_pcm_null_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_null_fwd(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
switch (snd_enum_to_int(null->state)) {
|
||||
case SND_PCM_STATE_PREPARED:
|
||||
case SND_PCM_STATE_RUNNING:
|
||||
|
|
@ -179,7 +179,7 @@ static snd_pcm_sframes_t snd_pcm_null_fwd(snd_pcm_t *pcm, snd_pcm_uframes_t size
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_null_writei(snd_pcm_t *pcm, const void *buffer ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (null->state == SND_PCM_STATE_PREPARED &&
|
||||
pcm->start_mode != SND_PCM_START_EXPLICIT) {
|
||||
null->state = SND_PCM_STATE_RUNNING;
|
||||
|
|
@ -189,7 +189,7 @@ static snd_pcm_sframes_t snd_pcm_null_writei(snd_pcm_t *pcm, const void *buffer
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_null_writen(snd_pcm_t *pcm, void **bufs ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (null->state == SND_PCM_STATE_PREPARED &&
|
||||
pcm->start_mode != SND_PCM_START_EXPLICIT) {
|
||||
null->state = SND_PCM_STATE_RUNNING;
|
||||
|
|
@ -199,7 +199,7 @@ static snd_pcm_sframes_t snd_pcm_null_writen(snd_pcm_t *pcm, void **bufs ATTRIBU
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_null_readi(snd_pcm_t *pcm, void *buffer ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (null->state == SND_PCM_STATE_PREPARED &&
|
||||
pcm->start_mode != SND_PCM_START_EXPLICIT) {
|
||||
null->state = SND_PCM_STATE_RUNNING;
|
||||
|
|
@ -210,7 +210,7 @@ static snd_pcm_sframes_t snd_pcm_null_readi(snd_pcm_t *pcm, void *buffer ATTRIBU
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_null_readn(snd_pcm_t *pcm, void **bufs ATTRIBUTE_UNUSED, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (null->state == SND_PCM_STATE_PREPARED &&
|
||||
pcm->start_mode != SND_PCM_START_EXPLICIT) {
|
||||
null->state = SND_PCM_STATE_RUNNING;
|
||||
|
|
@ -253,7 +253,7 @@ static int snd_pcm_null_sw_params(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_pa
|
|||
|
||||
static int snd_pcm_null_mmap(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (!(pcm->info & SND_PCM_INFO_MMAP)) {
|
||||
size_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size);
|
||||
int id = shmget(IPC_PRIVATE, size, 0666);
|
||||
|
|
@ -268,7 +268,7 @@ static int snd_pcm_null_mmap(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_null_munmap(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private;
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (shmctl(null->shmid, IPC_RMID, 0) < 0) {
|
||||
SYSERR("shmctl IPC_RMID failed");
|
||||
return -errno;
|
||||
|
|
@ -361,7 +361,7 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_null_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = null;
|
||||
pcm->private_data = null;
|
||||
pcm->poll_fd = fd;
|
||||
pcm->hw_ptr = &null->hw_ptr;
|
||||
pcm->appl_ptr = &null->appl_ptr;
|
||||
|
|
@ -370,12 +370,12 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_null_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_iterator_t i, next;
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -1015,7 +1015,7 @@ struct _snd_pcm_hw_strategy {
|
|||
unsigned int max_badness,
|
||||
snd_pcm_t *pcm,
|
||||
const snd_pcm_hw_strategy_t *strategy);
|
||||
void *private;
|
||||
void *private_data;
|
||||
void (*free)(snd_pcm_hw_strategy_t *strategy);
|
||||
};
|
||||
|
||||
|
|
@ -1034,7 +1034,7 @@ struct _snd_pcm_hw_strategy_simple {
|
|||
unsigned int param,
|
||||
snd_pcm_t *pcm,
|
||||
const snd_pcm_hw_strategy_simple_t *par);
|
||||
void *private;
|
||||
void *private_data;
|
||||
void (*free)(snd_pcm_hw_strategy_simple_t *strategy);
|
||||
};
|
||||
|
||||
|
|
@ -1210,7 +1210,7 @@ int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
|||
|
||||
void snd_pcm_hw_strategy_simple_free(snd_pcm_hw_strategy_t *strategy)
|
||||
{
|
||||
snd_pcm_hw_strategy_simple_t *pars = strategy->private;
|
||||
snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
|
||||
int k;
|
||||
for (k = 0; k <= SND_PCM_HW_PARAM_LAST; ++k) {
|
||||
if (pars[k].valid && pars[k].free)
|
||||
|
|
@ -1225,7 +1225,7 @@ int snd_pcm_hw_strategy_simple_choose_param(const snd_pcm_hw_params_t *params,
|
|||
{
|
||||
snd_pcm_hw_param_t var;
|
||||
int best_var = -1;
|
||||
const snd_pcm_hw_strategy_simple_t *pars = strategy->private;
|
||||
const snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
|
||||
unsigned int min_choices = UINT_MAX;
|
||||
unsigned int min_order = UINT_MAX;
|
||||
for (var = 0; var <= SND_PCM_HW_PARAM_LAST; ++var) {
|
||||
|
|
@ -1254,7 +1254,7 @@ int snd_pcm_hw_strategy_simple_next_value(snd_pcm_hw_params_t *params,
|
|||
snd_pcm_t *pcm,
|
||||
const snd_pcm_hw_strategy_t *strategy)
|
||||
{
|
||||
const snd_pcm_hw_strategy_simple_t *pars = strategy->private;
|
||||
const snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
|
||||
assert(pars[var].valid);
|
||||
return pars[var].next_value(params, var, value, dir, pcm, &pars[var]);
|
||||
}
|
||||
|
|
@ -1267,7 +1267,7 @@ int snd_pcm_hw_strategy_simple_min_badness(const snd_pcm_hw_params_t *params,
|
|||
{
|
||||
snd_pcm_hw_param_t var;
|
||||
unsigned int badness = 0;
|
||||
const snd_pcm_hw_strategy_simple_t *pars = strategy->private;
|
||||
const snd_pcm_hw_strategy_simple_t *pars = strategy->private_data;
|
||||
for (var = 0; var <= SND_PCM_HW_PARAM_LAST; ++var) {
|
||||
unsigned int b;
|
||||
if (!pars[var].valid)
|
||||
|
|
@ -1283,7 +1283,7 @@ int snd_pcm_hw_strategy_simple_min_badness(const snd_pcm_hw_params_t *params,
|
|||
|
||||
void snd_pcm_hw_strategy_simple_near_free(snd_pcm_hw_strategy_simple_t *par)
|
||||
{
|
||||
snd_pcm_hw_strategy_simple_near_t *p = par->private;
|
||||
snd_pcm_hw_strategy_simple_near_t *p = par->private_data;
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
|
@ -1292,7 +1292,7 @@ unsigned int snd_pcm_hw_strategy_simple_near_min_badness(const snd_pcm_hw_params
|
|||
snd_pcm_t *pcm,
|
||||
const snd_pcm_hw_strategy_simple_t *par)
|
||||
{
|
||||
const snd_pcm_hw_strategy_simple_near_t *p = par->private;
|
||||
const snd_pcm_hw_strategy_simple_near_t *p = par->private_data;
|
||||
snd_pcm_hw_params_t params1 = *params;
|
||||
int value = snd_pcm_hw_param_set_near(pcm, ¶ms1, var, p->best, 0);
|
||||
int diff;
|
||||
|
|
@ -1309,7 +1309,7 @@ int snd_pcm_hw_strategy_simple_near_next_value(snd_pcm_hw_params_t *params,
|
|||
snd_pcm_t *pcm,
|
||||
const snd_pcm_hw_strategy_simple_t *par)
|
||||
{
|
||||
const snd_pcm_hw_strategy_simple_near_t *p = par->private;
|
||||
const snd_pcm_hw_strategy_simple_near_t *p = par->private_data;
|
||||
if (value < 0) {
|
||||
*dir = 0;
|
||||
return snd_pcm_hw_param_set_near(pcm, params, var, p->best, dir);
|
||||
|
|
@ -1319,7 +1319,7 @@ int snd_pcm_hw_strategy_simple_near_next_value(snd_pcm_hw_params_t *params,
|
|||
|
||||
void snd_pcm_hw_strategy_simple_choices_free(snd_pcm_hw_strategy_simple_t *par)
|
||||
{
|
||||
snd_pcm_hw_strategy_simple_choices_t *p = par->private;
|
||||
snd_pcm_hw_strategy_simple_choices_t *p = par->private_data;
|
||||
// free(p->choices);
|
||||
free(p);
|
||||
}
|
||||
|
|
@ -1329,7 +1329,7 @@ unsigned int snd_pcm_hw_strategy_simple_choices_min_badness(const snd_pcm_hw_par
|
|||
snd_pcm_t *pcm,
|
||||
const snd_pcm_hw_strategy_simple_t *par)
|
||||
{
|
||||
const snd_pcm_hw_strategy_simple_choices_t *p = par->private;
|
||||
const snd_pcm_hw_strategy_simple_choices_t *p = par->private_data;
|
||||
unsigned int k;
|
||||
for (k = 0; k < p->count; ++k) {
|
||||
if (snd_pcm_hw_param_set(pcm, (snd_pcm_hw_params_t *) params, SND_TEST, var, p->choices[k].value, 0))
|
||||
|
|
@ -1345,7 +1345,7 @@ int snd_pcm_hw_strategy_simple_choices_next_value(snd_pcm_hw_params_t *params,
|
|||
snd_pcm_t *pcm,
|
||||
const snd_pcm_hw_strategy_simple_t *par)
|
||||
{
|
||||
const snd_pcm_hw_strategy_simple_choices_t *p = par->private;
|
||||
const snd_pcm_hw_strategy_simple_choices_t *p = par->private_data;
|
||||
unsigned int k = 0;
|
||||
if (value >= 0) {
|
||||
for (; k < p->count; ++k) {
|
||||
|
|
@ -1393,7 +1393,7 @@ int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp,
|
|||
s->min_badness = snd_pcm_hw_strategy_simple_min_badness;
|
||||
s->badness_min = badness_min;
|
||||
s->badness_max = badness_max;
|
||||
s->private = data;
|
||||
s->private_data = data;
|
||||
s->free = snd_pcm_hw_strategy_simple_free;
|
||||
*strategyp = s;
|
||||
return 0;
|
||||
|
|
@ -1405,7 +1405,7 @@ int snd_pcm_hw_strategy_simple_near(snd_pcm_hw_strategy_t *strategy,
|
|||
unsigned int best,
|
||||
unsigned int mul)
|
||||
{
|
||||
snd_pcm_hw_strategy_simple_t *s = strategy->private;
|
||||
snd_pcm_hw_strategy_simple_t *s = strategy->private_data;
|
||||
snd_pcm_hw_strategy_simple_near_t *data;
|
||||
assert(strategy);
|
||||
assert(var <= SND_PCM_HW_PARAM_LAST);
|
||||
|
|
@ -1420,7 +1420,7 @@ int snd_pcm_hw_strategy_simple_near(snd_pcm_hw_strategy_t *strategy,
|
|||
s->valid = 1;
|
||||
s->next_value = snd_pcm_hw_strategy_simple_near_next_value;
|
||||
s->min_badness = snd_pcm_hw_strategy_simple_near_min_badness;
|
||||
s->private = data;
|
||||
s->private_data = data;
|
||||
s->free = snd_pcm_hw_strategy_simple_near_free;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1431,7 +1431,7 @@ int snd_pcm_hw_strategy_simple_choices(snd_pcm_hw_strategy_t *strategy,
|
|||
unsigned int count,
|
||||
snd_pcm_hw_strategy_simple_choices_list_t *choices)
|
||||
{
|
||||
snd_pcm_hw_strategy_simple_t *s = strategy->private;
|
||||
snd_pcm_hw_strategy_simple_t *s = strategy->private_data;
|
||||
snd_pcm_hw_strategy_simple_choices_t *data;
|
||||
assert(strategy);
|
||||
assert(var <= SND_PCM_HW_PARAM_LAST);
|
||||
|
|
@ -1446,7 +1446,7 @@ int snd_pcm_hw_strategy_simple_choices(snd_pcm_hw_strategy_t *strategy,
|
|||
s->order = order;
|
||||
s->next_value = snd_pcm_hw_strategy_simple_choices_next_value;
|
||||
s->min_badness = snd_pcm_hw_strategy_simple_choices_min_badness;
|
||||
s->private = data;
|
||||
s->private_data = data;
|
||||
s->free = snd_pcm_hw_strategy_simple_choices_free;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1518,7 +1518,7 @@ struct _snd_pcm_hw_rule {
|
|||
int var;
|
||||
snd_pcm_hw_rule_func_t func;
|
||||
int deps[4];
|
||||
void *private;
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params,
|
||||
|
|
@ -1545,7 +1545,7 @@ int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params,
|
|||
snd_interval_t t;
|
||||
snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]),
|
||||
hw_param_interval_c(params, rule->deps[1]),
|
||||
(unsigned long) rule->private, &t);
|
||||
(unsigned long) rule->private_data, &t);
|
||||
return snd_interval_refine(hw_param_interval(params, rule->var), &t);
|
||||
}
|
||||
|
||||
|
|
@ -1554,7 +1554,7 @@ int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params,
|
|||
{
|
||||
snd_interval_t t;
|
||||
snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]),
|
||||
(unsigned long) rule->private,
|
||||
(unsigned long) rule->private_data,
|
||||
hw_param_interval_c(params, rule->deps[1]), &t);
|
||||
return snd_interval_refine(hw_param_interval(params, rule->var), &t);
|
||||
}
|
||||
|
|
@ -1624,140 +1624,140 @@ static snd_pcm_hw_rule_t refine_rules[] = {
|
|||
var: SND_PCM_HW_PARAM_FORMAT,
|
||||
func: snd_pcm_hw_rule_format,
|
||||
deps: { SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_SAMPLE_BITS,
|
||||
func: snd_pcm_hw_rule_sample_bits,
|
||||
deps: { SND_PCM_HW_PARAM_FORMAT,
|
||||
SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_SAMPLE_BITS,
|
||||
func: snd_pcm_hw_rule_div,
|
||||
deps: { SND_PCM_HW_PARAM_FRAME_BITS,
|
||||
SND_PCM_HW_PARAM_CHANNELS, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_FRAME_BITS,
|
||||
func: snd_pcm_hw_rule_mul,
|
||||
deps: { SND_PCM_HW_PARAM_SAMPLE_BITS,
|
||||
SND_PCM_HW_PARAM_CHANNELS, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_FRAME_BITS,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_PERIOD_BYTES,
|
||||
SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
|
||||
private: (void*) 8,
|
||||
private_data: (void*) 8,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_FRAME_BITS,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_BYTES,
|
||||
SND_PCM_HW_PARAM_BUFFER_SIZE, -1 },
|
||||
private: (void*) 8,
|
||||
private_data: (void*) 8,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_CHANNELS,
|
||||
func: snd_pcm_hw_rule_div,
|
||||
deps: { SND_PCM_HW_PARAM_FRAME_BITS,
|
||||
SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_RATE,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
SND_PCM_HW_PARAM_PERIOD_TIME, -1 },
|
||||
private: (void*) 1000000,
|
||||
private_data: (void*) 1000000,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_RATE,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
SND_PCM_HW_PARAM_BUFFER_TIME, -1 },
|
||||
private: (void*) 1000000,
|
||||
private_data: (void*) 1000000,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_PERIODS,
|
||||
func: snd_pcm_hw_rule_div,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
func: snd_pcm_hw_rule_div,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
SND_PCM_HW_PARAM_PERIODS, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_PERIOD_BYTES,
|
||||
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
|
||||
private: (void*) 8,
|
||||
private_data: (void*) 8,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
func: snd_pcm_hw_rule_muldivk,
|
||||
deps: { SND_PCM_HW_PARAM_PERIOD_TIME,
|
||||
SND_PCM_HW_PARAM_RATE, -1 },
|
||||
private: (void*) 1000000,
|
||||
private_data: (void*) 1000000,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
func: snd_pcm_hw_rule_mul,
|
||||
deps: { SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
SND_PCM_HW_PARAM_PERIODS, -1 },
|
||||
private: 0,
|
||||
private_data: 0,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_BYTES,
|
||||
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
|
||||
private: (void*) 8,
|
||||
private_data: (void*) 8,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
func: snd_pcm_hw_rule_muldivk,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_TIME,
|
||||
SND_PCM_HW_PARAM_RATE, -1 },
|
||||
private: (void*) 1000000,
|
||||
private_data: (void*) 1000000,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_PERIOD_BYTES,
|
||||
func: snd_pcm_hw_rule_muldivk,
|
||||
deps: { SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
|
||||
private: (void*) 8,
|
||||
private_data: (void*) 8,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_BUFFER_BYTES,
|
||||
func: snd_pcm_hw_rule_muldivk,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
|
||||
private: (void*) 8,
|
||||
private_data: (void*) 8,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_PERIOD_TIME,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_PERIOD_SIZE,
|
||||
SND_PCM_HW_PARAM_RATE, -1 },
|
||||
private: (void*) 1000000,
|
||||
private_data: (void*) 1000000,
|
||||
},
|
||||
{
|
||||
var: SND_PCM_HW_PARAM_BUFFER_TIME,
|
||||
func: snd_pcm_hw_rule_mulkdiv,
|
||||
deps: { SND_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
SND_PCM_HW_PARAM_RATE, -1 },
|
||||
private: (void*) 1000000,
|
||||
private_data: (void*) 1000000,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ typedef struct {
|
|||
|
||||
static int snd_pcm_plug_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
int err, result = 0;
|
||||
if (plug->ttable)
|
||||
free(plug->ttable);
|
||||
|
|
@ -48,19 +48,19 @@ static int snd_pcm_plug_close(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_plug_nonblock(snd_pcm_t *pcm, int nonblock)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
return snd_pcm_nonblock(plug->slave, nonblock);
|
||||
}
|
||||
|
||||
static int snd_pcm_plug_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
return snd_pcm_async(plug->slave, sig, pid);
|
||||
}
|
||||
|
||||
static int snd_pcm_plug_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
snd_pcm_t *slave = plug->req_slave;
|
||||
int err;
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const
|
|||
|
||||
static void snd_pcm_plug_clear(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
snd_pcm_t *slave = plug->req_slave;
|
||||
/* Clear old plugins */
|
||||
if (plug->slave != slave) {
|
||||
|
|
@ -203,7 +203,7 @@ typedef struct {
|
|||
|
||||
static int snd_pcm_plug_change_rate(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
int err;
|
||||
assert(snd_pcm_format_linear(slv->format));
|
||||
if (clt->rate == slv->rate)
|
||||
|
|
@ -220,7 +220,7 @@ static int snd_pcm_plug_change_rate(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plu
|
|||
|
||||
static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
unsigned int tt_ssize, tt_cused, tt_sused;
|
||||
snd_pcm_route_ttable_entry_t *ttable;
|
||||
int err;
|
||||
|
|
@ -285,10 +285,10 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
|
|||
|
||||
static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
int err;
|
||||
snd_pcm_format_t cfmt;
|
||||
int (*f)(snd_pcm_t **pcm, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int (*f)(snd_pcm_t **pcm, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
if (snd_pcm_format_linear(slv->format)) {
|
||||
/* Conversion is done in another plugin */
|
||||
if (clt->format == slv->format ||
|
||||
|
|
@ -346,7 +346,7 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p
|
|||
|
||||
static int snd_pcm_plug_change_access(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *clt, snd_pcm_plug_params_t *slv)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
int err;
|
||||
if (clt->access == slv->access)
|
||||
return 0;
|
||||
|
|
@ -361,7 +361,7 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
|
|||
snd_pcm_plug_params_t *client,
|
||||
snd_pcm_plug_params_t *slave)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
int (*funcs[])(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *s, snd_pcm_plug_params_t *d) = {
|
||||
snd_pcm_plug_change_format,
|
||||
snd_pcm_plug_change_channels,
|
||||
|
|
@ -408,7 +408,7 @@ static int snd_pcm_plug_hw_refine_sprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
|
|||
static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
snd_pcm_t *slave = plug->req_slave;
|
||||
unsigned int links = (SND_PCM_HW_PARBIT_PERIOD_TIME |
|
||||
SND_PCM_HW_PARBIT_TICK_TIME);
|
||||
|
|
@ -533,7 +533,7 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
|
|||
|
||||
static int snd_pcm_plug_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
return snd_pcm_hw_refine(plug->req_slave, params);
|
||||
}
|
||||
|
||||
|
|
@ -549,7 +549,7 @@ static int snd_pcm_plug_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
snd_pcm_t *slave = plug->req_slave;
|
||||
snd_pcm_plug_params_t clt_params, slv_params;
|
||||
snd_pcm_hw_params_t sparams;
|
||||
|
|
@ -594,7 +594,7 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_plug_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
snd_pcm_t *slave = plug->slave;
|
||||
int err = snd_pcm_hw_free(slave);
|
||||
snd_pcm_plug_clear(pcm);
|
||||
|
|
@ -603,13 +603,13 @@ static int snd_pcm_plug_hw_free(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_plug_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
return snd_pcm_sw_params(plug->slave, params);
|
||||
}
|
||||
|
||||
static int snd_pcm_plug_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
return snd_pcm_channel_info(plug->slave, info);
|
||||
}
|
||||
|
||||
|
|
@ -625,7 +625,7 @@ static int snd_pcm_plug_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
|
||||
static void snd_pcm_plug_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
snd_pcm_plug_t *plug = pcm->private_data;
|
||||
snd_output_printf(out, "Plug PCM: ");
|
||||
snd_pcm_dump(plug->slave, out);
|
||||
}
|
||||
|
|
@ -679,7 +679,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = slave->fast_ops;
|
||||
pcm->fast_op_arg = slave->fast_op_arg;
|
||||
pcm->private = plug;
|
||||
pcm->private_data = plug;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = slave->hw_ptr;
|
||||
pcm->appl_ptr = slave->appl_ptr;
|
||||
|
|
@ -704,14 +704,14 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_config_t *tt = NULL;
|
||||
snd_pcm_route_ttable_entry_t *ttable = NULL;
|
||||
unsigned int cused, sused;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
int snd_pcm_plugin_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
int err = 0;
|
||||
if (plugin->close_slave)
|
||||
err = snd_pcm_close(plugin->slave);
|
||||
|
|
@ -36,43 +36,43 @@ int snd_pcm_plugin_close(snd_pcm_t *pcm)
|
|||
|
||||
int snd_pcm_plugin_nonblock(snd_pcm_t *pcm, int nonblock)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_nonblock(plugin->slave, nonblock);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_async(plugin->slave, sig, pid);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_info(plugin->slave, info);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_hw_free(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_sw_params(plugin->slave, params);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_channel_info_shm(pcm, info, plugin->shmid);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
int err = snd_pcm_status(plugin->slave, status);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -84,13 +84,13 @@ int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
|
||||
snd_pcm_state_t snd_pcm_plugin_state(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_state(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_sframes_t sd;
|
||||
int err = snd_pcm_delay(plugin->slave, &sd);
|
||||
if (err < 0)
|
||||
|
|
@ -103,7 +103,7 @@ int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
|
||||
int snd_pcm_plugin_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
int err = snd_pcm_prepare(plugin->slave);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -119,7 +119,7 @@ int snd_pcm_plugin_prepare(snd_pcm_t *pcm)
|
|||
|
||||
int snd_pcm_plugin_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
int err = snd_pcm_reset(plugin->slave);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -135,31 +135,31 @@ int snd_pcm_plugin_reset(snd_pcm_t *pcm)
|
|||
|
||||
int snd_pcm_plugin_start(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_start(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_drop(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_drain(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_pause(snd_pcm_t *pcm, int enable)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_pause(plugin->slave, enable);
|
||||
}
|
||||
|
||||
snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_sframes_t n = snd_pcm_mmap_hw_avail(pcm);
|
||||
assert(n >= 0);
|
||||
if (n > 0) {
|
||||
|
|
@ -190,7 +190,7 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t frames;
|
||||
snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
|
||||
|
|
@ -202,7 +202,7 @@ snd_pcm_sframes_t snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, snd_
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_plugin_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t frames;
|
||||
snd_pcm_areas_from_bufs(pcm, areas, bufs);
|
||||
|
|
@ -214,7 +214,7 @@ snd_pcm_sframes_t snd_pcm_plugin_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_ufr
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_plugin_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t frames;
|
||||
snd_pcm_areas_from_buf(pcm, areas, buffer);
|
||||
|
|
@ -226,7 +226,7 @@ snd_pcm_sframes_t snd_pcm_plugin_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_ufr
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_plugin_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_channel_area_t areas[pcm->channels];
|
||||
snd_pcm_sframes_t frames;
|
||||
snd_pcm_areas_from_bufs(pcm, areas, bufs);
|
||||
|
|
@ -238,7 +238,7 @@ snd_pcm_sframes_t snd_pcm_plugin_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_ufra
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_plugin_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframes_t client_size)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_t *slave = plugin->slave;
|
||||
snd_pcm_uframes_t client_xfer = 0;
|
||||
snd_pcm_uframes_t slave_xfer = 0;
|
||||
|
|
@ -275,7 +275,7 @@ snd_pcm_sframes_t snd_pcm_plugin_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframes_t
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_t *slave = plugin->slave;
|
||||
snd_pcm_uframes_t client_xfer;
|
||||
snd_pcm_uframes_t slave_xfer = 0;
|
||||
|
|
@ -313,7 +313,7 @@ snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
|||
|
||||
int snd_pcm_plugin_mmap(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plug = pcm->private;
|
||||
snd_pcm_plugin_t *plug = pcm->private_data;
|
||||
size_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size);
|
||||
int id = shmget(IPC_PRIVATE, size, 0666);
|
||||
if (id < 0) {
|
||||
|
|
@ -326,7 +326,7 @@ int snd_pcm_plugin_mmap(snd_pcm_t *pcm)
|
|||
|
||||
int snd_pcm_plugin_munmap(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plug = pcm->private;
|
||||
snd_pcm_plugin_t *plug = pcm->private_data;
|
||||
if (shmctl(plug->shmid, IPC_RMID, 0) < 0) {
|
||||
SYSERR("shmctl IPC_RMID failed");
|
||||
return -errno;
|
||||
|
|
@ -336,19 +336,19 @@ int snd_pcm_plugin_munmap(snd_pcm_t *pcm)
|
|||
|
||||
int snd_pcm_plugin_poll_descriptor(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_poll_descriptor(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return snd_pcm_hw_refine(plugin->slave, params);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
return _snd_pcm_hw_params(plugin->slave, params);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,22 +102,22 @@ typedef int snd_pcm_route_ttable_entry_t;
|
|||
int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||
int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||
int snd_pcm_copy_open(snd_pcm_t **pcmp, char *name, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_linear_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_csize, unsigned int tt_ssize,
|
||||
unsigned int *tt_cused, unsigned int *tt_sused,
|
||||
int schannels);
|
||||
int snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
||||
int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, unsigned int schannels,
|
||||
snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_ssize,
|
||||
unsigned int tt_cused, unsigned int tt_sused,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_rate_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, int srate, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, int srate, snd_pcm_t *slave, int close_slave);
|
||||
|
||||
|
||||
#define SND_PCM_ACCBIT_PLUGIN ((1 << (unsigned long) SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *dst_areas,
|
|||
for (channel = 0; channel < channels; ++channel) {
|
||||
const snd_pcm_channel_area_t *src_area = &src_areas[channel];
|
||||
const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
|
||||
char *src, *dst;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
int16_t old_sample = states->sample;
|
||||
unsigned int pos = states->pos;
|
||||
|
|
@ -167,7 +168,8 @@ snd_pcm_uframes_t snd_pcm_rate_shrink(const snd_pcm_channel_area_t *dst_areas,
|
|||
const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
|
||||
unsigned int pos;
|
||||
int sum;
|
||||
char *src, *dst;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
sum = states->sum;
|
||||
pos = states->pos;
|
||||
|
|
@ -253,7 +255,7 @@ static int snd_pcm_rate_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
|
|||
|
||||
static int snd_pcm_rate_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -270,7 +272,7 @@ static int snd_pcm_rate_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *
|
|||
static int snd_pcm_rate_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_interval_t t, buffer_size;
|
||||
const snd_interval_t *srate, *crate;
|
||||
int err;
|
||||
|
|
@ -299,7 +301,7 @@ static int snd_pcm_rate_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
|||
static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_interval_t t;
|
||||
const snd_interval_t *sbuffer_size;
|
||||
const snd_interval_t *srate, *crate;
|
||||
|
|
@ -339,7 +341,7 @@ static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm,
|
|||
|
||||
static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_pcm_t *slave = rate->plug.slave;
|
||||
snd_pcm_format_t src_format, dst_format;
|
||||
unsigned int src_rate, dst_rate;
|
||||
|
|
@ -379,7 +381,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
|
||||
static int snd_pcm_rate_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
if (rate->states) {
|
||||
free(rate->states);
|
||||
rate->states = 0;
|
||||
|
|
@ -389,7 +391,7 @@ static int snd_pcm_rate_hw_free(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_rate_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_pcm_t *slave = rate->plug.slave;
|
||||
snd_pcm_sw_params_t sparams;
|
||||
sparams = *params;
|
||||
|
|
@ -402,7 +404,7 @@ static int snd_pcm_rate_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
|
||||
static int snd_pcm_rate_init(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
unsigned int k;
|
||||
for (k = 0; k < pcm->channels; ++k) {
|
||||
rate->states[k].sum = 0;
|
||||
|
|
@ -423,7 +425,7 @@ static snd_pcm_sframes_t snd_pcm_rate_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t client_size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_pcm_t *slave = rate->plug.slave;
|
||||
snd_pcm_uframes_t client_xfer = 0;
|
||||
snd_pcm_uframes_t slave_xfer = 0;
|
||||
|
|
@ -475,7 +477,7 @@ static snd_pcm_sframes_t snd_pcm_rate_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t *slave_sizep)
|
||||
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_pcm_t *slave = rate->plug.slave;
|
||||
snd_pcm_uframes_t client_xfer = 0;
|
||||
snd_pcm_uframes_t slave_xfer = 0;
|
||||
|
|
@ -521,7 +523,7 @@ static snd_pcm_sframes_t snd_pcm_rate_read_areas(snd_pcm_t *pcm,
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_rate_client_frames(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
/* Round toward zero */
|
||||
if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
return muldiv_down(frames, DIV, rate->pitch);
|
||||
|
|
@ -531,7 +533,7 @@ snd_pcm_sframes_t snd_pcm_rate_client_frames(snd_pcm_t *pcm, snd_pcm_sframes_t f
|
|||
|
||||
snd_pcm_sframes_t snd_pcm_rate_slave_frames(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
/* Round toward zero */
|
||||
if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
return muldiv_down(frames, rate->pitch, DIV);
|
||||
|
|
@ -541,7 +543,7 @@ snd_pcm_sframes_t snd_pcm_rate_slave_frames(snd_pcm_t *pcm, snd_pcm_sframes_t fr
|
|||
|
||||
static void snd_pcm_rate_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private;
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
|
||||
snd_output_printf(out, "Rate conversion PCM (%d)\n",
|
||||
rate->srate);
|
||||
|
|
@ -572,7 +574,7 @@ snd_pcm_ops_t snd_pcm_rate_ops = {
|
|||
munmap: snd_pcm_plugin_munmap,
|
||||
};
|
||||
|
||||
int snd_pcm_rate_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, int srate, snd_pcm_t *slave, int close_slave)
|
||||
int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, int srate, snd_pcm_t *slave, int close_slave)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_rate_t *rate;
|
||||
|
|
@ -608,7 +610,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, in
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_plugin_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = rate;
|
||||
pcm->private_data = rate;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = &rate->plug.hw_ptr;
|
||||
pcm->appl_ptr = &rate->plug.appl_ptr;
|
||||
|
|
@ -617,17 +619,17 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, in
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
long srate = -1;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area,
|
|||
void *conv;
|
||||
const snd_pcm_channel_area_t *src_area = 0;
|
||||
unsigned int srcidx;
|
||||
char *src, *dst;
|
||||
const char *src;
|
||||
char *dst;
|
||||
int src_step, dst_step;
|
||||
for (srcidx = 0; srcidx < ttable->nsrcs; ++srcidx) {
|
||||
src_area = &src_areas[ttable->srcs[srcidx].channel];
|
||||
|
|
@ -208,7 +209,7 @@ void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
|||
int nsrcs = ttable->nsrcs;
|
||||
char *dst;
|
||||
int dst_step;
|
||||
char *srcs[nsrcs];
|
||||
const char *srcs[nsrcs];
|
||||
int src_steps[nsrcs];
|
||||
snd_pcm_route_ttable_src_t src_tt[nsrcs];
|
||||
u_int32_t sample = 0;
|
||||
|
|
@ -267,7 +268,7 @@ void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
|||
#endif
|
||||
zero_end:
|
||||
for (srcidx = 0; srcidx < nsrcs; ++srcidx) {
|
||||
char *src = srcs[srcidx];
|
||||
const char *src = srcs[srcidx];
|
||||
|
||||
/* Get sample */
|
||||
goto *get;
|
||||
|
|
@ -418,7 +419,7 @@ void snd_pcm_route_convert(const snd_pcm_channel_area_t *dst_areas,
|
|||
|
||||
static int snd_pcm_route_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
snd_pcm_route_params_t *params = &route->params;
|
||||
int err = 0;
|
||||
unsigned int dst_channel;
|
||||
|
|
@ -460,7 +461,7 @@ static int snd_pcm_route_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd
|
|||
|
||||
static int snd_pcm_route_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
|
||||
|
|
@ -479,7 +480,7 @@ static int snd_pcm_route_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
|
|||
static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
int err;
|
||||
unsigned int links = (SND_PCM_HW_PARBIT_RATE |
|
||||
SND_PCM_HW_PARBIT_PERIODS |
|
||||
|
|
@ -503,7 +504,7 @@ static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *
|
|||
static int snd_pcm_route_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
||||
snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
int err;
|
||||
unsigned int links = (SND_PCM_HW_PARBIT_RATE |
|
||||
SND_PCM_HW_PARBIT_PERIODS |
|
||||
|
|
@ -536,7 +537,7 @@ static int snd_pcm_route_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
snd_pcm_t *slave = route->plug.slave;
|
||||
snd_pcm_format_t src_format, dst_format;
|
||||
int err = snd_pcm_hw_params_slave(pcm, params,
|
||||
|
|
@ -576,7 +577,7 @@ static snd_pcm_sframes_t snd_pcm_route_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
snd_pcm_t *slave = route->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -610,7 +611,7 @@ static snd_pcm_sframes_t snd_pcm_route_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t size,
|
||||
snd_pcm_uframes_t *slave_sizep)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
snd_pcm_t *slave = route->plug.slave;
|
||||
snd_pcm_uframes_t xfer = 0;
|
||||
snd_pcm_sframes_t err = 0;
|
||||
|
|
@ -640,7 +641,7 @@ static snd_pcm_sframes_t snd_pcm_route_read_areas(snd_pcm_t *pcm,
|
|||
|
||||
static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_route_t *route = pcm->private;
|
||||
snd_pcm_route_t *route = pcm->private_data;
|
||||
unsigned int dst;
|
||||
if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
|
||||
snd_output_printf(out, "Route conversion PCM\n");
|
||||
|
|
@ -763,7 +764,7 @@ int route_load_ttable(snd_pcm_route_params_t *params, snd_pcm_stream_t stream,
|
|||
}
|
||||
|
||||
|
||||
int snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
||||
int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, unsigned int schannels,
|
||||
snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_ssize,
|
||||
|
|
@ -802,7 +803,7 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_plugin_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = route;
|
||||
pcm->private_data = route;
|
||||
pcm->poll_fd = slave->poll_fd;
|
||||
pcm->hw_ptr = &route->plug.hw_ptr;
|
||||
pcm->appl_ptr = &route->plug.appl_ptr;
|
||||
|
|
@ -823,13 +824,13 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
|
|||
{
|
||||
int cused = -1;
|
||||
int sused = -1;
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, inext;
|
||||
unsigned int k;
|
||||
for (k = 0; k < tt_csize * tt_ssize; ++k)
|
||||
ttable[k] = 0.0;
|
||||
snd_config_foreach(i, tt) {
|
||||
snd_config_for_each(i, inext, tt) {
|
||||
snd_config_t *in = snd_config_iterator_entry(i);
|
||||
snd_config_iterator_t j;
|
||||
snd_config_iterator_t j, jnext;
|
||||
char *p;
|
||||
long cchannel;
|
||||
errno = 0;
|
||||
|
|
@ -841,7 +842,7 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
|
|||
}
|
||||
if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
|
||||
return -EINVAL;
|
||||
snd_config_foreach(j, in) {
|
||||
snd_config_for_each(j, jnext, in) {
|
||||
snd_config_t *jn = snd_config_iterator_entry(j);
|
||||
double value;
|
||||
long schannel;
|
||||
|
|
@ -879,11 +880,11 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
|
|||
|
||||
#define MAX_CHANNELS 32
|
||||
|
||||
int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
|
|
@ -892,7 +893,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_config_t *tt = NULL;
|
||||
snd_pcm_route_ttable_entry_t ttable[MAX_CHANNELS*MAX_CHANNELS];
|
||||
unsigned int cused, sused;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ static snd_pcm_uframes_t _snd_pcm_share_slave_forward(snd_pcm_share_slave_t *sla
|
|||
*/
|
||||
static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm, int slave_xrun)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_t *spcm = slave->pcm;
|
||||
snd_pcm_uframes_t buffer_size = spcm->buffer_size;
|
||||
|
|
@ -394,7 +394,7 @@ void *snd_pcm_share_slave_thread(void *data)
|
|||
|
||||
static void _snd_pcm_share_update(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_t *spcm = slave->pcm;
|
||||
snd_pcm_uframes_t missing;
|
||||
|
|
@ -434,7 +434,7 @@ static int snd_pcm_share_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock
|
|||
|
||||
static int snd_pcm_share_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
if (sig)
|
||||
share->async_sig = sig;
|
||||
else
|
||||
|
|
@ -448,13 +448,13 @@ static int snd_pcm_share_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
|||
|
||||
static int snd_pcm_share_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
return snd_pcm_info(share->slave->pcm, info);
|
||||
}
|
||||
|
||||
static int snd_pcm_share_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_access_mask_t access_mask;
|
||||
int err;
|
||||
|
|
@ -486,7 +486,7 @@ static int snd_pcm_share_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
|
|||
|
||||
static int snd_pcm_share_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *sparams)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_access_mask_t saccess_mask = { SND_PCM_ACCBIT_MMAP };
|
||||
_snd_pcm_hw_params_any(sparams);
|
||||
|
|
@ -562,13 +562,13 @@ static int snd_pcm_share_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
|
|||
|
||||
static int snd_pcm_share_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
return snd_pcm_hw_refine(share->slave->pcm, params);
|
||||
}
|
||||
|
||||
static int snd_pcm_share_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
return _snd_pcm_hw_params(share->slave->pcm, params);
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +584,7 @@ static int snd_pcm_share_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_t *spcm = slave->pcm;
|
||||
int err = 0;
|
||||
|
|
@ -643,7 +643,7 @@ static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
|
||||
static int snd_pcm_share_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -662,7 +662,7 @@ static int snd_pcm_share_sw_params(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_sw_p
|
|||
|
||||
static int snd_pcm_share_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
snd_pcm_sframes_t sd = 0, d = 0;
|
||||
|
|
@ -693,13 +693,13 @@ static int snd_pcm_share_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
|
|||
|
||||
static snd_pcm_state_t snd_pcm_share_state(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
return share->state;
|
||||
}
|
||||
|
||||
static int _snd_pcm_share_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
snd_pcm_sframes_t sd;
|
||||
|
|
@ -724,7 +724,7 @@ static int _snd_pcm_share_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
|
||||
static int snd_pcm_share_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -735,7 +735,7 @@ static int snd_pcm_share_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_share_avail_update(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_sframes_t avail;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -757,7 +757,7 @@ static snd_pcm_sframes_t snd_pcm_share_avail_update(snd_pcm_t *pcm)
|
|||
/* Call it with mutex held */
|
||||
static snd_pcm_sframes_t _snd_pcm_share_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_sframes_t ret = 0;
|
||||
snd_pcm_sframes_t frames;
|
||||
|
|
@ -790,7 +790,7 @@ static snd_pcm_sframes_t _snd_pcm_share_mmap_forward(snd_pcm_t *pcm, snd_pcm_ufr
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_share_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_sframes_t ret;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -801,7 +801,7 @@ static snd_pcm_sframes_t snd_pcm_share_mmap_forward(snd_pcm_t *pcm, snd_pcm_ufra
|
|||
|
||||
static int snd_pcm_share_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -821,7 +821,7 @@ static int snd_pcm_share_prepare(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_share_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
/* FIXME? */
|
||||
|
|
@ -835,7 +835,7 @@ static int snd_pcm_share_reset(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_share_start(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
if (share->state != SND_PCM_STATE_PREPARED)
|
||||
|
|
@ -897,7 +897,7 @@ static int snd_pcm_share_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRI
|
|||
|
||||
static int snd_pcm_share_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
unsigned int channel = info->channel;
|
||||
int c = share->slave_channels[channel];
|
||||
|
|
@ -910,7 +910,7 @@ static int snd_pcm_share_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *in
|
|||
|
||||
static snd_pcm_sframes_t _snd_pcm_share_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_sframes_t n;
|
||||
switch (snd_enum_to_int(share->state)) {
|
||||
|
|
@ -950,7 +950,7 @@ static snd_pcm_sframes_t _snd_pcm_share_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_share_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
snd_pcm_sframes_t ret;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -962,7 +962,7 @@ static snd_pcm_sframes_t snd_pcm_share_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
|
|||
/* Warning: take the mutex before to call this */
|
||||
static void _snd_pcm_share_stop(snd_pcm_t *pcm, snd_pcm_state_t state)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
if (!pcm->mmap_channels) {
|
||||
/* PCM closing already begun in the main thread */
|
||||
|
|
@ -995,7 +995,7 @@ static void _snd_pcm_share_stop(snd_pcm_t *pcm, snd_pcm_state_t state)
|
|||
|
||||
static int snd_pcm_share_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -1053,7 +1053,7 @@ static int snd_pcm_share_drain(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_share_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
|
|
@ -1090,7 +1090,7 @@ static int snd_pcm_share_drop(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_share_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
int err = 0;
|
||||
Pthread_mutex_lock(&slaves_mutex);
|
||||
|
|
@ -1131,7 +1131,7 @@ static int snd_pcm_share_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
|
||||
static void snd_pcm_share_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
{
|
||||
snd_pcm_share_t *share = pcm->private;
|
||||
snd_pcm_share_t *share = pcm->private_data;
|
||||
snd_pcm_share_slave_t *slave = share->slave;
|
||||
unsigned int k;
|
||||
snd_output_printf(out, "Share PCM\n");
|
||||
|
|
@ -1344,7 +1344,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_share_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = share;
|
||||
pcm->private_data = share;
|
||||
pcm->poll_fd = share->client_socket;
|
||||
pcm->hw_ptr = &share->hw_ptr;
|
||||
pcm->appl_ptr = &share->appl_ptr;
|
||||
|
|
@ -1358,10 +1358,10 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
||||
int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *sname = NULL;
|
||||
snd_config_t *binding = NULL;
|
||||
int err;
|
||||
|
|
@ -1373,7 +1373,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
long srate = -1;
|
||||
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
@ -1437,7 +1437,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
ERR("binding is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_foreach(i, binding) {
|
||||
snd_config_for_each(i, next, binding) {
|
||||
int cchannel = -1;
|
||||
char *p;
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
|
|
@ -1459,7 +1459,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
for (idx = 0; idx < channels_count; ++idx)
|
||||
channels_map[idx] = -1;
|
||||
|
||||
snd_config_foreach(i, binding) {
|
||||
snd_config_for_each(i, next, binding) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
long cchannel;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ int receive_fd(int socket, void *data, size_t len, int *fd)
|
|||
|
||||
static int snd_pcm_shm_action(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
int err;
|
||||
char buf[1];
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
|
|
@ -98,7 +98,7 @@ static int snd_pcm_shm_action(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
int err;
|
||||
char buf[1];
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
|
|
@ -122,7 +122,7 @@ static int snd_pcm_shm_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock AT
|
|||
|
||||
static int snd_pcm_shm_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SND_PCM_IOCTL_ASYNC;
|
||||
ctrl->u.async.sig = sig;
|
||||
|
|
@ -134,7 +134,7 @@ static int snd_pcm_shm_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
|||
|
||||
static int snd_pcm_shm_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
// ctrl->u.info = *info;
|
||||
|
|
@ -201,7 +201,7 @@ static int snd_pcm_shm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pc
|
|||
static int snd_pcm_shm_hw_refine_slave(snd_pcm_t *pcm,
|
||||
snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->u.hw_refine = *params;
|
||||
|
|
@ -224,7 +224,7 @@ static int snd_pcm_shm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
static int snd_pcm_shm_hw_params_slave(snd_pcm_t *pcm,
|
||||
snd_pcm_hw_params_t *params)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_HW_PARAMS;
|
||||
|
|
@ -245,7 +245,7 @@ static int snd_pcm_shm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
|
||||
static int snd_pcm_shm_hw_free(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_HW_FREE;
|
||||
return snd_pcm_shm_action(pcm);
|
||||
|
|
@ -253,7 +253,7 @@ static int snd_pcm_shm_hw_free(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_SW_PARAMS;
|
||||
|
|
@ -300,7 +300,7 @@ static int snd_pcm_shm_munmap(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
int fd;
|
||||
|
|
@ -326,7 +326,7 @@ static int snd_pcm_shm_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * inf
|
|||
|
||||
static int snd_pcm_shm_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_STATUS;
|
||||
|
|
@ -340,7 +340,7 @@ static int snd_pcm_shm_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
|
||||
static snd_pcm_state_t snd_pcm_shm_state(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SND_PCM_IOCTL_STATE;
|
||||
return snd_int_to_enum(snd_pcm_shm_action(pcm));
|
||||
|
|
@ -348,7 +348,7 @@ static snd_pcm_state_t snd_pcm_shm_state(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_DELAY;
|
||||
|
|
@ -361,7 +361,7 @@ static int snd_pcm_shm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_shm_avail_update(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SND_PCM_IOCTL_AVAIL_UPDATE;
|
||||
|
|
@ -373,7 +373,7 @@ static snd_pcm_sframes_t snd_pcm_shm_avail_update(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_prepare(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_PREPARE;
|
||||
return snd_pcm_shm_action(pcm);
|
||||
|
|
@ -381,7 +381,7 @@ static int snd_pcm_shm_prepare(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_RESET;
|
||||
return snd_pcm_shm_action(pcm);
|
||||
|
|
@ -389,7 +389,7 @@ static int snd_pcm_shm_reset(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_start(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_START;
|
||||
return snd_pcm_shm_action(pcm);
|
||||
|
|
@ -397,7 +397,7 @@ static int snd_pcm_shm_start(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_drop(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_DROP;
|
||||
return snd_pcm_shm_action(pcm);
|
||||
|
|
@ -405,7 +405,7 @@ static int snd_pcm_shm_drop(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_DRAIN;
|
||||
|
|
@ -419,7 +419,7 @@ static int snd_pcm_shm_drain(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_pause(snd_pcm_t *pcm, int enable)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_PAUSE;
|
||||
ctrl->u.pause.enable = enable;
|
||||
|
|
@ -428,7 +428,7 @@ static int snd_pcm_shm_pause(snd_pcm_t *pcm, int enable)
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_shm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SNDRV_PCM_IOCTL_REWIND;
|
||||
ctrl->u.rewind.frames = frames;
|
||||
|
|
@ -437,7 +437,7 @@ static snd_pcm_sframes_t snd_pcm_shm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fr
|
|||
|
||||
static snd_pcm_sframes_t snd_pcm_shm_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
ctrl->cmd = SND_PCM_IOCTL_MMAP_FORWARD;
|
||||
ctrl->u.mmap_forward.frames = size;
|
||||
|
|
@ -446,7 +446,7 @@ static snd_pcm_sframes_t snd_pcm_shm_mmap_forward(snd_pcm_t *pcm, snd_pcm_uframe
|
|||
|
||||
static int snd_pcm_shm_poll_descriptor(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int fd, err;
|
||||
ctrl->cmd = SND_PCM_IOCTL_POLL_DESCRIPTOR;
|
||||
|
|
@ -458,7 +458,7 @@ static int snd_pcm_shm_poll_descriptor(snd_pcm_t *pcm)
|
|||
|
||||
static int snd_pcm_shm_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_shm_t *shm = pcm->private;
|
||||
snd_pcm_shm_t *shm = pcm->private_data;
|
||||
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int result;
|
||||
ctrl->cmd = SND_PCM_IOCTL_CLOSE;
|
||||
|
|
@ -650,7 +650,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, con
|
|||
pcm->op_arg = pcm;
|
||||
pcm->fast_ops = &snd_pcm_shm_fast_ops;
|
||||
pcm->fast_op_arg = pcm;
|
||||
pcm->private = shm;
|
||||
pcm->private_data = shm;
|
||||
err = snd_pcm_shm_poll_descriptor(pcm);
|
||||
if (err < 0) {
|
||||
snd_pcm_close(pcm);
|
||||
|
|
@ -716,10 +716,10 @@ int is_local(struct hostent *hent)
|
|||
return i < numreqs;
|
||||
}
|
||||
|
||||
int _snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
||||
int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *server = NULL;
|
||||
const char *sname = NULL;
|
||||
snd_config_t *sconfig;
|
||||
|
|
@ -729,7 +729,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
int err;
|
||||
int local;
|
||||
struct hostent *h;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
@ -768,7 +768,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
ERR("Unknown server %s", server);
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_foreach(i, sconfig) {
|
||||
snd_config_for_each(i, next, sconfig) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
const char *id = snd_config_get_id(n);
|
||||
if (strcmp(id, "comment") == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue