summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <git@arunraghavan.net>2015-06-09 12:06:48 +0530
committerArun Raghavan <git@arunraghavan.net>2015-06-12 12:43:18 +0530
commit81f7589a3fcba771e94d2aec67fb9e04a44e7086 (patch)
tree61c291491a224a5d22e379c9652845bf86f448b9
parent5adb126259958ab106584034f6a3c94a8ec4af60 (diff)
downloadpulseaudio-81f7589a3fcba771e94d2aec67fb9e04a44e7086.tar.gz
sink,source: Add a helper function to check whether this is a filter
-rw-r--r--src/modules/module-filter-apply.c4
-rw-r--r--src/pulsecore/sink.c9
-rw-r--r--src/pulsecore/sink.h2
-rw-r--r--src/pulsecore/source.c9
-rw-r--r--src/pulsecore/source.h2
5 files changed, 22 insertions, 4 deletions
diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c
index 5a927a3e2..c3f83ce2c 100644
--- a/src/modules/module-filter-apply.c
+++ b/src/modules/module-filter-apply.c
@@ -356,7 +356,7 @@ static void find_filters_for_module(struct userdata *u, pa_module *m, const char
PA_IDXSET_FOREACH(sink, u->core->sinks, idx) {
if (sink->module == m) {
- pa_assert(sink->input_to_master != NULL);
+ pa_assert(pa_sink_is_filter(sink));
fltr = filter_new(name, sink->input_to_master->sink, NULL);
fltr->module_index = m->index;
@@ -368,7 +368,7 @@ static void find_filters_for_module(struct userdata *u, pa_module *m, const char
PA_IDXSET_FOREACH(source, u->core->sources, idx) {
if (source->module == m && !source->monitor_of) {
- pa_assert(source->output_from_master != NULL);
+ pa_assert(pa_source_is_filter(source));
if (!fltr) {
fltr = filter_new(name, NULL, source->output_from_master->source);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index a22c19939..c2bf0e448 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -580,7 +580,7 @@ void pa_sink_put(pa_sink* s) {
pa_assert_ctl_context();
pa_assert(s->state == PA_SINK_INIT);
- pa_assert(!(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER) || s->input_to_master);
+ pa_assert(!(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER) || pa_sink_is_filter(s));
/* The following fields must be initialized properly when calling _put() */
pa_assert(s->asyncmsgq);
@@ -1558,6 +1558,13 @@ pa_sink *pa_sink_get_master(pa_sink *s) {
}
/* Called from main context */
+bool pa_sink_is_filter(pa_sink *s) {
+ pa_sink_assert_ref(s);
+
+ return (s->input_to_master != NULL);
+}
+
+/* Called from main context */
bool pa_sink_is_passthrough(pa_sink *s) {
pa_sink_input *alt_i;
uint32_t idx;
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index ed0f9eeea..3ae824036 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -440,6 +440,8 @@ bool pa_sink_flat_volume_enabled(pa_sink *s);
/* Get the master sink when sharing volumes */
pa_sink *pa_sink_get_master(pa_sink *s);
+bool pa_sink_is_filter(pa_sink *s);
+
/* Is the sink in passthrough mode? (that is, is there a passthrough sink input
* connected to this sink? */
bool pa_sink_is_passthrough(pa_sink *s);
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 4be730607..2dd7a2802 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -531,7 +531,7 @@ void pa_source_put(pa_source *s) {
pa_assert_ctl_context();
pa_assert(s->state == PA_SOURCE_INIT);
- pa_assert(!(s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER) || s->output_from_master);
+ pa_assert(!(s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER) || pa_source_is_filter(s));
/* The following fields must be initialized properly when calling _put() */
pa_assert(s->asyncmsgq);
@@ -1173,6 +1173,13 @@ pa_source *pa_source_get_master(pa_source *s) {
}
/* Called from main context */
+bool pa_source_is_filter(pa_source *s) {
+ pa_source_assert_ref(s);
+
+ return (s->output_from_master != NULL);
+}
+
+/* Called from main context */
bool pa_source_is_passthrough(pa_source *s) {
pa_source_assert_ref(s);
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index e7fc3e2d2..9ee078343 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -371,6 +371,8 @@ bool pa_source_flat_volume_enabled(pa_source *s);
/* Get the master source when sharing volumes */
pa_source *pa_source_get_master(pa_source *s);
+bool pa_source_is_filter(pa_source *s);
+
/* Is the source in passthrough mode? (that is, is this a monitor source for a sink
* that has a passthrough sink input connected to it. */
bool pa_source_is_passthrough(pa_source *s);