summaryrefslogtreecommitdiffstats
path: root/src/multimedia/camera
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-06-09 18:30:32 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-06-11 05:16:23 +0000
commit7f9beeaf9c1f86268dee8e6f668fbf78313ffd9c (patch)
tree6b35adfa5f694ceddd6e32a357f4e6b0ffa80666 /src/multimedia/camera
parentf93f4e3daab1f9cbebbf663f1119a080cb299b9f (diff)
Define QCamera::FrameRateRange as a struct.
Instead of an alias for QPair<qreal, qreal>. Task-number: QTBUG-46563 Change-Id: I7e1ac68242810f7e5f7e161571a11f5de7850e29 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/multimedia/camera')
-rw-r--r--src/multimedia/camera/qcamera.cpp26
-rw-r--r--src/multimedia/camera/qcamera.h24
2 files changed, 43 insertions, 7 deletions
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp
index daee0a930..e70bed047 100644
--- a/src/multimedia/camera/qcamera.cpp
+++ b/src/multimedia/camera/qcamera.cpp
@@ -72,7 +72,7 @@ static bool qt_sizeLessThan(const QSize &s1, const QSize &s2)
static bool qt_frameRateRangeLessThan(const QCamera::FrameRateRange &s1, const QCamera::FrameRateRange &s2)
{
- return s1.second < s2.second;
+ return s1.maximumFrameRate < s2.maximumFrameRate;
}
/*!
@@ -1028,15 +1028,29 @@ void QCamera::unlock()
/*!
- \typedef QCamera::FrameRateRange
+ \class QCamera::FrameRateRange
+ \inmodule QtMultimedia
+ \ingroup multimedia
+ \ingroup multimedia_camera
+ \since 5.5
+
+ \brief A FrameRateRange represents a range of frame rates as minimum and maximum rate.
- This is a typedef for QPair<qreal, qreal>.
+ If the minimum frame rate is equal to the maximum frame rate, the frame rate is fixed.
+ If not, the actual frame rate fluctuates between the minimum and the maximum.
- A frame rate range contains a minimum and a maximum frame rate, respectively the first and
- second element of the pair. If the minimum frame rate is equal to the maximum frame rate, the
- frame rate is fixed. If not, the actual frame rate fluctuates between the minimum and the maximum.
+ \sa QCamera::supportedViewfinderFrameRateRanges(), QCameraViewfinderSettings
*/
+/*!
+ \variable QCamera::FrameRateRange::minimumFrameRate
+ The minimum frame rate supported by the range, in frames per second.
+*/
+
+/*!
+ \variable QCamera::FrameRateRange::maximumFrameRate
+ The maximum frame rate supported by the range, in frames per second.
+*/
/*!
\enum QCamera::State
diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h
index a50c38496..ea81c02c4 100644
--- a/src/multimedia/camera/qcamera.h
+++ b/src/multimedia/camera/qcamera.h
@@ -77,7 +77,21 @@ class Q_MULTIMEDIA_EXPORT QCamera : public QMediaObject
Q_ENUMS(LockType)
Q_ENUMS(Position)
public:
- typedef QPair<qreal, qreal> FrameRateRange;
+ struct FrameRateRange
+ {
+ Q_DECL_CONSTEXPR FrameRateRange() Q_DECL_NOTHROW
+ : minimumFrameRate(0)
+ , maximumFrameRate(0)
+ { }
+
+ Q_DECL_CONSTEXPR FrameRateRange(qreal minimum, qreal maximum) Q_DECL_NOTHROW
+ : minimumFrameRate(minimum)
+ , maximumFrameRate(maximum)
+ { }
+
+ qreal minimumFrameRate;
+ qreal maximumFrameRate;
+ };
enum Status {
UnavailableStatus,
@@ -237,6 +251,14 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QCamera::LockTypes)
+Q_DECL_CONSTEXPR Q_INLINE_TEMPLATE bool operator==(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2) Q_DECL_NOTHROW
+{ return r1.minimumFrameRate == r2.minimumFrameRate && r1.maximumFrameRate == r2.maximumFrameRate; }
+
+Q_DECL_CONSTEXPR Q_INLINE_TEMPLATE bool operator!=(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2) Q_DECL_NOTHROW
+{ return !(r1 == r2); }
+
+Q_DECLARE_TYPEINFO(QCamera::FrameRateRange, Q_PRIMITIVE_TYPE);
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QCamera::State)