make pa_source_set_max_rewind() work similar to pa_sink_set_max_rewind()

This commit is contained in:
Lennart Poettering 2009-03-25 00:26:44 +01:00
parent 9151107cb9
commit 9bca59efc1
2 changed files with 20 additions and 2 deletions

View file

@ -956,6 +956,11 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_
*((size_t*) userdata) = s->thread_info.max_rewind; *((size_t*) userdata) = s->thread_info.max_rewind;
return 0; return 0;
case PA_SOURCE_MESSAGE_SET_MAX_REWIND:
pa_source_set_max_rewind_within_thread(s, (size_t) offset);
return 0;
case PA_SOURCE_MESSAGE_GET_LATENCY: case PA_SOURCE_MESSAGE_GET_LATENCY:
if (s->monitor_of) { if (s->monitor_of) {
@ -1083,7 +1088,7 @@ pa_usec_t pa_source_get_requested_latency(pa_source *s) {
} }
/* Called from IO thread */ /* Called from IO thread */
void pa_source_set_max_rewind(pa_source *s, size_t max_rewind) { void pa_source_set_max_rewind_within_thread(pa_source *s, size_t max_rewind) {
pa_source_output *o; pa_source_output *o;
void *state = NULL; void *state = NULL;
@ -1100,6 +1105,17 @@ void pa_source_set_max_rewind(pa_source *s, size_t max_rewind) {
} }
} }
/* Called from main thread */
void pa_source_set_max_rewind(pa_source *s, size_t max_rewind) {
pa_source_assert_ref(s);
if (PA_SOURCE_IS_LINKED(s->state))
pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_SET_MAX_REWIND, NULL, max_rewind, NULL) == 0);
else
pa_source_set_max_rewind_within_thread(s, max_rewind);
}
/* Called from IO thread */
void pa_source_invalidate_requested_latency(pa_source *s) { void pa_source_invalidate_requested_latency(pa_source *s) {
pa_source_output *o; pa_source_output *o;
void *state = NULL; void *state = NULL;

View file

@ -159,6 +159,7 @@ typedef enum pa_source_message {
PA_SOURCE_MESSAGE_SET_LATENCY_RANGE, PA_SOURCE_MESSAGE_SET_LATENCY_RANGE,
PA_SOURCE_MESSAGE_GET_LATENCY_RANGE, PA_SOURCE_MESSAGE_GET_LATENCY_RANGE,
PA_SOURCE_MESSAGE_GET_MAX_REWIND, PA_SOURCE_MESSAGE_GET_MAX_REWIND,
PA_SOURCE_MESSAGE_SET_MAX_REWIND,
PA_SOURCE_MESSAGE_MAX PA_SOURCE_MESSAGE_MAX
} pa_source_message_t; } pa_source_message_t;
@ -205,6 +206,7 @@ void pa_source_set_description(pa_source *s, const char *description);
void pa_source_set_asyncmsgq(pa_source *s, pa_asyncmsgq *q); void pa_source_set_asyncmsgq(pa_source *s, pa_asyncmsgq *q);
void pa_source_set_rtpoll(pa_source *s, pa_rtpoll *p); void pa_source_set_rtpoll(pa_source *s, pa_rtpoll *p);
void pa_source_set_max_rewind(pa_source *s, size_t max_rewind);
void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency); void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency);
void pa_source_detach(pa_source *s); void pa_source_detach(pa_source *s);
@ -259,7 +261,7 @@ void pa_source_detach_within_thread(pa_source *s);
pa_usec_t pa_source_get_requested_latency_within_thread(pa_source *s); pa_usec_t pa_source_get_requested_latency_within_thread(pa_source *s);
void pa_source_set_max_rewind(pa_source *s, size_t max_rewind); void pa_source_set_max_rewind_within_thread(pa_source *s, size_t max_rewind);
void pa_source_set_latency_range_within_thread(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency); void pa_source_set_latency_range_within_thread(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency);
/*** To be called exclusively by source output drivers, from IO context */ /*** To be called exclusively by source output drivers, from IO context */