summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-08-13 02:17:24 +0200
committerLennart Poettering <lennart@poettering.net>2009-08-13 02:17:24 +0200
commit5ee4069e9e68f81a71d208bb720d0c6bc6112fdc (patch)
treeee2244ea18f790632ab25e54826e0c9de7a0f84e /src/pulsecore
parent9a95fe49c848d2711dcdcf4c407e626e41e4657f (diff)
core: add functions to query max_rewind/max_request values from streams
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/sink-input.c19
-rw-r--r--src/pulsecore/sink-input.h4
-rw-r--r--src/pulsecore/source-output.c8
-rw-r--r--src/pulsecore/source-output.h2
4 files changed, 33 insertions, 0 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index c7837298..1f67d0fb 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -803,6 +803,25 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
}
/* Called from thread context */
+size_t pa_sink_input_get_max_rewind(pa_sink_input *i) {
+ pa_sink_input_assert_ref(i);
+ pa_sink_input_assert_io_context(i);
+
+ return i->thread_info.resampler ? pa_resampler_request(i->thread_info.resampler, i->sink->thread_info.max_rewind) : i->sink->thread_info.max_rewind;
+}
+
+/* Called from thread context */
+size_t pa_sink_input_get_max_request(pa_sink_input *i) {
+ pa_sink_input_assert_ref(i);
+ pa_sink_input_assert_io_context(i);
+
+ /* We're not verifying the status here, to allow this to be called
+ * in the state change handler between _INIT and _RUNNING */
+
+ return i->thread_info.resampler ? pa_resampler_request(i->thread_info.resampler, i->sink->thread_info.max_request) : i->sink->thread_info.max_request;
+}
+
+/* Called from thread context */
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_io_context(i);
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index 5ede1ca8..cd424e87 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -303,6 +303,10 @@ void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b);
int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate);
+/* This returns the sink's fields converted into out sample type */
+size_t pa_sink_input_get_max_rewind(pa_sink_input *i);
+size_t pa_sink_input_get_max_request(pa_sink_input *i);
+
/* Callable by everyone from main thread*/
/* External code may request disconnection with this function */
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index fdc00e15..5d79dbbb 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -537,6 +537,14 @@ void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in so
}
/* Called from thread context */
+size_t pa_source_output_get_max_rewind(pa_source_output *o) {
+ pa_source_output_assert_ref(o);
+ pa_source_output_assert_io_context(o);
+
+ return o->thread_info.resampler ? pa_resampler_request(o->thread_info.resampler, o->source->thread_info.max_rewind) : o->source->thread_info.max_rewind;
+}
+
+/* Called from thread context */
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_io_context(o);
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index 7b32c866..4bf88ca4 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -238,6 +238,8 @@ void pa_source_output_cork(pa_source_output *o, pa_bool_t b);
int pa_source_output_set_rate(pa_source_output *o, uint32_t rate);
+size_t pa_source_output_get_max_rewind(pa_source_output *o);
+
/* Callable by everyone */
/* External code may request disconnection with this funcion */