diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-05-18 10:45:06 +0000 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2005-05-18 10:45:06 +0000 |
commit | 842b5734245ac0035a955578434d6c3dd29ccfbc (patch) | |
tree | a40c9c09632d7d550880972d4bbbea6ae2e69210 | |
parent | cf4f4bc9c49eba76a0b45729cf2b35c63e9c033a (diff) |
Add poll_descriptors and poll_descriptors_count callbacks
Added poll_descriptors and poll_descriptors_count callbacks for multiple
poll_fd's.
-rw-r--r-- | src/pcm/pcm.c | 6 | ||||
-rw-r--r-- | src/pcm/pcm_adpcm.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_alaw.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_copy.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_file.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_generic.c | 12 | ||||
-rw-r--r-- | src/pcm/pcm_generic.h | 2 | ||||
-rw-r--r-- | src/pcm/pcm_hooks.c | 3 | ||||
-rw-r--r-- | src/pcm/pcm_iec958.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_ladspa.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_lfloat.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_linear.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_local.h | 2 | ||||
-rw-r--r-- | src/pcm/pcm_mulaw.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_multi.c | 24 | ||||
-rw-r--r-- | src/pcm/pcm_plug.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_rate.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_route.c | 2 | ||||
-rw-r--r-- | src/pcm/pcm_softvol.c | 2 |
19 files changed, 74 insertions, 1 deletions
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 5d5b0771..d93f3307 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -1273,7 +1273,9 @@ int snd_pcm_unlink(snd_pcm_t *pcm) int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm) { assert(pcm); - return 1; + if (pcm->ops->poll_descriptors_count) + return pcm->ops->poll_descriptors_count(pcm->op_arg); + return pcm->poll_fd_count; } @@ -1306,6 +1308,8 @@ int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int s int err; assert(pcm && pfds); + if (pcm->ops->poll_descriptors) + return pcm->ops->poll_descriptors(pcm->op_arg, pfds, space); if (pcm->fast_ops->poll_ask) { err = pcm->fast_ops->poll_ask(pcm->fast_op_arg); if (err < 0) diff --git a/src/pcm/pcm_adpcm.c b/src/pcm/pcm_adpcm.c index b9c32005..12b41c4d 100644 --- a/src/pcm/pcm_adpcm.c +++ b/src/pcm/pcm_adpcm.c @@ -529,6 +529,8 @@ static snd_pcm_ops_t snd_pcm_adpcm_ops = { .dump = snd_pcm_adpcm_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_alaw.c b/src/pcm/pcm_alaw.c index a76f15ac..30f2380b 100644 --- a/src/pcm/pcm_alaw.c +++ b/src/pcm/pcm_alaw.c @@ -400,6 +400,8 @@ static snd_pcm_ops_t snd_pcm_alaw_ops = { .dump = snd_pcm_alaw_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_copy.c b/src/pcm/pcm_copy.c index 64b4557b..a65f136a 100644 --- a/src/pcm/pcm_copy.c +++ b/src/pcm/pcm_copy.c @@ -163,6 +163,8 @@ static snd_pcm_ops_t snd_pcm_copy_ops = { .dump = snd_pcm_copy_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 3f876088..eaf9414a 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -347,6 +347,8 @@ static snd_pcm_ops_t snd_pcm_file_ops = { .dump = snd_pcm_file_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_file_mmap, .munmap = snd_pcm_file_munmap, diff --git a/src/pcm/pcm_generic.c b/src/pcm/pcm_generic.c index 7c26f5b4..ca7da520 100644 --- a/src/pcm/pcm_generic.c +++ b/src/pcm/pcm_generic.c @@ -56,6 +56,18 @@ int snd_pcm_generic_async(snd_pcm_t *pcm, int sig, pid_t pid) return snd_pcm_async(generic->slave, sig, pid); } +int snd_pcm_generic_poll_descriptors_count(snd_pcm_t *pcm) +{ + snd_pcm_generic_t *generic = pcm->private_data; + return snd_pcm_poll_descriptors_count(generic->slave); +} + +int snd_pcm_generic_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space) +{ + snd_pcm_generic_t *generic = pcm->private_data; + return snd_pcm_poll_descriptors(generic->slave, pfds, space); +} + int snd_pcm_generic_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) { snd_pcm_generic_t *generic = pcm->private_data; diff --git a/src/pcm/pcm_generic.h b/src/pcm/pcm_generic.h index 2d2b052a..4bcd123e 100644 --- a/src/pcm/pcm_generic.h +++ b/src/pcm/pcm_generic.h @@ -27,6 +27,8 @@ typedef struct { int snd_pcm_generic_close(snd_pcm_t *pcm); int snd_pcm_generic_nonblock(snd_pcm_t *pcm, int nonblock); int snd_pcm_generic_async(snd_pcm_t *pcm, int sig, pid_t pid); +int snd_pcm_generic_poll_descriptors_count(snd_pcm_t *pcm); +int snd_pcm_generic_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space); int snd_pcm_generic_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); int snd_pcm_generic_info(snd_pcm_t *pcm, snd_pcm_info_t * info); int snd_pcm_generic_hw_free(snd_pcm_t *pcm); diff --git a/src/pcm/pcm_hooks.c b/src/pcm/pcm_hooks.c index 608478b5..4efeb7fb 100644 --- a/src/pcm/pcm_hooks.c +++ b/src/pcm/pcm_hooks.c @@ -130,6 +130,9 @@ static snd_pcm_ops_t snd_pcm_hooks_ops = { .dump = snd_pcm_hooks_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, + .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, }; diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c index 04ec48c2..5586753b 100644 --- a/src/pcm/pcm_iec958.c +++ b/src/pcm/pcm_iec958.c @@ -423,6 +423,8 @@ static snd_pcm_ops_t snd_pcm_iec958_ops = { .dump = snd_pcm_iec958_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c index 3452a3b7..74f2762b 100644 --- a/src/pcm/pcm_ladspa.c +++ b/src/pcm/pcm_ladspa.c @@ -707,6 +707,8 @@ static snd_pcm_ops_t snd_pcm_ladspa_ops = { .dump = snd_pcm_ladspa_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_lfloat.c b/src/pcm/pcm_lfloat.c index deb58387..bfbf2891 100644 --- a/src/pcm/pcm_lfloat.c +++ b/src/pcm/pcm_lfloat.c @@ -359,6 +359,8 @@ static snd_pcm_ops_t snd_pcm_lfloat_ops = { .dump = snd_pcm_lfloat_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c index 03739238..e0dd6d4f 100644 --- a/src/pcm/pcm_linear.c +++ b/src/pcm/pcm_linear.c @@ -416,6 +416,8 @@ static snd_pcm_ops_t snd_pcm_linear_ops = { .dump = snd_pcm_linear_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 948e0f06..c2a89737 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -132,6 +132,8 @@ typedef struct { int (*close)(snd_pcm_t *pcm); int (*nonblock)(snd_pcm_t *pcm, int nonblock); int (*async)(snd_pcm_t *pcm, int sig, pid_t pid); + int (*poll_descriptors_count)(snd_pcm_t *pcm); + int (*poll_descriptors)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space); int (*poll_revents)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); int (*info)(snd_pcm_t *pcm, snd_pcm_info_t *info); int (*hw_refine)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); diff --git a/src/pcm/pcm_mulaw.c b/src/pcm/pcm_mulaw.c index 39564a38..72a5134c 100644 --- a/src/pcm/pcm_mulaw.c +++ b/src/pcm/pcm_mulaw.c @@ -415,6 +415,8 @@ static snd_pcm_ops_t snd_pcm_mulaw_ops = { .dump = snd_pcm_mulaw_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index ce3fc5ea..7847f27f 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -95,6 +95,27 @@ static int snd_pcm_multi_async(snd_pcm_t *pcm, int sig, pid_t pid) return snd_pcm_async(slave_0, sig, pid); } +static int snd_pcm_multi_poll_descriptors_count(snd_pcm_t *pcm) +{ + snd_pcm_multi_t *multi = pcm->private_data; + snd_pcm_t *slave_0 = multi->slaves[multi->master_slave].pcm; + return snd_pcm_poll_descriptors_count(slave_0); +} + +static int snd_pcm_multi_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space) +{ + snd_pcm_multi_t *multi = pcm->private_data; + snd_pcm_t *slave_0 = multi->slaves[multi->master_slave].pcm; + return snd_pcm_poll_descriptors(slave_0, pfds, space); +} + +static int snd_pcm_multi_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) +{ + snd_pcm_multi_t *multi = pcm->private_data; + snd_pcm_t *slave_0 = multi->slaves[multi->master_slave].pcm; + return snd_pcm_poll_descriptors_revents(slave_0, pfds, nfds, revents); +} + static int snd_pcm_multi_info(snd_pcm_t *pcm, snd_pcm_info_t *info) { snd_pcm_multi_t *multi = pcm->private_data; @@ -687,6 +708,9 @@ static snd_pcm_ops_t snd_pcm_multi_ops = { .dump = snd_pcm_multi_dump, .nonblock = snd_pcm_multi_nonblock, .async = snd_pcm_multi_async, + .poll_descriptors_count = snd_pcm_multi_poll_descriptors_count, + .poll_descriptors = snd_pcm_multi_poll_descriptors, + .poll_revents = snd_pcm_multi_poll_revents, .mmap = snd_pcm_multi_mmap, .munmap = snd_pcm_multi_munmap, }; diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index e71102a8..53ba4430 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -953,6 +953,8 @@ static snd_pcm_ops_t snd_pcm_plug_ops = { .dump = snd_pcm_plug_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_plug_mmap, .munmap = snd_pcm_plug_munmap, diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index cb831654..e36f193f 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -1377,6 +1377,8 @@ static snd_pcm_ops_t snd_pcm_rate_ops = { .dump = snd_pcm_rate_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index be612dfc..26a3dc6e 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -757,6 +757,8 @@ static snd_pcm_ops_t snd_pcm_route_ops = { .dump = snd_pcm_route_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c index 2b136524..e7b87769 100644 --- a/src/pcm/pcm_softvol.c +++ b/src/pcm/pcm_softvol.c @@ -583,6 +583,8 @@ static snd_pcm_ops_t snd_pcm_softvol_ops = { .dump = snd_pcm_softvol_dump, .nonblock = snd_pcm_generic_nonblock, .async = snd_pcm_generic_async, + .poll_descriptors_count = snd_pcm_generic_poll_descriptors_count, + .poll_descriptors = snd_pcm_generic_poll_descriptors, .poll_revents = snd_pcm_generic_poll_revents, .mmap = snd_pcm_generic_mmap, .munmap = snd_pcm_generic_munmap, |