[pulseaudio-commits] r2303 - /branches/glitch-free/src/modules/alsa-util.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed Apr 23 11:12:47 PDT 2008


Author: lennart
Date: Wed Apr 23 20:12:46 2008
New Revision: 2303

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2303&root=pulseaudio&view=rev
Log:
add new function pa_alsa_build_pollfd() to alsa-util to unify a bit more common code from the sink and the source

Modified:
    branches/glitch-free/src/modules/alsa-util.c

Modified: branches/glitch-free/src/modules/alsa-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/modules/alsa-util.c?rev=2303&root=pulseaudio&r1=2302&r2=2303&view=diff
==============================================================================
--- branches/glitch-free/src/modules/alsa-util.c (original)
+++ branches/glitch-free/src/modules/alsa-util.c Wed Apr 23 20:12:46 2008
@@ -1093,3 +1093,27 @@
 
     return 0;
 }
+
+pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll) {
+    int n, err;
+    struct pollfd *pollfd;
+    pa_rtpoll_item *item;
+
+    pa_assert(pcm);
+
+    if ((n = snd_pcm_poll_descriptors_count(pcm)) < 0) {
+        pa_log("snd_pcm_poll_descriptors_count() failed: %s", snd_strerror(n));
+        return NULL;
+    }
+
+    item = pa_rtpoll_item_new(rtpoll, PA_RTPOLL_NEVER, n);
+    pollfd = pa_rtpoll_item_get_pollfd(item, NULL);
+
+    if ((err = snd_pcm_poll_descriptors(pcm, pollfd, n)) < 0) {
+        pa_log("snd_pcm_poll_descriptors() failed: %s", snd_strerror(err));
+        pa_rtpoll_item_free(item);
+        return NULL;
+    }
+
+    return item;
+}




More information about the pulseaudio-commits mailing list