Added snd_*_card() functions.

This commit is contained in:
Jaroslav Kysela 2000-12-22 14:03:01 +00:00
parent c268a4bf56
commit 9acdef38c9
31 changed files with 140 additions and 12 deletions

View file

@ -261,6 +261,12 @@ ssize_t snd_pcm_readv(snd_pcm_t *pcm, const struct iovec *vector, int count)
return snd_pcm_readn(pcm, bufs, vector[0].iov_len);
}
int snd_pcm_card(snd_pcm_t *pcm)
{
assert(pcm);
return pcm->ops->card(pcm->op_arg);
}
/* FIXME */
#define snd_pcm_link_descriptor snd_pcm_poll_descriptor

View file

@ -532,6 +532,7 @@ static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_adpcm_ops = {
close: snd_pcm_adpcm_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_adpcm_hw_refine,
hw_params: snd_pcm_adpcm_hw_params,

View file

@ -400,6 +400,7 @@ static void snd_pcm_alaw_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_alaw_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_alaw_hw_refine,
hw_params: snd_pcm_alaw_hw_params,

View file

@ -158,6 +158,7 @@ static void snd_pcm_copy_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_copy_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_copy_hw_refine,
hw_params: snd_pcm_copy_hw_params,

View file

@ -49,6 +49,12 @@ static int snd_pcm_file_close(snd_pcm_t *pcm)
return 0;
}
static int snd_pcm_file_card(snd_pcm_t *pcm)
{
snd_pcm_file_t *file = pcm->private;
return snd_pcm_card(file->slave);
}
static int snd_pcm_file_nonblock(snd_pcm_t *pcm, int nonblock)
{
snd_pcm_file_t *file = pcm->private;
@ -301,6 +307,7 @@ static void snd_pcm_file_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_file_ops = {
close: snd_pcm_file_close,
card: snd_pcm_file_card,
info: snd_pcm_file_info,
hw_refine: snd_pcm_file_hw_refine,
hw_params: snd_pcm_file_hw_params,

View file

@ -109,6 +109,12 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
return 0;
}
static int snd_pcm_hw_card(snd_pcm_t *pcm)
{
snd_pcm_hw_t *hw = pcm->private;
return hw->card;
}
static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
{
snd_pcm_hw_t *hw = pcm->private;
@ -499,6 +505,7 @@ static void snd_pcm_hw_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_hw_ops = {
close: snd_pcm_hw_close,
card: snd_pcm_hw_card,
info: snd_pcm_hw_info,
hw_refine: snd_pcm_hw_hw_refine,
hw_params: snd_pcm_hw_hw_params,

View file

@ -239,6 +239,7 @@ static void snd_pcm_linear_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_linear_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_linear_hw_refine,
hw_params: snd_pcm_linear_hw_params,

View file

@ -56,6 +56,7 @@ typedef struct _snd_pcm_channel_info {
typedef struct {
int (*close)(snd_pcm_t *pcm);
int (*card)(snd_pcm_t *pcm);
int (*nonblock)(snd_pcm_t *pcm, int nonblock);
int (*async)(snd_pcm_t *pcm, int sig, pid_t pid);
int (*info)(snd_pcm_t *pcm, snd_pcm_info_t *info);

View file

@ -417,6 +417,7 @@ static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_mulaw_ops = {
close: snd_pcm_plugin_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_mulaw_hw_refine,
hw_params: snd_pcm_mulaw_hw_params,

View file

@ -67,6 +67,11 @@ static int snd_pcm_multi_close(snd_pcm_t *pcm)
return ret;
}
static int snd_pcm_multi_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
return -ENOENT; /* not available */
}
static int snd_pcm_multi_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -390,6 +395,7 @@ static void snd_pcm_multi_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_multi_ops = {
close: snd_pcm_multi_close,
card: snd_pcm_multi_card,
info: snd_pcm_multi_info,
hw_refine: snd_pcm_multi_hw_refine,
hw_params: snd_pcm_multi_hw_params,

View file

@ -42,6 +42,11 @@ static int snd_pcm_null_close(snd_pcm_t *pcm)
return 0;
}
static int snd_pcm_null_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
return -ENOENT; /* not available */
}
static int snd_pcm_null_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -295,6 +300,7 @@ static void snd_pcm_null_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_null_ops = {
close: snd_pcm_null_close,
card: snd_pcm_null_card,
info: snd_pcm_null_info,
hw_refine: snd_pcm_null_hw_refine,
hw_params: snd_pcm_null_hw_params,

View file

@ -51,6 +51,12 @@ static int snd_pcm_plug_close(snd_pcm_t *pcm)
return result;
}
static int snd_pcm_plug_card(snd_pcm_t *pcm)
{
snd_pcm_plug_t *plug = pcm->private;
return snd_pcm_card(plug->slave);
}
static int snd_pcm_plug_nonblock(snd_pcm_t *pcm, int nonblock)
{
snd_pcm_plug_t *plug = pcm->private;
@ -645,6 +651,7 @@ static void snd_pcm_plug_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_plug_ops = {
close: snd_pcm_plug_close,
card: snd_pcm_plug_card,
info: snd_pcm_plug_info,
hw_refine: snd_pcm_plug_hw_refine,
hw_params: snd_pcm_plug_hw_params,

View file

@ -34,6 +34,12 @@ int snd_pcm_plugin_close(snd_pcm_t *pcm)
return 0;
}
int snd_pcm_plugin_card(snd_pcm_t *pcm)
{
snd_pcm_plugin_t *plugin = pcm->private;
return snd_pcm_card(plugin->slave);
}
int snd_pcm_plugin_nonblock(snd_pcm_t *pcm, int nonblock)
{
snd_pcm_plugin_t *plugin = pcm->private;

View file

@ -31,6 +31,7 @@ typedef struct {
} snd_pcm_plugin_t;
int snd_pcm_plugin_close(snd_pcm_t *pcm);
int snd_pcm_plugin_card(snd_pcm_t *pcm);
int snd_pcm_plugin_nonblock(snd_pcm_t *pcm, int nonblock);
int snd_pcm_plugin_async(snd_pcm_t *pcm, int sig, pid_t pid);
int snd_pcm_plugin_info(snd_pcm_t *pcm, snd_pcm_info_t * info);

View file

@ -511,6 +511,7 @@ static void snd_pcm_rate_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_rate_ops = {
close: snd_pcm_rate_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_rate_hw_refine,
hw_params: snd_pcm_rate_hw_params,

View file

@ -660,6 +660,7 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_route_ops = {
close: snd_pcm_route_close,
card: snd_pcm_plugin_card,
info: snd_pcm_plugin_info,
hw_refine: snd_pcm_route_hw_refine,
hw_params: snd_pcm_route_hw_params,

View file

@ -417,6 +417,11 @@ static void _snd_pcm_share_update(snd_pcm_t *pcm)
}
}
static int snd_pcm_share_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
return -ENOENT; /* not available */
}
static int snd_pcm_share_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -1082,6 +1087,7 @@ static void snd_pcm_share_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_share_ops = {
close: snd_pcm_share_close,
card: snd_pcm_share_card,
info: snd_pcm_share_info,
hw_refine: snd_pcm_share_hw_refine,
hw_params: snd_pcm_share_hw_params,

View file

@ -116,6 +116,18 @@ static int snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
return ctrl->result;
}
static int snd_pcm_shm_card(snd_pcm_t *pcm)
{
snd_pcm_shm_t *shm = pcm->private;
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
int err;
ctrl->cmd = SND_PCM_IOCTL_CARD;
err = snd_pcm_shm_action(pcm);
if (err < 0)
return err;
return ctrl->u.card;
}
static int snd_pcm_shm_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
{
return 0;
@ -442,6 +454,7 @@ static void snd_pcm_shm_dump(snd_pcm_t *pcm, FILE *fp)
snd_pcm_ops_t snd_pcm_shm_ops = {
close: snd_pcm_shm_close,
card: snd_pcm_shm_card,
info: snd_pcm_shm_info,
hw_refine: snd_pcm_shm_hw_refine,
hw_params: snd_pcm_shm_hw_params,