[pulseaudio-commits] r1570 - /branches/lennart/src/pulsecore/sound-file-stream.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Aug 4 17:06:36 PDT 2007


Author: lennart
Date: Sun Aug  5 02:06:35 2007
New Revision: 1570

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

Modified:
    branches/lennart/src/pulsecore/sound-file-stream.c

Modified: branches/lennart/src/pulsecore/sound-file-stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
sound-file-stream.c?rev=3D1570&root=3Dpulseaudio&r1=3D1569&r2=3D1570&view=
=3Ddiff
=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/pulsecore/sound-file-stream.c (original)
+++ branches/lennart/src/pulsecore/sound-file-stream.c Sun Aug  5 02:06:35 =
2007
@@ -39,6 +39,8 @@
 #include "sound-file-stream.h"
 =

 #define BUF_SIZE (1024*10)
+
+/* FIXME: file access needs to be moved to seperate thread */
 =

 typedef struct file_stream {
     pa_msgobject parent;
@@ -58,10 +60,27 @@
 #define FILE_STREAM(o) (file_stream_cast(o))
 static PA_DEFINE_CHECK_TYPE(file_stream, pa_msgobject);
 =

+static void file_stream_unlink(file_stream *u) {
+    pa_assert(u);
+
+    if (!u->sink_input)
+        return;
+    =

+    pa_sink_input_disconnect(u->sink_input);
+    =

+    pa_sink_input_unref(u->sink_input);
+    u->sink_input =3D NULL;
+    =

+    /* Make sure we don't decrease the ref count twice. */
+    file_stream_unref(u);
+}
+
 static void file_stream_free(pa_object *o) {
     file_stream *u =3D FILE_STREAM(o);
     pa_assert(u);
 =

+    file_stream_unlink(u);
+    =

     if (u->memchunk.memblock)
         pa_memblock_unref(u->memchunk.memblock);
 =

@@ -69,20 +88,6 @@
         sf_close(u->sndfile);
 =

     pa_xfree(u);
-}
-
-static void file_stream_drop(file_stream *u) {
-    file_stream_assert_ref(u);
-
-    if (u->sink_input) {
-        pa_sink_input_disconnect(u->sink_input);
-
-        pa_sink_input_unref(u->sink_input);
-        u->sink_input =3D NULL;
-
-        /* Make sure we don't decrease the ref count twice. */
-        file_stream_unref(u);
-    }
 }
 =

 static int file_stream_process_msg(pa_msgobject *o, int code, void*userdat=
a, int64_t offset, pa_memchunk *chunk) {
@@ -91,7 +96,7 @@
     =

     switch (code) {
         case MESSAGE_DROP_FILE_STREAM:
-            file_stream_drop(u);
+            file_stream_unlink(u);
             break;
     }
 =

@@ -99,9 +104,9 @@
 }
 =

 static void sink_input_kill_cb(pa_sink_input *i) {
-    pa_assert(i);
-    =

-    file_stream_drop(FILE_STREAM(i->userdata));
+    pa_sink_input_assert_ref(i);
+    =

+    file_stream_unlink(FILE_STREAM(i->userdata));
 }
 =

 static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {




More information about the pulseaudio-commits mailing list