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:
committed by
Qt by Nokia
parent
29a2d09a43
commit
ae728a4b1e
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user