diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-17 03:02:21 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-17 03:02:21 +0100 |
commit | 4bb439c8af69448a7453f9409a7ff15b1e69b72d (patch) | |
tree | 50b436863ed1d8b4028f8ddac9d28e08d203d63a /src/plugins | |
parent | 2bebbc5dd1492c0e26183967ce3432748a56e3cd (diff) | |
parent | fa5744670ce9c5fdee65a98337e4d6bb5146c981 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: Iaf74b2b0f03af46942beaa5aa1fc61296a66ec47
Diffstat (limited to 'src/plugins')
6 files changed, 36 insertions, 28 deletions
diff --git a/src/plugins/coreaudio/coreaudiooutput.h b/src/plugins/coreaudio/coreaudiooutput.h index 9f62cd77d..97b1e0438 100644 --- a/src/plugins/coreaudio/coreaudiooutput.h +++ b/src/plugins/coreaudio/coreaudiooutput.h @@ -193,6 +193,7 @@ private: QTimer *m_intervalTimer; CoreAudioDeviceInfo *m_audioDeviceInfo; qreal m_cachedVolume; + qreal m_volume; bool m_pullMode; QAudio::Error m_errorCode; diff --git a/src/plugins/coreaudio/coreaudiooutput.mm b/src/plugins/coreaudio/coreaudiooutput.mm index 900e34e16..caa4a1abb 100644 --- a/src/plugins/coreaudio/coreaudiooutput.mm +++ b/src/plugins/coreaudio/coreaudiooutput.mm @@ -228,6 +228,7 @@ CoreAudioOutput::CoreAudioOutput(const QByteArray &device) , m_startTime(0) , m_audioBuffer(0) , m_cachedVolume(1.0) + , m_volume(1.0) , m_pullMode(false) , m_errorCode(QAudio::NoError) , m_stateCode(QAudio::StoppedState) @@ -435,11 +436,9 @@ QAudioFormat CoreAudioOutput::format() const void CoreAudioOutput::setVolume(qreal volume) { - const qreal normalizedVolume = qBound(qreal(0.0), volume, qreal(1.0)); - if (!m_isOpen) { - m_cachedVolume = normalizedVolume; + m_cachedVolume = qBound(qreal(0.0), volume, qreal(1.0)); + if (!m_isOpen) return; - } #if defined(Q_OS_OSX) //on OS X the volume can be set directly on the AudioUnit @@ -447,11 +446,9 @@ void CoreAudioOutput::setVolume(qreal volume) kHALOutputParam_Volume, kAudioUnitScope_Global, 0 /* bus */, - (float)normalizedVolume, + m_cachedVolume, 0) == noErr) - m_cachedVolume = normalizedVolume; -#else - m_cachedVolume = normalizedVolume; + m_volume = m_cachedVolume; #endif } @@ -513,15 +510,24 @@ OSStatus CoreAudioOutput::renderCallback(void *inRefCon, AudioUnitRenderActionFl if (framesRead > 0) { ioData->mBuffers[0].mDataByteSize = framesRead * bytesPerFrame; d->m_totalFrames += framesRead; -#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) - // on iOS we have to adjust the sound volume ourselves - if (!qFuzzyCompare(d->m_cachedVolume, qreal(1.0f))) { - QAudioHelperInternal::qMultiplySamples(d->m_cachedVolume, - d->m_audioFormat, - ioData->mBuffers[0].mData, /* input */ - ioData->mBuffers[0].mData, /* output */ - ioData->mBuffers[0].mDataByteSize); - } + +#if defined(Q_OS_MACOS) + // If playback is already stopped. + if (threadState != Running) { + qreal oldVolume = d->m_cachedVolume; + // Decrease volume smoothly. + d->setVolume(d->m_volume / 2); + d->m_cachedVolume = oldVolume; + } +#elif defined(Q_OS_IOS) || defined(Q_OS_TVOS) + // on iOS we have to adjust the sound volume ourselves + if (!qFuzzyCompare(d->m_cachedVolume, qreal(1.0f))) { + QAudioHelperInternal::qMultiplySamples(d->m_cachedVolume, + d->m_audioFormat, + ioData->mBuffers[0].mData, /* input */ + ioData->mBuffers[0].mData, /* output */ + ioData->mBuffers[0].mDataByteSize); + } #endif } @@ -546,8 +552,10 @@ bool CoreAudioOutput::open() if (m_errorCode != QAudio::NoError) return false; - if (m_isOpen) + if (m_isOpen) { + setVolume(m_cachedVolume); return true; + } AudioComponentDescription componentDescription; componentDescription.componentType = kAudioUnitType_Output; diff --git a/src/plugins/directshow/player/directshowiosource.cpp b/src/plugins/directshow/player/directshowiosource.cpp index 31e9a1300..d5833fafc 100644 --- a/src/plugins/directshow/player/directshowiosource.cpp +++ b/src/plugins/directshow/player/directshowiosource.cpp @@ -97,8 +97,6 @@ DirectShowIOSource::DirectShowIOSource(DirectShowEventLoop *loop) 0, // pbFormat }; - static const int count = sizeof(directshow_subtypes) / sizeof(GUID); - for (const auto &directshowSubtype : directshow_subtypes) { type.subtype = directshowSubtype; m_supportedMediaTypes.append(DirectShowMediaType(type)); diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp index 8768bd3da..81c9a1be2 100644 --- a/src/plugins/directshow/player/directshowplayerservice.cpp +++ b/src/plugins/directshow/player/directshowplayerservice.cpp @@ -216,7 +216,7 @@ QMediaControl *DirectShowPlayerService::requestControl(const char *name) } } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) { if (!m_videoRendererControl && !m_videoWindowControl) { - IBaseFilter *filter; + IBaseFilter *filter{}; #if QT_CONFIG(evr) if (!qgetenv("QT_DIRECTSHOW_NO_EVR").toInt()) { diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp index 9ab69d603..d4e7fa699 100644 --- a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp @@ -509,6 +509,7 @@ bool CameraBinFocus::probeBuffer(GstBuffer *buffer) { QVector<QRect> faces; +#if GST_CHECK_VERSION(1,1,3) gpointer state = NULL; const GstMetaInfo *info = GST_VIDEO_REGION_OF_INTEREST_META_INFO; @@ -520,6 +521,9 @@ bool CameraBinFocus::probeBuffer(GstBuffer *buffer) faces.append(QRect(region->x, region->y, region->w, region->h)); } +#else + Q_UNUSED(buffer); +#endif QMutexLocker locker(&m_mutex); diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp index 86585da9e..74ffd750e 100644 --- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp @@ -173,15 +173,12 @@ QPair<int,int> CameraBinVideoEncoder::rateAsRational(qreal frameRate) const GstEncodingProfile *CameraBinVideoEncoder::createProfile() { QString codec = m_actualVideoSettings.codec(); - QString preset = m_actualVideoSettings.encodingOption(QStringLiteral("preset")).toString(); - - GstCaps *caps; + GstCaps *caps = !codec.isEmpty() ? gst_caps_from_string(codec.toLatin1()) : nullptr; - if (codec.isEmpty()) - caps = 0; - else - caps = gst_caps_from_string(codec.toLatin1()); + if (!caps) + return nullptr; + QString preset = m_actualVideoSettings.encodingOption(QStringLiteral("preset")).toString(); GstEncodingVideoProfile *profile = gst_encoding_video_profile_new( caps, !preset.isEmpty() ? preset.toLatin1().constData() : NULL, //preset |