Commit 0723b8d3 authored by Avik Pal's avatar Avik Pal
Browse files

Ported to GStreamer 1.0

Artikulate has been ported to QtGstreamer 1.0 and it no longer supports QtMobility.
parent 97b08ae2
......@@ -27,28 +27,12 @@ set(ARTIKULATE_VERSION_MINOR 3)
set(ARTIKULATE_VERSION_PATCH 50)
find_package(KDeclarative REQUIRED)
find_package(QtMobility COMPONENTS MultimediaKit QUIET)
find_package(QtGStreamer QUIET)
# print information about built recording backends
message("----------------------------------")
message("Building following recording backends:")
if (QTGSTREAMER_FOUND)
message(" * QtGStreamer recording backend")
endif(QTGSTREAMER_FOUND)
if (QTMOBILITY_FOUND)
message(" * QtMultimedia recording backend (default)")
endif(QTMOBILITY_FOUND)
if (NOT QTGSTREAMER_FOUND AND NOT QTMOBILITY_FOUND)
message(FATAL_ERROR "No recording backend built: either QtGStreamer or QtMultimedia are required.")
endif()
message("----------------------------------")
find_package(QtGStreamer REQUIRED)
# set config files after packages are searched
configure_file("${artikulate_SOURCE_DIR}/version.h.cmake" "${artikulate_BINARY_DIR}/version.h" @ONLY)
configure_file("${artikulate_SOURCE_DIR}/config.h.cmake" "${artikulate_BINARY_DIR}/config.h" @ONLY)
add_subdirectory(qml)
# set include directories
......@@ -103,45 +87,23 @@ set(
${KDE4_KNEWSTUFF3_LIBS}
)
# select backend and add files
if (QTMOBILITY_FOUND)
include_directories(
${QTMOBILITY_INCLUDE_DIR}
${QTMOBILITY_MULTIMEDIAKIT_INCLUDE_DIR}
)
set(artikulateCore_SRCS
${artikulateCore_SRCS}
core/soundbackends/qtmultimediabackend.cpp
)
set(artikulateCoreTargetLibs
${artikulateCoreTargetLibs}
${QTMOBILITY_MULTIMEDIAKIT_LIBRARY}
)
set(artikulateeTargetLibs
${artikulateTargetLibs}
${QTMOBILITY_MULTIMEDIAKIT_LIBRARY}
)
endif(QTMOBILITY_FOUND)
if(QTGSTREAMER_FOUND)
include_directories(
${QTGSTREAMER_INCLUDE_DIR}
include_directories(
${QTGSTREAMER_INCLUDE_DIR}
)
set(artikulateCore_SRCS
${artikulateCore_SRCS}
core/soundbackends/qtgstreamerbackend.cpp
set(artikulateCore_SRCS
${artikulateCore_SRCS}
core/soundbackends/qtgstreamerbackend.cpp
)
set(artikulateCoreTargetLibs
${artikulateCoreTargetLibs}
${QTGLIB_LIBRARIES}
${QTGSTREAMER_LIBRARIES}
set(artikulateCoreTargetLibs
${artikulateCoreTargetLibs}
${QTGLIB_LIBRARIES}
${QTGSTREAMER_LIBRARIES}
)
set(artikulateeTargetLibs
${artikulateTargetLibs}
${QTGLIB_LIBRARIES}
${QTGSTREAMER_LIBRARIES}
set(artikulateeTargetLibs
${artikulateTargetLibs}
${QTGLIB_LIBRARIES}
${QTGSTREAMER_LIBRARIES}
)
endif(QTGSTREAMER_FOUND)
# compile UI files
kde4_add_ui_files(artikulateCore_SRCS
......
......@@ -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
......@@ -52,7 +51,6 @@ private:
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