[pulseaudio-commits] r1704 - /branches/lennart/src/modules/module-alsa-sink.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed Aug 22 15:27:09 PDT 2007


Author: lennart
Date: Thu Aug 23 00:27:07 2007
New Revision: 1704

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1704&root=3Dpulseaudio&vi=
ew=3Drev
Log:
minor cleanups

Modified:
    branches/lennart/src/modules/module-alsa-sink.c

Modified: branches/lennart/src/modules/module-alsa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/mo=
dule-alsa-sink.c?rev=3D1704&root=3Dpulseaudio&r1=3D1703&r2=3D1704&view=3Ddi=
ff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/modules/module-alsa-sink.c (original)
+++ branches/lennart/src/modules/module-alsa-sink.c Thu Aug 23 00:27:07 2007
@@ -27,12 +27,6 @@
 #endif
 =

 #include <stdio.h>
-
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
-#else
-#include "poll.h"
-#endif
 =

 #include <asoundlib.h>
 =

@@ -343,7 +337,8 @@
     pa_assert(u);
     pa_assert(u->pcm_handle);
 =

-    snd_pcm_drain(u->pcm_handle);    /* Let's suspend */
+    /* Let's suspend */
+    snd_pcm_drain(u->pcm_handle);    =

     snd_pcm_close(u->pcm_handle);
     u->pcm_handle =3D NULL;
 =

@@ -624,8 +619,6 @@
         if (PA_SINK_OPENED(u->sink->thread_info.state)) {
             int work_done =3D 0;
             =

-            pa_assert(u->pcm_handle);
-
             if (u->use_mmap) {
                 if ((work_done =3D mmap_write(u)) < 0)
                     goto fail;
@@ -647,8 +640,6 @@
         /* Check whether there is a message for us to process */
         if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &off=
set, &chunk, 0) =3D=3D 0) {
             int ret;
-
-/*             pa_log("processing msg");  */
 =

             if (!object && code =3D=3D PA_MESSAGE_SHUTDOWN) {
                 pa_asyncmsgq_done(u->thread_mq.inq, 0);
@@ -707,7 +698,6 @@
 int pa__init(pa_module*m) {
     =

     pa_modargs *ma =3D NULL;
-    int ret =3D -1;
     struct userdata *u =3D NULL;
     const char *dev;
     pa_sample_spec ss;
@@ -723,6 +713,8 @@
     int namereg_fail;
     int use_mmap =3D 1, b;
 =

+    snd_pcm_info_alloca(&pcm_info);
+    =

     pa_assert(m);
 =

     if (!(ma =3D pa_modargs_new(m->argument, valid_modargs))) {
@@ -773,8 +765,7 @@
 =

     u->device_name =3D pa_xstrdup(dev);
 =

-    if ((err =3D snd_pcm_info_malloc(&pcm_info)) < 0 ||
-        (err =3D snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
+    if ((err =3D snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
         pa_log("Error fetching PCM info: %s", snd_strerror(err));
         goto fail;
     }
@@ -903,24 +894,18 @@
     if (u->sink->get_mute)
         u->sink->get_mute(u->sink);
 =

-    ret =3D 0;
-
-finish:
-
-     if (ma)
-         pa_modargs_free(ma);
-     =

-     if (pcm_info)
-         snd_pcm_info_free(pcm_info);
-
-    return ret;
-
+    pa_modargs_free(ma);
+    =

+    return 0;
+    =

 fail:
 =

-    if (u)
-        pa__done(m);
-
-    goto finish;
+    if (ma)
+        pa_modargs_free(ma);
+
+    pa__done(m);
+
+    return -1;
 }
 =

 void pa__done(pa_module*m) {




More information about the pulseaudio-commits mailing list