aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Salveti de Araujo <ricardo.salveti@canonical.com>2014-09-04 21:58:37 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-09-04 21:58:37 +0000
commitf139f37478ccd129e88ade770c4454282fd91912 (patch)
treea192da40a16714fdf7f0b1a044e6c9e52f48da05
parent31cb88dcdffee6c66e00ab6247f4d0c7b088cf28 (diff)
parenta471ebcd8243a1b44609047203a323a117b84704 (diff)
downloadayatana-indicator-datetime-f139f37478ccd129e88ade770c4454282fd91912.tar.gz
ayatana-indicator-datetime-f139f37478ccd129e88ade770c4454282fd91912.tar.bz2
ayatana-indicator-datetime-f139f37478ccd129e88ade770c4454282fd91912.zip
sound: adding media role (alarm) when sink is pulsesink
Approved by: PS Jenkins bot
-rw-r--r--src/sound.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index d13c854..c6a7b0a 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -110,6 +110,25 @@ private:
GST_SEEK_TYPE_NONE,
(gint64)GST_CLOCK_TIME_NONE);
}
+ else if ((GST_MESSAGE_TYPE(msg) == GST_MESSAGE_STREAM_START) && (self->m_loop))
+ {
+ /* Set the media role if audio sink is pulsesink */
+ GstElement *audio_sink = NULL;
+ g_object_get(self->m_play, "audio-sink", &audio_sink, NULL);
+ if (audio_sink)
+ {
+ GstPluginFeature *feature = NULL;
+ feature = GST_PLUGIN_FEATURE_CAST(GST_ELEMENT_GET_CLASS(audio_sink)->elementfactory);
+ if (feature && g_strcmp0(gst_plugin_feature_get_name(feature), "pulsesink") == 0)
+ {
+ std::string role_str("props,media.role=alarm");
+ GstStructure *props = gst_structure_from_string(role_str.c_str(), NULL);
+ g_object_set(audio_sink, "stream-properties", props, NULL);
+ gst_structure_free(props);
+ }
+ gst_object_unref(audio_sink);
+ }
+ }
return G_SOURCE_CONTINUE; // keep listening
}