summaryrefslogtreecommitdiffstats
path: root/app/fileplayer.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-07-24 18:33:03 -0400
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-07-25 13:07:03 +0000
commita1797fdad6b12bef6548c55dc52b0b3de232ea07 (patch)
tree795544fffdc7b0ebcca8ca42d33ecab9bc74946f /app/fileplayer.cpp
parentba4889552e472a9046ea0b2098a52b36acbd25c5 (diff)
Change from ALSA sink to new pipewire sink for output, and add setting of the pipewire media role property. Bug-AGL: SPEC-2634 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Idc1dca82c8329071698ef0766a0ec1f50d90a98f (cherry picked from commit 049ff63ded31c90479e3aac10aa5624b2374bae6)
Diffstat (limited to 'app/fileplayer.cpp')
-rw-r--r--app/fileplayer.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/fileplayer.cpp b/app/fileplayer.cpp
index 85d2440..dfd609a 100644
--- a/app/fileplayer.cpp
+++ b/app/fileplayer.cpp
@@ -39,9 +39,10 @@ FilePlayer::FilePlayer(const std::string &path, const std::string &role) :
// Create elements we need
m_playbin = gst_element_factory_make("playbin", "play");
- m_alsa_sink = gst_element_factory_make("alsasink", NULL);
- if(!(m_playbin && m_alsa_sink))
+ m_audio_sink = gst_element_factory_make("pwaudiosink", NULL);
+ if(!(m_playbin && m_audio_sink))
goto error;
+ gst_util_set_object_arg(G_OBJECT(m_audio_sink), "stream-properties", "p,media.role=Communication");
// Set up bus callback
m_bus = gst_pipeline_get_bus(GST_PIPELINE(m_playbin));
@@ -60,8 +61,8 @@ FilePlayer::FilePlayer(const std::string &path, const std::string &role) :
error:
gst_object_unref(m_playbin);
m_playbin = nullptr;
- gst_object_unref(m_alsa_sink);
- m_alsa_sink = nullptr;
+ gst_object_unref(m_audio_sink);
+ m_audio_sink = nullptr;
gst_object_unref(m_bus);
m_bus = nullptr;
@@ -76,7 +77,7 @@ FilePlayer::~FilePlayer(void)
{
gst_element_set_state(m_playbin, GST_STATE_NULL);
gst_object_unref(m_playbin);
- gst_object_unref(m_alsa_sink);
+ gst_object_unref(m_audio_sink);
gst_object_unref(m_bus);
}
@@ -88,7 +89,7 @@ void FilePlayer::play(bool loop)
m_playing = true;
m_looping = loop;
- g_object_set(m_playbin, "audio-sink", m_alsa_sink, NULL);
+ g_object_set(m_playbin, "audio-sink", m_audio_sink, NULL);
std::string uri = "file://" + m_path;
g_object_set(m_playbin, "uri", uri.c_str(), NULL);