]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/play-memblockq.c
scache: when playing a sample from the cache make sure not queue them up when the...
[pulseaudio] / src / pulsecore / play-memblockq.c
index 8b3e79b9386b7b033a934b6ec75f685c486f69a9..0d6da3eeddfbe43b3f301eb6410e17de1477d56b 100644 (file)
@@ -5,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -47,9 +47,8 @@ enum {
     MEMBLOCKQ_STREAM_MESSAGE_UNLINK,
 };
 
     MEMBLOCKQ_STREAM_MESSAGE_UNLINK,
 };
 
-PA_DECLARE_CLASS(memblockq_stream);
+PA_DEFINE_PRIVATE_CLASS(memblockq_stream, pa_msgobject);
 #define MEMBLOCKQ_STREAM(o) (memblockq_stream_cast(o))
 #define MEMBLOCKQ_STREAM(o) (memblockq_stream_cast(o))
-static PA_DEFINE_CHECK_TYPE(memblockq_stream, pa_msgobject);
 
 static void memblockq_stream_unlink(memblockq_stream *u) {
     pa_assert(u);
 
 static void memblockq_stream_unlink(memblockq_stream *u) {
     pa_assert(u);
@@ -109,7 +108,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s
      * we are heard right-away. */
     if (PA_SINK_INPUT_IS_LINKED(state) &&
         i->thread_info.state == PA_SINK_INPUT_INIT)
      * we are heard right-away. */
     if (PA_SINK_INPUT_IS_LINKED(state) &&
         i->thread_info.state == PA_SINK_INPUT_INIT)
-        pa_sink_input_request_rewind(i, 0, FALSE, TRUE);
+        pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE);
 }
 
 static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) {
 }
 
 static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) {
@@ -146,7 +145,6 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
     memblockq_stream *u;
 
     pa_sink_input_assert_ref(i);
     memblockq_stream *u;
 
     pa_sink_input_assert_ref(i);
-    pa_assert(nbytes > 0);
     u = MEMBLOCKQ_STREAM(i->userdata);
     memblockq_stream_assert_ref(u);
 
     u = MEMBLOCKQ_STREAM(i->userdata);
     memblockq_stream_assert_ref(u);
 
@@ -175,7 +173,8 @@ pa_sink_input* pa_memblockq_sink_input_new(
         const pa_channel_map *map,
         pa_memblockq *q,
         pa_cvolume *volume,
         const pa_channel_map *map,
         pa_memblockq *q,
         pa_cvolume *volume,
-        pa_proplist *p) {
+        pa_proplist *p,
+        pa_sink_input_flags_t flags) {
 
     memblockq_stream *u = NULL;
     pa_sink_input_new_data data;
 
     memblockq_stream *u = NULL;
     pa_sink_input_new_data data;
@@ -200,8 +199,9 @@ pa_sink_input* pa_memblockq_sink_input_new(
     pa_sink_input_new_data_set_channel_map(&data, map);
     pa_sink_input_new_data_set_volume(&data, volume);
     pa_proplist_update(data.proplist, PA_UPDATE_REPLACE, p);
     pa_sink_input_new_data_set_channel_map(&data, map);
     pa_sink_input_new_data_set_volume(&data, volume);
     pa_proplist_update(data.proplist, PA_UPDATE_REPLACE, p);
+    data.flags |= flags;
 
 
-    u->sink_input = pa_sink_input_new(sink->core, &data, 0);
+    pa_sink_input_new(&u->sink_input, sink->core, &data);
     pa_sink_input_new_data_done(&data);
 
     if (!u->sink_input)
     pa_sink_input_new_data_done(&data);
 
     if (!u->sink_input)
@@ -239,6 +239,7 @@ int pa_play_memblockq(
         pa_memblockq *q,
         pa_cvolume *volume,
         pa_proplist *p,
         pa_memblockq *q,
         pa_cvolume *volume,
         pa_proplist *p,
+        pa_sink_input_flags_t flags,
         uint32_t *sink_input_index) {
 
     pa_sink_input *i;
         uint32_t *sink_input_index) {
 
     pa_sink_input *i;
@@ -247,7 +248,7 @@ int pa_play_memblockq(
     pa_assert(ss);
     pa_assert(q);
 
     pa_assert(ss);
     pa_assert(q);
 
-    if (!(i = pa_memblockq_sink_input_new(sink, ss, map, q, volume, p)))
+    if (!(i = pa_memblockq_sink_input_new(sink, ss, map, q, volume, p, flags)))
         return -1;
 
     pa_sink_input_put(i);
         return -1;
 
     pa_sink_input_put(i);