diff options
author | Jaroslav Kysela <perex@perex.cz> | 2000-12-22 14:03:01 +0000 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2000-12-22 14:03:01 +0000 |
commit | 9acdef38c9953436801989a620fb6b705baf6855 (patch) | |
tree | 381d0c475675dc05fc3622717bab59289d55b504 /src | |
parent | c268a4bf560790dff0b42dd77793d7e5adb9bd5f (diff) |
Added snd_*_card() functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/control/control.c | 6 | ||||
-rw-r--r-- | src/control/control_hw.c | 7 | ||||
-rw-r--r-- | src/control/control_local.h | 1 | ||||
-rw-r--r-- | src/control/control_shm.c | 13 | ||||
-rw-r--r-- | src/pcm/pcm.c | 6 | ||||
-rw-r--r-- | src/pcm/pcm_adpcm.c | 1 | ||||
-rw-r--r-- | src/pcm/pcm_alaw.c | 1 | ||||
-rw-r--r-- | src/pcm/pcm_copy.c | 1 | ||||
-rw-r--r-- | src/pcm/pcm_file.c | 7 | ||||
-rw-r--r-- | src/pcm/pcm_hw.c | 7 | ||||
-rw-r--r-- | src/pcm/pcm_linear.c | 1 | ||||
-rw-r--r-- | src/pcm/pcm_local.h | 1 | ||||
-rw-r--r-- | src/pcm/pcm_mulaw.c | 1 | ||||
-rw-r--r-- | src/pcm/pcm_multi.c | 6 | ||||
-rw-r--r-- | src/pcm/pcm_null.c | 6 | ||||
-rw-r--r-- | src/pcm/pcm_plug.c | 7 | ||||
-rw-r--r-- | src/pcm/pcm_plugin.c | 6 | ||||
-rw-r--r-- | src/pcm/pcm_plugin.h | 1 | ||||
-rw-r--r-- | src/pcm/pcm_rate.c | 1 | ||||
-rw-r--r-- | src/pcm/pcm_route.c | 1 | ||||
-rw-r--r-- | src/pcm/pcm_share.c | 6 | ||||
-rw-r--r-- | src/pcm/pcm_shm.c | 13 | ||||
-rw-r--r-- | src/rawmidi/rawmidi.c | 6 | ||||
-rw-r--r-- | src/rawmidi/rawmidi_hw.c | 7 | ||||
-rw-r--r-- | src/rawmidi/rawmidi_local.h | 1 |
25 files changed, 114 insertions, 0 deletions
diff --git a/src/control/control.c b/src/control/control.c index 584fd946..7a18e400 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -45,6 +45,12 @@ int snd_ctl_close(snd_ctl_t *ctl) return res; } +int snd_ctl_card(snd_ctl_t *ctl) +{ + assert(ctl); + return ctl->ops->card(ctl); +} + int snd_ctl_poll_descriptor(snd_ctl_t *ctl) { assert(ctl); diff --git a/src/control/control_hw.c b/src/control/control_hw.c index abc00106..85f80653 100644 --- a/src/control/control_hw.c +++ b/src/control/control_hw.c @@ -48,6 +48,12 @@ static int snd_ctl_hw_close(snd_ctl_t *handle) return res; } +static int snd_ctl_hw_card(snd_ctl_t *handle) +{ + snd_ctl_hw_t *hw = handle->private; + return hw->card; +} + static int snd_ctl_hw_poll_descriptor(snd_ctl_t *handle) { snd_ctl_hw_t *hw = handle->private; @@ -166,6 +172,7 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event) snd_ctl_ops_t snd_ctl_hw_ops = { close: snd_ctl_hw_close, + card: snd_ctl_hw_card, poll_descriptor: snd_ctl_hw_poll_descriptor, hw_info: snd_ctl_hw_hw_info, clist: snd_ctl_hw_clist, diff --git a/src/control/control_local.h b/src/control/control_local.h index 9a13521e..5bd9f197 100644 --- a/src/control/control_local.h +++ b/src/control/control_local.h @@ -33,6 +33,7 @@ typedef struct { int (*close)(snd_ctl_t *handle); + int (*card)(snd_ctl_t *handle); int (*poll_descriptor)(snd_ctl_t *handle); int (*hw_info)(snd_ctl_t *handle, snd_ctl_hw_info_t *info); int (*clist)(snd_ctl_t *handle, snd_control_list_t *list); diff --git a/src/control/control_shm.c b/src/control/control_shm.c index fad8a41a..e5131d33 100644 --- a/src/control/control_shm.c +++ b/src/control/control_shm.c @@ -95,6 +95,18 @@ static int snd_ctl_shm_close(snd_ctl_t *ctl) return result; } +static int snd_ctl_shm_card(snd_ctl_t *ctl) +{ + snd_ctl_shm_t *shm = ctl->private; + snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; + int card, err; + ctrl->cmd = SND_CTL_IOCTL_CARD; + err = snd_ctl_shm_action_fd(ctl, &card); + if (err < 0) + return err; + return card; +} + static int snd_ctl_shm_poll_descriptor(snd_ctl_t *ctl) { snd_ctl_shm_t *shm = ctl->private; @@ -310,6 +322,7 @@ static int snd_ctl_shm_read(snd_ctl_t *ctl, snd_ctl_event_t *event) snd_ctl_ops_t snd_ctl_shm_ops = { close: snd_ctl_shm_close, + card: snd_ctl_shm_card, poll_descriptor: snd_ctl_shm_poll_descriptor, hw_info: snd_ctl_shm_hw_info, clist: snd_ctl_shm_clist, diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index bb96a900..d46bbdc4 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -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 diff --git a/src/pcm/pcm_adpcm.c b/src/pcm/pcm_adpcm.c index 18307132..4c184abb 100644 --- a/src/pcm/pcm_adpcm.c +++ b/src/pcm/pcm_adpcm.c @@ -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, diff --git a/src/pcm/pcm_alaw.c b/src/pcm/pcm_alaw.c index 6459b0b5..8fd84589 100644 --- a/src/pcm/pcm_alaw.c +++ b/src/pcm/pcm_alaw.c @@ -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, diff --git a/src/pcm/pcm_copy.c b/src/pcm/pcm_copy.c index 25773dfa..594ead57 100644 --- a/src/pcm/pcm_copy.c +++ b/src/pcm/pcm_copy.c @@ -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, diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 55ca5693..4a801405 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -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, diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 63dea446..77bf9d94 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -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, diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c index 9ecb5252..6fb66128 100644 --- a/src/pcm/pcm_linear.c +++ b/src/pcm/pcm_linear.c @@ -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, diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 6bfdb707..5c354ab4 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -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); diff --git a/src/pcm/pcm_mulaw.c b/src/pcm/pcm_mulaw.c index ec0642f1..55dc7dac 100644 --- a/src/pcm/pcm_mulaw.c +++ b/src/pcm/pcm_mulaw.c @@ -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, diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index f36dd222..c4e5f425 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -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, diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c index 171a79e4..0e3ad1aa 100644 --- a/src/pcm/pcm_null.c +++ b/src/pcm/pcm_null.c @@ -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, diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 0019c6e2..1206af6b 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -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, diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 342cbe27..f7b53696 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -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; diff --git a/src/pcm/pcm_plugin.h b/src/pcm/pcm_plugin.h index cf58714e..24e68915 100644 --- a/src/pcm/pcm_plugin.h +++ b/src/pcm/pcm_plugin.h @@ -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); diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index ffb9349c..2e091416 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -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, diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index 3aec22a2..ad33740c 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -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, diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c index 071f59f0..ccb3870a 100644 --- a/src/pcm/pcm_share.c +++ b/src/pcm/pcm_share.c @@ -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, diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c index c9e73057..4655a252 100644 --- a/src/pcm/pcm_shm.c +++ b/src/pcm/pcm_shm.c @@ -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, diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c index 536098a7..50d89bda 100644 --- a/src/rawmidi/rawmidi.c +++ b/src/rawmidi/rawmidi.c @@ -41,6 +41,12 @@ int snd_rawmidi_close(snd_rawmidi_t *rmidi) return 0; } +int snd_rawmidi_card(snd_rawmidi_t *rmidi) +{ + assert(rmidi); + return rmidi->ops->card(rmidi); +} + int snd_rawmidi_poll_descriptor(snd_rawmidi_t *rmidi) { assert(rmidi); diff --git a/src/rawmidi/rawmidi_hw.c b/src/rawmidi/rawmidi_hw.c index 8a2590c6..a5b5ec95 100644 --- a/src/rawmidi/rawmidi_hw.c +++ b/src/rawmidi/rawmidi_hw.c @@ -50,6 +50,12 @@ static int snd_rawmidi_hw_close(snd_rawmidi_t *rmidi) return 0; } +static int snd_rawmidi_hw_card(snd_rawmidi_t *rmidi) +{ + snd_rawmidi_hw_t *hw = rmidi->private; + return hw->card; +} + static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int nonblock) { snd_rawmidi_hw_t *hw = rmidi->private; @@ -142,6 +148,7 @@ static ssize_t snd_rawmidi_hw_read(snd_rawmidi_t *rmidi, void *buffer, size_t si snd_rawmidi_ops_t snd_rawmidi_hw_ops = { close: snd_rawmidi_hw_close, + card: snd_rawmidi_hw_card, nonblock: snd_rawmidi_hw_nonblock, info: snd_rawmidi_hw_info, params: snd_rawmidi_hw_params, diff --git a/src/rawmidi/rawmidi_local.h b/src/rawmidi/rawmidi_local.h index 81b303de..16f7c037 100644 --- a/src/rawmidi/rawmidi_local.h +++ b/src/rawmidi/rawmidi_local.h @@ -36,6 +36,7 @@ typedef struct { int (*close)(snd_rawmidi_t *rawmidi); + int (*card)(snd_rawmidi_t *rawmidi); int (*nonblock)(snd_rawmidi_t *rawmidi, int nonblock); int (*info)(snd_rawmidi_t *rawmidi, snd_rawmidi_info_t *info); int (*params)(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params); |