AVFoundation: fix compilation on OSX < 10.9.
AVCaptureConnection.videoMaxFrameDuration is supported only since 10.9. Task-number: QTBUG-46159 Change-Id: I8ea57b69e97ea3802b5c444c57ab090c4edf31e2 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
This commit is contained in:
@@ -59,13 +59,20 @@ AVFPSRange qt_connection_framerates(AVCaptureConnection *videoConnection)
|
||||
}
|
||||
}
|
||||
|
||||
if (videoConnection.supportsVideoMaxFrameDuration) {
|
||||
const CMTime cmMax = videoConnection.videoMaxFrameDuration;
|
||||
if (CMTimeCompare(cmMax, kCMTimeInvalid)) {
|
||||
if (const Float64 maxSeconds = CMTimeGetSeconds(cmMax))
|
||||
newRange.first = 1. / maxSeconds;
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return newRange;
|
||||
}
|
||||
|
||||
@@ -76,31 +76,40 @@ void qt_set_framerate_limits(AVCaptureConnection *videoConnection,
|
||||
return;
|
||||
}
|
||||
|
||||
const qreal minFPS = settings.minimumFrameRate();
|
||||
const qreal maxFPS = settings.maximumFrameRate();
|
||||
|
||||
CMTime minDuration = kCMTimeInvalid;
|
||||
CMTime maxDuration = kCMTimeInvalid;
|
||||
if (minFPS > 0. || maxFPS > 0.) {
|
||||
if (maxFPS) {
|
||||
if (!videoConnection.supportsVideoMinFrameDuration)
|
||||
qDebugCamera() << Q_FUNC_INFO << "maximum framerate is not supported";
|
||||
else
|
||||
minDuration = CMTimeMake(1, maxFPS);
|
||||
}
|
||||
if (maxFPS > 0.) {
|
||||
if (!videoConnection.supportsVideoMinFrameDuration)
|
||||
qDebugCamera() << Q_FUNC_INFO << "maximum framerate is not supported";
|
||||
else
|
||||
minDuration = CMTimeMake(1, maxFPS);
|
||||
}
|
||||
if (videoConnection.supportsVideoMinFrameDuration)
|
||||
videoConnection.videoMinFrameDuration = minDuration;
|
||||
|
||||
if (minFPS) {
|
||||
const qreal minFPS = settings.minimumFrameRate();
|
||||
#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.)
|
||||
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;
|
||||
}
|
||||
|
||||
if (videoConnection.supportsVideoMinFrameDuration)
|
||||
videoConnection.videoMinFrameDuration = minDuration;
|
||||
if (videoConnection.supportsVideoMaxFrameDuration)
|
||||
videoConnection.videoMaxFrameDuration = maxDuration;
|
||||
#else
|
||||
if (minFPS > 0.)
|
||||
qDebugCamera() << Q_FUNC_INFO << "minimum framerate is not supported";
|
||||
#endif
|
||||
}
|
||||
|
||||
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_7, __IPHONE_7_0)
|
||||
|
||||
Reference in New Issue
Block a user