winrt: Add camera service

This adds a basic camera service with viewfinder (video renderer based),
still image capture, and device selection support.

Runtime apps must set the "webcam" and "microphone" device capabilities
in order to access the hardware. This can be done by adding the following
to the .pro file:
    WINRT_MANIFEST.capabilites_device += webcam microphone

[ChangeLog] Enabled basic camera support in the winrt backend.

Change-Id: If4f963ef645d93c757ae23aec9a9c8aae122324f
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Andrew Knight
2014-08-29 16:59:09 +03:00
parent 80ba1d635d
commit 0c3438c9a1
16 changed files with 2375 additions and 4 deletions

View File

@@ -44,6 +44,8 @@
#include "qwinrtserviceplugin.h"
#include "qwinrtmediaplayerservice.h"
#include "qwinrtcameraservice.h"
#include "qwinrtvideodeviceselectorcontrol.h"
QT_USE_NAMESPACE
@@ -52,6 +54,9 @@ QMediaService *QWinRTServicePlugin::create(QString const &key)
if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
return new QWinRTMediaPlayerService(this);
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
return new QWinRTCameraService(this);
return Q_NULLPTR;
}
@@ -68,3 +73,37 @@ QMediaServiceProviderHint::Features QWinRTServicePlugin::supportedFeatures(
return QMediaServiceProviderHint::Features();
}
QCamera::Position QWinRTServicePlugin::cameraPosition(const QByteArray &device) const
{
return QWinRTVideoDeviceSelectorControl::cameraPosition(device);
}
int QWinRTServicePlugin::cameraOrientation(const QByteArray &device) const
{
return QWinRTVideoDeviceSelectorControl::cameraOrientation(device);
}
QList<QByteArray> QWinRTServicePlugin::devices(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA)
return QWinRTVideoDeviceSelectorControl::deviceNames();
return QList<QByteArray>();
}
QString QWinRTServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
{
if (service == Q_MEDIASERVICE_CAMERA)
return QWinRTVideoDeviceSelectorControl::deviceDescription(device);
return QString();
}
QByteArray QWinRTServicePlugin::defaultDevice(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA)
return QWinRTVideoDeviceSelectorControl::defaultDeviceName();
return QByteArray();
}