rename sink_input->rewind to process_rewind() and set_max_rewind to update_max_rewind()
authorLennart Poettering <lennart@poettering.net>
Sun, 20 Apr 2008 20:35:44 +0000 (20:35 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 20 Apr 2008 20:35:44 +0000 (20:35 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2284 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/pulsecore/play-memblockq.c
src/pulsecore/protocol-native.c
src/pulsecore/sink-input.c
src/pulsecore/sink-input.h
src/pulsecore/sink.c
src/pulsecore/sound-file-stream.c
src/pulsecore/source-output.c
src/pulsecore/source-output.h
src/pulsecore/source.c

index 7b9b8fb..99b5913 100644 (file)
@@ -127,7 +127,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
     return 0;
 }
 
-static void sink_input_rewind_cb(pa_sink_input *i, size_t nbytes) {
+static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
     memblockq_stream *u;
 
     pa_sink_input_assert_ref(i);
@@ -141,7 +141,7 @@ static void sink_input_rewind_cb(pa_sink_input *i, size_t nbytes) {
     pa_memblockq_rewind(u->memblockq, nbytes);
 }
 
-static void sink_input_set_max_rewind(pa_sink_input *i, size_t nbytes) {
+static void sink_input_update_max_rewind(pa_sink_input *i, size_t nbytes) {
     memblockq_stream *u;
 
     pa_sink_input_assert_ref(i);
@@ -193,8 +193,8 @@ pa_sink_input* pa_memblockq_sink_input_new(
         goto fail;
 
     u->sink_input->pop = sink_input_pop_cb;
-    u->sink_input->rewind = sink_input_rewind_cb;
-    u->sink_input->set_max_rewind = sink_input_set_max_rewind;
+    u->sink_input->process_rewind = sink_input_process_rewind_cb;
+    u->sink_input->update_max_rewind = sink_input_update_max_rewind;
     u->sink_input->kill = sink_input_kill_cb;
     u->sink_input->userdata = u;
 
index 37200db..42baf8d 100644 (file)
@@ -209,8 +209,8 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk
 static void sink_input_kill_cb(pa_sink_input *i);
 static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend);
 static void sink_input_moved_cb(pa_sink_input *i);
-static void sink_input_rewind_cb(pa_sink_input *i, size_t nbytes);
-static void sink_input_set_max_rewind_cb(pa_sink_input *i, size_t nbytes);
+static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes);
+static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes);
 
 
 static void send_memblock(connection *c);
@@ -760,8 +760,8 @@ static playback_stream* playback_stream_new(
 
     s->sink_input->parent.process_msg = sink_input_process_msg;
     s->sink_input->pop = sink_input_pop_cb;
-    s->sink_input->rewind = sink_input_rewind_cb;
-    s->sink_input->set_max_rewind = sink_input_set_max_rewind_cb;
+    s->sink_input->process_rewind = sink_input_process_rewind_cb;
+    s->sink_input->update_max_rewind = sink_input_update_max_rewind_cb;
     s->sink_input->kill = sink_input_kill_cb;
     s->sink_input->moved = sink_input_moved_cb;
     s->sink_input->suspend = sink_input_suspend_cb;
@@ -1228,7 +1228,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
     return 0;
 }
 
-static void sink_input_rewind_cb(pa_sink_input *i, size_t nbytes) {
+static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
     playback_stream *s;
 
     pa_sink_input_assert_ref(i);
@@ -1242,7 +1242,7 @@ static void sink_input_rewind_cb(pa_sink_input *i, size_t nbytes) {
     pa_memblockq_rewind(s->memblockq, nbytes);
 }
 
-static void sink_input_set_max_rewind_cb(pa_sink_input *i, size_t nbytes) {
+static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes) {
     playback_stream *s;
 
     pa_sink_input_assert_ref(i);
index 7e6c5de..ccb1ff1 100644 (file)
@@ -98,8 +98,8 @@ static void reset_callbacks(pa_sink_input *i) {
     pa_assert(i);
 
     i->pop = NULL;
-    i->rewind = NULL;
-    i->set_max_rewind = NULL;
+    i->process_rewind = NULL;
+    i->update_max_rewind = NULL;
     i->attach = NULL;
     i->detach = NULL;
     i->suspend = NULL;
@@ -394,7 +394,7 @@ void pa_sink_input_put(pa_sink_input *i) {
 
     pa_assert(i->state == PA_SINK_INPUT_INIT);
     pa_assert(i->pop);
-    pa_assert(i->rewind);
+    pa_assert(i->process_rewind);
 
     i->thread_info.volume = i->volume;
     i->thread_info.muted = i->muted;
@@ -651,8 +651,8 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
                 pa_log_debug("Have to rewind %lu bytes on implementor.", (unsigned long) amount);
 
                 /* Tell the implementor */
-                if (i->rewind)
-                    i->rewind(i, amount);
+                if (i->process_rewind)
+                    i->process_rewind(i, amount);
             }
 
             /* And reset the resampler */
@@ -668,15 +668,15 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
 }
 
 /* Called from thread context */
-void pa_sink_input_set_max_rewind(pa_sink_input *i, size_t nbytes  /* in the sink's sample spec */) {
+void pa_sink_input_update_max_rewind(pa_sink_input *i, size_t nbytes  /* in the sink's sample spec */) {
     pa_sink_input_assert_ref(i);
     pa_assert(PA_SINK_INPUT_LINKED(i->thread_info.state));
     pa_assert(pa_frame_aligned(nbytes, &i->sink->sample_spec));
 
     pa_memblockq_set_maxrewind(i->thread_info.render_memblockq, nbytes);
 
-    if (i->set_max_rewind)
-        i->set_max_rewind(i, i->thread_info.resampler ? pa_resampler_request(i->thread_info.resampler, nbytes) : nbytes);
+    if (i->update_max_rewind)
+        i->update_max_rewind(i, i->thread_info.resampler ? pa_resampler_request(i->thread_info.resampler, nbytes) : nbytes);
 }
 
 pa_usec_t pa_sink_input_set_requested_latency(pa_sink_input *i, pa_usec_t usec) {
index 184a2c4..b433edc 100644 (file)
@@ -103,11 +103,11 @@ struct pa_sink_input {
      * before peek() if it is called at all. Only called if the sink
      * input driver ever plans to call
      * pa_sink_input_request_rewind(). Called from IO context. */
-    void (*rewind) (pa_sink_input *i, size_t nbytes);     /* may NOT be NULL */
+    void (*process_rewind) (pa_sink_input *i, size_t nbytes);     /* may NOT be NULL */
 
     /* Called whenever the maximum rewindable size of the sink
      * changes. Called from RT context. */
-    void (*set_max_rewind) (pa_sink_input *i, size_t nbytes); /* may be NULL */
+    void (*update_max_rewind) (pa_sink_input *i, size_t nbytes); /* may be NULL */
 
     /* If non-NULL this function is called when the input is first
      * connected to a sink or when the rtpoll/asyncmsgq fields
@@ -267,7 +267,7 @@ pa_bool_t pa_sink_input_safe_to_remove(pa_sink_input *i);
 int pa_sink_input_peek(pa_sink_input *i, size_t length, pa_memchunk *chunk, pa_cvolume *volume);
 void pa_sink_input_drop(pa_sink_input *i, size_t length);
 void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in the sink's sample spec */);
-void pa_sink_input_set_max_rewind(pa_sink_input *i, size_t nbytes  /* in the sink's sample spec */);
+void pa_sink_input_update_max_rewind(pa_sink_input *i, size_t nbytes  /* in the sink's sample spec */);
 
 int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offset, pa_memchunk *chunk);
 
index f631de3..39468f1 100644 (file)
@@ -981,7 +981,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
                 i->thread_info.sync_next->thread_info.sync_prev = i;
             }
 
-            pa_sink_input_set_max_rewind(i, s->thread_info.max_rewind);
+            pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
 
             pa_assert(!i->thread_info.attached);
             i->thread_info.attached = TRUE;
@@ -1111,7 +1111,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
                 pa_hashmap_put(s->thread_info.inputs, PA_UINT32_TO_PTR(info->ghost_sink_input->index), pa_sink_input_ref(info->ghost_sink_input));
                 info->ghost_sink_input->thread_info.sync_prev = info->ghost_sink_input->thread_info.sync_next = NULL;
 
-                pa_sink_input_set_max_rewind(info->ghost_sink_input, s->thread_info.max_rewind);
+                pa_sink_input_update_max_rewind(info->ghost_sink_input, s->thread_info.max_rewind);
 
                 pa_assert(!info->ghost_sink_input->thread_info.attached);
                 info->ghost_sink_input->thread_info.attached = TRUE;
@@ -1314,7 +1314,7 @@ void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
     s->thread_info.max_rewind = max_rewind;
 
     while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL)))
-        pa_sink_input_set_max_rewind(i, s->thread_info.max_rewind);
+        pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
 
     if (s->monitor_source)
         pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind);
index 9030d6d..604723f 100644 (file)
@@ -198,7 +198,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk
     return -1;
 }
 
-static void sink_input_rewind_cb(pa_sink_input *i, size_t nbytes) {
+static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
     file_stream *u;
 
     pa_sink_input_assert_ref(i);
@@ -212,7 +212,7 @@ static void sink_input_rewind_cb(pa_sink_input *i, size_t nbytes) {
     pa_memblockq_rewind(u->memblockq, nbytes);
 }
 
-static void sink_input_set_max_rewind_cb(pa_sink_input *i, size_t nbytes) {
+static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes) {
     file_stream *u;
 
     pa_sink_input_assert_ref(i);
@@ -331,8 +331,8 @@ int pa_play_file(
         goto fail;
 
     u->sink_input->pop = sink_input_pop_cb;
-    u->sink_input->rewind = sink_input_rewind_cb;
-    u->sink_input->set_max_rewind = sink_input_set_max_rewind_cb;
+    u->sink_input->process_rewind = sink_input_process_rewind_cb;
+    u->sink_input->update_max_rewind = sink_input_update_max_rewind_cb;
     u->sink_input->kill = sink_input_kill_cb;
     u->sink_input->userdata = u;
 
index 318f6f8..c6dc9e8 100644 (file)
@@ -80,8 +80,8 @@ static void reset_callbacks(pa_source_output *o) {
     pa_assert(o);
 
     o->push = NULL;
-    o->rewind = NULL;
-    o->set_max_rewind = NULL;
+    o->process_rewind = NULL;
+    o->update_max_rewind = NULL;
     o->attach = NULL;
     o->detach = NULL;
     o->suspend = NULL;
@@ -376,7 +376,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) {
         pa_memblockq_seek(o->thread_info.delay_memblockq, chunk->length, PA_SEEK_RELATIVE);
     }
 
-    limit = o->rewind ? 0 : o->source->thread_info.max_rewind;
+    limit = o->process_rewind ? 0 : o->source->thread_info.max_rewind;
 
     /* Implement the delay queue */
     while ((length = pa_memblockq_get_length(o->thread_info.delay_memblockq)) > limit) {
@@ -418,7 +418,7 @@ void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in si
     if (nbytes <= 0)
         return;
 
-    if (o->rewind) {
+    if (o->process_rewind) {
         pa_assert(pa_memblockq_get_length(o->thread_info.delay_memblockq) == 0);
 
         if (o->thread_info.resampler)
@@ -427,7 +427,7 @@ void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in si
         pa_log_debug("Have to rewind %lu bytes on implementor.", (unsigned long) nbytes);
 
         if (nbytes > 0)
-            o->rewind(o, nbytes);
+            o->process_rewind(o, nbytes);
 
         if (o->thread_info.resampler)
             pa_resampler_reset(o->thread_info.resampler);
@@ -437,13 +437,13 @@ void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in si
 }
 
 /* Called from thread context */
-void pa_source_output_set_max_rewind(pa_source_output *o, size_t nbytes  /* in the source's sample spec */) {
+void pa_source_output_update_max_rewind(pa_source_output *o, size_t nbytes  /* in the source's sample spec */) {
     pa_source_output_assert_ref(o);
     pa_assert(PA_SOURCE_OUTPUT_LINKED(o->thread_info.state));
     pa_assert(pa_frame_aligned(nbytes, &o->source->sample_spec));
 
-    if (o->set_max_rewind)
-        o->set_max_rewind(o, o->thread_info.resampler ? pa_resampler_result(o->thread_info.resampler, nbytes) : nbytes);
+    if (o->update_max_rewind)
+        o->update_max_rewind(o, o->thread_info.resampler ? pa_resampler_result(o->thread_info.resampler, nbytes) : nbytes);
 }
 
 pa_usec_t pa_source_output_set_requested_latency(pa_source_output *o, pa_usec_t usec) {
index f79761a..e7d8963 100644 (file)
@@ -84,11 +84,11 @@ struct pa_source_output {
 
     /* Only relevant for monitor sources right now: called when the
      * recorded stream is rewound. */
-    void (*rewind)(pa_source_output *o, size_t nbytes);
+    void (*process_rewind)(pa_source_output *o, size_t nbytes);
 
     /* Called whenever the maximum rewindable size of the source
      * changes. Called from RT context. */
-    void (*set_max_rewind) (pa_source_output *o, size_t nbytes); /* may be NULL */
+    void (*update_max_rewind) (pa_source_output *o, size_t nbytes); /* may be NULL */
 
     /* If non-NULL this function is called when the output is first
      * connected to a source. Called from IO thread context */
@@ -209,7 +209,7 @@ int pa_source_output_move_to(pa_source_output *o, pa_source *dest);
 
 void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk);
 void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes);
-void pa_source_output_set_max_rewind(pa_source_output *o, size_t nbytes);
+void pa_source_output_update_max_rewind(pa_source_output *o, size_t nbytes);
 
 int pa_source_output_process_msg(pa_msgobject *mo, int code, void *userdata, int64_t offset, pa_memchunk *chunk);
 
index 0de78f4..8138a43 100644 (file)
@@ -582,7 +582,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_
 
             pa_hashmap_put(s->thread_info.outputs, PA_UINT32_TO_PTR(o->index), pa_source_output_ref(o));
 
-            pa_source_output_set_max_rewind(o, s->thread_info.max_rewind);
+            pa_source_output_update_max_rewind(o, s->thread_info.max_rewind);
 
             pa_assert(!o->thread_info.attached);
             o->thread_info.attached = TRUE;
@@ -769,7 +769,7 @@ void pa_source_set_max_rewind(pa_source *s, size_t max_rewind) {
     s->thread_info.max_rewind = max_rewind;
 
     while ((o = pa_hashmap_iterate(s->thread_info.outputs, &state, NULL)))
-        pa_source_output_set_max_rewind(o, s->thread_info.max_rewind);
+        pa_source_output_update_max_rewind(o, s->thread_info.max_rewind);
 }
 
 void pa_source_invalidate_requested_latency(pa_source *s) {