Merge remote-tracking branch 'origin/5.5' into dev

Conflicts:
	.qmake.conf

Change-Id: Ib38fe1e0a4c937068741a9556748a18e35ba59af
This commit is contained in:
Liang Qi
2015-06-29 20:10:15 +02:00
30 changed files with 563 additions and 86 deletions

View File

@@ -157,7 +157,7 @@ void AVFCameraFlashControl::cameraStateChanged(QCamera::State newState)
bool AVFCameraFlashControl::applyFlashSettings()
{
Q_ASSERT(m_session->state() == QCamera::ActiveState);
Q_ASSERT(m_session->requestedState() == QCamera::ActiveState);
AVCaptureDevice *captureDevice = m_session->videoCaptureDevice();
if (!captureDevice) {

View File

@@ -70,32 +70,32 @@ QT_END_NAMESPACE
@private
AVFCameraService *m_service;
QT_MANGLE_NAMESPACE(AVFScopedPointer)<AVAssetWriterInput> m_cameraWriterInput;
QT_MANGLE_NAMESPACE(AVFScopedPointer)<AVCaptureDeviceInput> m_audioInput;
QT_MANGLE_NAMESPACE(AVFScopedPointer)<AVCaptureAudioDataOutput> m_audioOutput;
QT_MANGLE_NAMESPACE(AVFScopedPointer)<AVAssetWriterInput> m_audioWriterInput;
QT_PREPEND_NAMESPACE(AVFScopedPointer)<AVAssetWriterInput> m_cameraWriterInput;
QT_PREPEND_NAMESPACE(AVFScopedPointer)<AVCaptureDeviceInput> m_audioInput;
QT_PREPEND_NAMESPACE(AVFScopedPointer)<AVCaptureAudioDataOutput> m_audioOutput;
QT_PREPEND_NAMESPACE(AVFScopedPointer)<AVAssetWriterInput> m_audioWriterInput;
// High priority serial queue for video output:
QT_MANGLE_NAMESPACE(AVFScopedPointer)<dispatch_queue_t> m_videoQueue;
QT_PREPEND_NAMESPACE(AVFScopedPointer)<dispatch_queue_t> m_videoQueue;
// Serial queue for audio output:
QT_MANGLE_NAMESPACE(AVFScopedPointer)<dispatch_queue_t> m_audioQueue;
QT_PREPEND_NAMESPACE(AVFScopedPointer)<dispatch_queue_t> m_audioQueue;
// Queue to write sample buffers:
__weak dispatch_queue_t m_writerQueue;
QT_MANGLE_NAMESPACE(AVFScopedPointer)<AVAssetWriter> m_assetWriter;
QT_PREPEND_NAMESPACE(AVFScopedPointer)<AVAssetWriter> m_assetWriter;
// Delegate's queue.
__weak dispatch_queue_t m_delegateQueue;
// TODO: QPointer??
QT_PREPEND_NAMESPACE(AVFMediaAssetWriterDelegate) *m_delegate;
bool m_setStartTime;
QT_MANGLE_NAMESPACE(AVFAtomicBool) m_stopped;
QT_PREPEND_NAMESPACE(AVFAtomicBool) m_stopped;
bool m_stoppedInternal;
bool m_aborted;
QT_MANGLE_NAMESPACE(QMutex) m_writerMutex;
QT_PREPEND_NAMESPACE(QMutex) m_writerMutex;
@public
QT_MANGLE_NAMESPACE(AVFAtomicInt64) m_durationInMs;
QT_PREPEND_NAMESPACE(AVFAtomicInt64) m_durationInMs;
@private
CMTime m_startTime;
CMTime m_lastTimeStamp;

View File

@@ -50,19 +50,13 @@ AVFVideoFrameRenderer::AVFVideoFrameRenderer(QAbstractVideoSurface *surface, QOb
: QObject(parent)
, m_videoLayerRenderer(0)
, m_surface(surface)
, m_offscreenSurface(0)
, m_glContext(0)
, m_currentBuffer(1)
, m_isContextShared(true)
{
m_fbo[0] = 0;
m_fbo[1] = 0;
//Create Hidden QWindow surface to create context in this thread
m_offscreenSurface = new QWindow();
m_offscreenSurface->setSurfaceType(QWindow::OpenGLSurface);
//Needs geometry to be a valid surface, but size is not important
m_offscreenSurface->setGeometry(0, 0, 1, 1);
m_offscreenSurface->create();
}
AVFVideoFrameRenderer::~AVFVideoFrameRenderer()
@@ -94,7 +88,8 @@ GLuint AVFVideoFrameRenderer::renderLayerToTexture(AVPlayerLayer *layer)
return 0;
renderLayerToFBO(layer, fbo);
m_glContext->doneCurrent();
if (m_glContext)
m_glContext->doneCurrent();
return fbo->texture();
}
@@ -113,7 +108,8 @@ QImage AVFVideoFrameRenderer::renderLayerToImage(AVPlayerLayer *layer)
renderLayerToFBO(layer, fbo);
QImage fboImage = fbo->toImage();
m_glContext->doneCurrent();
if (m_glContext)
m_glContext->doneCurrent();
return fboImage;
}
@@ -125,7 +121,14 @@ QOpenGLFramebufferObject *AVFVideoFrameRenderer::initRenderer(AVPlayerLayer *lay
m_targetSize = QSize(layer.bounds.size.width, layer.bounds.size.height);
//Make sure we have an OpenGL context to make current
if (!m_glContext) {
if (!QOpenGLContext::currentContext() && !m_glContext) {
//Create Hidden QWindow surface to create context in this thread
m_offscreenSurface = new QWindow();
m_offscreenSurface->setSurfaceType(QWindow::OpenGLSurface);
//Needs geometry to be a valid surface, but size is not important
m_offscreenSurface->setGeometry(0, 0, 1, 1);
m_offscreenSurface->create();
//Create OpenGL context and set share context from surface
QOpenGLContext *shareContext = 0;
if (m_surface) {
@@ -151,7 +154,8 @@ QOpenGLFramebufferObject *AVFVideoFrameRenderer::initRenderer(AVPlayerLayer *lay
}
//Need current context
m_glContext->makeCurrent(m_offscreenSurface);
if (m_glContext)
m_glContext->makeCurrent(m_offscreenSurface);
//Create the CARenderer if needed
if (!m_videoLayerRenderer) {

View File

@@ -789,7 +789,7 @@ void DSCameraSession::disconnectGraph()
static bool qt_frameRateRangeGreaterThan(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2)
{
return r1.second > r2.second;
return r1.maximumFrameRate > r2.maximumFrameRate;
}
void DSCameraSession::updateSourceCapabilities()
@@ -896,8 +896,8 @@ void DSCameraSession::updateSourceCapabilities()
Q_FOREACH (const QCamera::FrameRateRange &frameRateRange, frameRateRanges) {
QCameraViewfinderSettings settings;
settings.setResolution(resolution);
settings.setMinimumFrameRate(frameRateRange.first);
settings.setMaximumFrameRate(frameRateRange.second);
settings.setMinimumFrameRate(frameRateRange.minimumFrameRate);
settings.setMaximumFrameRate(frameRateRange.maximumFrameRate);
settings.setPixelFormat(pixelFormat);
m_supportedViewfinderSettings.append(settings);

View File

@@ -56,7 +56,7 @@
using namespace Microsoft::WRL;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
#define BREAK_IF_FAILED(msg) RETURN_IF_FAILED(msg, break)
#define CONTINUE_IF_FAILED(msg) RETURN_IF_FAILED(msg, continue)
@@ -408,3 +408,5 @@ void QWinRTAbstractVideoRendererControl::present()
QVideoFrame frame(d->videoBuffer, d->format.frameSize(), d->format.pixelFormat());
d->surface->present(frame);
}
QT_END_NAMESPACE

View File

@@ -38,6 +38,7 @@
#include "qwinrtcameravideorenderercontrol.h"
#include "qwinrtvideodeviceselectorcontrol.h"
#include "qwinrtcameraimagecapturecontrol.h"
#include "qwinrtimageencodercontrol.h"
#include <QtCore/qfunctions_winrt.h>
#include <QtCore/QCoreApplication>
@@ -67,7 +68,7 @@ using namespace ABI::Windows::Media::Devices;
using namespace ABI::Windows::Media::MediaProperties;
using namespace ABI::Windows::Storage::Streams;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
#define RETURN_VOID_AND_EMIT_ERROR(msg) \
if (FAILED(hr)) { \
@@ -75,6 +76,10 @@ QT_USE_NAMESPACE
RETURN_VOID_IF_FAILED(msg); \
}
inline uint qHash (const QSize &key) {
return key.width() * key.height();
}
class CriticalSectionLocker
{
public:
@@ -129,6 +134,7 @@ public:
hr = deviceInfo->get_SystemSku(deviceModel.GetAddressOf());
Q_ASSERT_SUCCEEDED(hr);
m_flags |= bufferLockRequired(L"NOKIA RM-976", deviceModel);
m_flags |= bufferLockRequired(L"NOKIA RM-1019", deviceModel);
#endif
}
@@ -453,6 +459,7 @@ public:
QPointer<QWinRTCameraVideoRendererControl> videoRenderer;
QPointer<QWinRTVideoDeviceSelectorControl> videoDeviceSelector;
QPointer<QWinRTCameraImageCaptureControl> imageCaptureControl;
QPointer<QWinRTImageEncoderControl> imageEncoderControl;
};
QWinRTCameraControl::QWinRTCameraControl(QObject *parent)
@@ -470,6 +477,7 @@ QWinRTCameraControl::QWinRTCameraControl(QObject *parent)
this, &QWinRTCameraControl::onBufferRequested);
d->videoDeviceSelector = new QWinRTVideoDeviceSelectorControl(this);
d->imageCaptureControl = new QWinRTCameraImageCaptureControl(this);
d->imageEncoderControl = new QWinRTImageEncoderControl(this);
}
QWinRTCameraControl::~QWinRTCameraControl()
@@ -654,18 +662,18 @@ QCameraImageCaptureControl *QWinRTCameraControl::imageCaptureControl() const
return d->imageCaptureControl;
}
QImageEncoderControl *QWinRTCameraControl::imageEncoderControl() const
{
Q_D(const QWinRTCameraControl);
return d->imageEncoderControl;
}
IMediaCapture *QWinRTCameraControl::handle() const
{
Q_D(const QWinRTCameraControl);
return d->capture.Get();
}
QSize QWinRTCameraControl::imageSize() const
{
Q_D(const QWinRTCameraControl);
return d->size;
}
void QWinRTCameraControl::onBufferRequested()
{
Q_D(QWinRTCameraControl);
@@ -763,10 +771,11 @@ HRESULT QWinRTCameraControl::initialize()
Q_ASSERT_SUCCEEDED(hr);
d->size = QSize();
ComPtr<IVideoEncodingProperties> videoEncodingProperties;
quint32 encodingPropertiesListSize;
hr = encodingPropertiesList->get_Size(&encodingPropertiesListSize);
Q_ASSERT_SUCCEEDED(hr);
QHash<QSize, ComPtr<IVideoEncodingProperties>> videoEncodingPropertiesList;
int pixelCount = 0;
for (quint32 i = 0; i < encodingPropertiesListSize; ++i) {
ComPtr<IMediaEncodingProperties> properties;
hr = encodingPropertiesList->GetAt(i, &properties);
@@ -779,21 +788,33 @@ HRESULT QWinRTCameraControl::initialize()
Q_ASSERT_SUCCEEDED(hr);
hr = videoProperties->get_Height(&height);
Q_ASSERT_SUCCEEDED(hr);
// Choose the highest-quality format
if (int(width * height) > d->size.width() * d->size.height()) {
d->size = QSize(width, height);
videoEncodingProperties = videoProperties;
if (d->captureMode != QCamera::CaptureStillImage && int(width * height) > pixelCount) {
d->size = QSize(width, height);// Choose the Highest-quality format
pixelCount = d->size.width() * d->size.height();
}
videoEncodingPropertiesList.insert(QSize(width, height), videoProperties);
}
if (!videoEncodingProperties || d->size.isEmpty()) {
if (videoEncodingPropertiesList.isEmpty()) {
hr = MF_E_INVALID_FORMAT;
RETURN_HR_IF_FAILED("Failed to find a suitable video format");
}
if (d->captureMode == QCamera::CaptureStillImage) {
d->imageEncoderControl->setSupportedResolutionsList(videoEncodingPropertiesList.keys());
d->size = d->imageEncoderControl->imageSettings().resolution();
}
hr = RoActivateInstance(HString::MakeReference(RuntimeClass_Windows_Media_MediaProperties_MediaEncodingProfile).Get(),
&d->encodingProfile);
Q_ASSERT_SUCCEEDED(hr);
const ComPtr<IVideoEncodingProperties> videoEncodingProperties = videoEncodingPropertiesList[d->size];
if (!videoEncodingProperties) {
hr = MF_E_INVALID_FORMAT;
RETURN_HR_IF_FAILED("Failed to find a suitable video format properties");
}
hr = d->encodingProfile->put_Video(videoEncodingProperties.Get());
Q_ASSERT_SUCCEEDED(hr);
if (d->videoRenderer)
@@ -832,3 +853,5 @@ HRESULT QWinRTCameraControl::onRecordLimitationExceeded(IMediaCapture *)
setState(QCamera::LoadedState);
return S_OK;
}
QT_END_NAMESPACE

View File

@@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE
class QVideoRendererControl;
class QVideoDeviceSelectorControl;
class QCameraImageCaptureControl;
class QImageEncoderControl;
class QWinRTCameraControlPrivate;
class QWinRTCameraControl : public QCameraControl
@@ -83,9 +84,9 @@ public:
QVideoRendererControl *videoRenderer() const;
QVideoDeviceSelectorControl *videoDeviceSelector() const;
QCameraImageCaptureControl *imageCaptureControl() const;
QImageEncoderControl *imageEncoderControl() const;
ABI::Windows::Media::Capture::IMediaCapture *handle() const;
QSize imageSize() const;
private slots:
void onBufferRequested();

View File

@@ -36,6 +36,7 @@
#include "qwinrtcameraimagecapturecontrol.h"
#include "qwinrtcameracontrol.h"
#include "qwinrtimageencodercontrol.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -64,7 +65,7 @@ using namespace ABI::Windows::Media::MediaProperties;
using namespace ABI::Windows::Storage::Streams;
using namespace ABI::Windows::Graphics::Imaging;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
#define wchar(str) reinterpret_cast<const wchar_t *>(str.utf16())
@@ -166,7 +167,7 @@ int QWinRTCameraImageCaptureControl::capture(const QString &fileName)
hr = g->encodingPropertiesFactory->CreateBmp(&request.imageFormat);
Q_ASSERT_SUCCEEDED(hr);
const QSize imageSize = d->cameraControl->imageSize();
const QSize imageSize = static_cast<QWinRTImageEncoderControl*>(d->cameraControl->imageEncoderControl())->imageSettings().resolution();
hr = request.imageFormat->put_Width(imageSize.width());
Q_ASSERT_SUCCEEDED(hr);
hr = request.imageFormat->put_Height(imageSize.height());
@@ -174,6 +175,10 @@ int QWinRTCameraImageCaptureControl::capture(const QString &fileName)
hr = capture->CapturePhotoToStreamAsync(request.imageFormat.Get(), request.stream.Get(), &request.op);
Q_ASSERT_SUCCEEDED(hr);
if (!request.op) {
qErrnoWarning("Camera photo capture failed.");
return -1;
}
d->requests.insert(request.op.Get(), request);
hr = request.op->put_Completed(Callback<IAsyncActionCompletedHandler>(
@@ -266,10 +271,33 @@ HRESULT QWinRTCameraImageCaptureControl::onCaptureCompleted(IAsyncAction *asyncI
const QImage image(pixelData, pixelWidth, pixelHeight, QImage::Format_RGBA8888,
reinterpret_cast<QImageCleanupFunction>(&CoTaskMemFree), pixelData);
emit imageCaptured(request.id, image);
if (image.save(request.fileName))
QWinRTImageEncoderControl *imageEncoderControl = static_cast<QWinRTImageEncoderControl*>(d->cameraControl->imageEncoderControl());
int imageQuality = 100;
switch (imageEncoderControl->imageSettings().quality()) {
case QMultimedia::VeryLowQuality:
imageQuality = 20;
break;
case QMultimedia::LowQuality:
imageQuality = 40;
break;
case QMultimedia::NormalQuality:
imageQuality = 60;
break;
case QMultimedia::HighQuality:
imageQuality = 80;
break;
case QMultimedia::VeryHighQuality:
imageQuality = 100;
break;
}
if (image.save(request.fileName, imageEncoderControl->imageSettings().codec().toLatin1().data(), imageQuality))
emit imageSaved(request.id, request.fileName);
else
emit error(request.id, QCameraImageCapture::ResourceError, tr("Image saving failed"));
return S_OK;
}
QT_END_NAMESPACE

View File

@@ -37,7 +37,7 @@
#include "qwinrtcamerainfocontrol.h"
#include "qwinrtvideodeviceselectorcontrol.h"
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
QWinRTCameraInfoControl::QWinRTCameraInfoControl(QObject *parent)
: QCameraInfoControl(parent)
@@ -53,3 +53,5 @@ int QWinRTCameraInfoControl::cameraOrientation(const QString &deviceName) const
{
return QWinRTVideoDeviceSelectorControl::cameraOrientation(deviceName);
}
QT_END_NAMESPACE

View File

@@ -44,8 +44,9 @@
#include <QtMultimedia/QCameraImageCaptureControl>
#include <QtMultimedia/QVideoRendererControl>
#include <QtMultimedia/QVideoDeviceSelectorControl>
#include <QtMultimedia/QImageEncoderControl>
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
class QWinRTCameraServicePrivate
{
@@ -90,6 +91,11 @@ QMediaControl *QWinRTCameraService::requestControl(const char *name)
return d->cameraControl->imageCaptureControl();
}
if (qstrcmp(name, QImageEncoderControl_iid) == 0) {
if (d->cameraControl)
return d->cameraControl->imageEncoderControl();
}
return Q_NULLPTR;
}
@@ -97,3 +103,5 @@ void QWinRTCameraService::releaseControl(QMediaControl *control)
{
Q_UNUSED(control);
}
QT_END_NAMESPACE

View File

@@ -45,7 +45,7 @@
#include <wrl.h>
using namespace Microsoft::WRL;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
class D3DVideoBlitter
{
@@ -210,3 +210,5 @@ void QWinRTCameraVideoRendererControl::discardBuffers()
for (ComPtr<IMF2DBuffer> &buffer : d->buffers)
buffer.Reset();
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,124 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** 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 The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later 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 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwinrtimageencodercontrol.h"
QT_BEGIN_NAMESPACE
class QWinRTImageEncoderControlPrivate
{
public:
QList<QSize> supportedResolutions;
QImageEncoderSettings imageEncoderSetting;
};
QWinRTImageEncoderControl::QWinRTImageEncoderControl(QObject *parent)
: QImageEncoderControl(parent), d_ptr(new QWinRTImageEncoderControlPrivate)
{
}
QStringList QWinRTImageEncoderControl::supportedImageCodecs() const
{
return QStringList() << QStringLiteral("jpeg");
}
QString QWinRTImageEncoderControl::imageCodecDescription(const QString &codecName) const
{
if (codecName == QStringLiteral("jpeg"))
return tr("JPEG image");
return QString();
}
QList<QSize> QWinRTImageEncoderControl::supportedResolutions(const QImageEncoderSettings &settings, bool *continuous) const
{
Q_UNUSED(settings);
Q_D(const QWinRTImageEncoderControl);
if (continuous)
*continuous = false;
return d->supportedResolutions;
}
QImageEncoderSettings QWinRTImageEncoderControl::imageSettings() const
{
Q_D(const QWinRTImageEncoderControl);
return d->imageEncoderSetting;
}
void QWinRTImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings)
{
Q_D(QWinRTImageEncoderControl);
if (d->imageEncoderSetting == settings)
return;
d->imageEncoderSetting = settings;
applySettings();
}
void QWinRTImageEncoderControl::setSupportedResolutionsList(const QList<QSize> resolution)
{
Q_D(QWinRTImageEncoderControl);
d->supportedResolutions = resolution;
applySettings();
}
void QWinRTImageEncoderControl::applySettings()
{
Q_D(QWinRTImageEncoderControl);
d->imageEncoderSetting.setCodec(QStringLiteral("jpeg"));
QSize requestResolution = d->imageEncoderSetting.resolution();
if (d->supportedResolutions.isEmpty() || d->supportedResolutions.contains(requestResolution))
return;
if (!requestResolution.isValid())
requestResolution = QSize(0, 0);// Find the minimal available resolution
// Find closest resolution from the list
const int pixelCount = requestResolution.width() * requestResolution.height();
int minPixelCountGap = -1;
for (int i = 0; i < d->supportedResolutions.size(); ++i) {
int gap = qAbs(pixelCount - d->supportedResolutions.at(i).width() * d->supportedResolutions.at(i).height());
if (gap < minPixelCountGap || minPixelCountGap < 0) {
minPixelCountGap = gap;
requestResolution = d->supportedResolutions.at(i);
}
}
d->imageEncoderSetting.setResolution(requestResolution);
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** 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 The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later 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 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWINRTIMAGEENCODERCONTROL_H
#define QWINRTIMAGEENCODERCONTROL_H
#include <qimageencodercontrol.h>
QT_BEGIN_NAMESPACE
class QWinRTImageEncoderControlPrivate;
class QWinRTImageEncoderControl : public QImageEncoderControl
{
public:
explicit QWinRTImageEncoderControl(QObject *parent = 0);
QStringList supportedImageCodecs() const Q_DECL_OVERRIDE;
QString imageCodecDescription(const QString &codecName) const Q_DECL_OVERRIDE;
QList<QSize> supportedResolutions(const QImageEncoderSettings &settings, bool *continuous = 0) const Q_DECL_OVERRIDE;
QImageEncoderSettings imageSettings() const Q_DECL_OVERRIDE;
void setImageSettings(const QImageEncoderSettings &settings) Q_DECL_OVERRIDE;
void setSupportedResolutionsList(const QList<QSize> resolution);
void applySettings();
private:
QScopedPointer<QWinRTImageEncoderControlPrivate> d_ptr;
Q_DECLARE_PRIVATE(QWinRTImageEncoderControl)
};
QT_END_NAMESPACE
#endif // QWINRTIMAGEENCODERCONTROL_H

View File

@@ -55,7 +55,7 @@
#include <wrl.h>
using namespace Microsoft::WRL;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
#define QT_WINRT_MEDIAPLAYER_STREAM_ID "__qtmultimedia_winrt_player_stream"
@@ -892,3 +892,5 @@ void QWinRTMediaPlayerControl::finishRead()
Q_D(QWinRTMediaPlayerControl);
d->streamProvider->finishRead();
}
QT_END_NAMESPACE

View File

@@ -41,7 +41,7 @@
struct IMFMediaEngineClassFactory;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
class QVideoRendererControl;
@@ -96,4 +96,6 @@ private:
Q_DECLARE_PRIVATE(QWinRTMediaPlayerControl)
};
QT_END_NAMESPACE
#endif // QWINRTMEDIAPLAYERCONTROL_H

View File

@@ -47,7 +47,7 @@
using namespace Microsoft::WRL;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
class QWinRTMediaPlayerServicePrivate
{
@@ -104,3 +104,5 @@ void QWinRTMediaPlayerService::releaseControl(QMediaControl *control)
if (control == d->player)
d->player->deleteLater();
}
QT_END_NAMESPACE

View File

@@ -54,7 +54,7 @@
#include <wrl.h>
using namespace Microsoft::WRL;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
template <typename T>
class D3DDeviceLocker
@@ -149,3 +149,5 @@ bool QWinRTPlayerRendererControl::render(ID3D11Texture2D *texture)
RETURN_FALSE_IF_FAILED("Failed to transfer video frame to DXGI surface");
return true;
}
QT_END_NAMESPACE

View File

@@ -42,7 +42,7 @@
#include "qwinrtcameraservice.h"
#include "qwinrtvideodeviceselectorcontrol.h"
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
QMediaService *QWinRTServicePlugin::create(QString const &key)
{
@@ -102,3 +102,5 @@ QByteArray QWinRTServicePlugin::defaultDevice(const QByteArray &service) const
return QByteArray();
}
QT_END_NAMESPACE

View File

@@ -39,7 +39,7 @@
#include <QtMultimedia/QMediaServiceProviderPlugin>
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
class QWinRTServicePlugin : public QMediaServiceProviderPlugin
, public QMediaServiceFeaturesInterface
@@ -68,4 +68,6 @@ public:
QByteArray defaultDevice(const QByteArray &service) const Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
#endif // QWINRTSERVICEPLUGIN_H

View File

@@ -55,7 +55,7 @@ typedef ITypedEventHandler<DeviceWatcher *, DeviceInformation *> DeviceInformati
typedef ITypedEventHandler<DeviceWatcher *, DeviceInformationUpdate *> DeviceInformationUpdateHandler;
typedef ITypedEventHandler<DeviceWatcher *, IInspectable *> DeviceEnumerationCompletedHandler;
QT_USE_NAMESPACE
QT_BEGIN_NAMESPACE
static QString deviceName(IDeviceInformation *device)
{
@@ -386,3 +386,5 @@ void QWinRTVideoDeviceSelectorControl::setSelectedDevice(int index)
emit selectedDeviceChanged(deviceName(d->selectedDevice));
}
}
QT_END_NAMESPACE

View File

@@ -18,7 +18,8 @@ HEADERS += \
qwinrtmediaplayerservice.h \
qwinrtplayerrenderercontrol.h \
qwinrtserviceplugin.h \
qwinrtvideodeviceselectorcontrol.h
qwinrtvideodeviceselectorcontrol.h \
qwinrtimageencodercontrol.h
SOURCES += \
qwinrtabstractvideorenderercontrol.cpp \
@@ -31,7 +32,8 @@ SOURCES += \
qwinrtmediaplayerservice.cpp \
qwinrtplayerrenderercontrol.cpp \
qwinrtserviceplugin.cpp \
qwinrtvideodeviceselectorcontrol.cpp
qwinrtvideodeviceselectorcontrol.cpp \
qwinrtimageencodercontrol.cpp
OTHER_FILES += \
winrt.json