[PATCH v2 12/18] sink-input, source-output: Add pa_sink_input/source_output_get_description()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/pulsecore/sink-input.c    | 15 +++++++++++++++
 src/pulsecore/sink-input.h    |  2 ++
 src/pulsecore/source-output.c | 15 +++++++++++++++
 src/pulsecore/source-output.h |  4 +++-
 4 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 2cc0738..4863f15 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -32,6 +32,7 @@
 #include <pulse/util.h>
 #include <pulse/internal.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/mix.h>
 #include <pulsecore/core-subscribe.h>
 #include <pulsecore/log.h>
@@ -823,6 +824,20 @@ void pa_sink_input_put(pa_sink_input *i) {
     pa_sink_update_status(i->sink);
 }
 
+/* Called from the main thread. */
+const char *pa_sink_input_get_description(pa_sink_input *i) {
+    const char *description;
+
+    pa_assert(i);
+
+    description = pa_proplist_gets(i->proplist, PA_PROP_MEDIA_NAME);
+
+    if (!description)
+        description = _("(unnamed stream)");
+
+    return description;
+}
+
 /* Called from main context */
 void pa_sink_input_kill(pa_sink_input*i) {
     pa_sink_input_assert_ref(i);
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index fcd1545..bece745 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -362,6 +362,8 @@ size_t pa_sink_input_get_max_request(pa_sink_input *i);
 
 /* Callable by everyone from main thread*/
 
+const char *pa_sink_input_get_description(pa_sink_input *i);
+
 /* External code may request disconnection with this function */
 void pa_sink_input_kill(pa_sink_input*i);
 
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index f60b614..75f02ff 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -32,6 +32,7 @@
 #include <pulse/util.h>
 #include <pulse/internal.h>
 
+#include <pulsecore/i18n.h>
 #include <pulsecore/mix.h>
 #include <pulsecore/core-subscribe.h>
 #include <pulsecore/log.h>
@@ -684,6 +685,20 @@ void pa_source_output_put(pa_source_output *o) {
     pa_source_update_status(o->source);
 }
 
+/* Called from the main thread. */
+const char *pa_source_output_get_description(pa_source_output *o) {
+    const char *description;
+
+    pa_assert(o);
+
+    description = pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME);
+
+    if (!description)
+        description = _("(unnamed stream)");
+
+    return description;
+}
+
 /* Called from main context */
 void pa_source_output_kill(pa_source_output*o) {
     pa_source_output_assert_ref(o);
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index e60430f..fd95c3e 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -305,7 +305,9 @@ int pa_source_output_update_rate(pa_source_output *o);
 
 size_t pa_source_output_get_max_rewind(pa_source_output *o);
 
-/* Callable by everyone */
+/* Callable by everyone from the main thread. */
+
+const char *pa_source_output_get_description(pa_source_output *o);
 
 /* External code may request disconnection with this function */
 void pa_source_output_kill(pa_source_output*o);
-- 
1.8.1.2



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux