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

View File

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

View File

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

View File

@@ -4,7 +4,8 @@ INCLUDEPATH += controls
PUBLIC_HEADERS += \
controls/qaudiodecodercontrol.h \
controls/qaudioencodersettingscontrol.h \
controls/qaudioendpointselectorcontrol.h \
controls/qaudioinputselectorcontrol.h \
controls/qaudiooutputselectorcontrol.h \
controls/qcameracapturebufferformatcontrol.h \
controls/qcameracapturedestinationcontrol.h \
controls/qcameracontrol.h \
@@ -74,7 +75,8 @@ SOURCES += \
controls/qaudiodecodercontrol.cpp \
controls/qvideoencodersettingscontrol.cpp \
controls/qaudioencodersettingscontrol.cpp \
controls/qaudioendpointselectorcontrol.cpp \
controls/qaudioinputselectorcontrol.cpp \
controls/qaudiooutputselectorcontrol.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
#define QAUDIOENDPOINTSELECTORCONTROL_H
#ifndef QAUDIOINPUTSELECTORCONTROL_H
#define QAUDIOINPUTSELECTORCONTROL_H
#include <qaudio.h>
#include <qmediacontrol.h>
@@ -54,35 +54,35 @@ QT_MODULE(Multimedia)
// Class forward declaration required for QDoc bug
class QString;
class Q_MULTIMEDIA_EXPORT QAudioEndpointSelectorControl : public QMediaControl
class Q_MULTIMEDIA_EXPORT QAudioInputSelectorControl : public QMediaControl
{
Q_OBJECT
public:
virtual ~QAudioEndpointSelectorControl();
virtual ~QAudioInputSelectorControl();
virtual QList<QString> availableEndpoints() const = 0;
virtual QString endpointDescription(const QString& name) const = 0;
virtual QString defaultEndpoint() const = 0;
virtual QString activeEndpoint() const = 0;
virtual QList<QString> availableInputs() const = 0;
virtual QString inputDescription(const QString& name) const = 0;
virtual QString defaultInput() const = 0;
virtual QString activeInput() const = 0;
public Q_SLOTS:
virtual void setActiveEndpoint(const QString& name) = 0;
virtual void setActiveInput(const QString& name) = 0;
Q_SIGNALS:
void activeEndpointChanged(const QString& name);
void availableEndpointsChanged();
void activeInputChanged(const QString& name);
void availableInputsChanged();
protected:
QAudioEndpointSelectorControl(QObject *parent = 0);
QAudioInputSelectorControl(QObject *parent = 0);
};
#define QAudioEndpointSelectorControl_iid "org.qt-project.qt.audioendpointselectorcontrol/5.0"
Q_MEDIA_DECLARE_CONTROL(QAudioEndpointSelectorControl, QAudioEndpointSelectorControl_iid)
#define QAudioInputSelectorControl_iid "org.qt-project.qt.audioinputselectorcontrol/5.0"
Q_MEDIA_DECLARE_CONTROL(QAudioInputSelectorControl, QAudioInputSelectorControl_iid)
QT_END_NAMESPACE
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
#define QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H
#ifndef QGSTREAMERAUDIOINPUTSELECTOR_H
#define QGSTREAMERAUDIOINPUTSELECTOR_H
#include <qaudioendpointselectorcontrol.h>
#include <qaudioinputselectorcontrol.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
class QGstreamerAudioInputEndpointSelector : public QAudioEndpointSelectorControl
class QGstreamerAudioInputSelector : public QAudioInputSelectorControl
{
Q_OBJECT
public:
QGstreamerAudioInputEndpointSelector(QObject *parent);
~QGstreamerAudioInputEndpointSelector();
QGstreamerAudioInputSelector(QObject *parent);
~QGstreamerAudioInputSelector();
QList<QString> availableEndpoints() const;
QString endpointDescription(const QString& name) const;
QString defaultEndpoint() const;
QString activeEndpoint() const;
QList<QString> availableInputs() const;
QString inputDescription(const QString& name) const;
QString defaultInput() const;
QString activeInput() const;
public Q_SLOTS:
void setActiveEndpoint(const QString& name);
void setActiveInput(const QString& name);
private:
void update();
@@ -75,4 +75,4 @@ private:
QT_END_NAMESPACE
#endif // QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H
#endif // QGSTREAMERAUDIOINPUTSELECTOR_H

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -47,7 +47,7 @@
#include <qaudiorecorder.h>
#include <qaudioencodersettingscontrol.h>
#include <qmediarecordercontrol.h>
#include <qaudioendpointselectorcontrol.h>
#include <qaudioinputselectorcontrol.h>
#include <qaudiodeviceinfo.h>
#include <qaudioinput.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.
audiosource = new QAudioRecorder;
/* Spy the signal availableEndpointChanged and audioInputchanged */
QSignalSpy changed(mockMediaRecorderService->mockAudioEndpointSelector, SIGNAL(availableEndpointsChanged()));
/* Spy the signal availableInputsChanged and audioInputchanged */
QSignalSpy changed(mockMediaRecorderService->mockAudioInputSelector, SIGNAL(availableInputsChanged()));
QSignalSpy audioInputchange(audiosource, SIGNAL(availableAudioInputsChanged()));
/* 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(audioInputchange.count() == 1);
/* Now try removes */
changed.clear();
audioInputchange.clear();
QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioEndpointSelector, "removeEndpoints");
QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioInputSelector, "removeInputs");
QVERIFY(changed.count() == 1);
QVERIFY(audioInputchange.count() == 1);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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