diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-04-06 14:59:54 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-04-08 12:19:36 +0000 |
commit | 89de5fe956d32d68490b2ee29963ab18b651be0f (patch) | |
tree | 3e0e18e070503959310cb53723576982f0d6a606 /src/imports | |
parent | 66c339928cde3e582d75ef8350d91f3359dd86a5 (diff) |
Get rid of QMediaPlayer::setCustomRole() and related
setAudioRole should be enough here. And if more roles
are required, let's rather extend the enum.
Change-Id: I40194171c6053ffa1d3adf309e77d85a8c6524e2
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/multimedia/Video.qml | 18 | ||||
-rw-r--r-- | src/imports/multimedia/plugins.qmltypes | 3 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeaudio.cpp | 62 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeaudio_p.h | 6 |
4 files changed, 0 insertions, 89 deletions
diff --git a/src/imports/multimedia/Video.qml b/src/imports/multimedia/Video.qml index 7887ef7ce..45e0ec7e8 100644 --- a/src/imports/multimedia/Video.qml +++ b/src/imports/multimedia/Video.qml @@ -319,31 +319,13 @@ Item { \li MediaPlayer.AccessibilityRole - for accessibility, such as with a screen reader. \li MediaPlayer.SonificationRole - sonification, such as with user interface sounds. \li MediaPlayer.GameRole - game audio. - \li MediaPlayer.CustomRole - The role is specified by customAudioRole. \endlist - customAudioRole is cleared when this property is set to anything other than CustomRole. - \since 5.6 */ property alias audioRole: player.audioRole /*! - \qmlproperty string Video::customAudioRole - - This property holds the role of the audio stream when the backend supports audio roles - unknown to Qt. It can be set to specify the type of audio being played, allowing the - system to make appropriate decisions when it comes to volume, routing or post-processing. - - The audio role must be set before setting the source property. - - audioRole is set to CustomRole when this property is set. - - \since 5.11 - */ - property alias customAudioRole: player.customAudioRole - - /*! \qmlproperty bool Video::seekable This property holds whether the playback position of the video can be diff --git a/src/imports/multimedia/plugins.qmltypes b/src/imports/multimedia/plugins.qmltypes index 8074e380d..a386e73b0 100644 --- a/src/imports/multimedia/plugins.qmltypes +++ b/src/imports/multimedia/plugins.qmltypes @@ -427,7 +427,6 @@ Module { "UnknownRole": 0, "AccessibilityRole": 7, "AlarmRole": 4, - "CustomRole": 10, "GameRole": 9, "MusicRole": 1, "NotificationRole": 5, @@ -463,7 +462,6 @@ Module { } Property { name: "availability"; type: "Availability"; isReadonly: true } Property { name: "audioRole"; revision: 1; type: "AudioRole" } - Property { name: "customAudioRole"; revision: 3; type: "string" } Property { name: "notifyInterval"; revision: 2; type: "int" } Property { name: "videoOutput"; revision: 15; type: "QVariant" } Signal { name: "playlistChanged"; revision: 1 } @@ -472,7 +470,6 @@ Module { Signal { name: "stopped" } Signal { name: "playing" } Signal { name: "audioRoleChanged"; revision: 1 } - Signal { name: "customAudioRoleChanged"; revision: 3 } Signal { name: "error" Parameter { name: "error"; type: "QDeclarativeAudio::Error" } diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index 998ca5f2b..1c83dfd83 100644 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -210,11 +210,8 @@ bool QDeclarativeAudio::isAvailable() const \li AccessibilityRole - for accessibility, such as with a screen reader. \li SonificationRole - sonification, such as with user interface sounds. \li GameRole - game audio. - \li CustomRole - The role is specified by customAudioRole. \endlist - customAudioRole is cleared when this property is set to anything other than CustomRole. - \since 5.6 */ QDeclarativeAudio::AudioRole QDeclarativeAudio::audioRole() const @@ -230,49 +227,12 @@ void QDeclarativeAudio::setAudioRole(QDeclarativeAudio::AudioRole audioRole) if (m_complete) { m_player->setAudioRole(QAudio::Role(audioRole)); } else { - if (!m_customAudioRole.isEmpty()) { - m_customAudioRole.clear(); - emit customAudioRoleChanged(); - } m_audioRole = audioRole; emit audioRoleChanged(); } } /*! - \qmlproperty string QtMultimedia::Audio::customAudioRole - - This property holds the role of the audio stream when the backend supports audio - roles unknown to Qt. It can be set to specify the type of audio being played, - allowing the system to make appropriate decisions when it comes to volume, - routing or post-processing. - - The audio role must be set before setting the source property. - - audioRole is set to CustomRole when this property is set. - - \since 5.11 -*/ -QString QDeclarativeAudio::customAudioRole() const -{ - return !m_complete ? m_customAudioRole : m_player->customAudioRole(); -} - -void QDeclarativeAudio::setCustomAudioRole(const QString &audioRole) -{ - if (this->customAudioRole() == audioRole) - return; - - if (m_complete) { - m_player->setCustomAudioRole(audioRole); - } else { - setAudioRole(QDeclarativeAudio::CustomRole); - m_customAudioRole = audioRole; - emit customAudioRoleChanged(); - } -} - -/*! \qmlproperty int QtMultimedia::Audio::notifyInterval The interval at which notifiable properties will update. @@ -864,8 +824,6 @@ void QDeclarativeAudio::classBegin() this, SIGNAL(hasVideoChanged())); connect(m_player, SIGNAL(audioRoleChanged(QAudio::Role)), this, SIGNAL(audioRoleChanged())); - connect(m_player, SIGNAL(customAudioRoleChanged(const QString &)), - this, SIGNAL(customAudioRoleChanged())); connect(m_player, SIGNAL(notifyIntervalChanged(int)), this, SIGNAL(notifyIntervalChanged())); @@ -887,8 +845,6 @@ void QDeclarativeAudio::componentComplete() m_player->setPlaybackRate(m_playbackRate); if (m_audioRole != UnknownRole) m_player->setAudioRole(QAudio::Role(m_audioRole)); - if (!m_customAudioRole.isEmpty()) - m_player->setCustomAudioRole(m_customAudioRole); if (m_notifyInterval != m_player->notifyInterval()) m_player->setNotifyInterval(m_notifyInterval); @@ -1189,30 +1145,12 @@ void QDeclarativeAudio::_q_mediaChanged(const QUrl &) \li AccessibilityRole - for accessibility, such as with a screen reader. \li SonificationRole - sonification, such as with user interface sounds. \li GameRole - game audio. - \li CustomRole - The role is specified by customAudioRole. \endlist - customAudioRole is cleared when this property is set to anything other than CustomRole. - \since 5.6 */ /*! - \qmlproperty string QtMultimedia::MediaPlayer::customAudioRole - - This property holds the role of the audio stream when the backend supports audio - roles unknown to Qt. It can be set to specify the type of audio being played, - allowing the system to make appropriate decisions when it comes to volume, - routing or post-processing. - - The audio role must be set before setting the source property. - - audioRole is set to CustomRole when this property is set. - - \since 5.11 -*/ - -/*! \qmlmethod list<int> QtMultimedia::MediaPlayer::supportedAudioRoles() Returns a list of supported audio roles. diff --git a/src/imports/multimedia/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h index 5f5944768..da6db0885 100644 --- a/src/imports/multimedia/qdeclarativeaudio_p.h +++ b/src/imports/multimedia/qdeclarativeaudio_p.h @@ -87,7 +87,6 @@ class QDeclarativeAudio : public QObject, public QQmlParserStatus Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT) Q_PROPERTY(AudioRole audioRole READ audioRole WRITE setAudioRole NOTIFY audioRoleChanged REVISION 1) - Q_PROPERTY(QString customAudioRole READ customAudioRole WRITE setCustomAudioRole NOTIFY customAudioRoleChanged REVISION 3) Q_PROPERTY(int notifyInterval READ notifyInterval WRITE setNotifyInterval NOTIFY notifyIntervalChanged REVISION 2) Q_PROPERTY(QVariant videoOutput READ videoOutput WRITE setVideoOutput NOTIFY videoOutputChanged REVISION 15) Q_ENUMS(Status) @@ -136,7 +135,6 @@ public: UnknownRole = QAudio::UnknownRole, AccessibilityRole = QAudio::AccessibilityRole, AlarmRole = QAudio::AlarmRole, - CustomRole = QAudio::CustomRole, GameRole = QAudio::GameRole, MusicRole = QAudio::MusicRole, NotificationRole = QAudio::NotificationRole, @@ -167,8 +165,6 @@ public: AudioRole audioRole() const; void setAudioRole(AudioRole audioRole); - QString customAudioRole() const; - void setCustomAudioRole(const QString &audioRole); QUrl source() const; void setSource(const QUrl &url); @@ -241,7 +237,6 @@ Q_SIGNALS: void playbackRateChanged(); Q_REVISION(1) void audioRoleChanged(); - Q_REVISION(3) void customAudioRoleChanged(); void errorChanged(); void error(QDeclarativeAudio::Error error, const QString &errorString); @@ -268,7 +263,6 @@ private: qreal m_vol; qreal m_playbackRate; AudioRole m_audioRole; - QString m_customAudioRole; QMediaPlayer::State m_playbackState; QMediaPlayer::MediaStatus m_status; |