Commit 431b69f4 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Re-apply (some) GStreamer-1.x porting patches.

Got lost with last commit.
parent a60625cc
......@@ -19,14 +19,14 @@
*/
#include "capturedevicecontroller.h"
#include "soundbackends/soundbackendinterface.h"
#include "libsound/soundbackends/soundbackendinterface.h"
#include <config.h>
#if QTMOBILITY_FOUND
#include "soundbackends/qtmultimediabackend.h"
#endif
#if QTGSTREAMER_FOUND
#include "soundbackends/qtgstreamerbackend.h"
#include "libsound/soundbackends/qtgstreamerbackend.h"
#endif
#include <settings.h>
......
......@@ -26,7 +26,6 @@
#include <QGst/Init>
#include <QGst/ElementFactory>
#include <QGst/ChildProxy>
#include <QGst/PropertyProbe>
#include <QGst/Pipeline>
#include <QGst/Pad>
#include <QGst/Event>
......@@ -49,40 +48,12 @@ QtGStreamerBackend::QtGStreamerBackend()
return;
}
src->setState(QGst::StateReady);
QGst::ChildProxyPtr childProxy = src.dynamicCast<QGst::ChildProxy>();
if (childProxy && childProxy->childrenCount() > 0) {
//the actual source is the first child
//this source usually implements the property probe interface
m_audioProbe = childProxy->childByIndex(0).dynamicCast<QGst::PropertyProbe>();
}
//we got a reference to the underlying propertyProbe, so we don't need src anymore.
src->setState(QGst::StateNull);
//Most sources and sinks have a "device" property which supports probe
//and probing it returns all the available devices on the system.
//Here we try to make use of that to list the system's devices
//and if it fails, we just leave the source to use its default device.
if (m_audioProbe && m_audioProbe->propertySupportsProbe("device")) {
//get a list of devices that the element supports
QList<QGlib::Value> devices = m_audioProbe->probeAndGetValues("device");
Q_FOREACH(const QGlib::Value & device, devices) {
//set the element's device to the current device and retrieve its
//human-readable name through the "device-name" property
m_audioProbe->setProperty("device", device);
QString deviceName = m_audioProbe->property("device-name").toString();
m_availableDevices.insert(device.toString(), QString("%1 (%2)").arg(deviceName, device.toString()));
}
} else {
m_availableDevices.insert("", i18nc("@item:inlistbox default sound device", "Default"));
}
m_availableDevices.insert("", i18nc("default sound device", "Default"));
}
QtGStreamerBackend::~QtGStreamerBackend()
{
m_pipeline.clear();
m_audioProbe.clear();
}
QString QtGStreamerBackend::identifier()
......@@ -123,16 +94,6 @@ QGst::BinPtr QtGStreamerBackend::createAudioSrcBin()
return QGst::BinPtr();
}
QGst::ElementPtr src = audioBin->getElementByName("audiosrc");
src->setState(QGst::StateReady);
QGst::ChildProxyPtr childProxy = src.dynamicCast<QGst::ChildProxy>();
if (childProxy && childProxy->childrenCount() > 0) {
//the actual source is the first child
QGst::ObjectPtr realSrc = childProxy->childByIndex(0);
// realSrc->setProperty("device", ""); //FIXME when setting device pipeline breaks with creation error
}
return audioBin;
}
......@@ -216,7 +177,9 @@ void QtGStreamerBackend::stopPipeline()
QStringList QtGStreamerBackend::devices() const
{
//TODO switch to human readable device names
//TODO qtgstreamer backend currently only provides access to default backend,
// reenable selection by using Gst::Device
return m_availableDevices.keys();
}
......
......@@ -26,7 +26,6 @@
#include <QString>
#include <QGst/global.h>
#include <QGst/PropertyProbe>
#include <QGst/Pipeline>
class QtGStreamerBackend : public SoundBackendInterface
......@@ -51,8 +50,6 @@ private:
void onBusMessage(const QGst::MessagePtr &message);
void stopPipeline();
QGst::BinPtr createAudioSrcBin();
QGst::PropertyProbePtr m_audioProbe;
QGst::PipelinePtr m_pipeline;
QString m_device;
QMap<QString, QString> m_availableDevices; //!> (identifier,human readable name)
......
Markdown is supported
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