diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-04 11:27:51 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-11-04 11:30:08 +0100 |
commit | d3a2d9c96994c56d67467c131b8f080510d1a8fd (patch) | |
tree | 088c55da965b1fb6bb327b2821afc4755eab8117 /src | |
parent | 256ff7bb1551f6c62c4ac861472ea29f45dbab3a (diff) | |
parent | 75b4283fb05d07fb8654e031f266e9918f1ae647 (diff) | |
download | qtmultimedia-d3a2d9c96994c56d67467c131b8f080510d1a8fd.tar.gz |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ib038c5e3ebb48c0e46569a35d530fa5ceaf06a32
Diffstat (limited to 'src')
23 files changed, 64 insertions, 56 deletions
diff --git a/src/multimedia/camera/qcamera.cpp b/src/multimedia/camera/qcamera.cpp index 4c1c0a924..fd804316c 100644 --- a/src/multimedia/camera/qcamera.cpp +++ b/src/multimedia/camera/qcamera.cpp @@ -71,17 +71,15 @@ static void qRegisterCameraMetaTypes() Q_CONSTRUCTOR_FUNCTION(qRegisterCameraMetaTypes) -static bool qt_sizeLessThan(const QSize &s1, const QSize &s2) +Q_DECL_CONSTEXPR static bool qt_sizeLessThan(const QSize &s1, const QSize &s2) Q_DECL_NOTHROW { return (s1.width() * s1.height()) < (s2.width() * s2.height()); } -static bool qt_frameRateRangeLessThan(const QCamera::FrameRateRange &s1, const QCamera::FrameRateRange &s2) +Q_DECL_CONSTEXPR static bool qt_frameRateRangeLessThan(const QCamera::FrameRateRange &s1, const QCamera::FrameRateRange &s2) Q_DECL_NOTHROW { - if (s1.maximumFrameRate == s2.maximumFrameRate) - return s1.minimumFrameRate < s2.minimumFrameRate; - - return s1.maximumFrameRate < s2.maximumFrameRate; + return qFuzzyCompare(s1.maximumFrameRate, s2.maximumFrameRate) ? (s1.minimumFrameRate < s2.minimumFrameRate) + : (s1.maximumFrameRate < s2.maximumFrameRate); } /*! diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 08f194be7..fdb7ef7fa 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -100,7 +100,6 @@ static void qRegisterMediaPlayerMetaTypes() Q_CONSTRUCTOR_FUNCTION(qRegisterMediaPlayerMetaTypes) - #define MAX_NESTED_PLAYLISTS 16 class QMediaPlayerPrivate : public QMediaObjectPrivate @@ -112,38 +111,39 @@ public: : provider(0) , control(0) , audioRoleControl(0) + , playlist(0) + , networkAccessControl(0) , state(QMediaPlayer::StoppedState) , status(QMediaPlayer::UnknownMediaStatus) , error(QMediaPlayer::NoError) , ignoreNextStatusChange(-1) - , playlist(0) - , networkAccessControl(0) - , hasStreamPlaybackFeature(false) , nestedPlaylists(0) + , hasStreamPlaybackFeature(false) {} QMediaServiceProvider *provider; QMediaPlayerControl* control; QAudioRoleControl *audioRoleControl; - QMediaPlayer::State state; - QMediaPlayer::MediaStatus status; - QMediaPlayer::Error error; QString errorString; - int ignoreNextStatusChange; QPointer<QObject> videoOutput; QMediaPlaylist *playlist; QMediaNetworkAccessControl *networkAccessControl; QVideoSurfaceOutput surfaceOutput; - bool hasStreamPlaybackFeature; QMediaContent qrcMedia; QScopedPointer<QFile> qrcFile; QMediaContent rootMedia; QMediaContent pendingPlaylist; + QMediaPlayer::State state; + QMediaPlayer::MediaStatus status; + QMediaPlayer::Error error; + int ignoreNextStatusChange; + int nestedPlaylists; + bool hasStreamPlaybackFeature; + QMediaPlaylist *parentPlaylist(QMediaPlaylist *pls); bool isInChain(QUrl url); - int nestedPlaylists; void setMedia(const QMediaContent &media, QIODevice *stream = 0); diff --git a/src/multimedia/qmediametadata.cpp b/src/multimedia/qmediametadata.cpp index 9ffd2a727..42fabbe7e 100644 --- a/src/multimedia/qmediametadata.cpp +++ b/src/multimedia/qmediametadata.cpp @@ -164,7 +164,7 @@ Q_DEFINE_METADATA(ThumbnailImage); \ingroup multimedia \inmodule QtMultimedia - This namespace provides identifiers for meta-data attributes. + \brief Provides identifiers for meta-data attributes. \note Not all identifiers are supported on all platforms. Please consult vendor documentation for specific support on different platforms. diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp index 68d2fc66b..1c6497eb0 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp @@ -59,11 +59,11 @@ public: if (--mControl->mActiveStateChangeNotifiers) return; - if (mPreviousState != mControl->state()) - Q_EMIT mControl->stateChanged(mControl->state()); - if (mPreviousMediaStatus != mControl->mediaStatus()) Q_EMIT mControl->mediaStatusChanged(mControl->mediaStatus()); + + if (mPreviousState != mControl->state()) + Q_EMIT mControl->stateChanged(mControl->state()); } private: diff --git a/src/plugins/android/src/wrappers/jni/androidcamera.h b/src/plugins/android/src/wrappers/jni/androidcamera.h index f4694d7dc..1a59ff3c7 100644 --- a/src/plugins/android/src/wrappers/jni/androidcamera.h +++ b/src/plugins/android/src/wrappers/jni/androidcamera.h @@ -62,6 +62,7 @@ struct AndroidCameraInfo QCamera::Position position; int orientation; }; +Q_DECLARE_TYPEINFO(AndroidCameraInfo, Q_MOVABLE_TYPE); class AndroidCamera : public QObject { diff --git a/src/plugins/directshow/directshow.pro b/src/plugins/directshow/directshow.pro index 117b02ade..182f232c0 100644 --- a/src/plugins/directshow/directshow.pro +++ b/src/plugins/directshow/directshow.pro @@ -12,7 +12,7 @@ SOURCES += dsserviceplugin.cpp mingw: DEFINES += NO_DSHOW_STRSAFE -!config_wmf: include(player/player.pri) +!config_wmf|!contains(QT_CONFIG, wmf-backend): include(player/player.pri) !wince: include(camera/camera.pri) OTHER_FILES += \ diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index 2919648a7..9ecd9b79c 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -612,18 +612,18 @@ void QGstreamerPlayerControl::popAndNotifyState() QMediaPlayer::MediaStatus oldMediaStatus = m_mediaStatusStack.pop(); if (m_stateStack.isEmpty()) { - if (m_currentState != oldState) { + if (m_mediaStatus != oldMediaStatus) { #ifdef DEBUG_PLAYBIN - qDebug() << "State changed:" << m_currentState; + qDebug() << "Media status changed:" << m_mediaStatus; #endif - emit stateChanged(m_currentState); + emit mediaStatusChanged(m_mediaStatus); } - if (m_mediaStatus != oldMediaStatus) { + if (m_currentState != oldState) { #ifdef DEBUG_PLAYBIN - qDebug() << "Media status changed:" << m_mediaStatus; + qDebug() << "State changed:" << m_currentState; #endif - emit mediaStatusChanged(m_mediaStatus); + emit stateChanged(m_currentState); } } } diff --git a/src/plugins/qnx-audio/audio/qnxaudioinput.cpp b/src/plugins/qnx-audio/audio/qnxaudioinput.cpp index fc67f4211..35d11597c 100644 --- a/src/plugins/qnx-audio/audio/qnxaudioinput.cpp +++ b/src/plugins/qnx-audio/audio/qnxaudioinput.cpp @@ -282,7 +282,7 @@ bool QnxAudioInput::open() } // Necessary so that bytesFree() which uses the "free" member of the status struct works - snd_pcm_plugin_set_disable(m_pcmHandle, PLUGIN_DISABLE_MMAP); + snd_pcm_plugin_set_disable(m_pcmHandle, PLUGIN_MMAP); snd_pcm_channel_info_t info; memset(&info, 0, sizeof(info)); diff --git a/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp b/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp index 2c196624b..d5805c2bd 100644 --- a/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp +++ b/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp @@ -286,7 +286,7 @@ bool QnxAudioOutput::open() } // Necessary so that bytesFree() which uses the "free" member of the status struct works - snd_pcm_plugin_set_disable(m_pcmHandle, PLUGIN_DISABLE_MMAP); + snd_pcm_plugin_set_disable(m_pcmHandle, PLUGIN_MMAP); snd_pcm_channel_info_t info; memset(&info, 0, sizeof(info)); diff --git a/src/plugins/windowsaudio/qwindowsaudiooutput.cpp b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp index c4bbbe85d..815b78979 100644 --- a/src/plugins/windowsaudio/qwindowsaudiooutput.cpp +++ b/src/plugins/windowsaudio/qwindowsaudiooutput.cpp @@ -53,6 +53,7 @@ #include "qwindowsaudioutils.h" #include <QtEndian> #include <QtCore/QDataStream> +#include <private/qaudiohelpers_p.h> //#define DEBUG_AUDIO 1 @@ -72,7 +73,7 @@ QWindowsAudioOutput::QWindowsAudioOutput(const QByteArray &device) audioSource = 0; pullMode = true; finished = false; - volumeCache = (qreal)1.; + volumeCache = qreal(1.0); } QWindowsAudioOutput::~QWindowsAudioOutput() @@ -280,8 +281,6 @@ bool QWindowsAudioOutput::open() timeStampOpened.restart(); elapsedTimeOffset = 0; - setVolume(volumeCache); - errorState = QAudio::NoError; if(pullMode) { deviceState = QAudio::ActiveState; @@ -407,7 +406,11 @@ qint64 QWindowsAudioOutput::write( const char *data, qint64 len ) remain = l; else remain = period_size; - memcpy(current->lpData, p, remain); + + if (volumeCache < qreal(1.0)) + QAudioHelperInternal::qMultiplySamples(volumeCache, settings, p, current->lpData, remain); + else + memcpy(current->lpData, p, remain); l -= remain; p += remain; @@ -595,16 +598,10 @@ QAudio::State QWindowsAudioOutput::state() const void QWindowsAudioOutput::setVolume(qreal v) { - const qreal normalizedVolume = qBound(qreal(0.0), v, qreal(1.0)); - if (deviceState != QAudio::ActiveState) { - volumeCache = normalizedVolume; + if (qFuzzyCompare(volumeCache, v)) return; - } - const quint16 scaled = normalizedVolume * 0xFFFF; - DWORD vol = MAKELONG(scaled, scaled); - MMRESULT res = waveOutSetVolume(hWaveOut, vol); - if (res == MMSYSERR_NOERROR) - volumeCache = normalizedVolume; + + volumeCache = qBound(qreal(0), v, qreal(1)); } qreal QWindowsAudioOutput::volume() const diff --git a/src/plugins/wmf/mfstream.cpp b/src/plugins/wmf/mfstream.cpp index 3ae6324af..fd95bf20b 100644 --- a/src/plugins/wmf/mfstream.cpp +++ b/src/plugins/wmf/mfstream.cpp @@ -236,7 +236,7 @@ STDMETHODIMP MFStream::Seek( break; } bool seekOK = m_stream->seek(pos); - if (*pqwCurrentPosition) + if (pqwCurrentPosition) *pqwCurrentPosition = pos; if (seekOK) return S_OK; diff --git a/src/plugins/wmf/mfactivate.cpp b/src/plugins/wmf/player/mfactivate.cpp index e06906584..e06906584 100644 --- a/src/plugins/wmf/mfactivate.cpp +++ b/src/plugins/wmf/player/mfactivate.cpp diff --git a/src/plugins/wmf/mfactivate.h b/src/plugins/wmf/player/mfactivate.h index 3243296e8..3243296e8 100644 --- a/src/plugins/wmf/mfactivate.h +++ b/src/plugins/wmf/player/mfactivate.h diff --git a/src/plugins/wmf/mftvideo.cpp b/src/plugins/wmf/player/mftvideo.cpp index 747fe6aea..747fe6aea 100644 --- a/src/plugins/wmf/mftvideo.cpp +++ b/src/plugins/wmf/player/mftvideo.cpp diff --git a/src/plugins/wmf/mftvideo.h b/src/plugins/wmf/player/mftvideo.h index ffcb80b32..ffcb80b32 100644 --- a/src/plugins/wmf/mftvideo.h +++ b/src/plugins/wmf/player/mftvideo.h diff --git a/src/plugins/wmf/player/player.pri b/src/plugins/wmf/player/player.pri index c24370eea..a10e2df60 100644 --- a/src/plugins/wmf/player/player.pri +++ b/src/plugins/wmf/player/player.pri @@ -13,7 +13,10 @@ HEADERS += \ $$PWD/mfmetadatacontrol.h \ $$PWD/mfaudioprobecontrol.h \ $$PWD/mfvideoprobecontrol.h \ - $$PWD/mfevrvideowindowcontrol.h + $$PWD/mfevrvideowindowcontrol.h \ + $$PWD/samplegrabber.h \ + $$PWD/mftvideo.h \ + $$PWD/mfactivate.h SOURCES += \ $$PWD/mfplayerservice.cpp \ @@ -24,6 +27,9 @@ SOURCES += \ $$PWD/mfmetadatacontrol.cpp \ $$PWD/mfaudioprobecontrol.cpp \ $$PWD/mfvideoprobecontrol.cpp \ - $$PWD/mfevrvideowindowcontrol.cpp + $$PWD/mfevrvideowindowcontrol.cpp \ + $$PWD/samplegrabber.cpp \ + $$PWD/mftvideo.cpp \ + $$PWD/mfactivate.cpp include($$PWD/../../common/evr.pri) diff --git a/src/plugins/wmf/samplegrabber.cpp b/src/plugins/wmf/player/samplegrabber.cpp index d137335f3..d137335f3 100644 --- a/src/plugins/wmf/samplegrabber.cpp +++ b/src/plugins/wmf/player/samplegrabber.cpp diff --git a/src/plugins/wmf/samplegrabber.h b/src/plugins/wmf/player/samplegrabber.h index 9ca673a1b..9ca673a1b 100644 --- a/src/plugins/wmf/samplegrabber.h +++ b/src/plugins/wmf/player/samplegrabber.h diff --git a/src/plugins/wmf/sourceresolver.cpp b/src/plugins/wmf/sourceresolver.cpp index 78163e97f..f10f68c42 100644 --- a/src/plugins/wmf/sourceresolver.cpp +++ b/src/plugins/wmf/sourceresolver.cpp @@ -37,12 +37,13 @@ ** ****************************************************************************/ -#include "mfplayersession.h" #include "mfstream.h" #include "sourceresolver.h" #include <Mferror.h> #include <nserror.h> #include <QtCore/qfile.h> +#include <QtCore/qdebug.h> +#include <QtMultimedia/qmediaplayer.h> /* SourceResolver is separated from MFPlayerSession to handle the work of resolving a media source diff --git a/src/plugins/wmf/wmf.pro b/src/plugins/wmf/wmf.pro index e83c51595..c75efe28c 100644 --- a/src/plugins/wmf/wmf.pro +++ b/src/plugins/wmf/wmf.pro @@ -10,24 +10,19 @@ INCLUDEPATH += . HEADERS += \ wmfserviceplugin.h \ mfstream.h \ - sourceresolver.h \ - samplegrabber.h \ - mftvideo.h \ - mfactivate.h + sourceresolver.h SOURCES += \ wmfserviceplugin.cpp \ mfstream.cpp \ - sourceresolver.cpp \ - samplegrabber.cpp \ - mftvideo.cpp \ - mfactivate.cpp + sourceresolver.cpp -include (player/player.pri) +contains(QT_CONFIG, wmf-backend): include (player/player.pri) include (decoder/decoder.pri) OTHER_FILES += \ - wmf.json + wmf.json \ + wmf_audiodecode.json PLUGIN_TYPE = mediaservice PLUGIN_CLASS_NAME = WMFServicePlugin diff --git a/src/plugins/wmf/wmf_audiodecode.json b/src/plugins/wmf/wmf_audiodecode.json new file mode 100644 index 000000000..2a65dd758 --- /dev/null +++ b/src/plugins/wmf/wmf_audiodecode.json @@ -0,0 +1,4 @@ +{ + "Keys": ["windowsmediafoundation"], + "Services": ["org.qt-project.qt.audiodecode"] +} diff --git a/src/plugins/wmf/wmfserviceplugin.cpp b/src/plugins/wmf/wmfserviceplugin.cpp index ada1c8069..c6597ed78 100644 --- a/src/plugins/wmf/wmfserviceplugin.cpp +++ b/src/plugins/wmf/wmfserviceplugin.cpp @@ -97,9 +97,11 @@ void WMFServicePlugin::release(QMediaService *service) QMediaServiceProviderHint::Features WMFServicePlugin::supportedFeatures( const QByteArray &service) const { +#ifdef QMEDIA_MEDIAFOUNDATION_PLAYER if (service == Q_MEDIASERVICE_MEDIAPLAYER) return QMediaServiceProviderHint::StreamPlayback; else +#endif return QMediaServiceProviderHint::Features(); } diff --git a/src/plugins/wmf/wmfserviceplugin.h b/src/plugins/wmf/wmfserviceplugin.h index cd3000199..082358837 100644 --- a/src/plugins/wmf/wmfserviceplugin.h +++ b/src/plugins/wmf/wmfserviceplugin.h @@ -54,7 +54,11 @@ class WMFServicePlugin Q_INTERFACES(QMediaServiceSupportedDevicesInterface) Q_INTERFACES(QMediaServiceDefaultDeviceInterface) Q_INTERFACES(QMediaServiceFeaturesInterface) +#ifdef QMEDIA_MEDIAFOUNDATION_PLAYER Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "wmf.json") +#else + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "wmf_audiodecode.json") +#endif public: QMediaService* create(QString const& key); void release(QMediaService *service); |