diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2014-07-08 15:56:05 +1000 |
---|---|---|
committer | Andrew den Exter <andrew.den.exter@qinetic.com.au> | 2014-07-12 02:46:10 +0200 |
commit | cddbe8736d995b4bfdfbbf1abfc3d6aeae3eb214 (patch) | |
tree | 8d775c9ee17902ae39aebae0d825ee3a93455135 /src/multimedia | |
parent | 074bd6ab37bbbb4dbba188921783fd98be872555 (diff) |
Provide face and orientation info from gstreamer camera backend.
Cleans up duplicate device enumeration code so the devices listed by
the QMediaServiceProviderPlugin are the same as those in the
QVideoInputDeviceControl and includes face and orientation information
if available.
Change-Id: Iaa4c303c973bcf3e0f7c8c2fd7a7de629bccec86
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h | 12 | ||||
-rw-r--r-- | src/multimedia/gsttools_headers/qgstutils_p.h | 16 |
2 files changed, 22 insertions, 6 deletions
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h index eeb576ef5..c4fe83fbc 100644 --- a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h +++ b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h @@ -46,6 +46,7 @@ #include <QtCore/qstringlist.h> #include <gst/gst.h> +#include <qcamera.h> QT_BEGIN_NAMESPACE @@ -54,7 +55,7 @@ class QGstreamerVideoInputDeviceControl : public QVideoDeviceSelectorControl Q_OBJECT public: QGstreamerVideoInputDeviceControl(QObject *parent); - QGstreamerVideoInputDeviceControl(GstElement *source, QObject *parent); + QGstreamerVideoInputDeviceControl(GstElementFactory *factory, QObject *parent); ~QGstreamerVideoInputDeviceControl(); int deviceCount() const; @@ -65,17 +66,16 @@ public: int defaultDevice() const; int selectedDevice() const; + static QString primaryCamera() { return tr("Main camera"); } + static QString secondaryCamera() { return tr("Front camera"); } + public Q_SLOTS: void setSelectedDevice(int index); private: - void update(); - - GstElement *m_source; + GstElementFactory *m_factory; int m_selectedDevice; - QStringList m_names; - QStringList m_descriptions; }; QT_END_NAMESPACE diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h index eea1e15d9..701de59da 100644 --- a/src/multimedia/gsttools_headers/qgstutils_p.h +++ b/src/multimedia/gsttools_headers/qgstutils_p.h @@ -55,8 +55,10 @@ #include <QtCore/qmap.h> #include <QtCore/qset.h> +#include <QtCore/qvector.h> #include <gst/gst.h> #include <qaudioformat.h> +#include <qcamera.h> QT_BEGIN_NAMESPACE @@ -65,6 +67,14 @@ class QVariant; class QByteArray; namespace QGstUtils { + struct CameraInfo + { + QString name; + QString description; + int orientation; + QCamera::Position position; + }; + QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list); QSize capsResolution(const GstCaps *caps); @@ -76,6 +86,12 @@ namespace QGstUtils { QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs, const QSet<QString> &supportedMimeTypeSet); + + QVector<CameraInfo> enumerateCameras(GstElementFactory *factory = 0); + QList<QByteArray> cameraDevices(GstElementFactory * factory = 0); + QString cameraDescription(const QString &device, GstElementFactory * factory = 0); + QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0); + int cameraOrientation(const QString &device, GstElementFactory * factory = 0); } void qt_gst_object_ref_sink(gpointer object); |