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>
This commit is contained in:
Andrew den Exter
2014-07-08 15:56:05 +10:00
committed by Andrew den Exter
parent 074bd6ab37
commit cddbe8736d
15 changed files with 445 additions and 283 deletions

View File

@@ -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

View File

@@ -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);