summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/sink.c14
-rw-r--r--src/pulsecore/sink.h2
-rw-r--r--src/pulsecore/source.c7
-rw-r--r--src/pulsecore/source.h2
4 files changed, 24 insertions, 1 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index d1d9785a..e770950c 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -556,3 +556,17 @@ void pa_sink_set_description(pa_sink *s, const char *description) {
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
+
+unsigned pa_sink_used_by(pa_sink *s) {
+ unsigned ret;
+
+ assert(s);
+ assert(s->ref >= 1);
+
+ ret = pa_idxset_size(s->inputs);
+
+ if (s->monitor_source)
+ ret += pa_source_used_by(s->monitor_source);
+
+ return ret;
+}
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index fb0912ca..1d870620 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -103,4 +103,6 @@ int pa_sink_get_mute(pa_sink *sink, pa_mixer_t m);
void pa_sink_set_description(pa_sink *s, const char *description);
+unsigned pa_sink_used_by(pa_sink *s);
+
#endif
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 903de88b..ae72f040 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -333,3 +333,10 @@ void pa_source_set_description(pa_source *s, const char *description) {
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
+
+unsigned pa_source_used_by(pa_source *s) {
+ assert(s);
+ assert(s->ref >= 1);
+
+ return pa_idxset_size(s->outputs);
+}
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index be0c969d..4dbe4e01 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -104,5 +104,5 @@ int pa_source_get_mute(pa_source *source, pa_mixer_t m);
void pa_source_set_description(pa_source *s, const char *description);
-
+unsigned pa_source_used_by(pa_source *s);
#endif