diff options
-rw-r--r-- | src/multimedia/camera/qcamera.cpp | 5 | ||||
-rw-r--r-- | src/multimedia/camera/qcameraviewfindersettings.cpp | 3 | ||||
-rw-r--r-- | src/plugins/directshow/camera/dscamerasession.cpp | 4 | ||||
-rw-r--r-- | tests/auto/unit/qcamera/tst_qcamera.cpp | 411 | ||||
-rw-r--r-- | tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h | 45 |
5 files changed, 462 insertions, 6 deletions
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp index a5fee276..ea1b6beb 100644 --- a/src/multimedia/camera/qcamera.cpp +++ b/src/multimedia/camera/qcamera.cpp @@ -72,6 +72,9 @@ static bool qt_sizeLessThan(const QSize &s1, const QSize &s2) static bool qt_frameRateRangeLessThan(const QCamera::FrameRateRange &s1, const QCamera::FrameRateRange &s2) { + if (s1.maximumFrameRate == s2.maximumFrameRate) + return s1.minimumFrameRate < s2.minimumFrameRate; + return s1.maximumFrameRate < s2.maximumFrameRate; } @@ -658,7 +661,7 @@ QList<QCameraViewfinderSettings> QCamera::supportedViewfinderSettings(const QCam && (qFuzzyIsNull(settings.minimumFrameRate()) || qFuzzyCompare((float)settings.minimumFrameRate(), (float)s.minimumFrameRate())) && (qFuzzyIsNull(settings.maximumFrameRate()) || qFuzzyCompare((float)settings.maximumFrameRate(), (float)s.maximumFrameRate())) && (settings.pixelFormat() == QVideoFrame::Format_Invalid || settings.pixelFormat() == s.pixelFormat()) - && (settings.pixelAspectRatio() == QSize(1, 1) || settings.pixelAspectRatio() == s.pixelAspectRatio())) { + && (settings.pixelAspectRatio().isEmpty() || settings.pixelAspectRatio() == s.pixelAspectRatio())) { results.append(s); } } diff --git a/src/multimedia/camera/qcameraviewfindersettings.cpp b/src/multimedia/camera/qcameraviewfindersettings.cpp index df4fa702..af0d614c 100644 --- a/src/multimedia/camera/qcameraviewfindersettings.cpp +++ b/src/multimedia/camera/qcameraviewfindersettings.cpp @@ -50,8 +50,7 @@ public: isNull(true), minimumFrameRate(0.0), maximumFrameRate(0.0), - pixelFormat(QVideoFrame::Format_Invalid), - pixelAspectRatio(1, 1) + pixelFormat(QVideoFrame::Format_Invalid) { } diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index a2586aa9..2d3aa1bc 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -646,7 +646,8 @@ bool DSCameraSession::configurePreviewFormat() if ((m_viewfinderSettings.resolution().isEmpty() || m_viewfinderSettings.resolution() == s.resolution()) && (qFuzzyIsNull(m_viewfinderSettings.minimumFrameRate()) || qFuzzyCompare((float)m_viewfinderSettings.minimumFrameRate(), (float)s.minimumFrameRate())) && (qFuzzyIsNull(m_viewfinderSettings.maximumFrameRate()) || qFuzzyCompare((float)m_viewfinderSettings.maximumFrameRate(), (float)s.maximumFrameRate())) - && (m_viewfinderSettings.pixelFormat() == QVideoFrame::Format_Invalid || m_viewfinderSettings.pixelFormat() == s.pixelFormat())) { + && (m_viewfinderSettings.pixelFormat() == QVideoFrame::Format_Invalid || m_viewfinderSettings.pixelFormat() == s.pixelFormat()) + && (m_viewfinderSettings.pixelAspectRatio().isEmpty() || m_viewfinderSettings.pixelAspectRatio() == s.pixelAspectRatio())) { resolvedViewfinderSettings = s; break; } @@ -899,6 +900,7 @@ void DSCameraSession::updateSourceCapabilities() settings.setMinimumFrameRate(frameRateRange.minimumFrameRate); settings.setMaximumFrameRate(frameRateRange.maximumFrameRate); settings.setPixelFormat(pixelFormat); + settings.setPixelAspectRatio(1, 1); m_supportedViewfinderSettings.append(settings); AM_MEDIA_TYPE format; diff --git a/tests/auto/unit/qcamera/tst_qcamera.cpp b/tests/auto/unit/qcamera/tst_qcamera.cpp index 49fce92d..6d6894e6 100644 --- a/tests/auto/unit/qcamera/tst_qcamera.cpp +++ b/tests/auto/unit/qcamera/tst_qcamera.cpp @@ -90,6 +90,14 @@ private slots: void testImageSettings(); void testViewfinderSettings(); void testViewfinderSettingsChange(); + void testSupportedViewfinderSettings_data(); + void testSupportedViewfinderSettings(); + void testSupportedViewfinderResolutions_data(); + void testSupportedViewfinderResolutions(); + void testSupportedViewfinderFrameRateRanges_data(); + void testSupportedViewfinderFrameRateRanges(); + void testSupportedViewfinderPixelFormats_data(); + void testSupportedViewfinderPixelFormats(); void testCameraLock(); void testCameraLockCancel(); void testCameraEncodingProperyChange(); @@ -163,8 +171,11 @@ private: MockMediaServiceProvider *provider; }; +Q_DECLARE_METATYPE(QCamera::FrameRateRange) + void tst_QCamera::initTestCase() { + qRegisterMetaType<QCamera::FrameRateRange>("FrameRateRange"); } void tst_QCamera::init() @@ -906,7 +917,7 @@ void tst_QCamera::testViewfinderSettings() QVERIFY(!settings.isNull()); settings = QCameraViewfinderSettings(); - QCOMPARE(settings.pixelAspectRatio(), QSize(1, 1)); + QCOMPARE(settings.pixelAspectRatio(), QSize()); settings.setPixelAspectRatio(QSize(2, 1)); QCOMPARE(settings.pixelAspectRatio(), QSize(2, 1)); settings.setPixelAspectRatio(3, 2); @@ -1044,6 +1055,404 @@ void tst_QCamera::testViewfinderSettingsChange() QCOMPARE(statusChangedSignal.count(), 1); } +class ViewfinderSettingsBuilder +{ +public: + ViewfinderSettingsBuilder &setResolution(int width, int height) { + m_settings.setResolution(width, height); + return *this; + } + + ViewfinderSettingsBuilder &setMinimumFrameRate(qreal r) { + m_settings.setMinimumFrameRate(r); + return *this; + } + + ViewfinderSettingsBuilder &setMaximumFrameRate(qreal r) { + m_settings.setMaximumFrameRate(r); + return *this; + } + + ViewfinderSettingsBuilder &setPixelFormat(QVideoFrame::PixelFormat f) { + m_settings.setPixelFormat(f); + return *this; + } + + ViewfinderSettingsBuilder &setPixelAspectRatio(int h, int v) { + m_settings.setPixelAspectRatio(h, v); + return *this; + } + + QCameraViewfinderSettings build() { + QCameraViewfinderSettings s = m_settings; + m_settings = QCameraViewfinderSettings(); + return s; + } + +private: + QCameraViewfinderSettings m_settings; +}; + +void tst_QCamera::testSupportedViewfinderSettings_data() +{ + // see mockcameraviewfindersettingscontrol.h for expected values + + ViewfinderSettingsBuilder builder; + + QTest::addColumn<QCameraViewfinderSettings>("settings"); + QTest::addColumn< QList<int> >("expectedSupportedSettings"); + + QTest::newRow("all supported settings") << QCameraViewfinderSettings() + << (QList<int>() << 0 << 1 << 2 << 3 << 4 << 5); + + QTest::newRow("invalid resolution") << builder.setResolution(452472, 44453).build() + << QList<int>(); + + QTest::newRow("resolution (1)") << builder.setResolution(640, 480).build() + << (QList<int>() << 0); + + QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build() + << (QList<int>() << 1 << 3 << 4); + + QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build() + << QList<int>(); + + QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build() + << (QList<int>() << 2); + + QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build() + << (QList<int>() << 1 << 3); + + QTest::newRow("minimum frame rate (3)") << builder.setMinimumFrameRate(30).build() + << (QList<int>() << 0 << 4 << 5); + + QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build() + << QList<int>(); + + QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build() + << (QList<int>() << 1 << 2 << 3); + + QTest::newRow("maximum frame rate (2)") << builder.setMaximumFrameRate(30).build() + << (QList<int>() << 0 << 4 << 5); + + QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_CameraRaw).build() + << QList<int>(); + + QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build() + << (QList<int>() << 2); + + QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_YV12).build() + << (QList<int>() << 3 << 4); + + QTest::newRow("pixel format (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build() + << (QList<int>() << 0 << 1 << 5); + + QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(5, 3).build() + << QList<int>(); + + QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build() + << (QList<int>() << 2); + + QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build() + << (QList<int>() << 0 << 1 << 3 << 4 << 5); + + QTest::newRow("invalid multi settings") << builder.setResolution(640, 480) + .setMinimumFrameRate(10) + .setMaximumFrameRate(10) + .build() + << QList<int>(); + + QTest::newRow("multi settings (1)") << builder.setResolution(640, 480) + .setMinimumFrameRate(30) + .setMaximumFrameRate(30) + .build() + << (QList<int>() << 0); + + QTest::newRow("multi settings (2)") << builder.setResolution(1280, 720) + .setMinimumFrameRate(10) + .setMaximumFrameRate(10) + .build() + << (QList<int>() << 1 << 3); + + QTest::newRow("multi settings (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12) + .setMinimumFrameRate(30) + .build() + << (QList<int>() << 0 << 5); + + QTest::newRow("multi settings (4)") << builder.setPixelAspectRatio(1, 1) + .setMaximumFrameRate(10) + .build() + << (QList<int>() << 1 << 3); +} + +void tst_QCamera::testSupportedViewfinderSettings() +{ + QFETCH(QCameraViewfinderSettings, settings); + QFETCH(QList<int>, expectedSupportedSettings); + + QList<QCameraViewfinderSettings> actualSupportedSettings = QCamera().supportedViewfinderSettings(settings); + QCOMPARE(actualSupportedSettings.size(), expectedSupportedSettings.size()); + for (int i = 0; i < expectedSupportedSettings.size(); ++i) { + QCameraViewfinderSettings expectedSettings = mockCameraService->mockViewfinderSettingsControl->supportedSettings.at(expectedSupportedSettings.at(i)); + QCOMPARE(actualSupportedSettings.at(i), expectedSettings); + } +} + +void tst_QCamera::testSupportedViewfinderResolutions_data() +{ + // see mockcameraviewfindersettingscontrol.h for expected values + + typedef QList<QSize> SizeList; + ViewfinderSettingsBuilder builder; + + QTest::addColumn<QCameraViewfinderSettings>("settings"); + QTest::addColumn<SizeList>("expectedResolutions"); + + QTest::newRow("empty settings") << QCameraViewfinderSettings() + << (SizeList() << QSize(320, 240) + << QSize(640, 480) + << QSize(1280, 720) + << QSize(1920, 1080)); + + QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build() + << SizeList(); + + QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build() + << (SizeList() << QSize(1920, 1080)); + + QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build() + << (SizeList() << QSize(1280, 720)); + + QTest::newRow("minimum frame rate (3)") << builder.setMinimumFrameRate(30).build() + << (SizeList() << QSize(320, 240) + << QSize(640, 480) + << QSize(1280, 720)); + + QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build() + << SizeList(); + + QTest::newRow("maximum frame rate") << builder.setMaximumFrameRate(10).build() + << (SizeList() << QSize(1280, 720) + << QSize(1920, 1080)); + + QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_CameraRaw).build() + << SizeList(); + + QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build() + << (SizeList() << QSize(1920, 1080)); + + QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_YV12).build() + << (SizeList() << QSize(1280, 720)); + + QTest::newRow("pixel format (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build() + << (SizeList() << QSize(320, 240) + << QSize(640, 480) + << QSize(1280, 720)); + + QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(7, 2).build() + << SizeList(); + + QTest::newRow("pixel aspect ratio (1") << builder.setPixelAspectRatio(2, 1).build() + << (SizeList() << QSize(1920, 1080)); + + QTest::newRow("pixel aspect ratio (2") << builder.setPixelAspectRatio(1, 1).build() + << (SizeList() << QSize(320, 240) + << QSize(640, 480) + << QSize(1280, 720)); + + QTest::newRow("invalid multi settings (1)") << builder.setMinimumFrameRate(2) + .setMaximumFrameRate(3) + .build() + << SizeList(); + + QTest::newRow("invalid multi settings (2)") << builder.setMinimumFrameRate(5) + .setMaximumFrameRate(11) + .build() + << SizeList(); + + QTest::newRow("multi settings (1)") << builder.setMinimumFrameRate(10) + .setMaximumFrameRate(10) + .build() + << (SizeList() << QSize(1280, 720)); + + QTest::newRow("multi settings (2)") << builder.setMinimumFrameRate(30) + .setMaximumFrameRate(30) + .build() + << (SizeList() << QSize(320, 240) + << QSize(640, 480) + << QSize(1280, 720)); + + QTest::newRow("multi settings (3)") << builder.setPixelFormat(QVideoFrame::Format_NV12) + .setMinimumFrameRate(30) + .build() + << (SizeList() << QSize(320, 240) + << QSize(640, 480)); + + QTest::newRow("multi settings (4)") << builder.setPixelAspectRatio(1, 1) + .setMaximumFrameRate(10) + .build() + << (SizeList() << QSize(1280, 720)); +} + +void tst_QCamera::testSupportedViewfinderResolutions() +{ + QFETCH(QCameraViewfinderSettings, settings); + QFETCH(QList<QSize>, expectedResolutions); + + QList<QSize> actualResolutions = QCamera().supportedViewfinderResolutions(settings); + QCOMPARE(actualResolutions.size(), expectedResolutions.size()); + for (int i = 0; i < actualResolutions.size(); ++i) + QCOMPARE(actualResolutions.at(i), expectedResolutions.at(i)); +} + +void tst_QCamera::testSupportedViewfinderFrameRateRanges_data() +{ + // see mockcameraviewfindersettingscontrol.h for expected values + + typedef QList<QCamera::FrameRateRange> RangeList; + ViewfinderSettingsBuilder builder; + + QTest::addColumn<QCameraViewfinderSettings>("settings"); + QTest::addColumn<RangeList>("expectedFrameRateRanges"); + + QTest::newRow("empty settings") << QCameraViewfinderSettings() + << (RangeList() << QCamera::FrameRateRange(5, 10) + << QCamera::FrameRateRange(10, 10) + << QCamera::FrameRateRange(30, 30)); + + QTest::newRow("invalid resolution") << builder.setResolution(452472, 444534).build() + << RangeList(); + + QTest::newRow("resolution (1)") << builder.setResolution(320, 240).build() + << (RangeList() << QCamera::FrameRateRange(30, 30)); + + QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build() + << (RangeList() << QCamera::FrameRateRange(10, 10) + << QCamera::FrameRateRange(30, 30)); + + QTest::newRow("resolution (3)") << builder.setResolution(1920, 1080).build() + << (RangeList() << QCamera::FrameRateRange(5, 10)); + + QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build() + << RangeList(); + + QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build() + << (RangeList() << QCamera::FrameRateRange(5, 10)); + + QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build() + << (RangeList() << QCamera::FrameRateRange(10, 10)); + + QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build() + << RangeList(); + + QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build() + << (RangeList() << QCamera::FrameRateRange(5, 10) + << QCamera::FrameRateRange(10, 10)); + + QTest::newRow("maximum frame rate (2)") << builder.setMaximumFrameRate(30).build() + << (RangeList() << QCamera::FrameRateRange(30, 30)); + + QTest::newRow("invalid pixel format") << builder.setPixelFormat(QVideoFrame::Format_IMC1).build() + << RangeList(); + + QTest::newRow("pixel format (1)") << builder.setPixelFormat(QVideoFrame::Format_BGR32).build() + << (RangeList() << QCamera::FrameRateRange(5, 10)); + + QTest::newRow("pixel format (2)") << builder.setPixelFormat(QVideoFrame::Format_NV12).build() + << (RangeList() << QCamera::FrameRateRange(10, 10) + << QCamera::FrameRateRange(30, 30)); + + QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(2, 3).build() + << RangeList(); + + QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build() + << (RangeList() << QCamera::FrameRateRange(5, 10)); + + QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build() + << (RangeList() << QCamera::FrameRateRange(10, 10) + << QCamera::FrameRateRange(30, 30)); +} + +void tst_QCamera::testSupportedViewfinderFrameRateRanges() +{ + QFETCH(QCameraViewfinderSettings, settings); + QFETCH(QList<QCamera::FrameRateRange>, expectedFrameRateRanges); + + QList<QCamera::FrameRateRange> actualFrameRateRanges = QCamera().supportedViewfinderFrameRateRanges(settings); + QCOMPARE(actualFrameRateRanges.size(), expectedFrameRateRanges.size()); + for (int i = 0; i < actualFrameRateRanges.size(); ++i) + QCOMPARE(actualFrameRateRanges.at(i), expectedFrameRateRanges.at(i)); +} + +void tst_QCamera::testSupportedViewfinderPixelFormats_data() +{ + // see mockcameraviewfindersettingscontrol.h for expected values + + typedef QList<QVideoFrame::PixelFormat> FormatList; + ViewfinderSettingsBuilder builder; + + QTest::addColumn<QCameraViewfinderSettings>("settings"); + QTest::addColumn<FormatList>("expectedPixelFormats"); + + QTest::newRow("empty settings") << QCameraViewfinderSettings() + << (FormatList() << QVideoFrame::Format_NV12 + << QVideoFrame::Format_BGR32 + << QVideoFrame::Format_YV12); + + QTest::newRow("invalid resolution") << builder.setResolution(452472, 444534).build() + << FormatList(); + + QTest::newRow("resolution (1)") << builder.setResolution(640, 480).build() + << (FormatList() << QVideoFrame::Format_NV12); + + QTest::newRow("resolution (2)") << builder.setResolution(1280, 720).build() + << (FormatList() << QVideoFrame::Format_NV12 + << QVideoFrame::Format_YV12); + + QTest::newRow("invalid minimum frame rate") << builder.setMinimumFrameRate(2).build() + << FormatList(); + + QTest::newRow("minimum frame rate (1)") << builder.setMinimumFrameRate(5).build() + << (FormatList() << QVideoFrame::Format_BGR32); + + QTest::newRow("minimum frame rate (2)") << builder.setMinimumFrameRate(10).build() + << (FormatList() << QVideoFrame::Format_NV12 + << QVideoFrame::Format_YV12); + + QTest::newRow("invalid maximum frame rate") << builder.setMaximumFrameRate(2).build() + << FormatList(); + + QTest::newRow("maximum frame rate (1)") << builder.setMaximumFrameRate(10).build() + << (FormatList() << QVideoFrame::Format_NV12 + << QVideoFrame::Format_BGR32 + << QVideoFrame::Format_YV12); + + QTest::newRow("maximum frame rate (2)") << builder.setMinimumFrameRate(30).build() + << (FormatList() << QVideoFrame::Format_NV12 + << QVideoFrame::Format_YV12); + + QTest::newRow("invalid pixel aspect ratio") << builder.setPixelAspectRatio(2, 3).build() + << FormatList(); + + QTest::newRow("pixel aspect ratio (1)") << builder.setPixelAspectRatio(2, 1).build() + << (FormatList() << QVideoFrame::Format_BGR32); + + QTest::newRow("pixel aspect ratio (2)") << builder.setPixelAspectRatio(1, 1).build() + << (FormatList() << QVideoFrame::Format_NV12 + << QVideoFrame::Format_YV12); +} + +void tst_QCamera::testSupportedViewfinderPixelFormats() +{ + QFETCH(QCameraViewfinderSettings, settings); + QFETCH(QList<QVideoFrame::PixelFormat>, expectedPixelFormats); + + QList<QVideoFrame::PixelFormat> actualPixelFormats = QCamera().supportedViewfinderPixelFormats(settings); + QCOMPARE(actualPixelFormats.size(), expectedPixelFormats.size()); + for (int i = 0; i < actualPixelFormats.size(); ++i) + QCOMPARE(actualPixelFormats.at(i), expectedPixelFormats.at(i)); +} + void tst_QCamera::testCameraLock() { QCamera camera; diff --git a/tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h b/tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h index f272bb09..85427a70 100644 --- a/tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h +++ b/tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h @@ -43,6 +43,48 @@ public: MockCameraViewfinderSettingsControl(QObject *parent = 0): QCameraViewfinderSettingsControl2(parent) { + QCameraViewfinderSettings s; + s.setResolution(640, 480); + s.setMinimumFrameRate(30); + s.setMaximumFrameRate(30); + s.setPixelFormat(QVideoFrame::Format_NV12); + s.setPixelAspectRatio(1, 1); + supportedSettings.append(s); + + s.setResolution(1280, 720); + s.setMinimumFrameRate(10); + s.setMaximumFrameRate(10); + s.setPixelFormat(QVideoFrame::Format_NV12); + s.setPixelAspectRatio(1, 1); + supportedSettings.append(s); + + s.setResolution(1920, 1080); + s.setMinimumFrameRate(5); + s.setMaximumFrameRate(10); + s.setPixelFormat(QVideoFrame::Format_BGR32); + s.setPixelAspectRatio(2, 1); + supportedSettings.append(s); + + s.setResolution(1280, 720); + s.setMinimumFrameRate(10); + s.setMaximumFrameRate(10); + s.setPixelFormat(QVideoFrame::Format_YV12); + s.setPixelAspectRatio(1, 1); + supportedSettings.append(s); + + s.setResolution(1280, 720); + s.setMinimumFrameRate(30); + s.setMaximumFrameRate(30); + s.setPixelFormat(QVideoFrame::Format_YV12); + s.setPixelAspectRatio(1, 1); + supportedSettings.append(s); + + s.setResolution(320, 240); + s.setMinimumFrameRate(30); + s.setMaximumFrameRate(30); + s.setPixelFormat(QVideoFrame::Format_NV12); + s.setPixelAspectRatio(1, 1); + supportedSettings.append(s); } ~MockCameraViewfinderSettingsControl() {} @@ -59,10 +101,11 @@ public: QList<QCameraViewfinderSettings> supportedViewfinderSettings() const { - return QList<QCameraViewfinderSettings>(); + return supportedSettings; } QCameraViewfinderSettings settings; + QList<QCameraViewfinderSettings> supportedSettings; }; #endif // MOCKCAMERAVIEWFINDERSETTINGSCONTROL_H |