summaryrefslogtreecommitdiffstats
path: root/polyp/alsa-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-11-21 02:43:05 +0000
committerLennart Poettering <lennart@poettering.net>2004-11-21 02:43:05 +0000
commitfa751e537db75108f9a1597d83a4e1093173fc28 (patch)
treed07c63ecfbc618599c88a089055713f98b02f9ba /polyp/alsa-util.c
parent6985eda9347730d4506de630c310a34e7844df0a (diff)
some commenting
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@298 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/alsa-util.c')
-rw-r--r--polyp/alsa-util.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/polyp/alsa-util.c b/polyp/alsa-util.c
index eaa21d49..52eaaed4 100644
--- a/polyp/alsa-util.c
+++ b/polyp/alsa-util.c
@@ -30,7 +30,9 @@
#include "sample.h"
#include "xmalloc.h"
-int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, struct pa_sample_spec *ss, uint32_t *periods, snd_pcm_uframes_t *period_size) {
+/* Set the hardware parameters of the given ALSA device. Returns the
+ * selected fragment settings in *period/*period_size */
+int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, const struct pa_sample_spec *ss, uint32_t *periods, snd_pcm_uframes_t *period_size) {
int ret = -1;
snd_pcm_uframes_t buffer_size;
snd_pcm_hw_params_t *hwparams = NULL;
@@ -79,6 +81,11 @@ finish:
return ret;
}
+/* Allocate an IO event for every ALSA poll descriptor for the
+ * specified ALSA device. Return a pointer to such an array in
+ * *io_events. Store the length of that array in *n_io_events. Use the
+ * specified callback function and userdata. The array has to be freed
+ * with pa_free_io_events(). */
int pa_create_io_events(snd_pcm_t *pcm_handle, struct pa_mainloop_api* m, struct pa_io_event ***io_events, unsigned *n_io_events, void (*cb)(struct pa_mainloop_api*a, struct pa_io_event *e, int fd, enum pa_io_event_flags events, void *userdata), void *userdata) {
unsigned i;
struct pollfd *pfds, *ppfd;
@@ -106,6 +113,7 @@ int pa_create_io_events(snd_pcm_t *pcm_handle, struct pa_mainloop_api* m, struct
return 0;
}
+/* Free the memory allocated by pa_create_io_events() */
void pa_free_io_events(struct pa_mainloop_api* m, struct pa_io_event **io_events, unsigned n_io_events) {
unsigned i;
struct pa_io_event **ios;