Replaced endpoint control with audio input and output controls

Change-Id: I981aabe39d106ced4ee1240db9e5b653c6fa5e91
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2012-07-16 11:28:02 +10:00
committed by Qt by Nokia
parent 29a2d09a43
commit ae728a4b1e
34 changed files with 549 additions and 328 deletions

View File

@@ -224,7 +224,7 @@ void MediaExample::AudioRecorder()
audioRecorder->record(); audioRecorder->record();
//! [Audio recorder] //! [Audio recorder]
//! [Audio recorder endpoints] //! [Audio recorder inputs]
QStringList inputs = audioRecorder->audioInputs(); QStringList inputs = audioRecorder->audioInputs();
QString selectedInput = audioRecorder->defaultAudioInput(); QString selectedInput = audioRecorder->defaultAudioInput();
@@ -235,7 +235,7 @@ void MediaExample::AudioRecorder()
} }
audioRecorder->setAudioInput(selectedInput); audioRecorder->setAudioInput(selectedInput);
//! [Audio recorder endpoints] //! [Audio recorder inputs]
} }
void MediaExample::RadioTuna() void MediaExample::RadioTuna()

View File

@@ -42,7 +42,7 @@ PRIVATE_HEADERS += \
qgstvideobuffer_p.h \ qgstvideobuffer_p.h \
qvideosurfacegstsink_p.h \ qvideosurfacegstsink_p.h \
qgstreamervideorendererinterface_p.h \ qgstreamervideorendererinterface_p.h \
qgstreameraudioinputendpointselector_p.h \ qgstreameraudioinputselector_p.h \
qgstreamervideorenderer_p.h \ qgstreamervideorenderer_p.h \
qgstreamervideoinputdevicecontrol_p.h \ qgstreamervideoinputdevicecontrol_p.h \
gstvideoconnector_p.h \ gstvideoconnector_p.h \
@@ -58,7 +58,7 @@ SOURCES += \
qgstvideobuffer.cpp \ qgstvideobuffer.cpp \
qvideosurfacegstsink.cpp \ qvideosurfacegstsink.cpp \
qgstreamervideorendererinterface.cpp \ qgstreamervideorendererinterface.cpp \
qgstreameraudioinputendpointselector.cpp \ qgstreameraudioinputselector.cpp \
qgstreamervideorenderer.cpp \ qgstreamervideorenderer.cpp \
qgstreamervideoinputdevicecontrol.cpp \ qgstreamervideoinputdevicecontrol.cpp \
qgstcodecsinfo.cpp \ qgstcodecsinfo.cpp \

View File

@@ -39,7 +39,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qgstreameraudioinputendpointselector_p.h" #include "qgstreameraudioinputselector_p.h"
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -50,22 +50,22 @@
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#endif #endif
QGstreamerAudioInputEndpointSelector::QGstreamerAudioInputEndpointSelector(QObject *parent) QGstreamerAudioInputSelector::QGstreamerAudioInputSelector(QObject *parent)
:QAudioEndpointSelectorControl(parent) :QAudioInputSelectorControl(parent)
{ {
update(); update();
} }
QGstreamerAudioInputEndpointSelector::~QGstreamerAudioInputEndpointSelector() QGstreamerAudioInputSelector::~QGstreamerAudioInputSelector()
{ {
} }
QList<QString> QGstreamerAudioInputEndpointSelector::availableEndpoints() const QList<QString> QGstreamerAudioInputSelector::availableInputs() const
{ {
return m_names; return m_names;
} }
QString QGstreamerAudioInputEndpointSelector::endpointDescription(const QString& name) const QString QGstreamerAudioInputSelector::inputDescription(const QString& name) const
{ {
QString desc; QString desc;
@@ -78,7 +78,7 @@ QString QGstreamerAudioInputEndpointSelector::endpointDescription(const QString&
return desc; return desc;
} }
QString QGstreamerAudioInputEndpointSelector::defaultEndpoint() const QString QGstreamerAudioInputSelector::defaultInput() const
{ {
if (m_names.size() > 0) if (m_names.size() > 0)
return m_names.at(0); return m_names.at(0);
@@ -86,20 +86,20 @@ QString QGstreamerAudioInputEndpointSelector::defaultEndpoint() const
return QString(); return QString();
} }
QString QGstreamerAudioInputEndpointSelector::activeEndpoint() const QString QGstreamerAudioInputSelector::activeInput() const
{ {
return m_audioInput; return m_audioInput;
} }
void QGstreamerAudioInputEndpointSelector::setActiveEndpoint(const QString& name) void QGstreamerAudioInputSelector::setActiveInput(const QString& name)
{ {
if (m_audioInput.compare(name) != 0) { if (m_audioInput.compare(name) != 0) {
m_audioInput = name; m_audioInput = name;
emit activeEndpointChanged(name); emit activeInputChanged(name);
} }
} }
void QGstreamerAudioInputEndpointSelector::update() void QGstreamerAudioInputSelector::update()
{ {
m_names.clear(); m_names.clear();
m_descriptions.clear(); m_descriptions.clear();
@@ -115,7 +115,7 @@ void QGstreamerAudioInputEndpointSelector::update()
m_audioInput = m_names.at(0); m_audioInput = m_names.at(0);
} }
void QGstreamerAudioInputEndpointSelector::updateAlsaDevices() void QGstreamerAudioInputSelector::updateAlsaDevices()
{ {
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
void **hints, **n; void **hints, **n;
@@ -149,7 +149,7 @@ void QGstreamerAudioInputEndpointSelector::updateAlsaDevices()
#endif #endif
} }
void QGstreamerAudioInputEndpointSelector::updateOssDevices() void QGstreamerAudioInputSelector::updateOssDevices()
{ {
QDir devDir("/dev"); QDir devDir("/dev");
devDir.setFilter(QDir::System); devDir.setFilter(QDir::System);
@@ -160,7 +160,7 @@ void QGstreamerAudioInputEndpointSelector::updateOssDevices()
} }
} }
void QGstreamerAudioInputEndpointSelector::updatePulseDevices() void QGstreamerAudioInputSelector::updatePulseDevices()
{ {
GstElementFactory *factory = gst_element_factory_find("pulsesrc"); GstElementFactory *factory = gst_element_factory_find("pulsesrc");
if (factory) { if (factory) {

View File

@@ -4,7 +4,8 @@ INCLUDEPATH += controls
PUBLIC_HEADERS += \ PUBLIC_HEADERS += \
controls/qaudiodecodercontrol.h \ controls/qaudiodecodercontrol.h \
controls/qaudioencodersettingscontrol.h \ controls/qaudioencodersettingscontrol.h \
controls/qaudioendpointselectorcontrol.h \ controls/qaudioinputselectorcontrol.h \
controls/qaudiooutputselectorcontrol.h \
controls/qcameracapturebufferformatcontrol.h \ controls/qcameracapturebufferformatcontrol.h \
controls/qcameracapturedestinationcontrol.h \ controls/qcameracapturedestinationcontrol.h \
controls/qcameracontrol.h \ controls/qcameracontrol.h \
@@ -74,7 +75,8 @@ SOURCES += \
controls/qaudiodecodercontrol.cpp \ controls/qaudiodecodercontrol.cpp \
controls/qvideoencodersettingscontrol.cpp \ controls/qvideoencodersettingscontrol.cpp \
controls/qaudioencodersettingscontrol.cpp \ controls/qaudioencodersettingscontrol.cpp \
controls/qaudioendpointselectorcontrol.cpp \ controls/qaudioinputselectorcontrol.cpp \
controls/qaudiooutputselectorcontrol.cpp \
controls/qvideodeviceselectorcontrol.cpp controls/qvideodeviceselectorcontrol.cpp

View File

@@ -1,132 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaudioendpointselectorcontrol.h"
QT_BEGIN_NAMESPACE
/*!
\class QAudioEndpointSelectorControl
\brief The QAudioEndpointSelectorControl class provides an audio endpoint selector media control.
\inmodule QtMultimedia
\ingroup multimedia_control
The QAudioEndpointSelectorControl class provides descriptions of the audio
endpoints available on a system and allows one to be selected as the audio
of a media service.
The interface name of QAudioEndpointSelectorControl is \c org.qt-project.qt.audioendpointselectorcontrol/5.0 as
defined in QAudioEndpointSelectorControl_iid.
\sa QMediaService::requestControl()
*/
/*!
\macro QAudioEndpointSelectorControl_iid
\c org.qt-project.qt.audioendpointselectorcontrol/5.0
Defines the interface name of the QAudioEndpointSelectorControl class.
\relates QAudioEndpointSelectorControl
*/
/*!
Constructs a new audio endpoint selector control with the given \a parent.
*/
QAudioEndpointSelectorControl::QAudioEndpointSelectorControl(QObject *parent)
:QMediaControl(parent)
{
}
/*!
Destroys an audio endpoint selector control.
*/
QAudioEndpointSelectorControl::~QAudioEndpointSelectorControl()
{
}
/*!
\fn QList<QString> QAudioEndpointSelectorControl::availableEndpoints() const
Returns a list of the names of the available audio endpoints.
*/
/*!
\fn QString QAudioEndpointSelectorControl::endpointDescription(const QString& name) const
Returns the description of the endpoint \a name.
*/
/*!
\fn QString QAudioEndpointSelectorControl::defaultEndpoint() const
Returns the name of the default audio endpoint.
*/
/*!
\fn QString QAudioEndpointSelectorControl::activeEndpoint() const
Returns the name of the currently selected audio endpoint.
*/
/*!
\fn QAudioEndpointSelectorControl::setActiveEndpoint(const QString& name)
Set the active audio endpoint to \a name.
*/
/*!
\fn QAudioEndpointSelectorControl::activeEndpointChanged(const QString& name)
Signals that the audio endpoint has changed to \a name.
*/
/*!
\fn QAudioEndpointSelectorControl::availableEndpointsChanged()
Signals that list of available endpoints has changed.
*/
#include "moc_qaudioendpointselectorcontrol.cpp"
QT_END_NAMESPACE

View File

@@ -0,0 +1,132 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaudioinputselectorcontrol.h"
QT_BEGIN_NAMESPACE
/*!
\class QAudioInputSelectorControl
\brief The QAudioInputSelectorControl class provides an audio input selector media control.
\inmodule QtMultimedia
\ingroup multimedia_control
The QAudioInputSelectorControl class provides descriptions of the audio
inputs available on a system and allows one to be selected as the audio
input of a media service.
The interface name of QAudioInputSelectorControl is \c org.qt-project.qt.audioinputselectorcontrol/5.0 as
defined in QAudioInputSelectorControl_iid.
\sa QMediaService::requestControl()
*/
/*!
\macro QAudioInputSelectorControl_iid
\c org.qt-project.qt.audioinputselectorcontrol/5.0
Defines the interface name of the QAudioInputSelectorControl class.
\relates QAudioInputSelectorControl
*/
/*!
Constructs a new audio input selector control with the given \a parent.
*/
QAudioInputSelectorControl::QAudioInputSelectorControl(QObject *parent)
:QMediaControl(parent)
{
}
/*!
Destroys an audio input selector control.
*/
QAudioInputSelectorControl::~QAudioInputSelectorControl()
{
}
/*!
\fn QList<QString> QAudioInputSelectorControl::availableInputs() const
Returns a list of the names of the available audio inputs.
*/
/*!
\fn QString QAudioInputSelectorControl::inputDescription(const QString& name) const
Returns the description of the input \a name.
*/
/*!
\fn QString QAudioInputSelectorControl::defaultInput() const
Returns the name of the default audio input.
*/
/*!
\fn QString QAudioInputSelectorControl::activeInput() const
Returns the name of the currently selected audio input.
*/
/*!
\fn QAudioInputSelectorControl::setActiveInput(const QString& name)
Set the active audio input to \a name.
*/
/*!
\fn QAudioInputSelectorControl::activeInputChanged(const QString& name)
Signals that the audio input has changed to \a name.
*/
/*!
\fn QAudioInputSelectorControl::availableInputsChanged()
Signals that list of available inputs has changed.
*/
#include "moc_qaudioinputselectorcontrol.cpp"
QT_END_NAMESPACE

View File

@@ -39,8 +39,8 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QAUDIOENDPOINTSELECTORCONTROL_H #ifndef QAUDIOINPUTSELECTORCONTROL_H
#define QAUDIOENDPOINTSELECTORCONTROL_H #define QAUDIOINPUTSELECTORCONTROL_H
#include <qaudio.h> #include <qaudio.h>
#include <qmediacontrol.h> #include <qmediacontrol.h>
@@ -54,35 +54,35 @@ QT_MODULE(Multimedia)
// Class forward declaration required for QDoc bug // Class forward declaration required for QDoc bug
class QString; class QString;
class Q_MULTIMEDIA_EXPORT QAudioEndpointSelectorControl : public QMediaControl class Q_MULTIMEDIA_EXPORT QAudioInputSelectorControl : public QMediaControl
{ {
Q_OBJECT Q_OBJECT
public: public:
virtual ~QAudioEndpointSelectorControl(); virtual ~QAudioInputSelectorControl();
virtual QList<QString> availableEndpoints() const = 0; virtual QList<QString> availableInputs() const = 0;
virtual QString endpointDescription(const QString& name) const = 0; virtual QString inputDescription(const QString& name) const = 0;
virtual QString defaultEndpoint() const = 0; virtual QString defaultInput() const = 0;
virtual QString activeEndpoint() const = 0; virtual QString activeInput() const = 0;
public Q_SLOTS: public Q_SLOTS:
virtual void setActiveEndpoint(const QString& name) = 0; virtual void setActiveInput(const QString& name) = 0;
Q_SIGNALS: Q_SIGNALS:
void activeEndpointChanged(const QString& name); void activeInputChanged(const QString& name);
void availableEndpointsChanged(); void availableInputsChanged();
protected: protected:
QAudioEndpointSelectorControl(QObject *parent = 0); QAudioInputSelectorControl(QObject *parent = 0);
}; };
#define QAudioEndpointSelectorControl_iid "org.qt-project.qt.audioendpointselectorcontrol/5.0" #define QAudioInputSelectorControl_iid "org.qt-project.qt.audioinputselectorcontrol/5.0"
Q_MEDIA_DECLARE_CONTROL(QAudioEndpointSelectorControl, QAudioEndpointSelectorControl_iid) Q_MEDIA_DECLARE_CONTROL(QAudioInputSelectorControl, QAudioInputSelectorControl_iid)
QT_END_NAMESPACE QT_END_NAMESPACE
QT_END_HEADER QT_END_HEADER
#endif // QAUDIOENDPOINTSELECTORCONTROL_H #endif // QAUDIOINPUTSELECTORCONTROL_H

View File

@@ -0,0 +1,132 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaudiooutputselectorcontrol.h"
QT_BEGIN_NAMESPACE
/*!
\class QAudioOutputSelectorControl
\brief The QAudioOutputSelectorControl class provides an audio output selector media control.
\inmodule QtMultimedia
\ingroup multimedia_control
The QAudioOutputSelectorControl class provides descriptions of the audio
outputs available on a system and allows one to be selected as the audio
output of a media service.
The interface name of QAudioOutputSelectorControl is \c org.qt-project.qt.audiooutputselectorcontrol/5.0 as
defined in QAudioOutputSelectorControl_iid.
\sa QMediaService::requestControl()
*/
/*!
\macro QAudioOutputSelectorControl_iid
\c org.qt-project.qt.audiooutputselectorcontrol/5.0
Defines the interface name of the QAudioOutputSelectorControl class.
\relates QAudioOutputSelectorControl
*/
/*!
Constructs a new audio output selector control with the given \a parent.
*/
QAudioOutputSelectorControl::QAudioOutputSelectorControl(QObject *parent)
:QMediaControl(parent)
{
}
/*!
Destroys an audio output selector control.
*/
QAudioOutputSelectorControl::~QAudioOutputSelectorControl()
{
}
/*!
\fn QList<QString> QAudioOutputSelectorControl::availableOutputs() const
Returns a list of the names of the available audio outputs.
*/
/*!
\fn QString QAudioOutputSelectorControl::outputDescription(const QString& name) const
Returns the description of the output \a name.
*/
/*!
\fn QString QAudioOutputSelectorControl::defaultOutput() const
Returns the name of the default audio output.
*/
/*!
\fn QString QAudioOutputSelectorControl::activeOutput() const
Returns the name of the currently selected audio output.
*/
/*!
\fn QAudioOutputSelectorControl::setActiveOutput(const QString& name)
Set the active audio output to \a name.
*/
/*!
\fn QAudioOutputSelectorControl::activeOutputChanged(const QString& name)
Signals that the audio output has changed to \a name.
*/
/*!
\fn QAudioOutputSelectorControl::availableOutputsChanged()
Signals that list of available outputs has changed.
*/
#include "moc_qaudiooutputselectorcontrol.cpp"
QT_END_NAMESPACE

View File

@@ -0,0 +1,88 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QAUDIOOUTPUTSELECTORCONTROL_H
#define QAUDIOOUTPUTSELECTORCONTROL_H
#include <qaudio.h>
#include <qmediacontrol.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Multimedia)
// Class forward declaration required for QDoc bug
class QString;
class Q_MULTIMEDIA_EXPORT QAudioOutputSelectorControl : public QMediaControl
{
Q_OBJECT
public:
virtual ~QAudioOutputSelectorControl();
virtual QList<QString> availableOutputs() const = 0;
virtual QString outputDescription(const QString& name) const = 0;
virtual QString defaultOutput() const = 0;
virtual QString activeOutput() const = 0;
public Q_SLOTS:
virtual void setActiveOutput(const QString& name) = 0;
Q_SIGNALS:
void activeOutputChanged(const QString& name);
void availableOutputsChanged();
protected:
QAudioOutputSelectorControl(QObject *parent = 0);
};
#define QAudioOutputSelectorControl_iid "org.qt-project.qt.audiooutputselectorcontrol/5.0"
Q_MEDIA_DECLARE_CONTROL(QAudioOutputSelectorControl, QAudioOutputSelectorControl_iid)
QT_END_NAMESPACE
QT_END_HEADER
#endif // QAUDIOOUTPUTSELECTORCONTROL_H

View File

@@ -39,28 +39,28 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H #ifndef QGSTREAMERAUDIOINPUTSELECTOR_H
#define QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H #define QGSTREAMERAUDIOINPUTSELECTOR_H
#include <qaudioendpointselectorcontrol.h> #include <qaudioinputselectorcontrol.h>
#include <QtCore/qstringlist.h> #include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QGstreamerAudioInputEndpointSelector : public QAudioEndpointSelectorControl class QGstreamerAudioInputSelector : public QAudioInputSelectorControl
{ {
Q_OBJECT Q_OBJECT
public: public:
QGstreamerAudioInputEndpointSelector(QObject *parent); QGstreamerAudioInputSelector(QObject *parent);
~QGstreamerAudioInputEndpointSelector(); ~QGstreamerAudioInputSelector();
QList<QString> availableEndpoints() const; QList<QString> availableInputs() const;
QString endpointDescription(const QString& name) const; QString inputDescription(const QString& name) const;
QString defaultEndpoint() const; QString defaultInput() const;
QString activeEndpoint() const; QString activeInput() const;
public Q_SLOTS: public Q_SLOTS:
void setActiveEndpoint(const QString& name); void setActiveInput(const QString& name);
private: private:
void update(); void update();
@@ -75,4 +75,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H #endif // QGSTREAMERAUDIOINPUTSELECTOR_H

View File

@@ -40,7 +40,7 @@
****************************************************************************/ ****************************************************************************/
#include "qaudiorecorder.h" #include "qaudiorecorder.h"
#include "qaudioendpointselectorcontrol.h" #include "qaudioinputselectorcontrol.h"
#include "qmediaobject_p.h" #include "qmediaobject_p.h"
#include "qmediarecorder_p.h" #include "qmediarecorder_p.h"
#include <qmediaservice.h> #include <qmediaservice.h>
@@ -68,15 +68,14 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/multimedia-snippets/media.cpp Audio recorder \snippet doc/src/snippets/multimedia-snippets/media.cpp Audio recorder
In addition QAudioRecorder provides functionality for selecting the audio In addition QAudioRecorder provides functionality for selecting the audio input.
input from available audio endpoints.
\snippet doc/src/snippets/multimedia-snippets/media.cpp Audio recorder endpoints \snippet doc/src/snippets/multimedia-snippets/media.cpp Audio recorder inputs
The \l {audiorecorder}{Audio Recorder} example shows how to use this class The \l {audiorecorder}{Audio Recorder} example shows how to use this class
in more detail. in more detail.
\sa QMediaRecorder, QAudioEndpointSelectorControl \sa QMediaRecorder, QAudioInputSelectorControl
*/ */
class QAudioRecorderObject : public QMediaObject class QAudioRecorderObject : public QMediaObject
@@ -100,17 +99,17 @@ public:
void initControls() void initControls()
{ {
Q_Q(QAudioRecorder); Q_Q(QAudioRecorder);
audioEndpointSelector = 0; audioInputSelector = 0;
QMediaService *service = mediaObject ? mediaObject->service() : 0; QMediaService *service = mediaObject ? mediaObject->service() : 0;
if (service != 0) if (service != 0)
audioEndpointSelector = qobject_cast<QAudioEndpointSelectorControl*>(service->requestControl(QAudioEndpointSelectorControl_iid)); audioInputSelector = qobject_cast<QAudioInputSelectorControl*>(service->requestControl(QAudioInputSelectorControl_iid));
if (audioEndpointSelector) { if (audioInputSelector) {
q->connect(audioEndpointSelector, SIGNAL(activeEndpointChanged(QString)), q->connect(audioInputSelector, SIGNAL(activeInputChanged(QString)),
SIGNAL(audioInputChanged(QString))); SIGNAL(audioInputChanged(QString)));
q->connect(audioEndpointSelector, SIGNAL(availableEndpointsChanged()), q->connect(audioInputSelector, SIGNAL(availableInputsChanged()),
SIGNAL(availableAudioInputsChanged())); SIGNAL(availableAudioInputsChanged()));
} }
} }
@@ -118,10 +117,10 @@ public:
QAudioRecorderPrivate(): QAudioRecorderPrivate():
QMediaRecorderPrivate(), QMediaRecorderPrivate(),
provider(0), provider(0),
audioEndpointSelector(0) {} audioInputSelector(0) {}
QMediaServiceProvider *provider; QMediaServiceProvider *provider;
QAudioEndpointSelectorControl *audioEndpointSelector; QAudioInputSelectorControl *audioInputSelector;
}; };
@@ -153,8 +152,8 @@ QAudioRecorder::~QAudioRecorder()
QMediaObject *mediaObject = d->mediaObject; QMediaObject *mediaObject = d->mediaObject;
setMediaObject(0); setMediaObject(0);
if (service && d->audioEndpointSelector) if (service && d->audioInputSelector)
service->releaseControl(d->audioEndpointSelector); service->releaseControl(d->audioInputSelector);
if (d->provider && service) if (d->provider && service)
d->provider->releaseService(service); d->provider->releaseService(service);
@@ -169,8 +168,8 @@ QAudioRecorder::~QAudioRecorder()
QStringList QAudioRecorder::audioInputs() const QStringList QAudioRecorder::audioInputs() const
{ {
Q_D(const QAudioRecorder); Q_D(const QAudioRecorder);
if (d->audioEndpointSelector) if (d->audioInputSelector)
return d->audioEndpointSelector->availableEndpoints(); return d->audioInputSelector->availableInputs();
else else
return QStringList(); return QStringList();
} }
@@ -183,8 +182,8 @@ QString QAudioRecorder::audioInputDescription(const QString& name) const
{ {
Q_D(const QAudioRecorder); Q_D(const QAudioRecorder);
if (d->audioEndpointSelector) if (d->audioInputSelector)
return d->audioEndpointSelector->endpointDescription(name); return d->audioInputSelector->inputDescription(name);
else else
return QString(); return QString();
} }
@@ -197,8 +196,8 @@ QString QAudioRecorder::defaultAudioInput() const
{ {
Q_D(const QAudioRecorder); Q_D(const QAudioRecorder);
if (d->audioEndpointSelector) if (d->audioInputSelector)
return d->audioEndpointSelector->defaultEndpoint(); return d->audioInputSelector->defaultInput();
else else
return QString(); return QString();
} }
@@ -217,8 +216,8 @@ QString QAudioRecorder::audioInput() const
{ {
Q_D(const QAudioRecorder); Q_D(const QAudioRecorder);
if (d->audioEndpointSelector) if (d->audioInputSelector)
return d->audioEndpointSelector->activeEndpoint(); return d->audioInputSelector->activeInput();
else else
return QString(); return QString();
} }
@@ -231,8 +230,8 @@ void QAudioRecorder::setAudioInput(const QString& name)
{ {
Q_D(const QAudioRecorder); Q_D(const QAudioRecorder);
if (d->audioEndpointSelector) if (d->audioInputSelector)
return d->audioEndpointSelector->setActiveEndpoint(name); return d->audioInputSelector->setActiveInput(name);
} }
/*! /*!

View File

@@ -10,7 +10,7 @@ DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
HEADERS += audioencodercontrol.h \ HEADERS += audioencodercontrol.h \
audiocontainercontrol.h \ audiocontainercontrol.h \
audiomediarecordercontrol.h \ audiomediarecordercontrol.h \
audioendpointselector.h \ audioinputselector.h \
audiocaptureservice.h \ audiocaptureservice.h \
audiocaptureserviceplugin.h \ audiocaptureserviceplugin.h \
audiocapturesession.h audiocapturesession.h
@@ -18,7 +18,7 @@ HEADERS += audioencodercontrol.h \
SOURCES += audioencodercontrol.cpp \ SOURCES += audioencodercontrol.cpp \
audiocontainercontrol.cpp \ audiocontainercontrol.cpp \
audiomediarecordercontrol.cpp \ audiomediarecordercontrol.cpp \
audioendpointselector.cpp \ audioinputselector.cpp \
audiocaptureservice.cpp \ audiocaptureservice.cpp \
audiocaptureserviceplugin.cpp \ audiocaptureserviceplugin.cpp \
audiocapturesession.cpp audiocapturesession.cpp

View File

@@ -41,7 +41,7 @@
#include "audiocaptureservice.h" #include "audiocaptureservice.h"
#include "audiocapturesession.h" #include "audiocapturesession.h"
#include "audioendpointselector.h" #include "audioinputselector.h"
#include "audioencodercontrol.h" #include "audioencodercontrol.h"
#include "audiocontainercontrol.h" #include "audiocontainercontrol.h"
#include "audiomediarecordercontrol.h" #include "audiomediarecordercontrol.h"
@@ -53,14 +53,14 @@ AudioCaptureService::AudioCaptureService(QObject *parent):
m_encoderControl = new AudioEncoderControl(m_session); m_encoderControl = new AudioEncoderControl(m_session);
m_containerControl = new AudioContainerControl(m_session); m_containerControl = new AudioContainerControl(m_session);
m_mediaControl = new AudioMediaRecorderControl(m_session); m_mediaControl = new AudioMediaRecorderControl(m_session);
m_endpointSelector = new AudioEndpointSelector(m_session); m_inputSelector = new AudioInputSelector(m_session);
} }
AudioCaptureService::~AudioCaptureService() AudioCaptureService::~AudioCaptureService()
{ {
delete m_encoderControl; delete m_encoderControl;
delete m_containerControl; delete m_containerControl;
delete m_endpointSelector; delete m_inputSelector;
delete m_mediaControl; delete m_mediaControl;
delete m_session; delete m_session;
} }
@@ -73,8 +73,8 @@ QMediaControl *AudioCaptureService::requestControl(const char *name)
if (qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0) if (qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0)
return m_encoderControl; return m_encoderControl;
if (qstrcmp(name,QAudioEndpointSelectorControl_iid) == 0) if (qstrcmp(name,QAudioInputSelectorControl_iid) == 0)
return m_endpointSelector; return m_inputSelector;
if (qstrcmp(name,QMediaContainerControl_iid) == 0) if (qstrcmp(name,QMediaContainerControl_iid) == 0)
return m_containerControl; return m_containerControl;

View File

@@ -50,7 +50,7 @@ class AudioCaptureSession;
class AudioEncoderControl; class AudioEncoderControl;
class AudioContainerControl; class AudioContainerControl;
class AudioMediaRecorderControl; class AudioMediaRecorderControl;
class AudioEndpointSelector; class AudioInputSelector;
QT_USE_NAMESPACE QT_USE_NAMESPACE
@@ -67,7 +67,7 @@ private:
AudioCaptureSession *m_session; AudioCaptureSession *m_session;
AudioEncoderControl *m_encoderControl; AudioEncoderControl *m_encoderControl;
AudioContainerControl *m_containerControl; AudioContainerControl *m_containerControl;
AudioEndpointSelector *m_endpointSelector; AudioInputSelector *m_inputSelector;
AudioMediaRecorderControl *m_mediaControl; AudioMediaRecorderControl *m_mediaControl;
}; };

View File

@@ -47,7 +47,7 @@
#include <QDir> #include <QDir>
#include "audioencodercontrol.h" #include "audioencodercontrol.h"
#include "audioendpointselector.h" #include "audioinputselector.h"
#include "audiomediarecordercontrol.h" #include "audiomediarecordercontrol.h"
#include <qaudioformat.h> #include <qaudioformat.h>

View File

@@ -40,31 +40,31 @@
****************************************************************************/ ****************************************************************************/
#include "audiocapturesession.h" #include "audiocapturesession.h"
#include "audioendpointselector.h" #include "audioinputselector.h"
#include <qaudiodeviceinfo.h> #include <qaudiodeviceinfo.h>
AudioEndpointSelector::AudioEndpointSelector(QObject *parent) AudioInputSelector::AudioInputSelector(QObject *parent)
:QAudioEndpointSelectorControl(parent) :QAudioInputSelectorControl(parent)
{ {
m_session = qobject_cast<AudioCaptureSession*>(parent); m_session = qobject_cast<AudioCaptureSession*>(parent);
update(); update();
m_audioInput = defaultEndpoint(); m_audioInput = defaultInput();
} }
AudioEndpointSelector::~AudioEndpointSelector() AudioInputSelector::~AudioInputSelector()
{ {
} }
QList<QString> AudioEndpointSelector::availableEndpoints() const QList<QString> AudioInputSelector::availableInputs() const
{ {
return m_names; return m_names;
} }
QString AudioEndpointSelector::endpointDescription(const QString& name) const QString AudioInputSelector::inputDescription(const QString& name) const
{ {
QString desc; QString desc;
@@ -77,26 +77,26 @@ QString AudioEndpointSelector::endpointDescription(const QString& name) const
return desc; return desc;
} }
QString AudioEndpointSelector::defaultEndpoint() const QString AudioInputSelector::defaultInput() const
{ {
return QAudioDeviceInfo(QAudioDeviceInfo::defaultInputDevice()).deviceName(); return QAudioDeviceInfo(QAudioDeviceInfo::defaultInputDevice()).deviceName();
} }
QString AudioEndpointSelector::activeEndpoint() const QString AudioInputSelector::activeInput() const
{ {
return m_audioInput; return m_audioInput;
} }
void AudioEndpointSelector::setActiveEndpoint(const QString& name) void AudioInputSelector::setActiveInput(const QString& name)
{ {
if (m_audioInput.compare(name) != 0) { if (m_audioInput.compare(name) != 0) {
m_audioInput = name; m_audioInput = name;
m_session->setCaptureDevice(name); m_session->setCaptureDevice(name);
emit activeEndpointChanged(name); emit activeInputChanged(name);
} }
} }
void AudioEndpointSelector::update() void AudioInputSelector::update()
{ {
m_names.clear(); m_names.clear();
m_descriptions.clear(); m_descriptions.clear();

View File

@@ -39,31 +39,31 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef AUDIOENDPOINTSELECTOR_H #ifndef AUDIOINPUTSELECTOR_H
#define AUDIOENDPOINTSELECTOR_H #define AUDIOINPUTSELECTOR_H
#include <QStringList> #include <QStringList>
#include "qaudioendpointselectorcontrol.h" #include "qaudioinputselectorcontrol.h"
class AudioCaptureSession; class AudioCaptureSession;
QT_USE_NAMESPACE QT_USE_NAMESPACE
class AudioEndpointSelector : public QAudioEndpointSelectorControl class AudioInputSelector : public QAudioInputSelectorControl
{ {
Q_OBJECT Q_OBJECT
public: public:
AudioEndpointSelector(QObject *parent); AudioInputSelector(QObject *parent);
virtual ~AudioEndpointSelector(); virtual ~AudioInputSelector();
QList<QString> availableEndpoints() const; QList<QString> availableInputs() const;
QString endpointDescription(const QString& name) const; QString inputDescription(const QString& name) const;
QString defaultEndpoint() const; QString defaultInput() const;
QString activeEndpoint() const; QString activeInput() const;
public Q_SLOTS: public Q_SLOTS:
void setActiveEndpoint(const QString& name); void setActiveInput(const QString& name);
private: private:
void update(); void update();
@@ -74,4 +74,4 @@ private:
AudioCaptureSession* m_session; AudioCaptureSession* m_session;
}; };
#endif // AUDIOENDPOINTSELECTOR_H #endif // AUDIOINPUTSELECTOR_H

View File

@@ -46,7 +46,7 @@
DirectShowAudioEndpointControl::DirectShowAudioEndpointControl( DirectShowAudioEndpointControl::DirectShowAudioEndpointControl(
DirectShowPlayerService *service, QObject *parent) DirectShowPlayerService *service, QObject *parent)
: QAudioEndpointSelectorControl(parent) : QAudioOutputSelectorControl(parent)
, m_service(service) , m_service(service)
, m_bindContext(0) , m_bindContext(0)
, m_deviceEnumerator(0) , m_deviceEnumerator(0)
@@ -56,7 +56,7 @@ DirectShowAudioEndpointControl::DirectShowAudioEndpointControl(
updateEndpoints(); updateEndpoints();
setActiveEndpoint(m_defaultEndpoint); setActiveOutput(m_defaultEndpoint);
} }
} }
@@ -72,12 +72,12 @@ DirectShowAudioEndpointControl::~DirectShowAudioEndpointControl()
m_deviceEnumerator->Release(); m_deviceEnumerator->Release();
} }
QList<QString> DirectShowAudioEndpointControl::availableEndpoints() const QList<QString> DirectShowAudioEndpointControl::availableOutputs() const
{ {
return m_devices.keys(); return m_devices.keys();
} }
QString DirectShowAudioEndpointControl::endpointDescription(const QString &name) const QString DirectShowAudioEndpointControl::outputDescription(const QString &name) const
{ {
#ifdef __IPropertyBag_INTERFACE_DEFINED__ #ifdef __IPropertyBag_INTERFACE_DEFINED__
QString description; QString description;
@@ -101,17 +101,17 @@ QString DirectShowAudioEndpointControl::endpointDescription(const QString &name)
#endif #endif
} }
QString DirectShowAudioEndpointControl::defaultEndpoint() const QString DirectShowAudioEndpointControl::defaultOutput() const
{ {
return m_defaultEndpoint; return m_defaultEndpoint;
} }
QString DirectShowAudioEndpointControl::activeEndpoint() const QString DirectShowAudioEndpointControl::activeOutput() const
{ {
return m_activeEndpoint; return m_activeEndpoint;
} }
void DirectShowAudioEndpointControl::setActiveEndpoint(const QString &name) void DirectShowAudioEndpointControl::setActiveOutput(const QString &name)
{ {
if (m_activeEndpoint == name) if (m_activeEndpoint == name)
return; return;

View File

@@ -42,7 +42,7 @@
#ifndef DIRECTSHOWAUDIOENDPOINTCONTROL_H #ifndef DIRECTSHOWAUDIOENDPOINTCONTROL_H
#define DIRECTSHOWAUDIOENDPOINTCONTROL_H #define DIRECTSHOWAUDIOENDPOINTCONTROL_H
#include "qaudioendpointselectorcontrol.h" #include "qaudiooutputselectorcontrol.h"
#include <dshow.h> #include <dshow.h>
@@ -50,21 +50,21 @@ class DirectShowPlayerService;
QT_USE_NAMESPACE QT_USE_NAMESPACE
class DirectShowAudioEndpointControl : public QAudioEndpointSelectorControl class DirectShowAudioEndpointControl : public QAudioOutputSelectorControl
{ {
Q_OBJECT Q_OBJECT
public: public:
DirectShowAudioEndpointControl(DirectShowPlayerService *service, QObject *parent = 0); DirectShowAudioEndpointControl(DirectShowPlayerService *service, QObject *parent = 0);
~DirectShowAudioEndpointControl(); ~DirectShowAudioEndpointControl();
QList<QString> availableEndpoints() const; QList<QString> availableOutputs() const;
QString endpointDescription(const QString &name) const; QString outputDescription(const QString &name) const;
QString defaultEndpoint() const; QString defaultOutput() const;
QString activeEndpoint() const; QString activeOutput() const;
void setActiveEndpoint(const QString& name); void setActiveOutput(const QString& name);
private: private:
void updateEndpoints(); void updateEndpoints();

View File

@@ -156,7 +156,7 @@ QMediaControl *DirectShowPlayerService::requestControl(const char *name)
{ {
if (qstrcmp(name, QMediaPlayerControl_iid) == 0) { if (qstrcmp(name, QMediaPlayerControl_iid) == 0) {
return m_playerControl; return m_playerControl;
} else if (qstrcmp(name, QAudioEndpointSelectorControl_iid) == 0) { } else if (qstrcmp(name, QAudioOutputSelectorControl_iid) == 0) {
return m_audioEndpointControl; return m_audioEndpointControl;
} else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) { } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
return m_metaDataControl; return m_metaDataControl;

View File

@@ -62,7 +62,7 @@
#include "camerabincapturedestination.h" #include "camerabincapturedestination.h"
#include <private/qgstreamerbushelper_p.h> #include <private/qgstreamerbushelper_p.h>
#include <private/qgstreameraudioinputendpointselector_p.h> #include <private/qgstreameraudioinputselector_p.h>
#include <private/qgstreamervideoinputdevicecontrol_p.h> #include <private/qgstreamervideoinputdevicecontrol_p.h>
#if defined(HAVE_WIDGETS) #if defined(HAVE_WIDGETS)
@@ -95,7 +95,7 @@ CameraBinService::CameraBinService(const QString &service, QObject *parent):
m_cameraControl = 0; m_cameraControl = 0;
m_metaDataControl = 0; m_metaDataControl = 0;
m_audioInputEndpointSelector = 0; m_audioInputSelector = 0;
m_videoInputDevice = 0; m_videoInputDevice = 0;
m_videoOutput = 0; m_videoOutput = 0;
@@ -139,11 +139,11 @@ CameraBinService::CameraBinService(const QString &service, QObject *parent):
return; return;
} }
m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this); m_audioInputSelector = new QGstreamerAudioInputSelector(this);
connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString))); connect(m_audioInputSelector, SIGNAL(activeInputChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));
if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0) if (m_captureSession && m_audioInputSelector->availableInputs().size() > 0)
m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint()); m_captureSession->setCaptureDevice(m_audioInputSelector->defaultInput());
m_metaDataControl = new CameraBinMetaData(this); m_metaDataControl = new CameraBinMetaData(this);
connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)), connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
@@ -183,8 +183,8 @@ QMediaControl *CameraBinService::requestControl(const char *name)
} }
} }
if (qstrcmp(name,QAudioEndpointSelectorControl_iid) == 0) if (qstrcmp(name,QAudioInputSelectorControl_iid) == 0)
return m_audioInputEndpointSelector; return m_audioInputSelector;
if (qstrcmp(name,QVideoDeviceSelectorControl_iid) == 0) if (qstrcmp(name,QVideoDeviceSelectorControl_iid) == 0)
return m_videoInputDevice; return m_videoInputDevice;

View File

@@ -47,7 +47,7 @@
#include <gst/gst.h> #include <gst/gst.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAudioEndpointSelectorControl; class QAudioInputSelectorControl;
class QVideoDeviceSelectorControl; class QVideoDeviceSelectorControl;
@@ -83,7 +83,7 @@ private:
CameraBinControl *m_cameraControl; CameraBinControl *m_cameraControl;
CameraBinMetaData *m_metaDataControl; CameraBinMetaData *m_metaDataControl;
QAudioEndpointSelectorControl *m_audioInputEndpointSelector; QAudioInputSelectorControl *m_audioInputSelector;
QVideoDeviceSelectorControl *m_videoInputDevice; QVideoDeviceSelectorControl *m_videoInputDevice;
QMediaControl *m_videoOutput; QMediaControl *m_videoOutput;

View File

@@ -52,7 +52,7 @@
#include "qgstreamercapturemetadatacontrol.h" #include "qgstreamercapturemetadatacontrol.h"
#include "qgstreamerimagecapturecontrol.h" #include "qgstreamerimagecapturecontrol.h"
#include <private/qgstreameraudioinputendpointselector_p.h> #include <private/qgstreameraudioinputselector_p.h>
#include <private/qgstreamervideoinputdevicecontrol_p.h> #include <private/qgstreamervideoinputdevicecontrol_p.h>
#include <private/qgstreameraudioprobecontrol_p.h> #include <private/qgstreameraudioprobecontrol_p.h>
@@ -75,7 +75,7 @@ QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObje
m_metaDataControl = 0; m_metaDataControl = 0;
m_videoInput = 0; m_videoInput = 0;
m_audioInputEndpointSelector = 0; m_audioInputSelector = 0;
m_videoInputDevice = 0; m_videoInputDevice = 0;
m_videoOutput = 0; m_videoOutput = 0;
@@ -112,11 +112,11 @@ QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObje
m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession); m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession);
} }
m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this); m_audioInputSelector = new QGstreamerAudioInputSelector(this);
connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString))); connect(m_audioInputSelector, SIGNAL(activeInputChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));
if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0) if (m_captureSession && m_audioInputSelector->availableInputs().size() > 0)
m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint()); m_captureSession->setCaptureDevice(m_audioInputSelector->defaultInput());
m_metaDataControl = new QGstreamerCaptureMetaDataControl(this); m_metaDataControl = new QGstreamerCaptureMetaDataControl(this);
connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)), connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
@@ -132,8 +132,8 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
if (!m_captureSession) if (!m_captureSession)
return 0; return 0;
if (qstrcmp(name,QAudioEndpointSelectorControl_iid) == 0) if (qstrcmp(name,QAudioInputSelectorControl_iid) == 0)
return m_audioInputEndpointSelector; return m_audioInputSelector;
if (qstrcmp(name,QVideoDeviceSelectorControl_iid) == 0) if (qstrcmp(name,QVideoDeviceSelectorControl_iid) == 0)
return m_videoInputDevice; return m_videoInputDevice;

View File

@@ -48,7 +48,7 @@
#include <gst/gst.h> #include <gst/gst.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAudioEndpointSelectorControl; class QAudioInputSelectorControl;
class QVideoDeviceSelectorControl; class QVideoDeviceSelectorControl;
class QGstreamerCaptureSession; class QGstreamerCaptureSession;
@@ -82,7 +82,7 @@ private:
QGstreamerV4L2Input *m_videoInput; QGstreamerV4L2Input *m_videoInput;
QGstreamerCaptureMetaDataControl *m_metaDataControl; QGstreamerCaptureMetaDataControl *m_metaDataControl;
QAudioEndpointSelectorControl *m_audioInputEndpointSelector; QAudioInputSelectorControl *m_audioInputSelector;
QVideoDeviceSelectorControl *m_videoInputDevice; QVideoDeviceSelectorControl *m_videoInputDevice;
QMediaControl *m_videoOutput; QMediaControl *m_videoOutput;

View File

@@ -43,11 +43,11 @@
#include "mfaudioendpointcontrol.h" #include "mfaudioendpointcontrol.h"
MFAudioEndpointControl::MFAudioEndpointControl(QObject *parent) MFAudioEndpointControl::MFAudioEndpointControl(QObject *parent)
: QAudioEndpointSelectorControl(parent) : QAudioOutputSelectorControl(parent)
, m_currentActivate(0) , m_currentActivate(0)
{ {
updateEndpoints(); updateEndpoints();
setActiveEndpoint(m_defaultEndpoint); setActiveOutput(m_defaultEndpoint);
} }
MFAudioEndpointControl::~MFAudioEndpointControl() MFAudioEndpointControl::~MFAudioEndpointControl()
@@ -59,27 +59,27 @@ MFAudioEndpointControl::~MFAudioEndpointControl()
m_currentActivate->Release(); m_currentActivate->Release();
} }
QList<QString> MFAudioEndpointControl::availableEndpoints() const QList<QString> MFAudioEndpointControl::availableOutputs() const
{ {
return m_devices.keys(); return m_devices.keys();
} }
QString MFAudioEndpointControl::endpointDescription(const QString &name) const QString MFAudioEndpointControl::outputDescription(const QString &name) const
{ {
return name.section(QLatin1Char('\\'), -1); return name.section(QLatin1Char('\\'), -1);
} }
QString MFAudioEndpointControl::defaultEndpoint() const QString MFAudioEndpointControl::defaultOutput() const
{ {
return m_defaultEndpoint; return m_defaultEndpoint;
} }
QString MFAudioEndpointControl::activeEndpoint() const QString MFAudioEndpointControl::activeOutput() const
{ {
return m_activeEndpoint; return m_activeEndpoint;
} }
void MFAudioEndpointControl::setActiveEndpoint(const QString &name) void MFAudioEndpointControl::setActiveOutput(const QString &name)
{ {
if (m_activeEndpoint == name) if (m_activeEndpoint == name)
return; return;

View File

@@ -46,27 +46,27 @@
#include <mfidl.h> #include <mfidl.h>
#include <mmdeviceapi.h> #include <mmdeviceapi.h>
#include "qaudioendpointselectorcontrol.h" #include "qaudiooutputselectorcontrol.h"
class MFPlayerService; class MFPlayerService;
QT_USE_NAMESPACE QT_USE_NAMESPACE
class MFAudioEndpointControl : public QAudioEndpointSelectorControl class MFAudioEndpointControl : public QAudioOutputSelectorControl
{ {
Q_OBJECT Q_OBJECT
public: public:
MFAudioEndpointControl(QObject *parent = 0); MFAudioEndpointControl(QObject *parent = 0);
~MFAudioEndpointControl(); ~MFAudioEndpointControl();
QList<QString> availableEndpoints() const; QList<QString> availableOutputs() const;
QString endpointDescription(const QString &name) const; QString outputDescription(const QString &name) const;
QString defaultEndpoint() const; QString defaultOutput() const;
QString activeEndpoint() const; QString activeOutput() const;
void setActiveEndpoint(const QString& name); void setActiveOutput(const QString& name);
IMFActivate* currentActivate() const; IMFActivate* currentActivate() const;

View File

@@ -87,7 +87,7 @@ QMediaControl* MFPlayerService::requestControl(const char *name)
{ {
if (qstrcmp(name, QMediaPlayerControl_iid) == 0) { if (qstrcmp(name, QMediaPlayerControl_iid) == 0) {
return m_player; return m_player;
} else if (qstrcmp(name, QAudioEndpointSelectorControl_iid) == 0) { } else if (qstrcmp(name, QAudioOutputSelectorControl_iid) == 0) {
return m_audioEndpointControl; return m_audioEndpointControl;
} else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) { } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
return m_metaDataControl; return m_metaDataControl;

View File

@@ -47,7 +47,7 @@
#include <qaudiorecorder.h> #include <qaudiorecorder.h>
#include <qaudioencodersettingscontrol.h> #include <qaudioencodersettingscontrol.h>
#include <qmediarecordercontrol.h> #include <qmediarecordercontrol.h>
#include <qaudioendpointselectorcontrol.h> #include <qaudioinputselectorcontrol.h>
#include <qaudiodeviceinfo.h> #include <qaudiodeviceinfo.h>
#include <qaudioinput.h> #include <qaudioinput.h>
#include <qmediaobject.h> #include <qmediaobject.h>
@@ -171,19 +171,19 @@ void tst_QAudioRecorder::testAvailableAudioInputChangedSignal()
// The availabilityChangedSignal is implemented in QAudioRecorder. SO using it to test the signal. // The availabilityChangedSignal is implemented in QAudioRecorder. SO using it to test the signal.
audiosource = new QAudioRecorder; audiosource = new QAudioRecorder;
/* Spy the signal availableEndpointChanged and audioInputchanged */ /* Spy the signal availableInputsChanged and audioInputchanged */
QSignalSpy changed(mockMediaRecorderService->mockAudioEndpointSelector, SIGNAL(availableEndpointsChanged())); QSignalSpy changed(mockMediaRecorderService->mockAudioInputSelector, SIGNAL(availableInputsChanged()));
QSignalSpy audioInputchange(audiosource, SIGNAL(availableAudioInputsChanged())); QSignalSpy audioInputchange(audiosource, SIGNAL(availableAudioInputsChanged()));
/* Add the end points and verify if the available end point changed signal is emitted. */ /* Add the end points and verify if the available end point changed signal is emitted. */
QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioEndpointSelector, "addEndpoints"); QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioInputSelector, "addInputs");
QVERIFY(changed.count() == 1); QVERIFY(changed.count() == 1);
QVERIFY(audioInputchange.count() == 1); QVERIFY(audioInputchange.count() == 1);
/* Now try removes */ /* Now try removes */
changed.clear(); changed.clear();
audioInputchange.clear(); audioInputchange.clear();
QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioEndpointSelector, "removeEndpoints"); QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioInputSelector, "removeInputs");
QVERIFY(changed.count() == 1); QVERIFY(changed.count() == 1);
QVERIFY(audioInputchange.count() == 1); QVERIFY(audioInputchange.count() == 1);
} }

View File

@@ -48,7 +48,7 @@
#include <qmediarecordercontrol.h> #include <qmediarecordercontrol.h>
#include <qmediarecorder.h> #include <qmediarecorder.h>
#include <qmetadatawritercontrol.h> #include <qmetadatawritercontrol.h>
#include <qaudioendpointselectorcontrol.h> #include <qaudioinputselectorcontrol.h>
#include <qaudioencodersettingscontrol.h> #include <qaudioencodersettingscontrol.h>
#include <qmediacontainercontrol.h> #include <qmediacontainercontrol.h>
#include <qvideoencodersettingscontrol.h> #include <qvideoencodersettingscontrol.h>

View File

@@ -48,7 +48,7 @@
#include <qmediaobject.h> #include <qmediaobject.h>
#include <qmediaservice.h> #include <qmediaservice.h>
#include <qmetadatareadercontrol.h> #include <qmetadatareadercontrol.h>
#include <qaudioendpointselectorcontrol.h> #include <qaudioinputselectorcontrol.h>
#include "mockmediarecorderservice.h" #include "mockmediarecorderservice.h"
#include "mockmediaserviceprovider.h" #include "mockmediaserviceprovider.h"

View File

@@ -49,7 +49,7 @@
#include <qmediarecordercontrol.h> #include <qmediarecordercontrol.h>
#include <qmediarecorder.h> #include <qmediarecorder.h>
#include <qmetadatawritercontrol.h> #include <qmetadatawritercontrol.h>
#include <qaudioendpointselectorcontrol.h> #include <qaudioinputselectorcontrol.h>
#include <qaudioencodersettingscontrol.h> #include <qaudioencodersettingscontrol.h>
#include <qmediacontainercontrol.h> #include <qmediacontainercontrol.h>
#include <qvideoencodersettingscontrol.h> #include <qvideoencodersettingscontrol.h>
@@ -116,7 +116,7 @@ private slots:
private: private:
QAudioEncoderSettingsControl* encode; QAudioEncoderSettingsControl* encode;
QAudioEndpointSelectorControl* audio; QAudioInputSelectorControl* audio;
MockMediaObject *object; MockMediaObject *object;
MockMediaRecorderService*service; MockMediaRecorderService*service;
MockMediaRecorderControl *mock; MockMediaRecorderControl *mock;
@@ -134,7 +134,7 @@ void tst_QMediaRecorder::initTestCase()
object = new MockMediaObject(this, service); object = new MockMediaObject(this, service);
capture = new QMediaRecorder(object); capture = new QMediaRecorder(object);
audio = qobject_cast<QAudioEndpointSelectorControl*>(service->requestControl(QAudioEndpointSelectorControl_iid)); audio = qobject_cast<QAudioInputSelectorControl*>(service->requestControl(QAudioInputSelectorControl_iid));
encode = qobject_cast<QAudioEncoderSettingsControl*>(service->requestControl(QAudioEncoderSettingsControl_iid)); encode = qobject_cast<QAudioEncoderSettingsControl*>(service->requestControl(QAudioEncoderSettingsControl_iid));
videoEncode = qobject_cast<QVideoEncoderSettingsControl*>(service->requestControl(QVideoEncoderSettingsControl_iid)); videoEncode = qobject_cast<QVideoEncoderSettingsControl*>(service->requestControl(QVideoEncoderSettingsControl_iid));
} }
@@ -396,14 +396,14 @@ void tst_QMediaRecorder::testVolume()
void tst_QMediaRecorder::testAudioDeviceControl() void tst_QMediaRecorder::testAudioDeviceControl()
{ {
QSignalSpy readSignal(audio,SIGNAL(activeEndpointChanged(QString))); QSignalSpy readSignal(audio,SIGNAL(activeInputChanged(QString)));
QVERIFY(audio->availableEndpoints().size() == 3); QVERIFY(audio->availableInputs().size() == 3);
QVERIFY(audio->defaultEndpoint().compare("device1") == 0); QVERIFY(audio->defaultInput().compare("device1") == 0);
audio->setActiveEndpoint("device2"); audio->setActiveInput("device2");
QTestEventLoop::instance().enterLoop(1); QTestEventLoop::instance().enterLoop(1);
QVERIFY(audio->activeEndpoint().compare("device2") == 0); QVERIFY(audio->activeInput().compare("device2") == 0);
QVERIFY(readSignal.count() == 1); QVERIFY(readSignal.count() == 1);
QVERIFY(audio->endpointDescription("device2").compare("dev2 comment") == 0); QVERIFY(audio->inputDescription("device2").compare("dev2 comment") == 0);
} }
void tst_QMediaRecorder::testAudioEncodeControl() void tst_QMediaRecorder::testAudioEncodeControl()

View File

@@ -39,31 +39,31 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef MOCKAUDIOENDPOINTSELECTOR_H #ifndef MOCKAUDIOINPUTSELECTOR_H
#define MOCKAUDIOENDPOINTSELECTOR_H #define MOCKAUDIOINPUTSELECTOR_H
#include "qaudioendpointselectorcontrol.h" #include "qaudioinputselectorcontrol.h"
class MockAudioEndpointSelector : public QAudioEndpointSelectorControl class MockAudioInputSelector : public QAudioInputSelectorControl
{ {
Q_OBJECT Q_OBJECT
public: public:
MockAudioEndpointSelector(QObject *parent): MockAudioInputSelector(QObject *parent):
QAudioEndpointSelectorControl(parent) QAudioInputSelectorControl(parent)
{ {
m_names << "device1" << "device2" << "device3"; m_names << "device1" << "device2" << "device3";
m_descriptions << "dev1 comment" << "dev2 comment" << "dev3 comment"; m_descriptions << "dev1 comment" << "dev2 comment" << "dev3 comment";
m_audioInput = "device1"; m_audioInput = "device1";
emit availableEndpointsChanged(); emit availableInputsChanged();
} }
~MockAudioEndpointSelector() {} ~MockAudioInputSelector() {}
QList<QString> availableEndpoints() const QList<QString> availableInputs() const
{ {
return m_names; return m_names;
} }
QString endpointDescription(const QString& name) const QString inputDescription(const QString& name) const
{ {
QString desc; QString desc;
@@ -76,34 +76,34 @@ public:
return desc; return desc;
} }
QString defaultEndpoint() const QString defaultInput() const
{ {
return m_names.at(0); return m_names.at(0);
} }
QString activeEndpoint() const QString activeInput() const
{ {
return m_audioInput; return m_audioInput;
} }
public Q_SLOTS: public Q_SLOTS:
void setActiveEndpoint(const QString& name) void setActiveInput(const QString& name)
{ {
m_audioInput = name; m_audioInput = name;
emit activeEndpointChanged(name); emit activeInputChanged(name);
} }
void addEndpoints() void addInputs()
{ {
m_names << "device4"; m_names << "device4";
emit availableEndpointsChanged(); emit availableInputsChanged();
} }
void removeEndpoints() void removeInputs()
{ {
m_names.clear(); m_names.clear();
emit availableEndpointsChanged(); emit availableInputsChanged();
} }
private: private:
@@ -114,4 +114,4 @@ private:
#endif // MOCKAUDIOENDPOINTSELECTOR_H #endif // MOCKAUDIOINPUTSELECTOR_H

View File

@@ -47,7 +47,7 @@
#include "mockaudioencodercontrol.h" #include "mockaudioencodercontrol.h"
#include "mockmediarecordercontrol.h" #include "mockmediarecordercontrol.h"
#include "mockvideoencodercontrol.h" #include "mockvideoencodercontrol.h"
#include "mockaudioendpointselector.h" #include "mockaudioinputselector.h"
#include "mockmediacontainercontrol.h" #include "mockmediacontainercontrol.h"
#include "mockmetadatawritercontrol.h" #include "mockmetadatawritercontrol.h"
#include "mockavailabilitycontrol.h" #include "mockavailabilitycontrol.h"
@@ -63,7 +63,7 @@ public:
mockAvailabilityControl(availability), mockAvailabilityControl(availability),
hasControls(true) hasControls(true)
{ {
mockAudioEndpointSelector = new MockAudioEndpointSelector(this); mockAudioInputSelector = new MockAudioInputSelector(this);
mockAudioEncoderControl = new MockAudioEncoderControl(this); mockAudioEncoderControl = new MockAudioEncoderControl(this);
mockFormatControl = new MockMediaContainerControl(this); mockFormatControl = new MockMediaContainerControl(this);
mockVideoEncoderControl = new MockVideoEncoderControl(this); mockVideoEncoderControl = new MockVideoEncoderControl(this);
@@ -75,8 +75,8 @@ public:
{ {
if (hasControls && qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0) if (hasControls && qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0)
return mockAudioEncoderControl; return mockAudioEncoderControl;
if (hasControls && qstrcmp(name,QAudioEndpointSelectorControl_iid) == 0) if (hasControls && qstrcmp(name,QAudioInputSelectorControl_iid) == 0)
return mockAudioEndpointSelector; return mockAudioInputSelector;
if (hasControls && qstrcmp(name,QMediaRecorderControl_iid) == 0) if (hasControls && qstrcmp(name,QMediaRecorderControl_iid) == 0)
return mockControl; return mockControl;
if (hasControls && qstrcmp(name,QMediaContainerControl_iid) == 0) if (hasControls && qstrcmp(name,QMediaContainerControl_iid) == 0)
@@ -98,7 +98,7 @@ public:
} }
QMediaControl *mockControl; QMediaControl *mockControl;
QAudioEndpointSelectorControl *mockAudioEndpointSelector; QAudioInputSelectorControl *mockAudioInputSelector;
QAudioEncoderSettingsControl *mockAudioEncoderControl; QAudioEncoderSettingsControl *mockAudioEncoderControl;
QMediaContainerControl *mockFormatControl; QMediaContainerControl *mockFormatControl;
QVideoEncoderSettingsControl *mockVideoEncoderControl; QVideoEncoderSettingsControl *mockVideoEncoderControl;

View File

@@ -8,7 +8,7 @@ HEADERS *= \
../qmultimedia_common/mockmediarecordercontrol.h \ ../qmultimedia_common/mockmediarecordercontrol.h \
../qmultimedia_common/mockvideoencodercontrol.h \ ../qmultimedia_common/mockvideoencodercontrol.h \
../qmultimedia_common/mockaudioencodercontrol.h \ ../qmultimedia_common/mockaudioencodercontrol.h \
../qmultimedia_common/mockaudioendpointselector.h \ ../qmultimedia_common/mockaudioinputselector.h \
../qmultimedia_common/mockaudioprobecontrol.h \ ../qmultimedia_common/mockaudioprobecontrol.h \
# We also need all the container/metadata bits # We also need all the container/metadata bits