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

@@ -30,7 +30,8 @@ HEADERS += \
$$PWD/camerabinresourcepolicy.h \
$$PWD/camerabincapturedestination.h \
$$PWD/camerabincapturebufferformat.h \
$$PWD/camerabinviewfindersettings.h
$$PWD/camerabinviewfindersettings.h \
$$PWD/camerabininfocontrol.h
SOURCES += \
$$PWD/camerabinserviceplugin.cpp \
@@ -48,7 +49,8 @@ SOURCES += \
$$PWD/camerabinresourcepolicy.cpp \
$$PWD/camerabincapturedestination.cpp \
$$PWD/camerabinviewfindersettings.cpp \
$$PWD/camerabincapturebufferformat.cpp
$$PWD/camerabincapturebufferformat.cpp \
$$PWD/camerabininfocontrol.cpp
maemo6 {
HEADERS += \

View File

@@ -0,0 +1,71 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "camerabininfocontrol.h"
#include <private/qgstutils_p.h>
QT_BEGIN_NAMESPACE
CameraBinInfoControl::CameraBinInfoControl(GstElementFactory *sourceFactory, QObject *parent)
: QCameraInfoControl(parent)
, m_sourceFactory(sourceFactory)
{
gst_object_ref(GST_OBJECT(m_sourceFactory));
}
CameraBinInfoControl::~CameraBinInfoControl()
{
gst_object_unref(GST_OBJECT(m_sourceFactory));
}
QCamera::Position CameraBinInfoControl::cameraPosition(const QString &device) const
{
return QGstUtils::cameraPosition(device, m_sourceFactory);
}
int CameraBinInfoControl::cameraOrientation(const QString &device) const
{
return QGstUtils::cameraOrientation(device, m_sourceFactory);
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CAMERABININFOCONTROL_H
#define CAMERABININFOCONTROL_H
#include <qcamerainfocontrol.h>
#include <gst/gst.h>
QT_BEGIN_NAMESPACE
class CameraBinInfoControl : public QCameraInfoControl
{
Q_OBJECT
public:
CameraBinInfoControl(GstElementFactory *sourceFactory, QObject *parent);
~CameraBinInfoControl();
QCamera::Position cameraPosition(const QString &deviceName) const;
int cameraOrientation(const QString &deviceName) const;
private:
GstElementFactory * const m_sourceFactory;
};
QT_END_NAMESPACE
#endif

View File

@@ -48,6 +48,7 @@
#include "camerabinimageencoder.h"
#include "camerabincontrol.h"
#include "camerabinmetadata.h"
#include "camerabininfocontrol.h"
#ifdef HAVE_GST_PHOTOGRAPHY
#include "camerabinexposure.h"
@@ -89,8 +90,9 @@
QT_BEGIN_NAMESPACE
CameraBinService::CameraBinService(const QString &service, QObject *parent):
QMediaService(parent)
CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *parent):
QMediaService(parent),
m_cameraInfoControl(0)
{
m_captureSession = 0;
m_metaDataControl = 0;
@@ -106,40 +108,32 @@ CameraBinService::CameraBinService(const QString &service, QObject *parent):
#endif
m_imageCaptureControl = 0;
if (service == Q_MEDIASERVICE_CAMERA) {
m_captureSession = new CameraBinSession(this);
m_videoInputDevice = new QGstreamerVideoInputDeviceControl(
m_captureSession->buildCameraSource(), m_captureSession);
m_imageCaptureControl = new CameraBinImageCapture(m_captureSession);
m_captureSession = new CameraBinSession(sourceFactory, this);
m_videoInputDevice = new QGstreamerVideoInputDeviceControl(sourceFactory, m_captureSession);
m_imageCaptureControl = new CameraBinImageCapture(m_captureSession);
connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
m_captureSession, SLOT(setDevice(QString)));
connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
m_captureSession, SLOT(setDevice(QString)));
if (m_videoInputDevice->deviceCount())
m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
if (m_videoInputDevice->deviceCount())
m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
#if defined(Q_WS_MAEMO_6) && defined(__arm__) && defined(HAVE_WIDGETS)
m_videoRenderer = new QGstreamerGLTextureRenderer(this);
m_videoRenderer = new QGstreamerGLTextureRenderer(this);
#else
m_videoRenderer = new QGstreamerVideoRenderer(this);
m_videoRenderer = new QGstreamerVideoRenderer(this);
#endif
#ifdef Q_WS_MAEMO_6
m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
#else
m_videoWindow = new QGstreamerVideoWindow(this);
m_videoWindow = new QGstreamerVideoWindow(this);
#endif
#if defined(HAVE_WIDGETS)
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
#endif
}
if (!m_captureSession) {
qWarning() << Q_FUNC_INFO << "Service type is not supported:" << service;
return;
}
m_audioInputSelector = new QGstreamerAudioInputSelector(this);
connect(m_audioInputSelector, SIGNAL(activeInputChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));
@@ -244,6 +238,12 @@ QMediaControl *CameraBinService::requestControl(const char *name)
if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0)
return m_captureSession->viewfinderSettingsControl();
if (qstrcmp(name, QCameraInfoControl_iid) == 0) {
if (!m_cameraInfoControl)
m_cameraInfoControl = new CameraBinInfoControl(m_captureSession->sourceFactory(), this);
return m_cameraInfoControl;
}
return 0;
}

View File

@@ -67,7 +67,7 @@ class CameraBinService : public QMediaService
Q_OBJECT
public:
CameraBinService(const QString &service, QObject *parent = 0);
CameraBinService(GstElementFactory *sourceFactory, QObject *parent = 0);
virtual ~CameraBinService();
QMediaControl *requestControl(const char *name);
@@ -92,6 +92,7 @@ private:
QGstreamerVideoWidgetControl *m_videoWidgetControl;
#endif
CameraBinImageCapture *m_imageCaptureControl;
QMediaControl *m_cameraInfoControl;
};
QT_END_NAMESPACE

View File

@@ -55,12 +55,25 @@
QT_BEGIN_NAMESPACE
template <typename T, int N> static int lengthOf(const T(&)[N]) { return N; }
CameraBinServicePlugin::CameraBinServicePlugin()
: m_sourceFactory(0)
{
}
CameraBinServicePlugin::~CameraBinServicePlugin()
{
if (m_sourceFactory)
gst_object_unref(GST_OBJECT(m_sourceFactory));
}
QMediaService* CameraBinServicePlugin::create(const QString &key)
{
QGstUtils::initializeGst();
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
return new CameraBinService(key);
return new CameraBinService(sourceFactory());
qWarning() << "Gstreamer camerabin service plugin: unsupported key:" << key;
return 0;
@@ -82,40 +95,24 @@ QMediaServiceProviderHint::Features CameraBinServicePlugin::supportedFeatures(
QByteArray CameraBinServicePlugin::defaultDevice(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
return m_defaultCameraDevice;
}
return QByteArray();
return service == Q_MEDIASERVICE_CAMERA
? QGstUtils::enumerateCameras(sourceFactory()).value(0).name.toUtf8()
: QByteArray();
}
QList<QByteArray> CameraBinServicePlugin::devices(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
return m_cameraDevices;
}
return QList<QByteArray>();
return service == Q_MEDIASERVICE_CAMERA
? QGstUtils::cameraDevices(m_sourceFactory)
: QList<QByteArray>();
}
QString CameraBinServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
QString CameraBinServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &deviceName)
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
for (int i=0; i<m_cameraDevices.count(); i++)
if (m_cameraDevices[i] == device)
return m_cameraDescriptions[i];
}
return QString();
return service == Q_MEDIASERVICE_CAMERA
? QGstUtils::cameraDescription(deviceName, m_sourceFactory)
: QString();
}
QVariant CameraBinServicePlugin::deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property)
@@ -126,53 +123,36 @@ QVariant CameraBinServicePlugin::deviceProperty(const QByteArray &service, const
return QVariant();
}
void CameraBinServicePlugin::updateDevices() const
QCamera::Position CameraBinServicePlugin::cameraPosition(const QByteArray &deviceName) const
{
m_defaultCameraDevice.clear();
m_cameraDevices.clear();
m_cameraDescriptions.clear();
return QGstUtils::cameraPosition(deviceName, m_sourceFactory);
}
QDir devDir("/dev");
devDir.setFilter(QDir::System);
int CameraBinServicePlugin::cameraOrientation(const QByteArray &deviceName) const
{
return QGstUtils::cameraOrientation(deviceName, m_sourceFactory);
}
QFileInfoList entries = devDir.entryInfoList(QStringList() << "video*");
GstElementFactory *CameraBinServicePlugin::sourceFactory() const
{
if (!m_sourceFactory) {
GstElementFactory *factory = 0;
const QByteArray envCandidate = qgetenv("QT_GSTREAMER_CAMERABIN_SRC");
if (!envCandidate.isEmpty())
factory = gst_element_factory_find(envCandidate.constData());
foreach (const QFileInfo &entryInfo, entries) {
int fd = qt_safe_open(entryInfo.filePath().toLatin1().constData(), O_RDWR );
if (fd == -1)
continue;
static const char *candidates[] = { "subdevsrc", "wrappercamerabinsrc" };
for (int i = 0; !factory && i < lengthOf(candidates); ++i)
factory = gst_element_factory_find(candidates[i]);
bool isCamera = false;
v4l2_input input;
memset(&input, 0, sizeof(input));
for (; ::ioctl(fd, VIDIOC_ENUMINPUT, &input) >= 0; ++input.index) {
if (input.type == V4L2_INPUT_TYPE_CAMERA || input.type == 0) {
isCamera = ::ioctl(fd, VIDIOC_S_INPUT, input.index) != 0;
break;
}
if (factory) {
m_sourceFactory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(
GST_PLUGIN_FEATURE(factory)));
gst_object_unref((GST_OBJECT(factory)));
}
if (isCamera) {
// find out its driver "name"
QString name;
struct v4l2_capability vcap;
memset(&vcap, 0, sizeof(struct v4l2_capability));
if (ioctl(fd, VIDIOC_QUERYCAP, &vcap) != 0)
name = entryInfo.fileName();
else
name = QString((const char*)vcap.card);
//qDebug() << "found camera: " << name;
m_cameraDevices.append(entryInfo.filePath().toLocal8Bit());
m_cameraDescriptions.append(name);
}
qt_safe_close(fd);
}
if (!m_cameraDevices.isEmpty())
m_defaultCameraDevice = m_cameraDevices.first();
return m_sourceFactory;
}
QT_END_NAMESPACE

View File

@@ -44,7 +44,9 @@
#define CAMERABINSERVICEPLUGIN_H
#include <qmediaserviceproviderplugin.h>
#include <QtCore/QObject>
#include <private/qgstreamervideoinputdevicecontrol_p.h>
#include <gst/gst.h>
QT_BEGIN_NAMESPACE
@@ -53,13 +55,18 @@ class CameraBinServicePlugin
, public QMediaServiceSupportedDevicesInterface
, public QMediaServiceDefaultDeviceInterface
, public QMediaServiceFeaturesInterface
, public QMediaServiceCameraInfoInterface
{
Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
Q_INTERFACES(QMediaServiceFeaturesInterface)
Q_INTERFACES(QMediaServiceCameraInfoInterface)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "camerabin.json")
public:
CameraBinServicePlugin();
~CameraBinServicePlugin();
QMediaService* create(QString const& key);
void release(QMediaService *service);
@@ -70,12 +77,13 @@ public:
QString deviceDescription(const QByteArray &service, const QByteArray &device);
QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property);
private:
void updateDevices() const;
QCamera::Position cameraPosition(const QByteArray &device) const;
int cameraOrientation(const QByteArray &device) const;
mutable QByteArray m_defaultCameraDevice;
mutable QList<QByteArray> m_cameraDevices;
mutable QStringList m_cameraDescriptions;
private:
GstElementFactory *sourceFactory() const;
mutable GstElementFactory *m_sourceFactory;
};
QT_END_NAMESPACE

View File

@@ -119,7 +119,7 @@
QT_BEGIN_NAMESPACE
CameraBinSession::CameraBinSession(QObject *parent)
CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *parent)
:QObject(parent),
m_recordingActive(false),
m_state(QCamera::UnloadedState),
@@ -133,6 +133,7 @@ CameraBinSession::CameraBinSession(QObject *parent)
m_viewfinderInterface(0),
m_videoSrc(0),
m_viewfinderElement(0),
m_sourceFactory(sourceFactory),
m_viewfinderHasChanged(true),
m_videoInputHasChanged(true),
m_audioSrc(0),
@@ -142,6 +143,9 @@ CameraBinSession::CameraBinSession(QObject *parent)
m_audioEncoder(0),
m_muxer(0)
{
if (m_sourceFactory)
gst_object_ref(GST_OBJECT(m_sourceFactory));
m_camerabin = gst_element_factory_make("camerabin2", "camerabin2");
g_signal_connect(G_OBJECT(m_camerabin), "notify::idle", G_CALLBACK(updateBusyStatus), this);
qt_gst_object_ref_sink(m_camerabin);
@@ -195,6 +199,9 @@ CameraBinSession::~CameraBinSession()
}
if (m_viewfinderElement)
gst_object_unref(GST_OBJECT(m_viewfinderElement));
if (m_sourceFactory)
gst_object_unref(GST_OBJECT(m_sourceFactory));
}
#ifdef HAVE_GST_PHOTOGRAPHY
@@ -383,32 +390,17 @@ GstElement *CameraBinSession::buildCameraSource()
m_videoInputHasChanged = false;
GstElement *videoSrc = 0;
if (!videoSrc)
g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &videoSrc, NULL);
// If the QT_GSTREAMER_CAMERABIN_SRC environment variable has been set use the source
// it recommends.
const QByteArray envCandidate = qgetenv("QT_GSTREAMER_CAMERABIN_SRC");
if (!m_videoSrc && !envCandidate.isEmpty()) {
m_videoSrc = gst_element_factory_make(envCandidate.constData(), "camera_source");
}
if (m_sourceFactory)
m_videoSrc = gst_element_factory_create(m_sourceFactory, "camera_source");
// If gstreamer has set a default source use it.
if (!m_videoSrc)
m_videoSrc = videoSrc;
// If there's no better guidance try the names of some known camera source elements.
if (!m_videoSrc) {
const QList<QByteArray> candidates = QList<QByteArray>()
<< "subdevsrc"
<< "wrappercamerabinsrc";
foreach (const QByteArray &sourceElementName, candidates) {
m_videoSrc = gst_element_factory_make(sourceElementName.constData(), "camera_source");
if (m_videoSrc)
break;
}
}
if (m_videoSrc && !m_inputDevice.isEmpty()) {
#if CAMERABIN_DEBUG
qDebug() << "set camera device" << m_inputDevice;

View File

@@ -96,7 +96,7 @@ public:
BackCamera // Main photo camera
};
CameraBinSession(QObject *parent);
CameraBinSession(GstElementFactory *sourceFactory, QObject *parent);
~CameraBinSession();
#ifdef HAVE_GST_PHOTOGRAPHY
@@ -121,6 +121,7 @@ public:
QString generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const;
GstElement *buildCameraSource();
GstElementFactory *sourceFactory() const { return m_sourceFactory; }
CameraBinControl *cameraControl() const { return m_cameraControl; }
CameraBinAudioEncoder *audioEncodeControl() const { return m_audioEncodeControl; }
@@ -239,6 +240,7 @@ private:
GstElement *m_camerabin;
GstElement *m_videoSrc;
GstElement *m_viewfinderElement;
GstElementFactory *m_sourceFactory;
bool m_viewfinderHasChanged;
bool m_videoInputHasChanged;

View File

@@ -51,9 +51,6 @@
#include "qgstreamercaptureservice.h"
#include <private/qgstutils_p.h>
#include <private/qcore_unix_p.h>
#include <linux/videodev2.h>
QMediaService* QGstreamerCaptureServicePlugin::create(const QString &key)
{
QGstUtils::initializeGst();
@@ -87,40 +84,19 @@ QMediaServiceProviderHint::Features QGstreamerCaptureServicePlugin::supportedFea
QByteArray QGstreamerCaptureServicePlugin::defaultDevice(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
return m_defaultCameraDevice;
}
return QByteArray();
return service == Q_MEDIASERVICE_CAMERA
? QGstUtils::enumerateCameras().value(0).name.toUtf8()
: QByteArray();
}
QList<QByteArray> QGstreamerCaptureServicePlugin::devices(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
return m_cameraDevices;
}
return QList<QByteArray>();
return service == Q_MEDIASERVICE_CAMERA ? QGstUtils::cameraDevices() : QList<QByteArray>();
}
QString QGstreamerCaptureServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
for (int i=0; i<m_cameraDevices.count(); i++)
if (m_cameraDevices[i] == device)
return m_cameraDescriptions[i];
}
return QString();
return service == Q_MEDIASERVICE_CAMERA ? QGstUtils::cameraDescription(deviceName) : QString();
}
QVariant QGstreamerCaptureServicePlugin::deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property)
@@ -131,56 +107,6 @@ QVariant QGstreamerCaptureServicePlugin::deviceProperty(const QByteArray &servic
return QVariant();
}
void QGstreamerCaptureServicePlugin::updateDevices() const
{
m_defaultCameraDevice.clear();
m_cameraDevices.clear();
m_cameraDescriptions.clear();
QDir devDir("/dev");
devDir.setFilter(QDir::System);
QFileInfoList entries = devDir.entryInfoList(QStringList() << "video*");
foreach( const QFileInfo &entryInfo, entries ) {
//qDebug() << "Try" << entryInfo.filePath();
int fd = qt_safe_open(entryInfo.filePath().toLatin1().constData(), O_RDWR );
if (fd == -1)
continue;
bool isCamera = false;
v4l2_input input;
memset(&input, 0, sizeof(input));
for (; ::ioctl(fd, VIDIOC_ENUMINPUT, &input) >= 0; ++input.index) {
if(input.type == V4L2_INPUT_TYPE_CAMERA || input.type == 0) {
isCamera = ::ioctl(fd, VIDIOC_S_INPUT, input.index) != 0;
break;
}
}
if (isCamera) {
// find out its driver "name"
QString name;
struct v4l2_capability vcap;
memset(&vcap, 0, sizeof(struct v4l2_capability));
if (ioctl(fd, VIDIOC_QUERYCAP, &vcap) != 0)
name = entryInfo.fileName();
else
name = QString((const char*)vcap.card);
//qDebug() << "found camera: " << name;
m_cameraDevices.append(entryInfo.filePath().toLocal8Bit());
m_cameraDescriptions.append(name);
}
qt_safe_close(fd);
}
if (!m_cameraDevices.isEmpty())
m_defaultCameraDevice = m_cameraDevices.first();
}
#endif
QMultimedia::SupportEstimate QGstreamerCaptureServicePlugin::hasSupport(const QString &mimeType,

View File

@@ -87,13 +87,6 @@ public:
QStringList supportedMimeTypes() const;
private:
#if defined(USE_GSTREAMER_CAMERA)
void updateDevices() const;
mutable QByteArray m_defaultCameraDevice;
mutable QList<QByteArray> m_cameraDevices;
mutable QStringList m_cameraDescriptions;
#endif
void updateSupportedMimeTypes() const;
mutable QSet<QString> m_supportedMimeTypeSet; //for fast access