summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/avfoundation/camera/avfcameraservice.mm4
-rw-r--r--src/plugins/avfoundation/camera/avfcamerasession.mm16
-rw-r--r--src/plugins/avfoundation/camera/avfcamerautility.h17
-rw-r--r--src/plugins/avfoundation/camera/avfcamerautility.mm114
-rw-r--r--src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm161
-rw-r--r--src/plugins/avfoundation/camera/avfcamerazoomcontrol.mm15
-rw-r--r--src/plugins/avfoundation/camera/avfimageencodercontrol.mm126
-rw-r--r--src/plugins/avfoundation/camera/avfmediaassetwriter.mm1
-rw-r--r--src/plugins/avfoundation/camera/avfvideoencodersettingscontrol.mm86
-rw-r--r--src/plugins/avfoundation/camera/camera.pro7
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.h1
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm15
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h3
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm17
-rw-r--r--src/plugins/coreaudio/coreaudiosessionmanager.mm113
-rw-r--r--src/plugins/directshow/camera/dscamerasession.cpp32
-rw-r--r--src/plugins/directshow/dsserviceplugin.cpp3
-rw-r--r--src/plugins/directshow/helpers/directshowglobal.h7
-rw-r--r--src/plugins/directshow/player/directshowplayercontrol.cpp4
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.h10
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h26
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h4
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h8
-rw-r--r--src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h2
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinaudioencoder.h10
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h6
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.h6
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.cpp36
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.h11
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontrol.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.h10
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.h8
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinfocus.h22
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.h20
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageencoder.h10
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageprocessing.h8
-rw-r--r--src/plugins/gstreamer/camerabin/camerabininfocontrol.h4
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.h10
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinmetadata.h10
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinrecorder.h22
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.h4
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinserviceplugin.h16
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp2
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.h4
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h8
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinvideoencoder.h12
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h6
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h6
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinzoom.h14
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp75
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h16
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h14
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h12
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h4
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h16
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h6
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h10
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h10
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp47
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h19
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h22
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h6
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp69
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h19
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h2
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h6
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h44
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h4
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h10
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp123
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h5
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h10
-rw-r--r--src/plugins/wasapi/qwasapiaudioinput.cpp10
-rw-r--r--src/plugins/wasapi/qwasapiaudioinput.h2
-rw-r--r--src/plugins/wasapi/qwasapiaudiooutput.cpp10
-rw-r--r--src/plugins/wasapi/qwasapiaudiooutput.h2
-rw-r--r--src/plugins/wasapi/wasapi.pro5
-rw-r--r--src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp26
-rw-r--r--src/plugins/winrt/qwinrtcameraimagecapturecontrol.h4
79 files changed, 585 insertions, 1094 deletions
diff --git a/src/plugins/avfoundation/camera/avfcameraservice.mm b/src/plugins/avfoundation/camera/avfcameraservice.mm
index a1213be3b..7fd04250e 100644
--- a/src/plugins/avfoundation/camera/avfcameraservice.mm
+++ b/src/plugins/avfoundation/camera/avfcameraservice.mm
@@ -37,9 +37,9 @@
**
****************************************************************************/
+#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qvariant.h>
#include <QtCore/qdebug.h>
-#include <QtCore/qsysinfo.h>
#include "avfcameraservice.h"
#include "avfcameracontrol.h"
@@ -96,7 +96,7 @@ AVFCameraService::AVFCameraService(QObject *parent):
m_cameraFocusControl = new AVFCameraFocusControl(this);
m_cameraExposureControl = 0;
#if defined(Q_OS_IOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0)
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8))
m_cameraExposureControl = new AVFCameraExposureControl(this);
#endif
diff --git a/src/plugins/avfoundation/camera/avfcamerasession.mm b/src/plugins/avfoundation/camera/avfcamerasession.mm
index c32b072ef..0b7c0e9d8 100644
--- a/src/plugins/avfoundation/camera/avfcamerasession.mm
+++ b/src/plugins/avfoundation/camera/avfcamerasession.mm
@@ -432,18 +432,12 @@ void AVFCameraSession::removeProbe(AVFMediaVideoProbeControl *probe)
FourCharCode AVFCameraSession::defaultCodec()
{
if (!m_defaultCodec) {
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- if (AVCaptureDevice *device = videoCaptureDevice()) {
- AVCaptureDeviceFormat *format = device.activeFormat;
- if (!format || !format.formatDescription)
- return m_defaultCodec;
- m_defaultCodec = CMVideoFormatDescriptionGetCodecType(format.formatDescription);
- }
+ if (AVCaptureDevice *device = videoCaptureDevice()) {
+ AVCaptureDeviceFormat *format = device.activeFormat;
+ if (!format || !format.formatDescription)
+ return m_defaultCodec;
+ m_defaultCodec = CMVideoFormatDescriptionGetCodecType(format.formatDescription);
}
-#else
- // TODO: extract media subtype.
-#endif
}
return m_defaultCodec;
}
diff --git a/src/plugins/avfoundation/camera/avfcamerautility.h b/src/plugins/avfoundation/camera/avfcamerautility.h
index 4da5f751e..ba1bd3861 100644
--- a/src/plugins/avfoundation/camera/avfcamerautility.h
+++ b/src/plugins/avfoundation/camera/avfcamerautility.h
@@ -40,7 +40,6 @@
#ifndef AVFCAMERAUTILITY_H
#define AVFCAMERAUTILITY_H
-#include <QtCore/qsysinfo.h>
#include <QtCore/qglobal.h>
#include <QtCore/qvector.h>
#include <QtCore/qdebug.h>
@@ -152,23 +151,9 @@ private:
Q_DISABLE_COPY(AVFScopedPointer);
};
-inline QSysInfo::MacVersion qt_OS_limit(QSysInfo::MacVersion osxVersion,
- QSysInfo::MacVersion iosVersion)
-{
-#ifdef Q_OS_OSX
- Q_UNUSED(iosVersion)
- return osxVersion;
-#else
- Q_UNUSED(osxVersion)
- return iosVersion;
-#endif
-}
-
typedef QPair<qreal, qreal> AVFPSRange;
AVFPSRange qt_connection_framerates(AVCaptureConnection *videoConnection);
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
-
QVector<AVCaptureDeviceFormat *> qt_unique_device_formats(AVCaptureDevice *captureDevice,
FourCharCode preferredFormat);
QSize qt_device_format_resolution(AVCaptureDeviceFormat *format);
@@ -185,8 +170,6 @@ AVFrameRateRange *qt_find_supported_framerate_range(AVCaptureDeviceFormat *forma
bool qt_formats_are_equal(AVCaptureDeviceFormat *f1, AVCaptureDeviceFormat *f2);
bool qt_set_active_format(AVCaptureDevice *captureDevice, AVCaptureDeviceFormat *format, bool preserveFps);
-#endif
-
AVFPSRange qt_current_framerates(AVCaptureDevice *captureDevice, AVCaptureConnection *videoConnection);
void qt_set_framerate_limits(AVCaptureDevice *captureDevice, AVCaptureConnection *videoConnection,
qreal minFPS, qreal maxFPS);
diff --git a/src/plugins/avfoundation/camera/avfcamerautility.mm b/src/plugins/avfoundation/camera/avfcamerautility.mm
index 279642e4f..872075e0f 100644
--- a/src/plugins/avfoundation/camera/avfcamerautility.mm
+++ b/src/plugins/avfoundation/camera/avfcamerautility.mm
@@ -40,6 +40,7 @@
#include "avfcamerautility.h"
#include "avfcameradebug.h"
+#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qvector.h>
#include <QtCore/qpair.h>
#include <private/qmultimediautils_p.h>
@@ -66,26 +67,17 @@ AVFPSRange qt_connection_framerates(AVCaptureConnection *videoConnection)
}
}
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_5_0)
-#if QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_9)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_9)
-#endif
- {
- if (videoConnection.supportsVideoMaxFrameDuration) {
- const CMTime cmMax = videoConnection.videoMaxFrameDuration;
- if (CMTimeCompare(cmMax, kCMTimeInvalid)) {
- if (const Float64 maxSeconds = CMTimeGetSeconds(cmMax))
- newRange.first = 1. / maxSeconds;
- }
+ if (videoConnection.supportsVideoMaxFrameDuration) {
+ const CMTime cmMax = videoConnection.videoMaxFrameDuration;
+ if (CMTimeCompare(cmMax, kCMTimeInvalid)) {
+ if (const Float64 maxSeconds = CMTimeGetSeconds(cmMax))
+ newRange.first = 1. / maxSeconds;
}
}
-#endif
return newRange;
}
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
-
namespace {
inline bool qt_area_sane(const QSize &size)
@@ -189,7 +181,7 @@ QSize qt_device_format_high_resolution(AVCaptureDeviceFormat *format)
Q_ASSERT(format);
QSize res;
#if defined(Q_OS_IOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0) {
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) {
const CMVideoDimensions hrDim(format.highResolutionStillImageDimensions);
res.setWidth(hrDim.width);
res.setHeight(hrDim.height);
@@ -436,8 +428,6 @@ bool qt_set_active_format(AVCaptureDevice *captureDevice, AVCaptureDeviceFormat
return true;
}
-#endif // SDK
-
void qt_set_framerate_limits(AVCaptureConnection *videoConnection, qreal minFPS, qreal maxFPS)
{
Q_ASSERT(videoConnection);
@@ -458,32 +448,17 @@ void qt_set_framerate_limits(AVCaptureConnection *videoConnection, qreal minFPS,
if (videoConnection.supportsVideoMinFrameDuration)
videoConnection.videoMinFrameDuration = minDuration;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_5_0)
-#if QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_9)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_9) {
- if (minFPS > 0.)
+ CMTime maxDuration = kCMTimeInvalid;
+ if (minFPS > 0.) {
+ if (!videoConnection.supportsVideoMaxFrameDuration)
qDebugCamera() << Q_FUNC_INFO << "minimum framerate is not supported";
- } else
-#endif
- {
- CMTime maxDuration = kCMTimeInvalid;
- if (minFPS > 0.) {
- if (!videoConnection.supportsVideoMaxFrameDuration)
- qDebugCamera() << Q_FUNC_INFO << "minimum framerate is not supported";
- else
- maxDuration = CMTimeMake(1, minFPS);
- }
- if (videoConnection.supportsVideoMaxFrameDuration)
- videoConnection.videoMaxFrameDuration = maxDuration;
+ else
+ maxDuration = CMTimeMake(1, minFPS);
}
-#else
- if (minFPS > 0.)
- qDebugCamera() << Q_FUNC_INFO << "minimum framerate is not supported";
-#endif
+ if (videoConnection.supportsVideoMaxFrameDuration)
+ videoConnection.videoMaxFrameDuration = maxDuration;
}
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
-
CMTime qt_adjusted_frame_duration(AVFrameRateRange *range, qreal fps)
{
Q_ASSERT(range);
@@ -549,7 +524,7 @@ void qt_set_framerate_limits(AVCaptureDevice *captureDevice, qreal minFPS, qreal
#ifdef Q_OS_IOS
[captureDevice setActiveVideoMinFrameDuration:minFrameDuration];
[captureDevice setActiveVideoMaxFrameDuration:maxFrameDuration];
-#else // Q_OS_OSX
+#elif defined(Q_OS_MACOS)
if (CMTimeCompare(minFrameDuration, kCMTimeInvalid) == 0
&& CMTimeCompare(maxFrameDuration, kCMTimeInvalid) == 0) {
AVFrameRateRange *range = captureDevice.activeFormat.videoSupportedFrameRateRanges.firstObject;
@@ -560,32 +535,16 @@ void qt_set_framerate_limits(AVCaptureDevice *captureDevice, qreal minFPS, qreal
if (CMTimeCompare(minFrameDuration, kCMTimeInvalid))
[captureDevice setActiveVideoMinFrameDuration:minFrameDuration];
-#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9)
-#if QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_9)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_9)
-#endif
- {
- if (CMTimeCompare(maxFrameDuration, kCMTimeInvalid))
- [captureDevice setActiveVideoMaxFrameDuration:maxFrameDuration];
- }
-#endif // QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9)
-#endif // Q_OS_OSX
+ if (CMTimeCompare(maxFrameDuration, kCMTimeInvalid))
+ [captureDevice setActiveVideoMaxFrameDuration:maxFrameDuration];
+#endif // Q_OS_MACOS
}
-#endif // Platform SDK >= 10.9, >= 7.0.
-
void qt_set_framerate_limits(AVCaptureDevice *captureDevice, AVCaptureConnection *videoConnection,
qreal minFPS, qreal maxFPS)
{
Q_ASSERT(captureDevice);
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_9, QSysInfo::MV_IOS_7_0))
- qt_set_framerate_limits(captureDevice, minFPS, maxFPS);
- else
-#endif
- if (videoConnection)
- qt_set_framerate_limits(videoConnection, minFPS, maxFPS);
-
+ qt_set_framerate_limits(captureDevice, minFPS, maxFPS);
}
AVFPSRange qt_current_framerates(AVCaptureDevice *captureDevice, AVCaptureConnection *videoConnection)
@@ -593,33 +552,16 @@ AVFPSRange qt_current_framerates(AVCaptureDevice *captureDevice, AVCaptureConnec
Q_ASSERT(captureDevice);
AVFPSRange fps;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- const CMTime minDuration = captureDevice.activeVideoMinFrameDuration;
- if (CMTimeCompare(minDuration, kCMTimeInvalid)) {
- if (const Float64 minSeconds = CMTimeGetSeconds(minDuration))
- fps.second = 1. / minSeconds; // Max FPS = 1 / MinDuration.
- }
-
-#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9)
-#if QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_9)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_9)
-#endif
- {
- const CMTime maxDuration = captureDevice.activeVideoMaxFrameDuration;
- if (CMTimeCompare(maxDuration, kCMTimeInvalid)) {
- if (const Float64 maxSeconds = CMTimeGetSeconds(maxDuration))
- fps.first = 1. / maxSeconds; // Min FPS = 1 / MaxDuration.
- }
- }
-#endif // QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9)
+ const CMTime minDuration = captureDevice.activeVideoMinFrameDuration;
+ if (CMTimeCompare(minDuration, kCMTimeInvalid)) {
+ if (const Float64 minSeconds = CMTimeGetSeconds(minDuration))
+ fps.second = 1. / minSeconds; // Max FPS = 1 / MinDuration.
+ }
- } else {
-#else // OSX < 10.7 or iOS < 7.0
- {
-#endif // QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (videoConnection)
- fps = qt_connection_framerates(videoConnection);
+ const CMTime maxDuration = captureDevice.activeVideoMaxFrameDuration;
+ if (CMTimeCompare(maxDuration, kCMTimeInvalid)) {
+ if (const Float64 maxSeconds = CMTimeGetSeconds(maxDuration))
+ fps.first = 1. / maxSeconds; // Min FPS = 1 / MaxDuration.
}
return fps;
diff --git a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
index 23dd2a4aa..0054a8d01 100644
--- a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
+++ b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm
@@ -47,7 +47,6 @@
#include <QtMultimedia/qabstractvideosurface.h>
#include <QtCore/qvariant.h>
-#include <QtCore/qsysinfo.h>
#include <QtCore/qvector.h>
#include <QtCore/qdebug.h>
#include <QtCore/qlist.h>
@@ -97,57 +96,36 @@ QList<QCameraViewfinderSettings> AVFCameraViewfinderSettingsControl2::supportedV
if (!pixelFormats.size())
pixelFormats << QVideoFrame::Format_Invalid; // The default value.
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- if (!captureDevice.formats || !captureDevice.formats.count) {
- qDebugCamera() << Q_FUNC_INFO << "no capture device formats found";
- return supportedSettings;
- }
+ if (!captureDevice.formats || !captureDevice.formats.count) {
+ qDebugCamera() << Q_FUNC_INFO << "no capture device formats found";
+ return supportedSettings;
+ }
- const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(captureDevice,
- m_service->session()->defaultCodec()));
- for (int i = 0; i < formats.size(); ++i) {
- AVCaptureDeviceFormat *format = formats[i];
-
- const QSize res(qt_device_format_resolution(format));
- if (res.isNull() || !res.isValid())
- continue;
- const QSize par(qt_device_format_pixel_aspect_ratio(format));
- if (par.isNull() || !par.isValid())
- continue;
-
- framerates = qt_device_format_framerates(format);
- if (!framerates.size())
- framerates << AVFPSRange(); // The default value.
-
- for (int i = 0; i < pixelFormats.size(); ++i) {
- for (int j = 0; j < framerates.size(); ++j) {
- QCameraViewfinderSettings newSet;
- newSet.setResolution(res);
- newSet.setPixelAspectRatio(par);
- newSet.setPixelFormat(pixelFormats[i]);
- newSet.setMinimumFrameRate(framerates[j].first);
- newSet.setMaximumFrameRate(framerates[j].second);
- supportedSettings << newSet;
- }
- }
- }
- } else {
-#else
- {
-#endif
- AVCaptureConnection *connection = videoConnection();
- if (connection) {
- // TODO: resolution and PAR.
- framerates << qt_connection_framerates(connection);
- for (int i = 0; i < pixelFormats.size(); ++i) {
- for (int j = 0; j < framerates.size(); ++j) {
- QCameraViewfinderSettings newSet;
- newSet.setPixelFormat(pixelFormats[i]);
- newSet.setMinimumFrameRate(framerates[j].first);
- newSet.setMaximumFrameRate(framerates[j].second);
- supportedSettings << newSet;
- }
+ const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(captureDevice,
+ m_service->session()->defaultCodec()));
+ for (int i = 0; i < formats.size(); ++i) {
+ AVCaptureDeviceFormat *format = formats[i];
+
+ const QSize res(qt_device_format_resolution(format));
+ if (res.isNull() || !res.isValid())
+ continue;
+ const QSize par(qt_device_format_pixel_aspect_ratio(format));
+ if (par.isNull() || !par.isValid())
+ continue;
+
+ framerates = qt_device_format_framerates(format);
+ if (!framerates.size())
+ framerates << AVFPSRange(); // The default value.
+
+ for (int i = 0; i < pixelFormats.size(); ++i) {
+ for (int j = 0; j < framerates.size(); ++j) {
+ QCameraViewfinderSettings newSet;
+ newSet.setResolution(res);
+ newSet.setPixelAspectRatio(par);
+ newSet.setPixelFormat(pixelFormats[i]);
+ newSet.setMinimumFrameRate(framerates[j].first);
+ newSet.setMaximumFrameRate(framerates[j].second);
+ supportedSettings << newSet;
}
}
}
@@ -170,25 +148,21 @@ QCameraViewfinderSettings AVFCameraViewfinderSettingsControl2::viewfinderSetting
return settings;
}
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- if (!captureDevice.activeFormat) {
- qDebugCamera() << Q_FUNC_INFO << "no active capture device format";
- return settings;
- }
-
- const QSize res(qt_device_format_resolution(captureDevice.activeFormat));
- const QSize par(qt_device_format_pixel_aspect_ratio(captureDevice.activeFormat));
- if (res.isNull() || !res.isValid() || par.isNull() || !par.isValid()) {
- qDebugCamera() << Q_FUNC_INFO << "failed to obtain resolution/pixel aspect ratio";
- return settings;
- }
+ if (!captureDevice.activeFormat) {
+ qDebugCamera() << Q_FUNC_INFO << "no active capture device format";
+ return settings;
+ }
- settings.setResolution(res);
- settings.setPixelAspectRatio(par);
+ const QSize res(qt_device_format_resolution(captureDevice.activeFormat));
+ const QSize par(qt_device_format_pixel_aspect_ratio(captureDevice.activeFormat));
+ if (res.isNull() || !res.isValid() || par.isNull() || !par.isValid()) {
+ qDebugCamera() << Q_FUNC_INFO << "failed to obtain resolution/pixel aspect ratio";
+ return settings;
}
-#endif
- // TODO: resolution and PAR before 7.0.
+
+ settings.setResolution(res);
+ settings.setPixelAspectRatio(par);
+
const AVFPSRange fps = qt_current_framerates(captureDevice, videoConnection());
settings.setMinimumFrameRate(fps.first);
settings.setMaximumFrameRate(fps.second);
@@ -285,35 +259,30 @@ AVCaptureDeviceFormat *AVFCameraViewfinderSettingsControl2::findBestFormatMatch(
if (!captureDevice || settings.isNull())
return nil;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
-
- const QSize &resolution = settings.resolution();
- if (!resolution.isNull() && resolution.isValid()) {
- // Either the exact match (including high resolution for images on iOS)
- // or a format with a resolution close to the requested one.
- return qt_find_best_resolution_match(captureDevice, resolution,
- m_service->session()->defaultCodec());
- }
-
- // No resolution requested, what about framerates?
- if (!qt_framerates_sane(settings)) {
- qDebugCamera() << Q_FUNC_INFO << "invalid framerate requested (min/max):"
- << settings.minimumFrameRate() << settings.maximumFrameRate();
- return nil;
- }
+ const QSize &resolution = settings.resolution();
+ if (!resolution.isNull() && resolution.isValid()) {
+ // Either the exact match (including high resolution for images on iOS)
+ // or a format with a resolution close to the requested one.
+ return qt_find_best_resolution_match(captureDevice, resolution,
+ m_service->session()->defaultCodec());
+ }
- const qreal minFPS(settings.minimumFrameRate());
- const qreal maxFPS(settings.maximumFrameRate());
- if (minFPS || maxFPS)
- return qt_find_best_framerate_match(captureDevice,
- m_service->session()->defaultCodec(),
- maxFPS ? maxFPS : minFPS);
- // Ignore PAR for the moment (PAR without resolution can
- // pick a format with really bad resolution).
- // No need to test pixel format, just return settings.
+ // No resolution requested, what about framerates?
+ if (!qt_framerates_sane(settings)) {
+ qDebugCamera() << Q_FUNC_INFO << "invalid framerate requested (min/max):"
+ << settings.minimumFrameRate() << settings.maximumFrameRate();
+ return nil;
}
-#endif
+
+ const qreal minFPS(settings.minimumFrameRate());
+ const qreal maxFPS(settings.maximumFrameRate());
+ if (minFPS || maxFPS)
+ return qt_find_best_framerate_match(captureDevice,
+ m_service->session()->defaultCodec(),
+ maxFPS ? maxFPS : minFPS);
+ // Ignore PAR for the moment (PAR without resolution can
+ // pick a format with really bad resolution).
+ // No need to test pixel format, just return settings.
return nil;
}
@@ -395,7 +364,6 @@ bool AVFCameraViewfinderSettingsControl2::applySettings(const QCameraViewfinderS
bool activeFormatChanged = false;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
AVCaptureDeviceFormat *match = findBestFormatMatch(settings);
if (match) {
activeFormatChanged = qt_set_active_format(captureDevice, match, false);
@@ -403,7 +371,6 @@ bool AVFCameraViewfinderSettingsControl2::applySettings(const QCameraViewfinderS
qDebugCamera() << Q_FUNC_INFO << "matching device format not found";
// We still can update the pixel format at least.
}
-#endif
AVCaptureVideoDataOutput *videoOutput = m_service->videoOutput() ? m_service->videoOutput()->videoDataOutput() : 0;
if (videoOutput) {
diff --git a/src/plugins/avfoundation/camera/avfcamerazoomcontrol.mm b/src/plugins/avfoundation/camera/avfcamerazoomcontrol.mm
index 2662793f8..47dc736a1 100644
--- a/src/plugins/avfoundation/camera/avfcamerazoomcontrol.mm
+++ b/src/plugins/avfoundation/camera/avfcamerazoomcontrol.mm
@@ -44,7 +44,6 @@
#include "avfcameracontrol.h"
#include "avfcameradebug.h"
-#include <QtCore/qsysinfo.h>
#include <QtCore/qglobal.h>
#include <QtCore/qdebug.h>
@@ -98,9 +97,6 @@ void AVFCameraZoomControl::zoomTo(qreal optical, qreal digital)
{
Q_UNUSED(optical)
Q_UNUSED(digital)
-#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_7_0)
- return;
if (qFuzzyCompare(CGFloat(digital), m_requestedZoomFactor))
return;
@@ -109,15 +105,10 @@ void AVFCameraZoomControl::zoomTo(qreal optical, qreal digital)
Q_EMIT requestedDigitalZoomChanged(digital);
zoomToRequestedDigital();
-#endif
}
void AVFCameraZoomControl::cameraStateChanged()
{
-#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_7_0)
- return;
-
const QCamera::State state = m_session->state();
if (state != QCamera::ActiveState) {
if (state == QCamera::UnloadedState && m_maxZoomFactor > 1.) {
@@ -146,15 +137,10 @@ void AVFCameraZoomControl::cameraStateChanged()
}
zoomToRequestedDigital();
-#endif
}
void AVFCameraZoomControl::zoomToRequestedDigital()
{
-#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_7_0)
- return;
-
AVCaptureDevice *captureDevice = m_session->videoCaptureDevice();
if (!captureDevice || !captureDevice.activeFormat)
return;
@@ -186,7 +172,6 @@ void AVFCameraZoomControl::zoomToRequestedDigital()
m_zoomFactor = clampedZoom;
Q_EMIT currentDigitalZoomChanged(clampedZoom);
}
-#endif
}
QT_END_NAMESPACE
diff --git a/src/plugins/avfoundation/camera/avfimageencodercontrol.mm b/src/plugins/avfoundation/camera/avfimageencodercontrol.mm
index e5aa8a4c2..8384ce6ae 100644
--- a/src/plugins/avfoundation/camera/avfimageencodercontrol.mm
+++ b/src/plugins/avfoundation/camera/avfimageencodercontrol.mm
@@ -48,7 +48,7 @@
#include <QtMultimedia/qmediaencodersettings.h>
-#include <QtCore/qsysinfo.h>
+#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qdebug.h>
#include <AVFoundation/AVFoundation.h>
@@ -84,36 +84,28 @@ QList<QSize> AVFImageEncoderControl::supportedResolutions(const QImageEncoderSet
if (!videoCaptureDeviceIsValid())
return resolutions;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
- const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(captureDevice,
- m_service->session()->defaultCodec()));
+ AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
+ const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(captureDevice,
+ m_service->session()->defaultCodec()));
- for (int i = 0; i < formats.size(); ++i) {
- AVCaptureDeviceFormat *format = formats[i];
+ for (int i = 0; i < formats.size(); ++i) {
+ AVCaptureDeviceFormat *format = formats[i];
- const QSize res(qt_device_format_resolution(format));
- if (!res.isNull() && res.isValid())
- resolutions << res;
+ const QSize res(qt_device_format_resolution(format));
+ if (!res.isNull() && res.isValid())
+ resolutions << res;
#if defined(Q_OS_IOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0) {
- // From Apple's docs (iOS):
- // By default, AVCaptureStillImageOutput emits images with the same dimensions as
- // its source AVCaptureDevice instance’s activeFormat.formatDescription. However,
- // if you set this property to YES, the receiver emits still images at the capture
- // device’s highResolutionStillImageDimensions value.
- const QSize hrRes(qt_device_format_high_resolution(format));
- if (!hrRes.isNull() && hrRes.isValid())
- resolutions << res;
- }
-#endif
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) {
+ // From Apple's docs (iOS):
+ // By default, AVCaptureStillImageOutput emits images with the same dimensions as
+ // its source AVCaptureDevice instance’s activeFormat.formatDescription. However,
+ // if you set this property to YES, the receiver emits still images at the capture
+ // device’s highResolutionStillImageDimensions value.
+ const QSize hrRes(qt_device_format_high_resolution(format));
+ if (!hrRes.isNull() && hrRes.isValid())
+ resolutions << res;
}
- } else {
-#else
- {
#endif
- // TODO: resolutions without AVCaptureDeviceFormat ...
}
if (continuous)
@@ -134,40 +126,32 @@ QImageEncoderSettings AVFImageEncoderControl::imageSettings() const
if (!videoCaptureDeviceIsValid())
return settings;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
- if (!captureDevice.activeFormat) {
- qDebugCamera() << Q_FUNC_INFO << "no active format";
- return settings;
- }
+ AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
+ if (!captureDevice.activeFormat) {
+ qDebugCamera() << Q_FUNC_INFO << "no active format";
+ return settings;
+ }
- QSize res(qt_device_format_resolution(captureDevice.activeFormat));
+ QSize res(qt_device_format_resolution(captureDevice.activeFormat));
#if defined(Q_OS_IOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0) {
- if (!m_service->imageCaptureControl() || !m_service->imageCaptureControl()->stillImageOutput()) {
- qDebugCamera() << Q_FUNC_INFO << "no still image output";
- return settings;
- }
-
- AVCaptureStillImageOutput *stillImageOutput = m_service->imageCaptureControl()->stillImageOutput();
- if (stillImageOutput.highResolutionStillImageOutputEnabled)
- res = qt_device_format_high_resolution(captureDevice.activeFormat);
- }
-#endif
- if (res.isNull() || !res.isValid()) {
- qDebugCamera() << Q_FUNC_INFO << "failed to exctract the image resolution";
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) {
+ if (!m_service->imageCaptureControl() || !m_service->imageCaptureControl()->stillImageOutput()) {
+ qDebugCamera() << Q_FUNC_INFO << "no still image output";
return settings;
}
- settings.setResolution(res);
- } else {
-#else
- {
+ AVCaptureStillImageOutput *stillImageOutput = m_service->imageCaptureControl()->stillImageOutput();
+ if (stillImageOutput.highResolutionStillImageOutputEnabled)
+ res = qt_device_format_high_resolution(captureDevice.activeFormat);
+ }
#endif
- // TODO: resolution without AVCaptureDeviceFormat.
+ if (res.isNull() || !res.isValid()) {
+ qDebugCamera() << Q_FUNC_INFO << "failed to exctract the image resolution";
+ return settings;
}
+ settings.setResolution(res);
+
settings.setCodec(QLatin1String("jpeg"));
return settings;
@@ -222,34 +206,26 @@ bool AVFImageEncoderControl::applySettings()
bool activeFormatChanged = false;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
- AVCaptureDeviceFormat *match = qt_find_best_resolution_match(captureDevice, res,
- m_service->session()->defaultCodec());
+ AVCaptureDevice *captureDevice = m_service->session()->videoCaptureDevice();
+ AVCaptureDeviceFormat *match = qt_find_best_resolution_match(captureDevice, res,
+ m_service->session()->defaultCodec());
- if (!match) {
- qDebugCamera() << Q_FUNC_INFO << "unsupported resolution:" << res;
- return false;
- }
+ if (!match) {
+ qDebugCamera() << Q_FUNC_INFO << "unsupported resolution:" << res;
+ return false;
+ }
- activeFormatChanged = qt_set_active_format(captureDevice, match, true);
+ activeFormatChanged = qt_set_active_format(captureDevice, match, true);
#if defined(Q_OS_IOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_8_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_8_0) {
- AVCaptureStillImageOutput *imageOutput = m_service->imageCaptureControl()->stillImageOutput();
- if (res == qt_device_format_high_resolution(captureDevice.activeFormat))
- imageOutput.highResolutionStillImageOutputEnabled = YES;
- else
- imageOutput.highResolutionStillImageOutputEnabled = NO;
- }
-#endif
- } else {
-#else
- {
-#endif
- // TODO: resolution without capture device format ...
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) {
+ AVCaptureStillImageOutput *imageOutput = m_service->imageCaptureControl()->stillImageOutput();
+ if (res == qt_device_format_high_resolution(captureDevice.activeFormat))
+ imageOutput.highResolutionStillImageOutputEnabled = YES;
+ else
+ imageOutput.highResolutionStillImageOutputEnabled = NO;
}
+#endif
return activeFormatChanged;
}
diff --git a/src/plugins/avfoundation/camera/avfmediaassetwriter.mm b/src/plugins/avfoundation/camera/avfmediaassetwriter.mm
index 28735bc6a..5a1257f6c 100644
--- a/src/plugins/avfoundation/camera/avfmediaassetwriter.mm
+++ b/src/plugins/avfoundation/camera/avfmediaassetwriter.mm
@@ -47,7 +47,6 @@
#include "avfmediacontainercontrol.h"
#include <QtCore/qmetaobject.h>
-#include <QtCore/qsysinfo.h>
QT_USE_NAMESPACE
diff --git a/src/plugins/avfoundation/camera/avfvideoencodersettingscontrol.mm b/src/plugins/avfoundation/camera/avfvideoencodersettingscontrol.mm
index b478ba321..bbb16e709 100644
--- a/src/plugins/avfoundation/camera/avfvideoencodersettingscontrol.mm
+++ b/src/plugins/avfoundation/camera/avfvideoencodersettingscontrol.mm
@@ -56,7 +56,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QStringList, supportedCodecs, (QStringList() << QLatin
#endif
))
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
static bool format_supports_framerate(AVCaptureDeviceFormat *format, qreal fps)
{
if (format && fps > qreal(0)) {
@@ -74,7 +73,6 @@ static bool format_supports_framerate(AVCaptureDeviceFormat *format, qreal fps)
return false;
}
-#endif
static bool real_list_contains(const QList<qreal> &list, qreal value)
{
@@ -107,24 +105,20 @@ QList<QSize> AVFVideoEncoderSettingsControl::supportedResolutions(const QVideoEn
QList<QSize> resolutions;
resolutions.append(QSize(32, 32));
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- AVCaptureDevice *device = m_service->session()->videoCaptureDevice();
- if (device) {
- int maximumWidth = 0;
- const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(device,
- m_service->session()->defaultCodec()));
- for (int i = 0; i < formats.size(); ++i) {
- const QSize res(qt_device_format_resolution(formats[i]));
- if (res.width() > maximumWidth)
- maximumWidth = res.width();
- }
-
- if (maximumWidth > 0)
- resolutions.append(QSize(maximumWidth, maximumWidth));
+ AVCaptureDevice *device = m_service->session()->videoCaptureDevice();
+ if (device) {
+ int maximumWidth = 0;
+ const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(device,
+ m_service->session()->defaultCodec()));
+ for (int i = 0; i < formats.size(); ++i) {
+ const QSize res(qt_device_format_resolution(formats[i]));
+ if (res.width() > maximumWidth)
+ maximumWidth = res.width();
}
+
+ if (maximumWidth > 0)
+ resolutions.append(QSize(maximumWidth, maximumWidth));
}
-#endif
if (resolutions.count() == 1)
resolutions.append(QSize(3840, 3840));
@@ -135,45 +129,39 @@ QList<QSize> AVFVideoEncoderSettingsControl::supportedResolutions(const QVideoEn
QList<qreal> AVFVideoEncoderSettingsControl::supportedFrameRates(const QVideoEncoderSettings &settings,
bool *continuous) const
{
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
QList<qreal> uniqueFrameRates;
- if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_7, QSysInfo::MV_IOS_7_0)) {
- AVCaptureDevice *device = m_service->session()->videoCaptureDevice();
- if (!device)
- return uniqueFrameRates;
+ AVCaptureDevice *device = m_service->session()->videoCaptureDevice();
+ if (!device)
+ return uniqueFrameRates;
- if (continuous)
- *continuous = false;
+ if (continuous)
+ *continuous = false;
- QVector<AVFPSRange> allRates;
+ QVector<AVFPSRange> allRates;
- if (!settings.resolution().isValid()) {
- const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(device, 0));
- for (int i = 0; i < formats.size(); ++i) {
- AVCaptureDeviceFormat *format = formats.at(i);
- allRates += qt_device_format_framerates(format);
- }
- } else {
- AVCaptureDeviceFormat *format = qt_find_best_resolution_match(device,
- settings.resolution(),
- m_service->session()->defaultCodec());
- if (format)
- allRates = qt_device_format_framerates(format);
+ if (!settings.resolution().isValid()) {
+ const QVector<AVCaptureDeviceFormat *> formats(qt_unique_device_formats(device, 0));
+ for (int i = 0; i < formats.size(); ++i) {
+ AVCaptureDeviceFormat *format = formats.at(i);
+ allRates += qt_device_format_framerates(format);
}
+ } else {
+ AVCaptureDeviceFormat *format = qt_find_best_resolution_match(device,
+ settings.resolution(),
+ m_service->session()->defaultCodec());
+ if (format)
+ allRates = qt_device_format_framerates(format);
+ }
- for (int j = 0; j < allRates.size(); ++j) {
- if (!real_list_contains(uniqueFrameRates, allRates[j].first))
- uniqueFrameRates.append(allRates[j].first);
- if (!real_list_contains(uniqueFrameRates, allRates[j].second))
- uniqueFrameRates.append(allRates[j].second);
- }
+ for (int j = 0; j < allRates.size(); ++j) {
+ if (!real_list_contains(uniqueFrameRates, allRates[j].first))
+ uniqueFrameRates.append(allRates[j].first);
+ if (!real_list_contains(uniqueFrameRates, allRates[j].second))
+ uniqueFrameRates.append(allRates[j].second);
}
return uniqueFrameRates;
-#else
- return QList<qreal>();
-#endif
}
QStringList AVFVideoEncoderSettingsControl::supportedVideoCodecs() const
@@ -243,7 +231,6 @@ NSDictionary *AVFVideoEncoderSettingsControl::applySettings(AVCaptureConnection
int w = m_requestedSettings.resolution().width();
int h = m_requestedSettings.resolution().height();
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
if (AVCaptureDeviceFormat *currentFormat = device.activeFormat) {
CMFormatDescriptionRef formatDesc = currentFormat.formatDescription;
CMVideoDimensions dim = CMVideoFormatDescriptionGetDimensions(formatDesc);
@@ -300,7 +287,6 @@ NSDictionary *AVFVideoEncoderSettingsControl::applySettings(AVCaptureConnection
h = qMin(h, dim.height);
}
}
-#endif
if (w > 0 && h > 0) {
// Width and height must be divisible by 2
@@ -382,13 +368,11 @@ void AVFVideoEncoderSettingsControl::unapplySettings(AVCaptureConnection *connec
const bool needFpsChanged = m_restoreFps.first || m_restoreFps.second;
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
if (m_restoreFormat) {
qt_set_active_format(device, m_restoreFormat, !needFpsChanged);
[m_restoreFormat release];
m_restoreFormat = nil;
}
-#endif
if (needFpsChanged) {
qt_set_framerate_limits(device, connection, m_restoreFps.first, m_restoreFps.second);
diff --git a/src/plugins/avfoundation/camera/camera.pro b/src/plugins/avfoundation/camera/camera.pro
index ab70c25c3..bd7b1fc97 100644
--- a/src/plugins/avfoundation/camera/camera.pro
+++ b/src/plugins/avfoundation/camera/camera.pro
@@ -5,13 +5,16 @@ CONFIG += no_keywords
QT += multimedia-private network
-LIBS += -framework AudioToolbox \
+LIBS += -framework CoreFoundation \
+ -framework Foundation \
+ -framework AudioToolbox \
-framework CoreAudio \
-framework QuartzCore \
-framework CoreMedia
osx:LIBS += -framework AppKit \
-framework AudioUnit
-ios:LIBS += -framework CoreVideo
+ios:LIBS += -framework CoreGraphics \
+ -framework CoreVideo
QMAKE_USE += avfoundation
diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.h b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.h
index b18862b55..4460a4867 100644
--- a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.h
+++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.h
@@ -63,7 +63,6 @@ private:
AVFMediaPlayerControl *m_control;
QMediaControl *m_videoOutput;
AVFMediaPlayerMetaDataControl *m_playerMetaDataControl;
- bool m_enableRenderControl;
};
QT_END_NAMESPACE
diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm
index 526c36cc6..6218401b3 100644
--- a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm
@@ -48,32 +48,19 @@
#endif
#include "avfvideowindowcontrol.h"
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_6_0)
#import <AVFoundation/AVFoundation.h>
-#endif
QT_USE_NAMESPACE
AVFMediaPlayerService::AVFMediaPlayerService(QObject *parent)
: QMediaService(parent)
, m_videoOutput(0)
- , m_enableRenderControl(true)
{
m_session = new AVFMediaPlayerSession(this);
m_control = new AVFMediaPlayerControl(this);
m_control->setSession(m_session);
m_playerMetaDataControl = new AVFMediaPlayerMetaDataControl(m_session, this);
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_6_0)
- // AVPlayerItemVideoOutput is available in SDK
- #if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_8, __IPHONE_6_0)
- // might not be available at runtime
- #if defined(Q_OS_IOS) || defined(Q_OS_TVOS)
- m_enableRenderControl = [AVPlayerItemVideoOutput class] != 0;
- #endif
- #endif
-#endif
-
connect(m_control, SIGNAL(mediaChanged(QMediaContent)), m_playerMetaDataControl, SLOT(updateTags()));
}
@@ -98,7 +85,7 @@ QMediaControl *AVFMediaPlayerService::requestControl(const char *name)
return m_playerMetaDataControl;
- if (m_enableRenderControl && (qstrcmp(name, QVideoRendererControl_iid) == 0)) {
+ if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
if (!m_videoOutput)
m_videoOutput = new AVFVideoRendererControl(this);
diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h
index f0cb46aaa..5696faf15 100644
--- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h
+++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h
@@ -86,8 +86,6 @@ public:
qreal playbackRate() const;
- inline bool isVolumeSupported() const { return m_volumeSupported; }
-
public Q_SLOTS:
void setPlaybackRate(qreal rate);
@@ -169,7 +167,6 @@ private:
QMediaContent m_resources;
ResourceHandler m_resourceHandler;
- const bool m_volumeSupported;
bool m_muted;
bool m_tryingAsync;
int m_volume;
diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
index 473a18884..e15c2e44a 100644
--- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
@@ -233,7 +233,7 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe
[m_player retain];
//Set the initial volume on new player object
- if (self.session && self.session->isVolumeSupported()) {
+ if (self.session) {
[m_player setVolume:m_session->volume() / 100.0f];
[m_player setMuted:m_session->isMuted()];
}
@@ -380,11 +380,6 @@ AVFMediaPlayerSession::AVFMediaPlayerSession(AVFMediaPlayerService *service, QOb
, m_state(QMediaPlayer::StoppedState)
, m_mediaStatus(QMediaPlayer::NoMedia)
, m_mediaStream(0)
-#ifdef Q_OS_IOS
- , m_volumeSupported(QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0)
-#else
- , m_volumeSupported(true)
-#endif
, m_muted(false)
, m_tryingAsync(false)
, m_volume(100)
@@ -749,11 +744,6 @@ void AVFMediaPlayerSession::setVolume(int volume)
qDebug() << Q_FUNC_INFO << volume;
#endif
- if (!m_volumeSupported) {
- qWarning("%s not implemented, requires iOS 7 or later", Q_FUNC_INFO);
- return;
- }
-
if (m_volume == volume)
return;
@@ -772,11 +762,6 @@ void AVFMediaPlayerSession::setMuted(bool muted)
qDebug() << Q_FUNC_INFO << muted;
#endif
- if (!m_volumeSupported) {
- qWarning("%s not implemented, requires iOS 7 or later", Q_FUNC_INFO);
- return;
- }
-
if (m_muted == muted)
return;
diff --git a/src/plugins/coreaudio/coreaudiosessionmanager.mm b/src/plugins/coreaudio/coreaudiosessionmanager.mm
index d381b82c0..923a1942f 100644
--- a/src/plugins/coreaudio/coreaudiosessionmanager.mm
+++ b/src/plugins/coreaudio/coreaudiosessionmanager.mm
@@ -42,10 +42,6 @@
#import <AVFoundation/AVAudioSession.h>
#import <Foundation/Foundation.h>
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
-#include <AudioToolbox/AudioToolbox.h>
-#endif
-
QT_BEGIN_NAMESPACE
@interface CoreAudioSessionObserver : NSObject
@@ -81,24 +77,19 @@ QT_BEGIN_NAMESPACE
self->m_sessionManager = sessionManager;
self->m_audioSession = [AVAudioSession sharedInstance];
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_6_0)
-#endif
- {
- //Set up observers
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(audioSessionInterruption:)
- name:AVAudioSessionInterruptionNotification
- object:self->m_audioSession];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(audioSessionMediaServicesWereReset:)
- name:AVAudioSessionMediaServicesWereResetNotification
- object:self->m_audioSession];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(audioSessionRouteChange:)
- name:AVAudioSessionRouteChangeNotification
- object:self->m_audioSession];
- }
+ //Set up observers
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioSessionInterruption:)
+ name:AVAudioSessionInterruptionNotification
+ object:self->m_audioSession];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioSessionMediaServicesWereReset:)
+ name:AVAudioSessionMediaServicesWereResetNotification
+ object:self->m_audioSession];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioSessionRouteChange:)
+ name:AVAudioSessionRouteChangeNotification
+ object:self->m_audioSession];
return self;
}
@@ -109,20 +100,15 @@ QT_BEGIN_NAMESPACE
qDebug() << Q_FUNC_INFO;
#endif
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_6_0)
-#endif
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:AVAudioSessionInterruptionNotification
- object:self->m_audioSession];
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:AVAudioSessionMediaServicesWereResetNotification
- object:self->m_audioSession];
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:AVAudioSessionRouteChangeNotification
- object:self->m_audioSession];
- }
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:AVAudioSessionInterruptionNotification
+ object:self->m_audioSession];
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:AVAudioSessionMediaServicesWereResetNotification
+ object:self->m_audioSession];
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:AVAudioSessionRouteChangeNotification
+ object:self->m_audioSession];
[super dealloc];
}
@@ -285,9 +271,6 @@ bool CoreAudioSessionManager::setCategory(CoreAudioSessionManager::AudioSessionC
#endif
break;
case CoreAudioSessionManager::MultiRoute:
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_6_0)
-#endif
targetCategory = AVAudioSessionCategoryMultiRoute;
break;
}
@@ -295,16 +278,9 @@ bool CoreAudioSessionManager::setCategory(CoreAudioSessionManager::AudioSessionC
if (targetCategory == nil)
return false;
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_6_0) {
- return [[m_sessionObserver audioSession] setCategory:targetCategory error:nil];
- } else
-#endif
- {
- return [[m_sessionObserver audioSession] setCategory:targetCategory
- withOptions:(AVAudioSessionCategoryOptions)options
- error:nil];
- }
+ return [[m_sessionObserver audioSession] setCategory:targetCategory
+ withOptions:(AVAudioSessionCategoryOptions)options
+ error:nil];
}
bool CoreAudioSessionManager::setMode(CoreAudioSessionManager::AudioSessionModes mode)
@@ -327,9 +303,6 @@ bool CoreAudioSessionManager::setMode(CoreAudioSessionManager::AudioSessionModes
targetMode = AVAudioSessionModeMeasurement;
break;
case CoreAudioSessionManager::MoviePlayback:
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_6_0)
-#endif
targetMode = AVAudioSessionModeMoviePlayback;
break;
}
@@ -360,11 +333,7 @@ CoreAudioSessionManager::AudioSessionCategorys CoreAudioSessionManager::category
} else if (category == AVAudioSessionCategoryAudioProcessing) {
localCategory = AudioProcessing;
#endif
- } else if (
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_6_0 &&
-#endif
- category == AVAudioSessionCategoryMultiRoute) {
+ } else if (category == AVAudioSessionCategoryMultiRoute) {
localCategory = MultiRoute;
}
@@ -386,11 +355,7 @@ CoreAudioSessionManager::AudioSessionModes CoreAudioSessionManager::mode()
localMode = VideoRecording;
} else if (mode == AVAudioSessionModeMeasurement) {
localMode = Measurement;
- } else if (
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_6_0 &&
-#endif
- mode == AVAudioSessionModeMoviePlayback) {
+ } else if (mode == AVAudioSessionModeMoviePlayback) {
localMode = MoviePlayback;
}
@@ -419,32 +384,12 @@ QList<QByteArray> CoreAudioSessionManager::outputDevices()
float CoreAudioSessionManager::currentIOBufferDuration()
{
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_6_0) {
- Float32 duration;
- UInt32 size = sizeof(duration);
- AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareIOBufferDuration, &size, &duration);
- return duration;
- } else
-#endif
- {
- return [[m_sessionObserver audioSession] IOBufferDuration];
- }
+ return [[m_sessionObserver audioSession] IOBufferDuration];
}
float CoreAudioSessionManager::preferredSampleRate()
{
-#if QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_6_0)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_IOS_6_0) {
- Float64 sampleRate;
- UInt32 size = sizeof(sampleRate);
- AudioSessionGetProperty(kAudioSessionProperty_PreferredHardwareSampleRate, &size, &sampleRate);
- return sampleRate;
- } else
-#endif
- {
- return [[m_sessionObserver audioSession] preferredSampleRate];
- }
+ return [[m_sessionObserver audioSession] preferredSampleRate];
}
#ifdef QT_DEBUG_COREAUDIO
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp
index 5587b479c..9955a4821 100644
--- a/src/plugins/directshow/camera/dscamerasession.cpp
+++ b/src/plugins/directshow/camera/dscamerasession.cpp
@@ -1078,40 +1078,10 @@ bool DSCameraSession::connectGraph()
void DSCameraSession::disconnectGraph()
{
- IPin *pPin = 0;
- HRESULT hr = getPin(m_sourceFilter, PINDIR_OUTPUT, &pPin);
- if (SUCCEEDED(hr)) {
- m_filterGraph->Disconnect(pPin);
- pPin->Release();
- pPin = NULL;
- }
-
- hr = getPin(m_previewFilter, PINDIR_INPUT, &pPin);
- if (SUCCEEDED(hr)) {
- m_filterGraph->Disconnect(pPin);
- pPin->Release();
- pPin = NULL;
- }
-
- hr = getPin(m_previewFilter, PINDIR_OUTPUT, &pPin);
- if (SUCCEEDED(hr)) {
- m_filterGraph->Disconnect(pPin);
- pPin->Release();
- pPin = NULL;
- }
-
- hr = getPin(m_nullRendererFilter, PINDIR_INPUT, &pPin);
- if (SUCCEEDED(hr)) {
- m_filterGraph->Disconnect(pPin);
- pPin->Release();
- pPin = NULL;
- }
-
// To avoid increasing the memory usage every time the graph is re-connected it's
// important that all filters are released; also the ones added by the "Intelligent Connect".
IEnumFilters *enumFilters = NULL;
- hr = m_filterGraph->EnumFilters(&enumFilters);
- if (SUCCEEDED(hr)) {
+ if (SUCCEEDED(m_filterGraph->EnumFilters(&enumFilters))) {
IBaseFilter *filter = NULL;
while (enumFilters->Next(1, &filter, NULL) == S_OK) {
m_filterGraph->RemoveFilter(filter);
diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp
index 6f31ce7e2..1c9d0eee1 100644
--- a/src/plugins/directshow/dsserviceplugin.cpp
+++ b/src/plugins/directshow/dsserviceplugin.cpp
@@ -43,6 +43,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/QFile>
+#include "directshowglobal.h"
#include "dsserviceplugin.h"
#ifdef QMEDIA_DIRECTSHOW_CAMERA
@@ -79,6 +80,8 @@ extern const CLSID CLSID_VideoInputDeviceCategory;
QT_USE_NAMESPACE
+Q_LOGGING_CATEGORY(qtDirectShowPlugin, "qt.multimedia.plugins.directshow")
+
static int g_refCount = 0;
void addRefCount()
{
diff --git a/src/plugins/directshow/helpers/directshowglobal.h b/src/plugins/directshow/helpers/directshowglobal.h
index f7890c52b..1447bff16 100644
--- a/src/plugins/directshow/helpers/directshowglobal.h
+++ b/src/plugins/directshow/helpers/directshowglobal.h
@@ -43,6 +43,13 @@
#include <dshow.h>
#include <QtCore/qglobal.h>
+#include <QtCore/qloggingcategory.h>
+
+QT_BEGIN_NAMESPACE
+
+Q_DECLARE_LOGGING_CATEGORY(qtDirectShowPlugin)
+
+QT_END_NAMESPACE
template <typename T> T *com_cast(IUnknown *unknown, const IID &iid)
{
diff --git a/src/plugins/directshow/player/directshowplayercontrol.cpp b/src/plugins/directshow/player/directshowplayercontrol.cpp
index fce488af2..2d0ee2d59 100644
--- a/src/plugins/directshow/player/directshowplayercontrol.cpp
+++ b/src/plugins/directshow/player/directshowplayercontrol.cpp
@@ -200,7 +200,7 @@ qreal DirectShowPlayerControl::playbackRate() const
void DirectShowPlayerControl::setPlaybackRate(qreal rate)
{
- if (m_playbackRate != rate) {
+ if (!qFuzzyCompare(m_playbackRate, rate)) {
m_service->setRate(rate);
emit playbackRateChanged(m_playbackRate = rate);
@@ -370,7 +370,7 @@ void DirectShowPlayerControl::updateMediaInfo(qint64 duration, int streamTypes,
void DirectShowPlayerControl::updatePlaybackRate(qreal rate)
{
- if (m_playbackRate != rate) {
+ if (!qFuzzyCompare(m_playbackRate, rate)) {
m_playbackRate = rate;
scheduleUpdate(PlaybackRateProperty);
diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h
index b8d30e79a..d933bd660 100644
--- a/src/plugins/directshow/player/directshowplayerservice.h
+++ b/src/plugins/directshow/player/directshowplayerservice.h
@@ -186,6 +186,7 @@ private:
int m_pendingTasks;
int m_executingTask;
int m_executedTasks;
+ int m_streamTypes;
HANDLE m_taskHandle;
HANDLE m_eventHandle;
GraphStatus m_graphStatus;
@@ -195,20 +196,19 @@ private:
IBaseFilter *m_source;
IBaseFilter *m_audioOutput;
IBaseFilter *m_videoOutput;
- int m_streamTypes;
qreal m_rate;
qint64 m_position;
qint64 m_seekPosition;
qint64 m_duration;
- bool m_buffering;
- bool m_seekable;
- bool m_atEnd;
- bool m_dontCacheNextSeekResult;
QMediaTimeRange m_playbackRange;
QUrl m_url;
QMediaResourceList m_resources;
QString m_errorString;
QMutex m_mutex;
+ bool m_buffering;
+ bool m_seekable;
+ bool m_atEnd;
+ bool m_dontCacheNextSeekResult;
friend class DirectShowPlayerServiceThread;
};
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h
index c9c5c70e3..f5e26e553 100644
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h
+++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodercontrol.h
@@ -64,25 +64,25 @@ public:
QGstreamerAudioDecoderControl(QGstreamerAudioDecoderSession *session, QObject *parent = 0);
~QGstreamerAudioDecoderControl();
- QAudioDecoder::State state() const;
+ QAudioDecoder::State state() const override;
- QString sourceFilename() const;
- void setSourceFilename(const QString &fileName);
+ QString sourceFilename() const override;
+ void setSourceFilename(const QString &fileName) override;
- QIODevice* sourceDevice() const;
- void setSourceDevice(QIODevice *device);
+ QIODevice* sourceDevice() const override;
+ void setSourceDevice(QIODevice *device) override;
- void start();
- void stop();
+ void start() override;
+ void stop() override;
- QAudioFormat audioFormat() const;
- void setAudioFormat(const QAudioFormat &format);
+ QAudioFormat audioFormat() const override;
+ void setAudioFormat(const QAudioFormat &format) override;
- QAudioBuffer read();
- bool bufferAvailable() const;
+ QAudioBuffer read() override;
+ bool bufferAvailable() const override;
- qint64 position() const;
- qint64 duration() const;
+ qint64 position() const override;
+ qint64 duration() const override;
private:
// Stuff goes here
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h
index df54d39f4..6e52b9d87 100644
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h
+++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderservice.h
@@ -56,8 +56,8 @@ public:
QGstreamerAudioDecoderService(QObject *parent = 0);
~QGstreamerAudioDecoderService();
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *control);
+ QMediaControl *requestControl(const char *name) override;
+ void releaseControl(QMediaControl *control) override;
private:
QGstreamerAudioDecoderControl *m_control;
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h
index a5ae56637..d1b96043b 100644
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h
+++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.h
@@ -55,11 +55,11 @@ class QGstreamerAudioDecoderServicePlugin
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "audiodecoder.json")
public:
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
+ QMediaService* create(const QString &key) override;
+ void release(QMediaService *service) override;
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const;
- QStringList supportedMimeTypes() const;
+ QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs) const override;
+ QStringList supportedMimeTypes() const override;
private:
void updateSupportedMimeTypes() const;
diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h
index 991ac0043..8038d6a25 100644
--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h
+++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h
@@ -73,7 +73,7 @@ public:
QAudioDecoder::State state() const { return m_state; }
QAudioDecoder::State pendingState() const { return m_pendingState; }
- bool processBusMessage(const QGstreamerMessage &message);
+ bool processBusMessage(const QGstreamerMessage &message) override;
#if defined(HAVE_GST_APPSRC)
QGstAppSrc *appsrc() const { return m_appSrc; }
diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
index cb3d895c7..7178a6b09 100644
--- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
@@ -66,20 +66,20 @@ public:
CameraBinAudioEncoder(QObject *parent);
virtual ~CameraBinAudioEncoder();
- QStringList supportedAudioCodecs() const;
- QString codecDescription(const QString &codecName) const;
+ QStringList supportedAudioCodecs() const override;
+ QString codecDescription(const QString &codecName) const override;
QStringList supportedEncodingOptions(const QString &codec) const;
QVariant encodingOption(const QString &codec, const QString &name) const;
void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
QList<int> supportedSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(),
- bool *isContinuous = 0) const;
+ bool *isContinuous = 0) const override;
QList<int> supportedChannelCounts(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
QList<int> supportedSampleSizes(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
+ QAudioEncoderSettings audioSettings() const override;
+ void setAudioSettings(const QAudioEncoderSettings &) override;
QAudioEncoderSettings actualAudioSettings() const;
void setActualAudioSettings(const QAudioEncoderSettings&);
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
index 96af6c7fb..a6cdc5297 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
+++ b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
@@ -59,10 +59,10 @@ public:
CameraBinCaptureBufferFormat(CameraBinSession *session);
virtual ~CameraBinCaptureBufferFormat();
- QList<QVideoFrame::PixelFormat> supportedBufferFormats() const;
+ QList<QVideoFrame::PixelFormat> supportedBufferFormats() const override;
- QVideoFrame::PixelFormat bufferFormat() const;
- void setBufferFormat(QVideoFrame::PixelFormat format);
+ QVideoFrame::PixelFormat bufferFormat() const override;
+ void setBufferFormat(QVideoFrame::PixelFormat format) override;
private:
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
index 0ee40e7ba..460fd1aa3 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
+++ b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
@@ -56,9 +56,9 @@ public:
CameraBinCaptureDestination(CameraBinSession *session);
virtual ~CameraBinCaptureDestination();
- bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const;
- QCameraImageCapture::CaptureDestinations captureDestination() const;
- void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination);
+ bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const override;
+ QCameraImageCapture::CaptureDestinations captureDestination() const override;
+ void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) override;
private:
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
index e72bf0e3c..e424f92a1 100644
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
@@ -39,6 +39,7 @@
#include "camerabincontainer.h"
#include <QtCore/qregexp.h>
+#include <private/qgstutils_p.h>
#include <QtCore/qdebug.h>
@@ -50,14 +51,6 @@ CameraBinContainer::CameraBinContainer(QObject *parent)
, m_supportedContainers(QGstCodecsInfo::Muxer)
#endif
{
- //extension for containers hard to guess from mimetype
- m_fileExtensions["video/x-matroska"] = "mkv";
- m_fileExtensions["video/quicktime"] = "mov";
- m_fileExtensions["video/x-msvideo"] = "avi";
- m_fileExtensions["video/msvideo"] = "avi";
- m_fileExtensions["audio/mpeg"] = "mp3";
- m_fileExtensions["application/x-shockwave-flash"] = "swf";
- m_fileExtensions["application/x-pn-realmedia"] = "rm";
}
QStringList CameraBinContainer::supportedContainers() const
@@ -127,9 +120,9 @@ GstEncodingContainerProfile *CameraBinContainer::createProfile()
//if format is not in the list of supported gstreamer mime types,
//try to find the mime type with matching extension
if (!supportedFormats.contains(format)) {
- QString extension = suggestedFileExtension(m_actualFormat);
+ QString extension = QGstUtils::fileExtensionForMimeType(m_actualFormat);
for (const QString &formatCandidate : supportedFormats) {
- if (suggestedFileExtension(formatCandidate) == extension) {
+ if (QGstUtils::fileExtensionForMimeType(formatCandidate) == extension) {
format = formatCandidate;
break;
}
@@ -152,27 +145,4 @@ GstEncodingContainerProfile *CameraBinContainer::createProfile()
#endif
-/*!
- Suggest file extension for current container mimetype.
- */
-QString CameraBinContainer::suggestedFileExtension(const QString &containerFormat) const
-{
- //for container names like avi instead of video/x-msvideo, use it as extension
- if (!containerFormat.contains('/'))
- return containerFormat;
-
- QString format = containerFormat.left(containerFormat.indexOf(','));
- QString extension = m_fileExtensions.value(format);
-
- if (!extension.isEmpty() || format.isEmpty())
- return extension;
-
- QRegExp rx("[-/]([\\w]+)$");
-
- if (rx.indexIn(format) != -1)
- extension = rx.cap(1);
-
- return extension;
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.h b/src/plugins/gstreamer/camerabin/camerabincontainer.h
index 8e9f21eaf..b9b7f1214 100644
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.h
+++ b/src/plugins/gstreamer/camerabin/camerabincontainer.h
@@ -62,18 +62,16 @@ public:
CameraBinContainer(QObject *parent);
virtual ~CameraBinContainer() {}
- virtual QStringList supportedContainers() const;
- virtual QString containerDescription(const QString &formatMimeType) const;
+ QStringList supportedContainers() const override;
+ QString containerDescription(const QString &formatMimeType) const override;
- virtual QString containerFormat() const;
- virtual void setContainerFormat(const QString &format);
+ QString containerFormat() const override;
+ void setContainerFormat(const QString &format) override;
QString actualContainerFormat() const;
void setActualContainerFormat(const QString &containerFormat);
void resetActualContainerFormat();
- QString suggestedFileExtension(const QString &containerFormat) const;
-
#ifdef HAVE_GST_ENCODING_PROFILES
GstEncodingContainerProfile *createProfile();
#endif
@@ -84,7 +82,6 @@ Q_SIGNALS:
private:
QString m_format;
QString m_actualFormat;
- QMap<QString, QString> m_fileExtensions;
#ifdef HAVE_GST_ENCODING_PROFILES
QGstCodecsInfo m_supportedContainers;
diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.h b/src/plugins/gstreamer/camerabin/camerabincontrol.h
index a4d052afb..56c02dad4 100644
--- a/src/plugins/gstreamer/camerabin/camerabincontrol.h
+++ b/src/plugins/gstreamer/camerabin/camerabincontrol.h
@@ -59,16 +59,16 @@ public:
bool isValid() const { return true; }
- QCamera::State state() const;
- void setState(QCamera::State state);
+ QCamera::State state() const override;
+ void setState(QCamera::State state) override;
- QCamera::Status status() const;
+ QCamera::Status status() const override;
- QCamera::CaptureModes captureMode() const;
- void setCaptureMode(QCamera::CaptureModes mode);
+ QCamera::CaptureModes captureMode() const override;
+ void setCaptureMode(QCamera::CaptureModes mode) override;
- bool isCaptureModeSupported(QCamera::CaptureModes mode) const;
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const;
+ bool isCaptureModeSupported(QCamera::CaptureModes mode) const override;
+ bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const override;
bool viewfinderColorSpaceConversion() const;
CamerabinResourcePolicy *resourcePolicy() { return m_resourcePolicy; }
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.h b/src/plugins/gstreamer/camerabin/camerabinexposure.h
index 0435569d4..c30da25ad 100644
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.h
+++ b/src/plugins/gstreamer/camerabin/camerabinexposure.h
@@ -58,12 +58,12 @@ public:
CameraBinExposure(CameraBinSession *session);
virtual ~CameraBinExposure();
- bool isParameterSupported(ExposureParameter parameter) const;
- QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const;
+ bool isParameterSupported(ExposureParameter parameter) const override;
+ QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const override;
- QVariant requestedValue(ExposureParameter parameter) const;
- QVariant actualValue(ExposureParameter parameter) const;
- bool setValue(ExposureParameter parameter, const QVariant& value);
+ QVariant requestedValue(ExposureParameter parameter) const override;
+ QVariant actualValue(ExposureParameter parameter) const override;
+ bool setValue(ExposureParameter parameter, const QVariant &value) override;
private:
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.h b/src/plugins/gstreamer/camerabin/camerabinflash.h
index 0bcfef1b9..84177f122 100644
--- a/src/plugins/gstreamer/camerabin/camerabinflash.h
+++ b/src/plugins/gstreamer/camerabin/camerabinflash.h
@@ -57,11 +57,11 @@ public:
CameraBinFlash(CameraBinSession *session);
virtual ~CameraBinFlash();
- QCameraExposure::FlashModes flashMode() const;
- void setFlashMode(QCameraExposure::FlashModes mode);
- bool isFlashModeSupported(QCameraExposure::FlashModes mode) const;
+ QCameraExposure::FlashModes flashMode() const override;
+ void setFlashMode(QCameraExposure::FlashModes mode) override;
+ bool isFlashModeSupported(QCameraExposure::FlashModes mode) const override;
- bool isFlashReady() const;
+ bool isFlashReady() const override;
private:
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.h b/src/plugins/gstreamer/camerabin/camerabinfocus.h
index 2b510a987..72a5006f9 100644
--- a/src/plugins/gstreamer/camerabin/camerabinfocus.h
+++ b/src/plugins/gstreamer/camerabin/camerabinfocus.h
@@ -68,17 +68,17 @@ public:
CameraBinFocus(CameraBinSession *session);
virtual ~CameraBinFocus();
- QCameraFocus::FocusModes focusMode() const;
- void setFocusMode(QCameraFocus::FocusModes mode);
- bool isFocusModeSupported(QCameraFocus::FocusModes mode) const;
+ QCameraFocus::FocusModes focusMode() const override;
+ void setFocusMode(QCameraFocus::FocusModes mode) override;
+ bool isFocusModeSupported(QCameraFocus::FocusModes mode) const override;
- QCameraFocus::FocusPointMode focusPointMode() const;
- void setFocusPointMode(QCameraFocus::FocusPointMode mode) ;
- bool isFocusPointModeSupported(QCameraFocus::FocusPointMode) const;
- QPointF customFocusPoint() const;
- void setCustomFocusPoint(const QPointF &point);
+ QCameraFocus::FocusPointMode focusPointMode() const override;
+ void setFocusPointMode(QCameraFocus::FocusPointMode mode) override;
+ bool isFocusPointModeSupported(QCameraFocus::FocusPointMode) const override;
+ QPointF customFocusPoint() const override;
+ void setCustomFocusPoint(const QPointF &point) override;
- QCameraFocusZoneList focusZones() const;
+ QCameraFocusZoneList focusZones() const override;
void handleFocusMessage(GstMessage*);
QCamera::LockStatus focusStatus() const { return m_focusStatus; }
@@ -94,7 +94,7 @@ public Q_SLOTS:
#if GST_CHECK_VERSION(1,0,0)
protected:
- void timerEvent(QTimerEvent *event);
+ void timerEvent(QTimerEvent *event) override;
#endif
private Q_SLOTS:
@@ -111,7 +111,7 @@ private:
void updateRegionOfInterest(const QVector<QRect> &rectangles);
#if GST_CHECK_VERSION(1,0,0)
- bool probeBuffer(GstBuffer *buffer);
+ bool probeBuffer(GstBuffer *buffer) override;
#endif
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h b/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
index a8a55bb06..5e00ab6d5 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
+++ b/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
@@ -62,14 +62,14 @@ public:
CameraBinImageCapture(CameraBinSession *session);
virtual ~CameraBinImageCapture();
- QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; }
- void setDriveMode(QCameraImageCapture::DriveMode) {}
+ QCameraImageCapture::DriveMode driveMode() const override { return QCameraImageCapture::SingleImageCapture; }
+ void setDriveMode(QCameraImageCapture::DriveMode) override {}
- bool isReadyForCapture() const;
- int capture(const QString &fileName);
- void cancelCapture();
+ bool isReadyForCapture() const override;
+ int capture(const QString &fileName) override;
+ void cancelCapture() override;
- bool processBusMessage(const QGstreamerMessage &message);
+ bool processBusMessage(const QGstreamerMessage &message) override;
private slots:
void updateState();
@@ -85,8 +85,8 @@ private:
{
public:
EncoderProbe(CameraBinImageCapture *capture) : capture(capture) {}
- void probeCaps(GstCaps *caps);
- bool probeBuffer(GstBuffer *buffer);
+ void probeCaps(GstCaps *caps) override;
+ bool probeBuffer(GstBuffer *buffer) override;
private:
CameraBinImageCapture * const capture;
@@ -96,8 +96,8 @@ private:
{
public:
MuxerProbe(CameraBinImageCapture *capture) : capture(capture) {}
- void probeCaps(GstCaps *caps);
- bool probeBuffer(GstBuffer *buffer);
+ void probeCaps(GstCaps *caps) override;
+ bool probeBuffer(GstBuffer *buffer) override;
private:
CameraBinImageCapture * const capture;
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h b/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
index 8c777b9cd..96f7ae7aa 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
@@ -58,13 +58,13 @@ public:
virtual ~CameraBinImageEncoder();
QList<QSize> supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const;
+ bool *continuous = 0) const override;
- QStringList supportedImageCodecs() const;
- QString imageCodecDescription(const QString &formatName) const;
+ QStringList supportedImageCodecs() const override;
+ QString imageCodecDescription(const QString &formatName) const override;
- QImageEncoderSettings imageSettings() const;
- void setImageSettings(const QImageEncoderSettings &settings);
+ QImageEncoderSettings imageSettings() const override;
+ void setImageSettings(const QImageEncoderSettings &settings) override;
Q_SIGNALS:
void settingsChanged();
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
index 82c6e1678..3021f6e9f 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
+++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
@@ -74,10 +74,10 @@ public:
bool setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode);
bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const;
- bool isParameterSupported(ProcessingParameter) const;
- bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const;
- QVariant parameter(ProcessingParameter parameter) const;
- void setParameter(ProcessingParameter parameter, const QVariant &value);
+ bool isParameterSupported(ProcessingParameter) const override;
+ bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const override;
+ QVariant parameter(ProcessingParameter parameter) const override;
+ void setParameter(ProcessingParameter parameter, const QVariant &value) override;
#ifdef HAVE_GST_PHOTOGRAPHY
void lockWhiteBalance();
diff --git a/src/plugins/gstreamer/camerabin/camerabininfocontrol.h b/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
index c5029dc0a..9c801e804 100644
--- a/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
+++ b/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
@@ -53,8 +53,8 @@ public:
CameraBinInfoControl(GstElementFactory *sourceFactory, QObject *parent);
~CameraBinInfoControl();
- QCamera::Position cameraPosition(const QString &deviceName) const;
- int cameraOrientation(const QString &deviceName) const;
+ QCamera::Position cameraPosition(const QString &deviceName) const override;
+ int cameraOrientation(const QString &deviceName) const override;
private:
GstElementFactory * const m_sourceFactory;
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.h b/src/plugins/gstreamer/camerabin/camerabinlocks.h
index c90675615..cd592ffd2 100644
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.h
+++ b/src/plugins/gstreamer/camerabin/camerabinlocks.h
@@ -61,16 +61,16 @@ public:
CameraBinLocks(CameraBinSession *session);
virtual ~CameraBinLocks();
- QCamera::LockTypes supportedLocks() const;
+ QCamera::LockTypes supportedLocks() const override;
- QCamera::LockStatus lockStatus(QCamera::LockType lock) const;
+ QCamera::LockStatus lockStatus(QCamera::LockType lock) const override;
- void searchAndLock(QCamera::LockTypes locks);
- void unlock(QCamera::LockTypes locks);
+ void searchAndLock(QCamera::LockTypes locks) override;
+ void unlock(QCamera::LockTypes locks) override;
protected:
#if GST_CHECK_VERSION(1, 2, 0)
- void timerEvent(QTimerEvent *event);
+ void timerEvent(QTimerEvent *event) override;
#endif
private slots:
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.h b/src/plugins/gstreamer/camerabin/camerabinmetadata.h
index 67d3bf46e..5fef7e388 100644
--- a/src/plugins/gstreamer/camerabin/camerabinmetadata.h
+++ b/src/plugins/gstreamer/camerabin/camerabinmetadata.h
@@ -52,12 +52,12 @@ public:
virtual ~CameraBinMetaData() {}
- bool isMetaDataAvailable() const { return true; }
- bool isWritable() const { return true; }
+ bool isMetaDataAvailable() const override { return true; }
+ bool isWritable() const override { return true; }
- QVariant metaData(const QString &key) const;
- void setMetaData(const QString &key, const QVariant &value);
- QStringList availableMetaData() const;
+ QVariant metaData(const QString &key) const override;
+ void setMetaData(const QString &key, const QVariant &value) override;
+ QStringList availableMetaData() const override;
Q_SIGNALS:
void metaDataChanged(const QMap<QByteArray, QVariant>&);
diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.h b/src/plugins/gstreamer/camerabin/camerabinrecorder.h
index c5280ebd7..9392f69a5 100644
--- a/src/plugins/gstreamer/camerabin/camerabinrecorder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinrecorder.h
@@ -58,27 +58,27 @@ public:
CameraBinRecorder(CameraBinSession *session);
virtual ~CameraBinRecorder();
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl &sink);
+ QUrl outputLocation() const override;
+ bool setOutputLocation(const QUrl &sink) override;
- QMediaRecorder::State state() const;
- QMediaRecorder::Status status() const;
+ QMediaRecorder::State state() const override;
+ QMediaRecorder::Status status() const override;
- qint64 duration() const;
+ qint64 duration() const override;
- bool isMuted() const;
- qreal volume() const;
+ bool isMuted() const override;
+ qreal volume() const override;
- void applySettings();
+ void applySettings() override;
#ifdef HAVE_GST_ENCODING_PROFILES
GstEncodingContainerProfile *videoProfile();
#endif
public slots:
- void setState(QMediaRecorder::State state);
- void setMuted(bool);
- void setVolume(qreal volume);
+ void setState(QMediaRecorder::State state) override;
+ void setMuted(bool) override;
+ void setVolume(qreal volume) override;
void updateStatus();
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.h b/src/plugins/gstreamer/camerabin/camerabinservice.h
index 9069c3d5c..44afef25f 100644
--- a/src/plugins/gstreamer/camerabin/camerabinservice.h
+++ b/src/plugins/gstreamer/camerabin/camerabinservice.h
@@ -71,8 +71,8 @@ public:
CameraBinService(GstElementFactory *sourceFactory, QObject *parent = 0);
virtual ~CameraBinService();
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *);
+ QMediaControl *requestControl(const char *name) override;
+ void releaseControl(QMediaControl *) override;
static bool isCameraBinAvailable();
diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
index 9b16c0eca..b31e44459 100644
--- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
+++ b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
@@ -65,18 +65,18 @@ public:
CameraBinServicePlugin();
~CameraBinServicePlugin();
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
+ QMediaService* create(const QString &key) override;
+ void release(QMediaService *service) override;
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
+ QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const override;
- QByteArray defaultDevice(const QByteArray &service) const;
- QList<QByteArray> devices(const QByteArray &service) const;
- QString deviceDescription(const QByteArray &service, const QByteArray &device);
+ QByteArray defaultDevice(const QByteArray &service) const override;
+ QList<QByteArray> devices(const QByteArray &service) const override;
+ QString deviceDescription(const QByteArray &service, const QByteArray &device) override;
QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property);
- QCamera::Position cameraPosition(const QByteArray &device) const;
- int cameraOrientation(const QByteArray &device) const;
+ QCamera::Position cameraPosition(const QByteArray &device) const override;
+ int cameraOrientation(const QByteArray &device) const override;
private:
GstElementFactory *sourceFactory() const;
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index 64c8780d3..1e075f58d 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -1112,7 +1112,7 @@ void CameraBinSession::recordVideo()
: m_sink.toString(),
QMediaStorageLocation::Movies,
QLatin1String("clip_"),
- m_mediaContainerControl->suggestedFileExtension(format));
+ QGstUtils::fileExtensionForMimeType(format));
m_recordingActive = true;
m_actualSink = QUrl::fromLocalFile(actualFileName);
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h
index ca0b22761..0d66d9ee1 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.h
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.h
@@ -161,8 +161,8 @@ public:
QString device() const { return m_inputDevice; }
- bool processSyncMessage(const QGstreamerMessage &message);
- bool processBusMessage(const QGstreamerMessage &message);
+ bool processSyncMessage(const QGstreamerMessage &message) override;
+ bool processBusMessage(const QGstreamerMessage &message) override;
QGstreamerVideoProbeControl *videoProbe();
diff --git a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h b/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h
index 2cc9f925c..a38dc78da 100644
--- a/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h
+++ b/src/plugins/gstreamer/camerabin/camerabinv4limageprocessing.h
@@ -55,10 +55,10 @@ public:
CameraBinV4LImageProcessing(CameraBinSession *session);
virtual ~CameraBinV4LImageProcessing();
- bool isParameterSupported(ProcessingParameter) const;
- bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const;
- QVariant parameter(ProcessingParameter parameter) const;
- void setParameter(ProcessingParameter parameter, const QVariant &value);
+ bool isParameterSupported(ProcessingParameter) const override;
+ bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const override;
+ QVariant parameter(ProcessingParameter parameter) const override;
+ void setParameter(ProcessingParameter parameter, const QVariant &value) override;
public slots:
void updateParametersInfo(QCamera::Status cameraStatus);
diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
index 7abcd66d5..9eb931dbb 100644
--- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
@@ -66,18 +66,18 @@ public:
virtual ~CameraBinVideoEncoder();
QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
+ bool *continuous = 0) const override;
QList< qreal > supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
+ bool *continuous = 0) const override;
QPair<int,int> rateAsRational(qreal) const;
- QStringList supportedVideoCodecs() const;
- QString videoCodecDescription(const QString &codecName) const;
+ QStringList supportedVideoCodecs() const override;
+ QString videoCodecDescription(const QString &codecName) const override;
- QVideoEncoderSettings videoSettings() const;
- void setVideoSettings(const QVideoEncoderSettings &settings);
+ QVideoEncoderSettings videoSettings() const override;
+ void setVideoSettings(const QVideoEncoderSettings &settings) override;
QVideoEncoderSettings actualVideoSettings() const;
void setActualVideoSettings(const QVideoEncoderSettings&);
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
index 7a03a065c..59a0ca8a9 100644
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
+++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
@@ -54,9 +54,9 @@ public:
CameraBinViewfinderSettings(CameraBinSession *session);
~CameraBinViewfinderSettings();
- bool isViewfinderParameterSupported(ViewfinderParameter parameter) const;
- QVariant viewfinderParameter(ViewfinderParameter parameter) const;
- void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value);
+ bool isViewfinderParameterSupported(ViewfinderParameter parameter) const override;
+ QVariant viewfinderParameter(ViewfinderParameter parameter) const override;
+ void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value) override;
private:
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h
index 36349b2de..5e03b007a 100644
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h
+++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h
@@ -53,10 +53,10 @@ public:
CameraBinViewfinderSettings2(CameraBinSession *session);
~CameraBinViewfinderSettings2();
- QList<QCameraViewfinderSettings> supportedViewfinderSettings() const;
+ QList<QCameraViewfinderSettings> supportedViewfinderSettings() const override;
- QCameraViewfinderSettings viewfinderSettings() const;
- void setViewfinderSettings(const QCameraViewfinderSettings &settings);
+ QCameraViewfinderSettings viewfinderSettings() const override;
+ void setViewfinderSettings(const QCameraViewfinderSettings &settings) override;
private:
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/camerabin/camerabinzoom.h b/src/plugins/gstreamer/camerabin/camerabinzoom.h
index e009de3b7..8ad4764b2 100644
--- a/src/plugins/gstreamer/camerabin/camerabinzoom.h
+++ b/src/plugins/gstreamer/camerabin/camerabinzoom.h
@@ -53,15 +53,15 @@ public:
CameraBinZoom(CameraBinSession *session);
virtual ~CameraBinZoom();
- qreal maximumOpticalZoom() const;
- qreal maximumDigitalZoom() const;
+ qreal maximumOpticalZoom() const override;
+ qreal maximumDigitalZoom() const override;
- qreal requestedOpticalZoom() const;
- qreal requestedDigitalZoom() const;
- qreal currentOpticalZoom() const;
- qreal currentDigitalZoom() const;
+ qreal requestedOpticalZoom() const override;
+ qreal requestedDigitalZoom() const override;
+ qreal currentOpticalZoom() const override;
+ qreal currentDigitalZoom() const override;
- void zoomTo(qreal optical, qreal digital);
+ void zoomTo(qreal optical, qreal digital) override;
private:
CameraBinSession *m_session;
diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp
index abb58c963..40294214a 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp
@@ -48,52 +48,18 @@
QGstreamerAudioEncode::QGstreamerAudioEncode(QObject *parent)
:QAudioEncoderSettingsControl(parent)
+ , m_codecs(QGstCodecsInfo::AudioEncoder)
{
- QList<QByteArray> codecCandidates;
-
- codecCandidates << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM"
- << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC";
-
- m_elementNames["audio/mpeg"] = "lamemp3enc";
- m_elementNames["audio/AMR"] = "amrnbenc";
- m_elementNames["audio/AMR-WB"] = "amrwbenc";
-
- m_elementNames["audio/vorbis"] = "vorbisenc";
- m_elementNames["audio/speex"] = "speexenc";
- m_elementNames["audio/PCM"] = "audioresample";
- m_elementNames["audio/FLAC"] = "flacenc";
- m_elementNames["audio/GSM"] = "gsmenc";
-
- m_codecOptions["audio/vorbis"] = QStringList() << "min-bitrate" << "max-bitrate";
- m_codecOptions["audio/mpeg"] = QStringList() << "mode";
- m_codecOptions["audio/speex"] = QStringList() << "mode" << "vbr" << "vad" << "dtx";
- m_codecOptions["audio/GSM"] = QStringList();
- m_codecOptions["audio/PCM"] = QStringList();
- m_codecOptions["audio/AMR"] = QStringList();
- m_codecOptions["audio/AMR-WB"] = QStringList();
-
- for (const QByteArray& codecName : qAsConst(codecCandidates)) {
- QByteArray elementName = m_elementNames[codecName];
- GstElementFactory *factory = gst_element_factory_find(elementName.constData());
+ for (const QString& codecName : m_codecs.supportedCodecs()) {
+ GstElementFactory *factory = gst_element_factory_find(m_codecs.codecElement(codecName).constData());
if (factory) {
- m_codecs.append(codecName);
- const gchar *descr = gst_element_factory_get_description(factory);
-
- if (codecName == QByteArray("audio/PCM"))
- m_codecDescriptions.insert(codecName, tr("Raw PCM audio"));
- else
- m_codecDescriptions.insert(codecName, QString::fromUtf8(descr));
-
m_streamTypes.insert(codecName,
QGstreamerMediaContainerControl::supportedStreamTypes(factory, GST_PAD_SRC));
gst_object_unref(GST_OBJECT(factory));
}
}
-
- //if (!m_codecs.isEmpty())
- // m_audioSettings.setCodec(m_codecs[0]);
}
QGstreamerAudioEncode::~QGstreamerAudioEncode()
@@ -102,17 +68,17 @@ QGstreamerAudioEncode::~QGstreamerAudioEncode()
QStringList QGstreamerAudioEncode::supportedAudioCodecs() const
{
- return m_codecs;
+ return m_codecs.supportedCodecs();
}
QString QGstreamerAudioEncode::codecDescription(const QString &codecName) const
{
- return m_codecDescriptions.value(codecName);
+ return m_codecs.codecDescription(codecName);
}
QStringList QGstreamerAudioEncode::supportedEncodingOptions(const QString &codec) const
{
- return m_codecOptions.value(codec);
+ return m_codecs.codecOptions(codec);
}
QVariant QGstreamerAudioEncode::encodingOption(
@@ -148,24 +114,24 @@ void QGstreamerAudioEncode::setAudioSettings(const QAudioEncoderSettings &settin
GstElement *QGstreamerAudioEncode::createEncoder()
{
QString codec = m_audioSettings.codec();
- GstElement *encoderElement = gst_element_factory_make(m_elementNames.value(codec).constData(), NULL);
+ GstElement *encoderElement = gst_element_factory_make(m_codecs.codecElement(codec).constData(), NULL);
if (!encoderElement)
return 0;
GstBin * encoderBin = GST_BIN(gst_bin_new("audio-encoder-bin"));
- GstElement *capsFilter = gst_element_factory_make("capsfilter", NULL);
+ GstElement *sinkCapsFilter = gst_element_factory_make("capsfilter", NULL);
+ GstElement *srcCapsFilter = gst_element_factory_make("capsfilter", NULL);
- gst_bin_add(encoderBin, capsFilter);
- gst_bin_add(encoderBin, encoderElement);
- gst_element_link(capsFilter, encoderElement);
+ gst_bin_add_many(encoderBin, sinkCapsFilter, encoderElement, srcCapsFilter, NULL);
+ gst_element_link_many(sinkCapsFilter, encoderElement, srcCapsFilter, NULL);
// add ghostpads
- GstPad *pad = gst_element_get_static_pad(capsFilter, "sink");
+ GstPad *pad = gst_element_get_static_pad(sinkCapsFilter, "sink");
gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("sink", pad));
gst_object_unref(GST_OBJECT(pad));
- pad = gst_element_get_static_pad(encoderElement, "src");
+ pad = gst_element_get_static_pad(srcCapsFilter, "src");
gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("src", pad));
gst_object_unref(GST_OBJECT(pad));
@@ -181,18 +147,23 @@ GstElement *QGstreamerAudioEncode::createEncoder()
gst_caps_append_structure(caps,structure);
- //qDebug() << "set caps filter:" << gst_caps_to_string(caps);
-
- g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL);
+ g_object_set(G_OBJECT(sinkCapsFilter), "caps", caps, NULL);
gst_caps_unref(caps);
}
+ // Some encoders support several codecs. Setting a caps filter downstream with the desired
+ // codec (which is actually a string representation of the caps) will make sure we use the
+ // correct codec.
+ GstCaps *caps = gst_caps_from_string(codec.toUtf8().constData());
+ g_object_set(G_OBJECT(srcCapsFilter), "caps", caps, NULL);
+ gst_caps_unref(caps);
+
if (encoderElement) {
if (m_audioSettings.encodingMode() == QMultimedia::ConstantQualityEncoding) {
QMultimedia::EncodingQuality qualityValue = m_audioSettings.quality();
- if (codec == QLatin1String("audio/vorbis")) {
+ if (codec == QLatin1String("audio/x-vorbis")) {
double qualityTable[] = {
0.1, //VeryLow
0.3, //Low
@@ -211,7 +182,7 @@ GstElement *QGstreamerAudioEncode::createEncoder()
9 //VeryHigh
};
g_object_set(G_OBJECT(encoderElement), "quality", quality[qualityValue], NULL);
- } else if (codec == QLatin1String("audio/speex")) {
+ } else if (codec == QLatin1String("audio/x-speex")) {
//0-10 range with default 8
double qualityTable[] = {
2, //VeryLow
diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h
index 8474aa1a0..04de602ad 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h
@@ -49,6 +49,7 @@
#include <gst/gst.h>
#include <qaudioformat.h>
+#include <private/qgstcodecsinfo_p.h>
QT_BEGIN_NAMESPACE
@@ -61,30 +62,27 @@ public:
QGstreamerAudioEncode(QObject *parent);
virtual ~QGstreamerAudioEncode();
- QStringList supportedAudioCodecs() const;
- QString codecDescription(const QString &codecName) const;
+ QStringList supportedAudioCodecs() const override;
+ QString codecDescription(const QString &codecName) const override;
QStringList supportedEncodingOptions(const QString &codec) const;
QVariant encodingOption(const QString &codec, const QString &name) const;
void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
QList<int> supportedSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(),
- bool *isContinuous = 0) const;
+ bool *isContinuous = 0) const override;
QList<int> supportedChannelCounts(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
QList<int> supportedSampleSizes(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
+ QAudioEncoderSettings audioSettings() const override;
+ void setAudioSettings(const QAudioEncoderSettings &) override;
GstElement *createEncoder();
QSet<QString> supportedStreamTypes(const QString &codecName) const;
private:
- QStringList m_codecs;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString,QString> m_codecDescriptions;
- QMap<QString,QStringList> m_codecOptions;
+ QGstCodecsInfo m_codecs;
QMap<QString, QMap<QString, QVariant> > m_options;
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h
index 55d85ce6f..0e53f0890 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h
@@ -56,22 +56,22 @@ public:
bool isValid() const { return true; }
- QCamera::State state() const;
- void setState(QCamera::State state);
+ QCamera::State state() const override;
+ void setState(QCamera::State state) override;
- QCamera::Status status() const { return m_status; }
+ QCamera::Status status() const override { return m_status; }
- QCamera::CaptureModes captureMode() const { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureModes mode);
+ QCamera::CaptureModes captureMode() const override { return m_captureMode; }
+ void setCaptureMode(QCamera::CaptureModes mode) override;
- bool isCaptureModeSupported(QCamera::CaptureModes mode) const;
+ bool isCaptureModeSupported(QCamera::CaptureModes mode) const override;
QCamera::LockTypes supportedLocks() const
{
return QCamera::NoLock;
}
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const;
+ bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const override;
public slots:
void reloadLater();
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h
index aa114535f..6839bbe68 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h
@@ -49,15 +49,15 @@ class QGstreamerCaptureMetaDataControl : public QMetaDataWriterControl
Q_OBJECT
public:
QGstreamerCaptureMetaDataControl(QObject *parent);
- virtual ~QGstreamerCaptureMetaDataControl() {};
+ ~QGstreamerCaptureMetaDataControl() {}
- bool isMetaDataAvailable() const { return true; }
- bool isWritable() const { return true; }
+ bool isMetaDataAvailable() const override { return true; }
+ bool isWritable() const override { return true; }
- QVariant metaData(const QString &key) const;
- void setMetaData(const QString &key, const QVariant &value);
- QStringList availableMetaData() const;
+ QVariant metaData(const QString &key) const override;
+ void setMetaData(const QString &key, const QVariant &value) override;
+ QStringList availableMetaData() const override;
Q_SIGNALS:
void metaDataChanged(const QMap<QByteArray, QVariant>&);
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
index dc731d810..aba98d495 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
@@ -70,8 +70,8 @@ public:
QGstreamerCaptureService(const QString &service, QObject *parent = 0);
virtual ~QGstreamerCaptureService();
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *);
+ QMediaControl *requestControl(const char *name) override;
+ void releaseControl(QMediaControl *) override;
private:
void setAudioPreview(GstElement *);
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h
index 1af9cdc90..d8b7e9768 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h
@@ -69,20 +69,20 @@ class QGstreamerCaptureServicePlugin
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediacapture.json")
#endif
public:
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
+ QMediaService* create(const QString &key) override;
+ void release(QMediaService *service) override;
#if defined(USE_GSTREAMER_CAMERA)
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
+ QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const override;
- QByteArray defaultDevice(const QByteArray &service) const;
- QList<QByteArray> devices(const QByteArray &service) const;
- QString deviceDescription(const QByteArray &service, const QByteArray &device);
+ QByteArray defaultDevice(const QByteArray &service) const override;
+ QList<QByteArray> devices(const QByteArray &service) const override;
+ QString deviceDescription(const QByteArray &service, const QByteArray &device) override;
QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property);
#endif
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const;
- QStringList supportedMimeTypes() const;
+ QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs) const override;
+ QStringList supportedMimeTypes() const override;
private:
void updateSupportedMimeTypes() const;
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h
index 79203224b..e0c9107a7 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h
@@ -138,7 +138,7 @@ public:
bool isReady() const;
- bool processBusMessage(const QGstreamerMessage &message);
+ bool processBusMessage(const QGstreamerMessage &message) override;
void addProbe(QGstreamerAudioProbeControl* probe);
void removeProbe(QGstreamerAudioProbeControl* probe);
@@ -166,8 +166,8 @@ public slots:
void setVolume(qreal volume);
private:
- void probeCaps(GstCaps *caps);
- bool probeBuffer(GstBuffer *buffer);
+ void probeCaps(GstCaps *caps) override;
+ bool probeBuffer(GstBuffer *buffer) override;
enum PipelineMode { EmptyPipeline, PreviewPipeline, RecordingPipeline, PreviewAndRecordingPipeline };
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h
index 7d4145ae1..f58cf09c5 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h
@@ -53,12 +53,12 @@ public:
QGstreamerImageCaptureControl(QGstreamerCaptureSession *session);
virtual ~QGstreamerImageCaptureControl();
- QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; }
- void setDriveMode(QCameraImageCapture::DriveMode) {}
+ QCameraImageCapture::DriveMode driveMode() const override { return QCameraImageCapture::SingleImageCapture; }
+ void setDriveMode(QCameraImageCapture::DriveMode) override {}
- bool isReadyForCapture() const;
- int capture(const QString &fileName);
- void cancelCapture();
+ bool isReadyForCapture() const override;
+ int capture(const QString &fileName) override;
+ void cancelCapture() override;
private slots:
void updateState();
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h b/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h
index d56a739f1..f3ebd3e90 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h
@@ -59,13 +59,13 @@ public:
virtual ~QGstreamerImageEncode();
QList<QSize> supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const;
+ bool *continuous = 0) const override;
- QStringList supportedImageCodecs() const;
- QString imageCodecDescription(const QString &codecName) const;
+ QStringList supportedImageCodecs() const override;
+ QString imageCodecDescription(const QString &codecName) const override;
- QImageEncoderSettings imageSettings() const;
- void setImageSettings(const QImageEncoderSettings &settings);
+ QImageEncoderSettings imageSettings() const override;
+ void setImageSettings(const QImageEncoderSettings &settings) override;
Q_SIGNALS:
void settingsChanged();
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp
index 4e07b35bd..05f1c8af5 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp
@@ -39,53 +39,19 @@
#include "qgstreamermediacontainercontrol.h"
+#include <private/qgstutils_p.h>
#include <QtCore/qdebug.h>
QGstreamerMediaContainerControl::QGstreamerMediaContainerControl(QObject *parent)
:QMediaContainerControl(parent)
+ , m_containers(QGstCodecsInfo::Muxer)
{
- QList<QByteArray> formatCandidates;
- formatCandidates << "matroska" << "ogg" << "mp4" << "wav" << "quicktime" << "avi" << "3gpp";
- formatCandidates << "flv" << "amr" << "asf" << "dv" << "gif";
- formatCandidates << "mpeg" << "vob" << "mpegts" << "3g2" << "3gp";
- formatCandidates << "raw";
-
- m_elementNames["matroska"] = "matroskamux";
- m_elementNames["ogg"] = "oggmux";
- m_elementNames["mp4"] = "ffmux_mp4";
- m_elementNames["quicktime"] = "ffmux_mov";
- m_elementNames["avi"] = "avimux";
- m_elementNames["3gpp"] = "gppmux";
- m_elementNames["flv"] = "flvmux";
- m_elementNames["wav"] = "wavenc";
- m_elementNames["amr"] = "ffmux_amr";
- m_elementNames["asf"] = "ffmux_asf";
- m_elementNames["dv"] = "ffmux_dv";
- m_elementNames["gif"] = "ffmux_gif";
- m_elementNames["mpeg"] = "ffmux_mpeg";
- m_elementNames["vob"] = "ffmux_vob";
- m_elementNames["mpegts"] = "ffmux_mpegts";
- m_elementNames["3g2"] = "ffmux_3g2";
- m_elementNames["3gp"] = "ffmux_3gp";
- m_elementNames["raw"] = "identity";
-
- m_containerExtensions["matroska"] = "mkv";
- m_containerExtensions["quicktime"] = "mov";
- m_containerExtensions["mpegts"] = "m2t";
- m_containerExtensions["mpeg"] = "mpg";
-
QSet<QString> allTypes;
- for (const QByteArray& formatName : qAsConst(formatCandidates)) {
- QByteArray elementName = m_elementNames[formatName];
- GstElementFactory *factory = gst_element_factory_find(elementName.constData());
+ for (const QString& formatName : supportedContainers()) {
+ GstElementFactory *factory = gst_element_factory_find(m_containers.codecElement(formatName).constData());
if (factory) {
- m_supportedContainers.append(formatName);
- const gchar *descr = gst_element_factory_get_description(factory);
- m_containerDescriptions.insert(formatName, QString::fromUtf8(descr));
-
-
if (formatName == QByteArray("raw")) {
m_streamTypes.insert(formatName, allTypes);
} else {
@@ -97,9 +63,6 @@ QGstreamerMediaContainerControl::QGstreamerMediaContainerControl(QObject *parent
gst_object_unref(GST_OBJECT(factory));
}
}
-
- //if (!m_supportedContainers.isEmpty())
- // setContainerFormat(m_supportedContainers[0]);
}
QSet<QString> QGstreamerMediaContainerControl::supportedStreamTypes(GstElementFactory *factory, GstPadDirection direction)
@@ -129,5 +92,5 @@ QSet<QString> QGstreamerMediaContainerControl::supportedStreamTypes(const QStrin
QString QGstreamerMediaContainerControl::containerExtension() const
{
- return m_containerExtensions.value(m_format, m_format);
+ return QGstUtils::fileExtensionForMimeType(m_format);
}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h
index b8e2cc045..5c730b21d 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h
@@ -45,6 +45,8 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qset.h>
+#include <private/qgstcodecsinfo_p.h>
+
#include <gst/gst.h>
QT_BEGIN_NAMESPACE
@@ -54,15 +56,15 @@ class QGstreamerMediaContainerControl : public QMediaContainerControl
Q_OBJECT
public:
QGstreamerMediaContainerControl(QObject *parent);
- virtual ~QGstreamerMediaContainerControl() {};
+ ~QGstreamerMediaContainerControl() {}
- virtual QStringList supportedContainers() const { return m_supportedContainers; }
- virtual QString containerFormat() const { return m_format; }
- virtual void setContainerFormat(const QString &formatMimeType) { m_format = formatMimeType; }
+ QStringList supportedContainers() const override { return m_containers.supportedCodecs(); }
+ QString containerFormat() const override { return m_format; }
+ void setContainerFormat(const QString &formatMimeType) override { m_format = formatMimeType; }
- virtual QString containerDescription(const QString &formatMimeType) const { return m_containerDescriptions.value(formatMimeType); }
+ QString containerDescription(const QString &formatMimeType) const override { return m_containers.codecDescription(formatMimeType); }
- QByteArray formatElementName() const { return m_elementNames.value(containerFormat()); }
+ QByteArray formatElementName() const { return m_containers.codecElement(containerFormat()); }
QSet<QString> supportedStreamTypes(const QString &container) const;
@@ -72,10 +74,7 @@ public:
private:
QString m_format;
- QStringList m_supportedContainers;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString, QString> m_containerDescriptions;
- QMap<QString, QString> m_containerExtensions;
+ QGstCodecsInfo m_containers;
QMap<QString, QSet<QString> > m_streamTypes;
};
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h
index 96e263e72..b80716f4c 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h
@@ -56,26 +56,26 @@ public:
QGstreamerRecorderControl(QGstreamerCaptureSession *session);
virtual ~QGstreamerRecorderControl();
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl &sink);
+ QUrl outputLocation() const override;
+ bool setOutputLocation(const QUrl &sink) override;
- QMediaRecorder::State state() const;
- QMediaRecorder::Status status() const;
+ QMediaRecorder::State state() const override;
+ QMediaRecorder::Status status() const override;
- qint64 duration() const;
+ qint64 duration() const override;
- bool isMuted() const;
- qreal volume() const;
+ bool isMuted() const override;
+ qreal volume() const override;
- void applySettings();
+ void applySettings() override;
public slots:
- void setState(QMediaRecorder::State state);
+ void setState(QMediaRecorder::State state) override;
void record();
void pause();
void stop();
- void setMuted(bool);
- void setVolume(qreal volume);
+ void setMuted(bool) override;
+ void setVolume(qreal volume) override;
private slots:
void updateStatus();
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h b/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h
index 20e855922..a82c7cf4b 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h
@@ -56,10 +56,10 @@ public:
QGstreamerV4L2Input(QObject *parent = 0);
virtual ~QGstreamerV4L2Input();
- GstElement *buildElement();
+ GstElement *buildElement() override;
- QList<qreal> supportedFrameRates(const QSize &frameSize = QSize()) const;
- QList<QSize> supportedResolutions(qreal frameRate = -1) const;
+ QList<qreal> supportedFrameRates(const QSize &frameSize = QSize()) const override;
+ QList<QSize> supportedResolutions(qreal frameRate = -1) const override;
QByteArray device() const;
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp
index f0781d831..6b4dbe4b7 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp
@@ -47,41 +47,17 @@
QGstreamerVideoEncode::QGstreamerVideoEncode(QGstreamerCaptureSession *session)
:QVideoEncoderSettingsControl(session), m_session(session)
+ , m_codecs(QGstCodecsInfo::VideoEncoder)
{
- QList<QByteArray> codecCandidates;
- codecCandidates << "video/h264" << "video/xvid" << "video/mpeg4" << "video/mpeg1" << "video/mpeg2" << "video/theora";
-
- m_elementNames["video/h264"] = "x264enc";
- m_elementNames["video/xvid"] = "xvidenc";
- m_elementNames["video/mpeg4"] = "ffenc_mpeg4";
- m_elementNames["video/mpeg1"] = "ffenc_mpeg1video";
- m_elementNames["video/mpeg2"] = "ffenc_mpeg2video";
- m_elementNames["video/theora"] = "theoraenc";
-
- m_codecOptions["video/h264"] = QStringList() << "quantizer";
- m_codecOptions["video/xvid"] = QStringList() << "quantizer" << "profile";
- m_codecOptions["video/mpeg4"] = QStringList() << "quantizer";
- m_codecOptions["video/mpeg1"] = QStringList() << "quantizer";
- m_codecOptions["video/mpeg2"] = QStringList() << "quantizer";
- m_codecOptions["video/theora"] = QStringList();
-
- for (const QByteArray& codecName : qAsConst(codecCandidates)) {
- QByteArray elementName = m_elementNames[codecName];
- GstElementFactory *factory = gst_element_factory_find(elementName.constData());
+ for (const QString& codecName : supportedVideoCodecs()) {
+ GstElementFactory *factory = gst_element_factory_find(m_codecs.codecElement(codecName).constData());
if (factory) {
- m_codecs.append(codecName);
- const gchar *descr = gst_element_factory_get_description(factory);
- m_codecDescriptions.insert(codecName, QString::fromUtf8(descr));
-
m_streamTypes.insert(codecName,
QGstreamerMediaContainerControl::supportedStreamTypes(factory, GST_PAD_SRC));
gst_object_unref(GST_OBJECT(factory));
}
}
-
- //if (!m_codecs.isEmpty())
- // m_videoSettings.setCodec(m_codecs[0]);
}
QGstreamerVideoEncode::~QGstreamerVideoEncode()
@@ -106,17 +82,17 @@ QList< qreal > QGstreamerVideoEncode::supportedFrameRates(const QVideoEncoderSet
QStringList QGstreamerVideoEncode::supportedVideoCodecs() const
{
- return m_codecs;
+ return m_codecs.supportedCodecs();
}
QString QGstreamerVideoEncode::videoCodecDescription(const QString &codecName) const
{
- return m_codecDescriptions.value(codecName);
+ return m_codecs.codecDescription(codecName);
}
QStringList QGstreamerVideoEncode::supportedEncodingOptions(const QString &codec) const
{
- return m_codecOptions.value(codec);
+ return m_codecs.codecOptions(codec);
}
QVariant QGstreamerVideoEncode::encodingOption(const QString &codec, const QString &name) const
@@ -143,28 +119,28 @@ void QGstreamerVideoEncode::setVideoSettings(const QVideoEncoderSettings &settin
GstElement *QGstreamerVideoEncode::createEncoder()
{
QString codec = m_videoSettings.codec();
- //qDebug() << "create encoder for video codec" << codec;
- GstElement *encoderElement = gst_element_factory_make( m_elementNames.value(codec).constData(), "video-encoder");
+ GstElement *encoderElement = gst_element_factory_make(m_codecs.codecElement(codec).constData(), "video-encoder");
if (!encoderElement)
return 0;
GstBin *encoderBin = GST_BIN(gst_bin_new("video-encoder-bin"));
- GstElement *capsFilter = gst_element_factory_make("capsfilter", "capsfilter-video");
- gst_bin_add(encoderBin, capsFilter);
+ GstElement *sinkCapsFilter = gst_element_factory_make("capsfilter", "capsfilter-video");
+ GstElement *srcCapsFilter = gst_element_factory_make("capsfilter", "capsfilter-video");
+ gst_bin_add_many(encoderBin, sinkCapsFilter, srcCapsFilter, NULL);
GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, NULL);
gst_bin_add(encoderBin, colorspace);
gst_bin_add(encoderBin, encoderElement);
- gst_element_link_many(capsFilter, colorspace, encoderElement, NULL);
+ gst_element_link_many(sinkCapsFilter, colorspace, encoderElement, srcCapsFilter, NULL);
// add ghostpads
- GstPad *pad = gst_element_get_static_pad(capsFilter, "sink");
+ GstPad *pad = gst_element_get_static_pad(sinkCapsFilter, "sink");
gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("sink", pad));
gst_object_unref(GST_OBJECT(pad));
- pad = gst_element_get_static_pad(encoderElement, "src");
+ pad = gst_element_get_static_pad(srcCapsFilter, "src");
gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("src", pad));
gst_object_unref(GST_OBJECT(pad));
@@ -172,7 +148,7 @@ GstElement *QGstreamerVideoEncode::createEncoder()
if (m_videoSettings.encodingMode() == QMultimedia::ConstantQualityEncoding) {
QMultimedia::EncodingQuality qualityValue = m_videoSettings.quality();
- if (codec == QLatin1String("video/h264")) {
+ if (codec == QLatin1String("video/x-h264")) {
//constant quantizer mode
g_object_set(G_OBJECT(encoderElement), "pass", 4, NULL);
int qualityTable[] = {
@@ -183,7 +159,7 @@ GstElement *QGstreamerVideoEncode::createEncoder()
8 //VeryHigh
};
g_object_set(G_OBJECT(encoderElement), "quantizer", qualityTable[qualityValue], NULL);
- } else if (codec == QLatin1String("video/xvid")) {
+ } else if (codec == QLatin1String("video/x-xvid")) {
//constant quantizer mode
g_object_set(G_OBJECT(encoderElement), "pass", 3, NULL);
int qualityTable[] = {
@@ -195,9 +171,7 @@ GstElement *QGstreamerVideoEncode::createEncoder()
};
int quant = qualityTable[qualityValue];
g_object_set(G_OBJECT(encoderElement), "quantizer", quant, NULL);
- } else if (codec == QLatin1String("video/mpeg4") ||
- codec == QLatin1String("video/mpeg1") ||
- codec == QLatin1String("video/mpeg2") ) {
+ } else if (codec.startsWith(QLatin1String("video/mpeg"))) {
//constant quantizer mode
g_object_set(G_OBJECT(encoderElement), "pass", 2, NULL);
//quant from 1 to 30, default ~3
@@ -210,7 +184,7 @@ GstElement *QGstreamerVideoEncode::createEncoder()
};
double quant = qualityTable[qualityValue];
g_object_set(G_OBJECT(encoderElement), "quantizer", quant, NULL);
- } else if (codec == QLatin1String("video/theora")) {
+ } else if (codec == QLatin1String("video/x-theora")) {
int qualityTable[] = {
8, //VeryLow
16, //Low
@@ -278,11 +252,18 @@ GstElement *QGstreamerVideoEncode::createEncoder()
//qDebug() << "set video caps filter:" << gst_caps_to_string(caps);
- g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL);
+ g_object_set(G_OBJECT(sinkCapsFilter), "caps", caps, NULL);
gst_caps_unref(caps);
}
+ // Some encoders support several codecs. Setting a caps filter downstream with the desired
+ // codec (which is actually a string representation of the caps) will make sure we use the
+ // correct codec.
+ GstCaps *caps = gst_caps_from_string(codec.toUtf8().constData());
+ g_object_set(G_OBJECT(srcCapsFilter), "caps", caps, NULL);
+ gst_caps_unref(caps);
+
return GST_ELEMENT(encoderBin);
}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h
index f4134b46f..bc6636012 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h
@@ -46,6 +46,8 @@
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
+#include <private/qgstcodecsinfo_p.h>
+
#include <gst/gst.h>
QT_BEGIN_NAMESPACE
@@ -60,18 +62,18 @@ public:
virtual ~QGstreamerVideoEncode();
QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
+ bool *continuous = 0) const override;
QList< qreal > supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
+ bool *continuous = 0) const override;
QPair<int,int> rateAsRational() const;
- QStringList supportedVideoCodecs() const;
- QString videoCodecDescription(const QString &codecName) const;
+ QStringList supportedVideoCodecs() const override;
+ QString videoCodecDescription(const QString &codecName) const override;
- QVideoEncoderSettings videoSettings() const;
- void setVideoSettings(const QVideoEncoderSettings &settings);
+ QVideoEncoderSettings videoSettings() const override;
+ void setVideoSettings(const QVideoEncoderSettings &settings) override;
QStringList supportedEncodingOptions(const QString &codec) const;
QVariant encodingOption(const QString &codec, const QString &name) const;
@@ -84,10 +86,7 @@ public:
private:
QGstreamerCaptureSession *m_session;
- QStringList m_codecs;
- QMap<QString,QString> m_codecDescriptions;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString,QStringList> m_codecOptions;
+ QGstCodecsInfo m_codecs;
QVideoEncoderSettings m_videoSettings;
QMap<QString, QMap<QString, QVariant> > m_options;
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h
index 2c303f5af..78299b608 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h
@@ -51,7 +51,7 @@ class QGStreamerAvailabilityControl : public QMediaAvailabilityControl
Q_OBJECT
public:
QGStreamerAvailabilityControl(QMediaPlayerResourceSetInterface *resources, QObject *parent = 0);
- QMultimedia::AvailabilityStatus availability() const;
+ QMultimedia::AvailabilityStatus availability() const override;
private Q_SLOTS:
void handleAvailabilityChanged();
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h
index 1bbc5b1a5..bf8f7e842 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h
@@ -53,11 +53,11 @@ public:
QGstreamerMetaDataProvider( QGstreamerPlayerSession *session, QObject *parent );
virtual ~QGstreamerMetaDataProvider();
- bool isMetaDataAvailable() const;
+ bool isMetaDataAvailable() const override;
bool isWritable() const;
- QVariant metaData(const QString &key) const;
- QStringList availableMetaData() const;
+ QVariant metaData(const QString &key) const override;
+ QStringList availableMetaData() const override;
private slots:
void updateTags();
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
index 9ecf5f499..6067a68fc 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
@@ -67,42 +67,42 @@ public:
QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent = 0);
~QGstreamerPlayerControl();
- QMediaPlayer::State state() const;
- QMediaPlayer::MediaStatus mediaStatus() const;
+ QMediaPlayer::State state() const override;
+ QMediaPlayer::MediaStatus mediaStatus() const override;
- qint64 position() const;
- qint64 duration() const;
+ qint64 position() const override;
+ qint64 duration() const override;
- int bufferStatus() const;
+ int bufferStatus() const override;
- int volume() const;
- bool isMuted() const;
+ int volume() const override;
+ bool isMuted() const override;
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
+ bool isAudioAvailable() const override;
+ bool isVideoAvailable() const override;
void setVideoOutput(QObject *output);
- bool isSeekable() const;
- QMediaTimeRange availablePlaybackRanges() const;
+ bool isSeekable() const override;
+ QMediaTimeRange availablePlaybackRanges() const override;
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
+ qreal playbackRate() const override;
+ void setPlaybackRate(qreal rate) override;
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- void setMedia(const QMediaContent&, QIODevice *);
+ QMediaContent media() const override;
+ const QIODevice *mediaStream() const override;
+ void setMedia(const QMediaContent&, QIODevice *) override;
QMediaPlayerResourceSetInterface* resources() const;
public Q_SLOTS:
- void setPosition(qint64 pos);
+ void setPosition(qint64 pos) override;
- void play();
- void pause();
- void stop();
+ void play() override;
+ void pause() override;
+ void stop() override;
- void setVolume(int volume);
- void setMuted(bool muted);
+ void setVolume(int volume) override;
+ void setMuted(bool muted) override;
private Q_SLOTS:
void updateSessionState(QMediaPlayer::State state);
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
index 423ee9173..ec0c0944b 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
@@ -69,8 +69,8 @@ public:
QGstreamerPlayerService(QObject *parent = 0);
~QGstreamerPlayerService();
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *control);
+ QMediaControl *requestControl(const char *name) override;
+ void releaseControl(QMediaControl *control) override;
private:
QGstreamerPlayerControl *m_control;
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h
index 8e3e8a2af..71eece23e 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h
@@ -58,13 +58,13 @@ class QGstreamerPlayerServicePlugin
Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediaplayer.json")
public:
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
+ QMediaService* create(const QString &key) override;
+ void release(QMediaService *service) override;
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
+ QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const override;
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const;
- QStringList supportedMimeTypes() const;
+ QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs) const override;
+ QStringList supportedMimeTypes() const override;
private:
void updateSupportedMimeTypes() const;
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
index 76a56aca7..f71332f35 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
@@ -47,7 +47,6 @@
#include <private/gstvideoconnector_p.h>
#endif
#include <private/qgstutils_p.h>
-#include <private/playlistfileparser_p.h>
#include <private/qgstutils_p.h>
#include <gst/gstvalue.h>
@@ -61,59 +60,12 @@
#include <QtCore/qdebug.h>
#include <QtCore/qdir.h>
#include <QtCore/qstandardpaths.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qmutex.h>
//#define DEBUG_PLAYBIN
//#define DEBUG_VO_BIN_DUMP
QT_BEGIN_NAMESPACE
-class TypefindDelegator
-{
-public:
- TypefindDelegator()
- {
- Q_ASSERT(gst_type_find_register(0, "playlist", GST_RANK_MARGINAL, notifySessions, 0, 0, 0, 0) == TRUE);
- }
-
- void add(QGstreamerPlayerSession *session)
- {
- QMutexLocker locker(&m_mtx);
- m_sessions.append(session);
- }
-
- void remove(QGstreamerPlayerSession *session)
- {
- QMutexLocker locker(&m_mtx);
- const int idx = m_sessions.indexOf(session);
- if (idx != -1)
- m_sessions.remove(idx);
- }
-
-private:
- static void notifySessions(GstTypeFind *find, gpointer /* unused */)
- {
- QMutexLocker locker(&m_mtx);
- SessionList::const_iterator it = m_sessions.constBegin();
- SessionList::const_iterator end = m_sessions.constEnd();
-
- while (it != end) {
- (*it)->playlistTypeFindFunction(find);
- ++it;
- }
- }
-
- typedef QVector<QGstreamerPlayerSession *> SessionList;
- static SessionList m_sessions;
- static QMutex m_mtx;
-};
-
-TypefindDelegator::SessionList TypefindDelegator::m_sessions;
-QMutex TypefindDelegator::m_mtx;
-
-Q_GLOBAL_STATIC(TypefindDelegator, g_typeRegister);
-
static bool usePlaybinVolume()
{
static enum { Yes, No, Unknown } status = Unknown;
@@ -191,10 +143,8 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
m_displayPrerolledFrame(true),
m_sourceType(UnknownSrc),
m_everPlayed(false),
- m_isLiveSource(false),
- m_isPlaylist(false)
+ m_isLiveSource(false)
{
- g_typeRegister->add(this);
m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL);
if (m_playbin) {
//GST_PLAY_FLAG_NATIVE_VIDEO omits configuration of ffmpegcolorspace and videoscale,
@@ -295,8 +245,6 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
QGstreamerPlayerSession::~QGstreamerPlayerSession()
{
- g_typeRegister->remove(this);
-
if (m_playbin) {
stop();
@@ -347,7 +295,6 @@ void QGstreamerPlayerSession::loadFromStream(const QNetworkRequest &request, QIO
m_request = request;
m_duration = -1;
m_lastPosition = 0;
- m_isPlaylist = false;
if (!m_appSrc)
m_appSrc = new QGstAppSrc(this);
@@ -377,7 +324,6 @@ void QGstreamerPlayerSession::loadFromUri(const QNetworkRequest &request)
m_request = request;
m_duration = -1;
m_lastPosition = 0;
- m_isPlaylist = false;
#if defined(HAVE_GST_APPSRC)
if (m_appSrc) {
@@ -945,13 +891,9 @@ bool QGstreamerPlayerSession::play()
if (m_playbin) {
m_pendingState = QMediaPlayer::PlayingState;
if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
- if (!m_isPlaylist) {
- qWarning() << "GStreamer; Unable to play -" << m_request.url().toString();
- m_pendingState = m_state = QMediaPlayer::StoppedState;
- emit stateChanged(m_state);
- } else {
- return true;
- }
+ qWarning() << "GStreamer; Unable to play -" << m_request.url().toString();
+ m_pendingState = m_state = QMediaPlayer::StoppedState;
+ emit stateChanged(m_state);
} else {
resumeVideoProbes();
return true;
@@ -972,13 +914,9 @@ bool QGstreamerPlayerSession::pause()
return true;
if (gst_element_set_state(m_playbin, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
- if (!m_isPlaylist) {
- qWarning() << "GStreamer; Unable to pause -" << m_request.url().toString();
- m_pendingState = m_state = QMediaPlayer::StoppedState;
- emit stateChanged(m_state);
- } else {
- return true;
- }
+ qWarning() << "GStreamer; Unable to pause -" << m_request.url().toString();
+ m_pendingState = m_state = QMediaPlayer::StoppedState;
+ emit stateChanged(m_state);
} else {
resumeVideoProbes();
return true;
@@ -1347,7 +1285,7 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message
if (err->domain == GST_STREAM_ERROR && err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND)
emit error(int(QMediaPlayer::FormatError), tr("Cannot play stream of type: <unknown>"));
// GStreamer shows warning for HTTP playlists
- if (!m_isPlaylist)
+ if (err && err->message)
qWarning() << "Warning:" << QString::fromUtf8(err->message);
g_error_free(err);
g_free(debug);
@@ -1356,10 +1294,6 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message
gchar *debug;
gst_message_parse_error(gm, &err, &debug);
- // remember playlist value,
- // it could be set to false after call to processInvalidMedia
- bool isPlaylist = m_isPlaylist;
-
// Nearly all errors map to ResourceError
QMediaPlayer::Error qerror = QMediaPlayer::ResourceError;
if (err->domain == GST_STREAM_ERROR
@@ -1368,7 +1302,7 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message
qerror = QMediaPlayer::AccessDeniedError;
}
processInvalidMedia(qerror, QString::fromUtf8(err->message));
- if (!isPlaylist)
+ if (err && err->message)
qWarning() << "Error:" << QString::fromUtf8(err->message);
g_error_free(err);
@@ -1804,14 +1738,9 @@ void QGstreamerPlayerSession::processInvalidMedia(QMediaPlayer::Error errorCode,
#ifdef DEBUG_PLAYBIN
qDebug() << Q_FUNC_INFO;
#endif
- if (m_isPlaylist) {
- stop();
- emit error(int(QMediaPlayer::MediaIsPlaylist), tr("Media is loaded as a playlist"));
- } else {
- emit invalidMedia();
- stop();
- emit error(int(errorCode), errorString);
- }
+ emit invalidMedia();
+ stop();
+ emit error(int(errorCode), errorString);
}
void QGstreamerPlayerSession::showPrerollFrames(bool enabled)
@@ -1936,32 +1865,4 @@ void QGstreamerPlayerSession::resumeVideoProbes()
m_videoProbe->stopFlushing();
}
-void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find)
-{
- gchar *strval = 0;
-#if GST_CHECK_VERSION(1,0,0)
- g_object_get(G_OBJECT(m_playbin), "current-uri", &strval, NULL);
-#else
- g_object_get(G_OBJECT(m_playbin), "uri", &strval, NULL);
-#endif
- const QString uri(QString::fromUtf8(strval));
- g_free(strval);
-
- guint64 length = gst_type_find_get_length(find);
- if (!length)
- length = 1024;
- else
- length = qMin(length, guint64(1024));
-
- while (length > 0) {
- const guint8 *data = gst_type_find_peek(find, 0, length);
- if (data) {
- m_isPlaylist = (QPlaylistFileParser::findPlaylistType(uri, 0, data, length) != QPlaylistFileParser::UNKNOWN);
- return;
- }
- length >>= 1; // for HTTP files length is not available,
- // so we have to try different buffer sizes
- }
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
index fdfb416bd..14ef6070f 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
@@ -114,7 +114,7 @@ public:
int activeStream(QMediaStreamsControl::StreamType streamType) const;
void setActiveStream(QMediaStreamsControl::StreamType streamType, int streamNumber);
- bool processBusMessage(const QGstreamerMessage &message);
+ bool processBusMessage(const QGstreamerMessage &message) override;
#if defined(HAVE_GST_APPSRC)
QGstAppSrc *appsrc() const { return m_appSrc; }
@@ -131,8 +131,6 @@ public:
void endOfMediaReset();
- void playlistTypeFindFunction(GstTypeFind *find);
-
public slots:
void loadFromUri(const QNetworkRequest &url);
void loadFromStream(const QNetworkRequest &url, QIODevice *stream);
@@ -255,7 +253,6 @@ private:
bool m_everPlayed;
bool m_isLiveSource;
- bool m_isPlaylist;
gulong pad_probe_id;
};
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h
index ec9de39f0..6f332c160 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h
@@ -53,13 +53,13 @@ public:
QGstreamerStreamsControl(QGstreamerPlayerSession *session, QObject *parent);
virtual ~QGstreamerStreamsControl();
- virtual int streamCount();
- virtual StreamType streamType(int streamNumber);
+ int streamCount() override;
+ StreamType streamType(int streamNumber) override;
- virtual QVariant metaData(int streamNumber, const QString &key);
+ QVariant metaData(int streamNumber, const QString &key) override;
- virtual bool isActive(int streamNumber);
- virtual void setActive(int streamNumber, bool state);
+ bool isActive(int streamNumber) override;
+ void setActive(int streamNumber, bool state) override;
private:
QGstreamerPlayerSession *m_session;
diff --git a/src/plugins/wasapi/qwasapiaudioinput.cpp b/src/plugins/wasapi/qwasapiaudioinput.cpp
index 22a77df38..561584e83 100644
--- a/src/plugins/wasapi/qwasapiaudioinput.cpp
+++ b/src/plugins/wasapi/qwasapiaudioinput.cpp
@@ -143,9 +143,7 @@ qint64 WasapiInputDevicePrivate::writeData(const char* data, qint64 len)
QWasapiAudioInput::QWasapiAudioInput(const QByteArray &device)
: m_deviceName(device)
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
, m_volumeCache(qreal(1.))
-#endif
, m_currentState(QAudio::StoppedState)
, m_currentError(QAudio::NoError)
, m_bufferFrames(0)
@@ -165,7 +163,6 @@ QWasapiAudioInput::~QWasapiAudioInput()
void QWasapiAudioInput::setVolume(qreal vol)
{
qCDebug(lcMmAudioInput) << __FUNCTION__ << vol;
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900 // Volume is only supported MSVC2015 and beyond
m_volumeCache = vol;
if (m_volumeControl) {
quint32 channelCount;
@@ -175,17 +172,12 @@ void QWasapiAudioInput::setVolume(qreal vol)
RETURN_VOID_IF_FAILED("Could not set audio volume.");
}
}
-#endif // defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
}
qreal QWasapiAudioInput::volume() const
{
qCDebug(lcMmAudioInput) << __FUNCTION__;
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900 // Volume is only supported MSVC2015 and beyond
return m_volumeCache;
-#else
- return qreal(1.0);
-#endif
}
void QWasapiAudioInput::process()
@@ -317,11 +309,9 @@ bool QWasapiAudioInput::initStart(bool pull)
hr = m_interface->m_client->GetService(IID_PPV_ARGS(&m_capture));
EMIT_RETURN_FALSE_IF_FAILED("Could not acquire render service.", QAudio::OpenError)
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900 // Volume is only supported MSVC2015 and beyond for WinRT
hr = m_interface->m_client->GetService(IID_PPV_ARGS(&m_volumeControl));
if (FAILED(hr))
qCDebug(lcMmAudioInput) << "Could not acquire volume control.";
-#endif // defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
hr = m_interface->m_client->GetBufferSize(&m_bufferFrames);
EMIT_RETURN_FALSE_IF_FAILED("Could not access buffer size.", QAudio::OpenError)
diff --git a/src/plugins/wasapi/qwasapiaudioinput.h b/src/plugins/wasapi/qwasapiaudioinput.h
index 3fd7315c1..34ede06b7 100644
--- a/src/plugins/wasapi/qwasapiaudioinput.h
+++ b/src/plugins/wasapi/qwasapiaudioinput.h
@@ -97,10 +97,8 @@ private:
QByteArray m_deviceName;
Microsoft::WRL::ComPtr<AudioInterface> m_interface;
Microsoft::WRL::ComPtr<IAudioCaptureClient> m_capture;
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
Microsoft::WRL::ComPtr<IAudioStreamVolume> m_volumeControl;
qreal m_volumeCache;
-#endif
QMutex m_mutex;
QAudio::State m_currentState;
QAudio::Error m_currentError;
diff --git a/src/plugins/wasapi/qwasapiaudiooutput.cpp b/src/plugins/wasapi/qwasapiaudiooutput.cpp
index 1b0f64451..79548011c 100644
--- a/src/plugins/wasapi/qwasapiaudiooutput.cpp
+++ b/src/plugins/wasapi/qwasapiaudiooutput.cpp
@@ -157,9 +157,7 @@ qint64 WasapiOutputDevicePrivate::writeData(const char* data, qint64 len)
QWasapiAudioOutput::QWasapiAudioOutput(const QByteArray &device)
: m_deviceName(device)
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
, m_volumeCache(qreal(1.))
-#endif
, m_currentState(QAudio::StoppedState)
, m_currentError(QAudio::NoError)
, m_interval(1000)
@@ -180,7 +178,6 @@ QWasapiAudioOutput::~QWasapiAudioOutput()
void QWasapiAudioOutput::setVolume(qreal vol)
{
qCDebug(lcMmAudioOutput) << __FUNCTION__ << vol;
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900 // Volume is only supported MSVC2015 and beyond for WinRT
m_volumeCache = vol;
if (m_volumeControl) {
quint32 channelCount;
@@ -190,17 +187,12 @@ void QWasapiAudioOutput::setVolume(qreal vol)
RETURN_VOID_IF_FAILED("Could not set audio volume.");
}
}
-#endif // defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
}
qreal QWasapiAudioOutput::volume() const
{
qCDebug(lcMmAudioOutput) << __FUNCTION__;
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900 // Volume is only supported MSVC2015 and beyond for WinRT
return m_volumeCache;
-#else
- return qreal(1.0);
-#endif
}
void QWasapiAudioOutput::process()
@@ -316,11 +308,9 @@ bool QWasapiAudioOutput::initStart(bool pull)
hr = m_interface->m_client->GetService(IID_PPV_ARGS(&m_renderer));
EMIT_RETURN_FALSE_IF_FAILED("Could not acquire render service.", QAudio::OpenError)
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900 // Volume is only supported MSVC2015 and beyond
hr = m_interface->m_client->GetService(IID_PPV_ARGS(&m_volumeControl));
if (FAILED(hr))
qCDebug(lcMmAudioOutput) << "Could not acquire volume control.";
-#endif // defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
hr = m_interface->m_client->GetBufferSize(&m_bufferFrames);
EMIT_RETURN_FALSE_IF_FAILED("Could not access buffer size.", QAudio::OpenError)
diff --git a/src/plugins/wasapi/qwasapiaudiooutput.h b/src/plugins/wasapi/qwasapiaudiooutput.h
index 118731af9..02974071b 100644
--- a/src/plugins/wasapi/qwasapiaudiooutput.h
+++ b/src/plugins/wasapi/qwasapiaudiooutput.h
@@ -98,10 +98,8 @@ private:
QByteArray m_deviceName;
Microsoft::WRL::ComPtr<AudioInterface> m_interface;
Microsoft::WRL::ComPtr<IAudioRenderClient> m_renderer;
-#if defined(CLASSIC_APP_BUILD) || _MSC_VER >= 1900
Microsoft::WRL::ComPtr<IAudioStreamVolume> m_volumeControl;
qreal m_volumeCache;
-#endif
QMutex m_mutex;
QAudio::State m_currentState;
QAudio::Error m_currentError;
diff --git a/src/plugins/wasapi/wasapi.pro b/src/plugins/wasapi/wasapi.pro
index 11dfd8abe..63409ce72 100644
--- a/src/plugins/wasapi/wasapi.pro
+++ b/src/plugins/wasapi/wasapi.pro
@@ -20,10 +20,7 @@ OTHER_FILES += \
LIBS += Mmdevapi.lib
-win32-* {
- DEFINES += CLASSIC_APP_BUILD
- LIBS += runtimeobject.lib
-}
+win32-*: LIBS += runtimeobject.lib
PLUGIN_TYPE = audio
PLUGIN_CLASS_NAME = QWasapiPlugin
diff --git a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp
index 177a0731c..54f4b103b 100644
--- a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp
+++ b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp
@@ -109,15 +109,16 @@ struct CaptureRequest
class QWinRTCameraImageCaptureControlPrivate
{
public:
+ QWinRTCameraImageCaptureControlPrivate()
+ : isActive(false)
+ {
+ }
+
QPointer<QWinRTCameraControl> cameraControl;
QHash<IAsyncAction *, CaptureRequest> requests;
quint16 currentCaptureId;
QMediaStorageLocation location;
-
- void onCameraStateChanged()
- {
-
- }
+ bool isActive;
};
QWinRTCameraImageCaptureControl::QWinRTCameraImageCaptureControl(QWinRTCameraControl *parent)
@@ -128,14 +129,14 @@ QWinRTCameraImageCaptureControl::QWinRTCameraImageCaptureControl(QWinRTCameraCon
d->cameraControl = parent;
connect(d->cameraControl, &QCameraControl::stateChanged,
- this, &QWinRTCameraImageCaptureControl::readyForCaptureChanged);
+ this, &QWinRTCameraImageCaptureControl::onCameraStateChanged);
d->currentCaptureId = 0;
}
bool QWinRTCameraImageCaptureControl::isReadyForCapture() const
{
Q_D(const QWinRTCameraImageCaptureControl);
- return d->cameraControl->state() == QCamera::ActiveState;
+ return d->isActive;
}
QCameraImageCapture::DriveMode QWinRTCameraImageCaptureControl::driveMode() const
@@ -215,6 +216,17 @@ void QWinRTCameraImageCaptureControl::cancelCapture()
emit captureQueueChanged(true);
}
+void QWinRTCameraImageCaptureControl::onCameraStateChanged(QCamera::State state)
+{
+ Q_D(QWinRTCameraImageCaptureControl);
+ const bool newActive = state == QCamera::ActiveState;
+ if (d->isActive == newActive)
+ return;
+
+ d->isActive = newActive;
+ emit readyForCaptureChanged(newActive);
+}
+
HRESULT QWinRTCameraImageCaptureControl::onCaptureCompleted(IAsyncAction *asyncInfo, AsyncStatus status)
{
qCDebug(lcMMCamera) << __FUNCTION__;
diff --git a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h
index 177eaf5d7..3820bfaf1 100644
--- a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h
+++ b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h
@@ -40,6 +40,7 @@
#ifndef QWINRTCAMERAIMAGECAPTURECONTROL_H
#define QWINRTCAMERAIMAGECAPTURECONTROL_H
+#include <QtMultimedia/QCamera>
#include <QtMultimedia/QCameraImageCaptureControl>
#include <QtCore/qt_windows.h>
@@ -71,6 +72,9 @@ public:
int capture(const QString &fileName) Q_DECL_OVERRIDE;
void cancelCapture() Q_DECL_OVERRIDE;
+private slots:
+ void onCameraStateChanged(QCamera::State state);
+
signals:
void captureQueueChanged(bool isEmpty);