diff options
author | Scott Murray <scott.murray@konsulko.com> | 2019-07-24 18:33:03 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2019-07-24 18:34:57 -0400 |
commit | 049ff63ded31c90479e3aac10aa5624b2374bae6 (patch) | |
tree | 795544fffdc7b0ebcca8ca42d33ecab9bc74946f /app/fileplayer.cpp | |
parent | ba4889552e472a9046ea0b2098a52b36acbd25c5 (diff) |
Switch to pipewire output
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
Diffstat (limited to 'app/fileplayer.cpp')
-rw-r--r-- | app/fileplayer.cpp | 13 |
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); |