Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I5575a4ba13212c9bfe73a3de3ef17c6528beafc3
This commit is contained in:
@@ -276,33 +276,38 @@ void QAndroidCameraSession::adjustViewfinderSize(const QSize &captureSize, bool
|
||||
if (!m_camera)
|
||||
return;
|
||||
|
||||
QSize viewfinderResolution = m_camera->previewSize();
|
||||
QSize currentViewfinderResolution = m_camera->previewSize();
|
||||
const qreal aspectRatio = qreal(captureSize.width()) / qreal(captureSize.height());
|
||||
if (viewfinderResolution.isValid() &&
|
||||
qFuzzyCompare(aspectRatio,
|
||||
qreal(viewfinderResolution.width()) / viewfinderResolution.height())) {
|
||||
if (currentViewfinderResolution.isValid() &&
|
||||
qAbs(aspectRatio - (qreal(currentViewfinderResolution.width()) / currentViewfinderResolution.height())) < 0.01) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSize adjustedViewfinderResolution;
|
||||
QList<QSize> previewSizes = m_camera->getSupportedPreviewSizes();
|
||||
for (int i = previewSizes.count() - 1; i >= 0; --i) {
|
||||
const QSize &size = previewSizes.at(i);
|
||||
// search for viewfinder resolution with the same aspect ratio
|
||||
if (qFuzzyCompare(aspectRatio, (static_cast<qreal>(size.width())/static_cast<qreal>(size.height())))) {
|
||||
viewfinderResolution = size;
|
||||
if (qAbs(aspectRatio - (qreal(size.width()) / size.height())) < 0.01) {
|
||||
adjustedViewfinderResolution = size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_camera->previewSize() != viewfinderResolution) {
|
||||
if (!adjustedViewfinderResolution.isValid()) {
|
||||
qWarning("Cannot find a viewfinder resolution matching the capture aspect ratio.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentViewfinderResolution != adjustedViewfinderResolution) {
|
||||
if (m_videoOutput)
|
||||
m_videoOutput->setVideoSize(viewfinderResolution);
|
||||
m_videoOutput->setVideoSize(adjustedViewfinderResolution);
|
||||
|
||||
// if preview is started, we have to stop it first before changing its size
|
||||
if (m_previewStarted && restartPreview)
|
||||
m_camera->stopPreview();
|
||||
|
||||
m_camera->setPreviewSize(viewfinderResolution);
|
||||
m_camera->setPreviewSize(adjustedViewfinderResolution);
|
||||
|
||||
// restart preview
|
||||
if (m_previewStarted && restartPreview)
|
||||
|
||||
@@ -337,7 +337,7 @@ void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent,
|
||||
if (!mTempFile.isNull())
|
||||
mediaPath = QStringLiteral("file://") + mTempFile->fileName();
|
||||
} else {
|
||||
mediaPath = url.toString();
|
||||
mediaPath = url.toString(QUrl::FullyEncoded);
|
||||
}
|
||||
|
||||
if (mVideoSize.isValid() && mVideoOutput)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
TARGET = dsengine
|
||||
win32:!qtHaveModule(opengl) {
|
||||
win32:!qtHaveModule(opengl)|contains(QT_CONFIG,dynamicgl) {
|
||||
LIBS_PRIVATE += -lgdi32 -luser32
|
||||
}
|
||||
PLUGIN_TYPE=mediaservice
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "dsvideodevicecontrol.h"
|
||||
|
||||
#ifdef QMEDIA_DIRECTSHOW_CAMERA
|
||||
#include <QtCore/QElapsedTimer>
|
||||
#include <dshow.h>
|
||||
#include "dscameraservice.h"
|
||||
#endif
|
||||
@@ -121,8 +122,7 @@ QByteArray DSServicePlugin::defaultDevice(const QByteArray &service) const
|
||||
{
|
||||
#ifdef QMEDIA_DIRECTSHOW_CAMERA
|
||||
if (service == Q_MEDIASERVICE_CAMERA) {
|
||||
if (m_cameraDevices.isEmpty())
|
||||
updateDevices();
|
||||
updateDevices();
|
||||
|
||||
return m_defaultCameraDevice;
|
||||
}
|
||||
@@ -135,8 +135,7 @@ QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const
|
||||
{
|
||||
#ifdef QMEDIA_DIRECTSHOW_CAMERA
|
||||
if (service == Q_MEDIASERVICE_CAMERA) {
|
||||
if (m_cameraDevices.isEmpty())
|
||||
updateDevices();
|
||||
updateDevices();
|
||||
|
||||
return m_cameraDevices;
|
||||
}
|
||||
@@ -149,8 +148,7 @@ QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByt
|
||||
{
|
||||
#ifdef QMEDIA_DIRECTSHOW_CAMERA
|
||||
if (service == Q_MEDIASERVICE_CAMERA) {
|
||||
if (m_cameraDevices.isEmpty())
|
||||
updateDevices();
|
||||
updateDevices();
|
||||
|
||||
for (int i=0; i<m_cameraDevices.count(); i++)
|
||||
if (m_cameraDevices[i] == device)
|
||||
@@ -164,6 +162,10 @@ QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByt
|
||||
|
||||
void DSServicePlugin::updateDevices() const
|
||||
{
|
||||
static QElapsedTimer timer;
|
||||
if (timer.isValid() && timer.elapsed() < 500) // ms
|
||||
return;
|
||||
|
||||
addRefCount();
|
||||
|
||||
m_defaultCameraDevice.clear();
|
||||
@@ -176,6 +178,7 @@ void DSServicePlugin::updateDevices() const
|
||||
}
|
||||
|
||||
releaseRefCount();
|
||||
timer.restart();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -454,7 +454,9 @@ QList<QByteArray> QWindowsAudioDeviceInfo::availableDevices(QAudio::Mode mode)
|
||||
pPropBag->Release();
|
||||
pMoniker->Release();
|
||||
}
|
||||
pEnum->Release();
|
||||
}
|
||||
pDevEnum->Release();
|
||||
}
|
||||
CoUninitialize();
|
||||
#else // Q_OS_WINCE
|
||||
|
||||
@@ -430,7 +430,7 @@ void QWindowsAudioInput::initMixer()
|
||||
return;
|
||||
mixerID = (HMIXEROBJ)mixerIntID;
|
||||
|
||||
// Get the Destination (Recording) Line Infomation
|
||||
// Get the Destination (Recording) Line Information
|
||||
MIXERLINE mixerLine;
|
||||
mixerLine.cbStruct = sizeof(MIXERLINE);
|
||||
mixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN;
|
||||
|
||||
@@ -1296,7 +1296,7 @@ void MFPlayerSession::commitRateChange(qreal rate, BOOL isThin)
|
||||
// (which might be earlier than the last decoded key frame)
|
||||
resetPosition = true;
|
||||
} else if (cmdNow == CmdPause) {
|
||||
// If paused, dont reset the position until we resume, otherwise
|
||||
// If paused, don't reset the position until we resume, otherwise
|
||||
// a new frame will be rendered
|
||||
m_presentationClock->GetCorrelatedTime(0, &hnsClockTime, &hnsSystemTime);
|
||||
m_request.setCommand(CmdSeekResume);
|
||||
|
||||
Reference in New Issue
Block a user