[pulseaudio-commits] r2219 - in /branches/glitch-free/src/modules: alsa-util.c alsa-util.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Apr 7 09:46:15 PDT 2008


Author: lennart
Date: Mon Apr  7 18:46:13 2008
New Revision: 2219

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2219&root=pulseaudio&view=rev
Log:
add utility functions to dump alsa PCM state

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

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=2219&root=pulseaudio&r1=2218&r2=2219&view=diff
==============================================================================
--- branches/glitch-free/src/modules/alsa-util.c (original)
+++ branches/glitch-free/src/modules/alsa-util.c Mon Apr  7 18:46:13 2008
@@ -894,3 +894,46 @@
 
     snd_mixer_selem_set_capture_volume_all(elem, v);
 }
+
+void pa_alsa_dump(snd_pcm_t *pcm) {
+    int err;
+    snd_output_t *out;
+
+    pa_assert(pcm);
+
+    pa_assert_se(snd_output_buffer_open(&out) == 0);
+
+    if ((err = snd_pcm_dump(pcm, out)) < 0)
+        pa_log_debug("snd_pcm_dump(): %s", snd_strerror(err));
+    else {
+        char *s = NULL;
+        snd_output_buffer_string(out, &s);
+        pa_log_debug("snd_pcm_dump():\n%s", pa_strnull(s));
+    }
+
+    pa_assert_se(snd_output_close(out) == 0);
+}
+
+void pa_alsa_dump_status(snd_pcm_t *pcm) {
+    int err;
+    snd_output_t *out;
+    snd_pcm_status_t *status;
+
+    pa_assert(pcm);
+
+    snd_pcm_status_alloca(&status);
+
+    pa_assert_se(snd_output_buffer_open(&out) == 0);
+
+    pa_assert_se(snd_pcm_status(pcm, status) == 0);
+
+    if ((err = snd_pcm_status_dump(status, out)) < 0)
+        pa_log_debug("snd_pcm_dump(): %s", snd_strerror(err));
+    else {
+        char *s = NULL;
+        snd_output_buffer_string(out, &s);
+        pa_log_debug("snd_pcm_dump():\n%s", pa_strnull(s));
+    }
+
+    pa_assert_se(snd_output_close(out) == 0);
+}

Modified: branches/glitch-free/src/modules/alsa-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/modules/alsa-util.h?rev=2219&root=pulseaudio&r1=2218&r2=2219&view=diff
==============================================================================
--- branches/glitch-free/src/modules/alsa-util.h (original)
+++ branches/glitch-free/src/modules/alsa-util.h Mon Apr  7 18:46:13 2008
@@ -82,4 +82,7 @@
 void pa_alsa_0dB_playback(snd_mixer_elem_t *elem);
 void pa_alsa_0dB_capture(snd_mixer_elem_t *elem);
 
+void pa_alsa_dump(snd_pcm_t *pcm);
+void pa_alsa_dump_status(snd_pcm_t *pcm);
+
 #endif




More information about the pulseaudio-commits mailing list