Commit 17928098 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

implement PHONON_BACKEND_VERSION_4_7's setStreamUuid

we now interactively set PA per-stream properties through gstreamer

CCBUG: 321288
FIXED-IN: 4.7.0
parent 94024779
......@@ -26,7 +26,7 @@ if (BUILD_PHONON_GSTREAMER)
${GLIB2_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${X11_X11_INCLUDE_PATH})
add_definitions(-DPHONON_BACKEND_VERSION_4_4)
add_definitions(-DPHONON_BACKEND_VERSION_4_7)
# configure plugin api
if(USE_INSTALL_PLUGIN)
......
......@@ -23,6 +23,7 @@
#include "mediaobject.h"
#include "gsthelper.h"
#include <phonon/audiooutput.h>
#include <phonon/pulsesupport.h>
#include <QtCore/QStringBuilder>
......@@ -209,6 +210,30 @@ bool AudioOutput::setOutputDevice(const QByteArray &driver, const QString &devic
}
#endif
#if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 6, 50))
void AudioOutput::setStreamUuid(QString uuid)
{
m_streamUuid = uuid;
#warning this really needs a check for pulsesink as well
if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_audioSink), "stream-properties")) {
const QHash<QString, QString> streamProperties = PulseSupport::getInstance()->streamProperties(uuid);
GstStructure *properties = gst_structure_empty_new("props");
QHashIterator<QString, QString> it(streamProperties);
while (it.hasNext()) {
it.next();
gst_structure_set(properties,
it.key().toUtf8().constData(), G_TYPE_STRING, it.value().toUtf8().constData(),
NULL);
}
Q_ASSERT(properties);
g_object_set (m_audioSink, "stream-properties", properties, NULL);
gst_structure_free(properties);
}
}
#endif
}
} //namespace Phonon::Gstreamer
#include "moc_audiooutput.cpp"
......@@ -39,10 +39,15 @@ public:
int outputDevice() const;
void setVolume(qreal newVolume);
bool setOutputDevice(int newDevice);
#if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 2, 0))
bool setOutputDevice(const AudioOutputDevice &newDevice);
#endif
#if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 6, 50))
void setStreamUuid(QString uuid);
#endif
public:
GstElement *audioElement()
{
......@@ -58,7 +63,6 @@ private:
bool setOutputDevice(const QByteArray &, const QString &, const GstState);
private:
qreal m_volumeLevel;
int m_device;
......@@ -66,6 +70,8 @@ private:
GstElement *m_audioBin;
GstElement *m_audioSink;
GstElement *m_conv;
QString m_streamUuid;
};
}
} //namespace Phonon::Gstreamer
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment