summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink.c
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2011-03-02 11:38:01 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2011-05-02 11:54:48 +0530
commit658a9153f094db9a30ac94428f4e46985e7096eb (patch)
tree311b0ec6d6bc46547c9d9752620a65c103732b5e /src/pulsecore/sink.c
parent8b3e68a202084467086af6c83e89c07adb9aa18a (diff)
sink-input: Kill passthrough streams if moving to an unsupported sink
This will eventually be replaced by a hook to let clients know that the stream has moved so that they can gracefully reconnect and renegotiate a supported format.
Diffstat (limited to 'src/pulsecore/sink.c')
-rw-r--r--src/pulsecore/sink.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 2b9402ab..626c7278 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -3292,6 +3292,33 @@ pa_idxset* pa_sink_get_formats(pa_sink *s) {
}
/* Called from the main thread */
+/* Checks if the sink can accept this format */
+pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f)
+{
+ pa_idxset *sink_formats = NULL;
+ pa_format_info *f_sink;
+ uint32_t i;
+ pa_bool_t ret = FALSE;
+
+ pa_assert(s);
+ pa_assert(f);
+
+ sink_formats = pa_sink_get_formats(s);
+
+ PA_IDXSET_FOREACH(f_sink, sink_formats, i) {
+ if (pa_format_info_is_compatible(f_sink, f)) {
+ ret = TRUE;
+ break;
+ }
+ }
+
+ if (sink_formats)
+ pa_idxset_free(sink_formats, (pa_free2_cb_t) pa_format_info_free2, NULL);
+
+ return ret;
+}
+
+/* Called from the main thread */
/* Calculates the intersection between formats supported by the sink and
* in_formats, and returns these, in the order of the sink's formats. */
pa_idxset* pa_sink_check_formats(pa_sink *s, pa_idxset *in_formats) {