rename sink_input->rewind to process_rewind() and set_max_rewind to update_max_rewind()

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2284 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2008-04-20 20:35:44 +00:00
parent 62e7bc17c4
commit 5971345e99
9 changed files with 41 additions and 41 deletions

View file

@ -127,7 +127,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
return 0; 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; memblockq_stream *u;
pa_sink_input_assert_ref(i); 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); 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; memblockq_stream *u;
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
@ -193,8 +193,8 @@ pa_sink_input* pa_memblockq_sink_input_new(
goto fail; goto fail;
u->sink_input->pop = sink_input_pop_cb; u->sink_input->pop = sink_input_pop_cb;
u->sink_input->rewind = sink_input_rewind_cb; u->sink_input->process_rewind = sink_input_process_rewind_cb;
u->sink_input->set_max_rewind = sink_input_set_max_rewind; u->sink_input->update_max_rewind = sink_input_update_max_rewind;
u->sink_input->kill = sink_input_kill_cb; u->sink_input->kill = sink_input_kill_cb;
u->sink_input->userdata = u; u->sink_input->userdata = u;

View 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_kill_cb(pa_sink_input *i);
static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend); 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_moved_cb(pa_sink_input *i);
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);
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);
static void send_memblock(connection *c); 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->parent.process_msg = sink_input_process_msg;
s->sink_input->pop = sink_input_pop_cb; s->sink_input->pop = sink_input_pop_cb;
s->sink_input->rewind = sink_input_rewind_cb; s->sink_input->process_rewind = sink_input_process_rewind_cb;
s->sink_input->set_max_rewind = sink_input_set_max_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->kill = sink_input_kill_cb;
s->sink_input->moved = sink_input_moved_cb; s->sink_input->moved = sink_input_moved_cb;
s->sink_input->suspend = sink_input_suspend_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; 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; playback_stream *s;
pa_sink_input_assert_ref(i); 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); 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; playback_stream *s;
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);

View file

@ -98,8 +98,8 @@ static void reset_callbacks(pa_sink_input *i) {
pa_assert(i); pa_assert(i);
i->pop = NULL; i->pop = NULL;
i->rewind = NULL; i->process_rewind = NULL;
i->set_max_rewind = NULL; i->update_max_rewind = NULL;
i->attach = NULL; i->attach = NULL;
i->detach = NULL; i->detach = NULL;
i->suspend = 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->state == PA_SINK_INPUT_INIT);
pa_assert(i->pop); pa_assert(i->pop);
pa_assert(i->rewind); pa_assert(i->process_rewind);
i->thread_info.volume = i->volume; i->thread_info.volume = i->volume;
i->thread_info.muted = i->muted; 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); pa_log_debug("Have to rewind %lu bytes on implementor.", (unsigned long) amount);
/* Tell the implementor */ /* Tell the implementor */
if (i->rewind) if (i->process_rewind)
i->rewind(i, amount); i->process_rewind(i, amount);
} }
/* And reset the resampler */ /* 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 */ /* 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_sink_input_assert_ref(i);
pa_assert(PA_SINK_INPUT_LINKED(i->thread_info.state)); pa_assert(PA_SINK_INPUT_LINKED(i->thread_info.state));
pa_assert(pa_frame_aligned(nbytes, &i->sink->sample_spec)); pa_assert(pa_frame_aligned(nbytes, &i->sink->sample_spec));
pa_memblockq_set_maxrewind(i->thread_info.render_memblockq, nbytes); pa_memblockq_set_maxrewind(i->thread_info.render_memblockq, nbytes);
if (i->set_max_rewind) if (i->update_max_rewind)
i->set_max_rewind(i, i->thread_info.resampler ? pa_resampler_request(i->thread_info.resampler, nbytes) : nbytes); 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) { pa_usec_t pa_sink_input_set_requested_latency(pa_sink_input *i, pa_usec_t usec) {

View file

@ -103,11 +103,11 @@ struct pa_sink_input {
* before peek() if it is called at all. Only called if the sink * before peek() if it is called at all. Only called if the sink
* input driver ever plans to call * input driver ever plans to call
* pa_sink_input_request_rewind(). Called from IO context. */ * 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 /* Called whenever the maximum rewindable size of the sink
* changes. Called from RT context. */ * 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 /* If non-NULL this function is called when the input is first
* connected to a sink or when the rtpoll/asyncmsgq fields * 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); 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_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_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); int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offset, pa_memchunk *chunk);

View 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; 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); pa_assert(!i->thread_info.attached);
i->thread_info.attached = TRUE; 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)); 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; 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); pa_assert(!info->ghost_sink_input->thread_info.attached);
info->ghost_sink_input->thread_info.attached = TRUE; 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; s->thread_info.max_rewind = max_rewind;
while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL))) 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) if (s->monitor_source)
pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind); pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind);

View file

@ -198,7 +198,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk
return -1; 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; file_stream *u;
pa_sink_input_assert_ref(i); 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); 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; file_stream *u;
pa_sink_input_assert_ref(i); pa_sink_input_assert_ref(i);
@ -331,8 +331,8 @@ int pa_play_file(
goto fail; goto fail;
u->sink_input->pop = sink_input_pop_cb; u->sink_input->pop = sink_input_pop_cb;
u->sink_input->rewind = sink_input_rewind_cb; u->sink_input->process_rewind = sink_input_process_rewind_cb;
u->sink_input->set_max_rewind = sink_input_set_max_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->kill = sink_input_kill_cb;
u->sink_input->userdata = u; u->sink_input->userdata = u;

View file

@ -80,8 +80,8 @@ static void reset_callbacks(pa_source_output *o) {
pa_assert(o); pa_assert(o);
o->push = NULL; o->push = NULL;
o->rewind = NULL; o->process_rewind = NULL;
o->set_max_rewind = NULL; o->update_max_rewind = NULL;
o->attach = NULL; o->attach = NULL;
o->detach = NULL; o->detach = NULL;
o->suspend = 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); 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 */ /* Implement the delay queue */
while ((length = pa_memblockq_get_length(o->thread_info.delay_memblockq)) > limit) { 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) if (nbytes <= 0)
return; return;
if (o->rewind) { if (o->process_rewind) {
pa_assert(pa_memblockq_get_length(o->thread_info.delay_memblockq) == 0); pa_assert(pa_memblockq_get_length(o->thread_info.delay_memblockq) == 0);
if (o->thread_info.resampler) 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); pa_log_debug("Have to rewind %lu bytes on implementor.", (unsigned long) nbytes);
if (nbytes > 0) if (nbytes > 0)
o->rewind(o, nbytes); o->process_rewind(o, nbytes);
if (o->thread_info.resampler) if (o->thread_info.resampler)
pa_resampler_reset(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 */ /* 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_source_output_assert_ref(o);
pa_assert(PA_SOURCE_OUTPUT_LINKED(o->thread_info.state)); pa_assert(PA_SOURCE_OUTPUT_LINKED(o->thread_info.state));
pa_assert(pa_frame_aligned(nbytes, &o->source->sample_spec)); pa_assert(pa_frame_aligned(nbytes, &o->source->sample_spec));
if (o->set_max_rewind) if (o->update_max_rewind)
o->set_max_rewind(o, o->thread_info.resampler ? pa_resampler_result(o->thread_info.resampler, nbytes) : nbytes); 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) { pa_usec_t pa_source_output_set_requested_latency(pa_source_output *o, pa_usec_t usec) {

View file

@ -84,11 +84,11 @@ struct pa_source_output {
/* Only relevant for monitor sources right now: called when the /* Only relevant for monitor sources right now: called when the
* recorded stream is rewound. */ * 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 /* Called whenever the maximum rewindable size of the source
* changes. Called from RT context. */ * 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 /* If non-NULL this function is called when the output is first
* connected to a source. Called from IO thread context */ * 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_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_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); int pa_source_output_process_msg(pa_msgobject *mo, int code, void *userdata, int64_t offset, pa_memchunk *chunk);

View 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_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); pa_assert(!o->thread_info.attached);
o->thread_info.attached = TRUE; 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; s->thread_info.max_rewind = max_rewind;
while ((o = pa_hashmap_iterate(s->thread_info.outputs, &state, NULL))) 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) { void pa_source_invalidate_requested_latency(pa_source *s) {