From 2841dbae0b7823f29467179aa61529cc0f5d4208 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 17 Dec 2020 12:26:23 +0100 Subject: Get rid of the AudioRole controls They were only used by the media player, so merge the functionality into QMediaPlayer and QMediaPlayerControl. Change-Id: Icceef061b41475e7b4bf3ef1848e60db5aa1307b Reviewed-by: Doris Verria Reviewed-by: Lars Knoll --- src/multimedia/controls/controls.pri | 6 +- src/multimedia/controls/qaudiorolecontrol.cpp | 118 -------------------- src/multimedia/controls/qaudiorolecontrol.h | 75 ------------- .../controls/qcustomaudiorolecontrol.cpp | 119 --------------------- src/multimedia/controls/qcustomaudiorolecontrol.h | 75 ------------- src/multimedia/controls/qmediaplayercontrol.cpp | 38 +++++++ src/multimedia/controls/qmediaplayercontrol.h | 8 ++ src/multimedia/playback/qmediaplayer.cpp | 80 +++++--------- .../android/src/mediaplayer/mediaplayer.pri | 4 - .../src/mediaplayer/qandroidaudiorolecontrol.cpp | 77 ------------- .../src/mediaplayer/qandroidaudiorolecontrol.h | 63 ----------- .../mediaplayer/qandroidcustomaudiorolecontrol.cpp | 87 --------------- .../mediaplayer/qandroidcustomaudiorolecontrol.h | 63 ----------- .../src/mediaplayer/qandroidmediaplayercontrol.cpp | 38 +++++++ .../src/mediaplayer/qandroidmediaplayercontrol.h | 7 +- .../src/mediaplayer/qandroidmediaservice.cpp | 16 --- src/plugins/qnx/mediaplayer/mediaplayer.pri | 8 +- .../qnx/mediaplayer/mmrendereraudiorolecontrol.cpp | 68 ------------ .../qnx/mediaplayer/mmrendereraudiorolecontrol.h | 63 ----------- .../mmrenderercustomaudiorolecontrol.cpp | 67 ------------ .../mediaplayer/mmrenderercustomaudiorolecontrol.h | 63 ----------- .../mediaplayer/mmrenderermediaplayercontrol.cpp | 41 ++++--- .../qnx/mediaplayer/mmrenderermediaplayercontrol.h | 10 +- .../mediaplayer/mmrenderermediaplayerservice.cpp | 26 ----- .../qnx/mediaplayer/mmrenderermediaplayerservice.h | 4 - 25 files changed, 148 insertions(+), 1076 deletions(-) delete mode 100644 src/multimedia/controls/qaudiorolecontrol.cpp delete mode 100644 src/multimedia/controls/qaudiorolecontrol.h delete mode 100644 src/multimedia/controls/qcustomaudiorolecontrol.cpp delete mode 100644 src/multimedia/controls/qcustomaudiorolecontrol.h delete mode 100644 src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.cpp delete mode 100644 src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.h delete mode 100644 src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.cpp delete mode 100644 src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.h delete mode 100644 src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp delete mode 100644 src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h delete mode 100644 src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.cpp delete mode 100644 src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.h (limited to 'src') diff --git a/src/multimedia/controls/controls.pri b/src/multimedia/controls/controls.pri index e1fedc7ed..477b0fe17 100644 --- a/src/multimedia/controls/controls.pri +++ b/src/multimedia/controls/controls.pri @@ -31,8 +31,6 @@ PUBLIC_HEADERS += \ controls/qvideowindowcontrol.h \ controls/qmediaaudioprobecontrol.h \ controls/qmediavideoprobecontrol.h \ - controls/qaudiorolecontrol.h \ - controls/qcustomaudiorolecontrol.h SOURCES += \ controls/qcameracapturebufferformatcontrol.cpp \ @@ -63,6 +61,4 @@ SOURCES += \ controls/qaudioencodersettingscontrol.cpp \ controls/qaudioinputselectorcontrol.cpp \ controls/qaudiooutputselectorcontrol.cpp \ - controls/qvideodeviceselectorcontrol.cpp \ - controls/qaudiorolecontrol.cpp \ - controls/qcustomaudiorolecontrol.cpp + controls/qvideodeviceselectorcontrol.cpp diff --git a/src/multimedia/controls/qaudiorolecontrol.cpp b/src/multimedia/controls/qaudiorolecontrol.cpp deleted file mode 100644 index 01e60a914..000000000 --- a/src/multimedia/controls/qaudiorolecontrol.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmediacontrol_p.h" -#include "qaudiorolecontrol.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QAudioRoleControl - \obsolete - \inmodule QtMultimedia - \ingroup multimedia_control - \since 5.6 - - \brief The QAudioRoleControl class provides control over the audio role of a media object. - - If a QMediaService supports audio roles it will implement QAudioRoleControl. - - The functionality provided by this control is exposed to application code through the - QMediaPlayer class. - - The interface name of QAudioRoleControl is \c org.qt-project.qt.audiorolecontrol/5.6 as - defined in QAudioRoleControl_iid. - - \sa QMediaService::requestControl(), QMediaPlayer -*/ - -/*! - \macro QAudioRoleControl_iid - - \c org.qt-project.qt.audiorolecontrol/5.6 - - Defines the interface name of the QAudioRoleControl class. - - \relates QAudioRoleControl -*/ - -/*! - Construct a QAudioRoleControl with the given \a parent. -*/ -QAudioRoleControl::QAudioRoleControl(QObject *parent) - : QMediaControl(*new QMediaControlPrivate, parent) -{ - -} - -/*! - Destroys the audio role control. -*/ -QAudioRoleControl::~QAudioRoleControl() -{ - -} - -/*! - \fn QAudio::Role QAudioRoleControl::audioRole() const - - Returns the audio role of the media played by the media service. -*/ - -/*! - \fn void QAudioRoleControl::setAudioRole(QAudio::Role role) - - Sets the audio \a role of the media played by the media service. -*/ - -/*! - \fn QList QAudioRoleControl::supportedAudioRoles() const - - Returns a list of audio roles that the media service supports. -*/ - -/*! - \fn void QAudioRoleControl::audioRoleChanged(QAudio::Role role) - - Signal emitted when the audio \a role has changed. - */ - -QT_END_NAMESPACE - -#include "moc_qaudiorolecontrol.cpp" diff --git a/src/multimedia/controls/qaudiorolecontrol.h b/src/multimedia/controls/qaudiorolecontrol.h deleted file mode 100644 index c59874fdf..000000000 --- a/src/multimedia/controls/qaudiorolecontrol.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QAUDIOROLECONTROL_H -#define QAUDIOROLECONTROL_H - -#include -#include - -QT_BEGIN_NAMESPACE - -// Class forward declaration required for QDoc bug -class QString; - -class Q_MULTIMEDIA_EXPORT QAudioRoleControl : public QMediaControl -{ - Q_OBJECT - -public: - virtual ~QAudioRoleControl(); - - virtual QAudio::Role audioRole() const = 0; - virtual void setAudioRole(QAudio::Role role) = 0; - - virtual QList supportedAudioRoles() const = 0; - -Q_SIGNALS: - void audioRoleChanged(QAudio::Role role); - -protected: - explicit QAudioRoleControl(QObject *parent = nullptr); -}; - -#define QAudioRoleControl_iid "org.qt-project.qt.audiorolecontrol/5.6" -Q_MEDIA_DECLARE_CONTROL(QAudioRoleControl, QAudioRoleControl_iid) - -QT_END_NAMESPACE - -#endif // QAUDIOROLECONTROL_H diff --git a/src/multimedia/controls/qcustomaudiorolecontrol.cpp b/src/multimedia/controls/qcustomaudiorolecontrol.cpp deleted file mode 100644 index f1b89eda5..000000000 --- a/src/multimedia/controls/qcustomaudiorolecontrol.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 QNX Software Systems. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmediacontrol_p.h" -#include "qcustomaudiorolecontrol.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QCustomAudioRoleControl - \obsolete - \inmodule QtMultimedia - \ingroup multimedia_control - \since 5.11 - - \brief The QCustomAudioRoleControl class provides control over the audio role of a media object. - - If a QMediaService supports audio roles it may implement QCustomAudioRoleControl in order to - provide access to roles unknown to Qt. - - The functionality provided by this control is exposed to application code through the - QMediaPlayer class. - - The interface name of QCustomAudioRoleControl is \c org.qt-project.qt.customaudiorolecontrol/5.11 as - defined in QCustomAudioRoleControl_iid. - - \sa QMediaService::requestControl(), QMediaPlayer -*/ - -/*! - \macro QCustomAudioRoleControl_iid - - \c org.qt-project.qt.customaudiorolecontrol/5.11 - - Defines the interface name of the QCustomAudioRoleControl class. - - \relates QCustomAudioRoleControl -*/ - -/*! - Construct a QCustomAudioRoleControl with the given \a parent. -*/ -QCustomAudioRoleControl::QCustomAudioRoleControl(QObject *parent) - : QMediaControl(*new QMediaControlPrivate, parent) -{ -} - -/*! - Destroys the audio role control. -*/ -QCustomAudioRoleControl::~QCustomAudioRoleControl() -{ -} - -/*! - \fn QAudio::Role QCustomAudioRoleControl::customAudioRole() const - - Returns the audio role of the media played by the media service. -*/ - -/*! - \fn void QCustomAudioRoleControl::setCustomAudioRole(const QString &role) - - Sets the audio \a role of the media played by the media service. -*/ - -/*! - \fn QStringList QCustomAudioRoleControl::supportedCustomAudioRoles() const - - Returns a list of custom audio roles that the media service supports. An - empty list may indicate that the supported custom audio roles aren't known. - The list may not be complete. -*/ - -/*! - \fn void QCustomAudioRoleControl::customAudioRoleChanged(const QString &role) - - Signal emitted when the audio \a role has changed. - */ - -QT_END_NAMESPACE - -#include "moc_qcustomaudiorolecontrol.cpp" diff --git a/src/multimedia/controls/qcustomaudiorolecontrol.h b/src/multimedia/controls/qcustomaudiorolecontrol.h deleted file mode 100644 index 5a587c034..000000000 --- a/src/multimedia/controls/qcustomaudiorolecontrol.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 QNX Software Systems. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QCUSTOMAUDIOROLECONTROL_H -#define QCUSTOMAUDIOROLECONTROL_H - -#include -#include - -QT_BEGIN_NAMESPACE - -// Class forward declaration required for QDoc bug -class QString; - -class Q_MULTIMEDIA_EXPORT QCustomAudioRoleControl : public QMediaControl -{ - Q_OBJECT - -public: - virtual ~QCustomAudioRoleControl(); - - virtual QString customAudioRole() const = 0; - virtual void setCustomAudioRole(const QString &role) = 0; - - virtual QStringList supportedCustomAudioRoles() const = 0; - -Q_SIGNALS: - void customAudioRoleChanged(const QString &role); - -protected: - explicit QCustomAudioRoleControl(QObject *parent = nullptr); -}; - -#define QCustomAudioRoleControl_iid "org.qt-project.qt.customaudiorolecontrol/5.11" -Q_MEDIA_DECLARE_CONTROL(QCustomAudioRoleControl, QCustomAudioRoleControl_iid) - -QT_END_NAMESPACE - -#endif // QCUSTOMAUDIOROLECONTROL_H diff --git a/src/multimedia/controls/qmediaplayercontrol.cpp b/src/multimedia/controls/qmediaplayercontrol.cpp index a180413b9..7602f80ce 100644 --- a/src/multimedia/controls/qmediaplayercontrol.cpp +++ b/src/multimedia/controls/qmediaplayercontrol.cpp @@ -369,6 +369,44 @@ QMediaPlayerControl::QMediaPlayerControl(QObject *parent): {stopped} state. */ +/*! + \fn QAudio::Role QMediaPlayerControl::audioRole() const + + Returns the audio role of the media played by the media service. +*/ + +/*! + \fn void QMediaPlayerControl::setAudioRole(QAudio::Role role) + + Sets the audio \a role of the media played by the media service. +*/ + +/*! + \fn QList QMediaPlayerControl::supportedAudioRoles() const + + Returns a list of audio roles that the media service supports. +*/ + +/*! + \fn QAudio::Role QMediaPlayerControl::customAudioRole() const + + Returns the audio role of the media played by the media service. +*/ + +/*! + \fn void QMediaPlayerControl::setCustomAudioRole(const QString &role) + + Sets the audio \a role of the media played by the media service. +*/ + +/*! + \fn QStringList QMediaPlayerControl::supportedCustomAudioRoles() const + + Returns a list of custom audio roles that the media service supports. An + empty list may indicate that the supported custom audio roles aren't known. + The list may not be complete. +*/ + /*! \fn QMediaPlayerControl::error(int error, const QString &errorString) diff --git a/src/multimedia/controls/qmediaplayercontrol.h b/src/multimedia/controls/qmediaplayercontrol.h index 8b5072572..00704ab07 100644 --- a/src/multimedia/controls/qmediaplayercontrol.h +++ b/src/multimedia/controls/qmediaplayercontrol.h @@ -93,7 +93,15 @@ public: virtual void pause() = 0; virtual void stop() = 0; + virtual void setAudioRole(QAudio::Role /*role*/) {} + virtual QList supportedAudioRoles() const { return {}; } + + virtual void setCustomAudioRole(const QString &/*role*/) {} + virtual QStringList supportedCustomAudioRoles() const { return {}; } + Q_SIGNALS: + void audioRoleChanged(QAudio::Role role); + void customAudioRoleChanged(const QString &role); void mediaChanged(const QMediaContent& content); void durationChanged(qint64 duration); void positionChanged(qint64 position); diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 6cbb68c1d..002f6ce74 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -46,8 +46,6 @@ #include #include #include -#include -#include #include #include @@ -110,8 +108,6 @@ public: QMediaPlayerPrivate() : provider(nullptr) , control(nullptr) - , audioRoleControl(nullptr) - , customAudioRoleControl(nullptr) , playlist(nullptr) , state(QMediaPlayer::StoppedState) , status(QMediaPlayer::UnknownMediaStatus) @@ -123,8 +119,6 @@ public: QMediaServiceProvider *provider; QMediaPlayerControl* control; - QAudioRoleControl *audioRoleControl; - QCustomAudioRoleControl *customAudioRoleControl; QString errorString; QPointer videoOutput; @@ -142,6 +136,9 @@ public: int nestedPlaylists; bool hasStreamPlaybackFeature; + QAudio::Role audioRole = QAudio::UnknownRole; + QString customAudioRole; + QMediaPlaylist *parentPlaylist(QMediaPlaylist *pls); bool isInChain(const QUrl &url); @@ -621,21 +618,6 @@ QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags): addPropertyWatch("bufferStatus"); d->hasStreamPlaybackFeature = d->provider->supportedFeatures(d->service).testFlag(QMediaServiceProviderHint::StreamPlayback); - - d->audioRoleControl = qobject_cast(d->service->requestControl(QAudioRoleControl_iid)); - if (d->audioRoleControl) { - connect(d->audioRoleControl, &QAudioRoleControl::audioRoleChanged, - this, &QMediaPlayer::audioRoleChanged); - - d->customAudioRoleControl = qobject_cast( - d->service->requestControl(QCustomAudioRoleControl_iid)); - if (d->customAudioRoleControl) { - connect(d->customAudioRoleControl, - &QCustomAudioRoleControl::customAudioRoleChanged, - this, - &QMediaPlayer::customAudioRoleChanged); - } - } } } } @@ -657,10 +639,6 @@ QMediaPlayer::~QMediaPlayer() if (d->service) { if (d->control) d->service->releaseControl(d->control); - if (d->audioRoleControl) - d->service->releaseControl(d->audioRoleControl); - if (d->customAudioRoleControl) - d->service->releaseControl(d->customAudioRoleControl); d->provider->releaseService(d->service); } @@ -1178,24 +1156,23 @@ QMultimedia::AvailabilityStatus QMediaPlayer::availability() const QAudio::Role QMediaPlayer::audioRole() const { Q_D(const QMediaPlayer); - - if (d->audioRoleControl != nullptr) - return d->audioRoleControl->audioRole(); - - return QAudio::UnknownRole; + return d->audioRole; } void QMediaPlayer::setAudioRole(QAudio::Role audioRole) { Q_D(QMediaPlayer); + if (d->audioRole == audioRole) + return; - if (d->audioRoleControl) { - if (d->customAudioRoleControl != nullptr && d->audioRoleControl->audioRole() != audioRole) { - d->customAudioRoleControl->setCustomAudioRole(QString()); - } - - d->audioRoleControl->setAudioRole(audioRole); + d->audioRole = audioRole; + d->control->setAudioRole(audioRole); + if (!d->customAudioRole.isEmpty()) { + d->customAudioRole.clear(); + emit customAudioRoleChanged(QString()); } + emit audioRoleChanged(audioRole); + } /*! @@ -1210,34 +1187,29 @@ QList QMediaPlayer::supportedAudioRoles() const { Q_D(const QMediaPlayer); - if (d->audioRoleControl) - return d->audioRoleControl->supportedAudioRoles(); - - return QList(); + return d->control->supportedAudioRoles(); } QString QMediaPlayer::customAudioRole() const { Q_D(const QMediaPlayer); - if (audioRole() != QAudio::CustomRole) - return QString(); - - if (d->customAudioRoleControl != nullptr) - return d->customAudioRoleControl->customAudioRole(); - - return QString(); + return d->customAudioRole; } void QMediaPlayer::setCustomAudioRole(const QString &audioRole) { Q_D(QMediaPlayer); + if (d->audioRole == QAudio::CustomRole && d->customAudioRole == audioRole) + return; - if (d->customAudioRoleControl) { - Q_ASSERT(d->audioRoleControl); - setAudioRole(QAudio::CustomRole); - d->customAudioRoleControl->setCustomAudioRole(audioRole); + d->customAudioRole = audioRole; + d->control->setCustomAudioRole(audioRole); + if (d->audioRole != QAudio::CustomRole) { + d->audioRole = QAudio::CustomRole; + emit audioRoleChanged(QAudio::CustomRole); } + emit customAudioRoleChanged(audioRole); } /*! @@ -1251,11 +1223,7 @@ void QMediaPlayer::setCustomAudioRole(const QString &audioRole) QStringList QMediaPlayer::supportedCustomAudioRoles() const { Q_D(const QMediaPlayer); - - if (d->customAudioRoleControl) - return d->customAudioRoleControl->supportedCustomAudioRoles(); - - return QStringList(); + return d->control->supportedCustomAudioRoles(); } // Enums diff --git a/src/plugins/android/src/mediaplayer/mediaplayer.pri b/src/plugins/android/src/mediaplayer/mediaplayer.pri index 3a9cef3a1..9f758a993 100644 --- a/src/plugins/android/src/mediaplayer/mediaplayer.pri +++ b/src/plugins/android/src/mediaplayer/mediaplayer.pri @@ -4,14 +4,10 @@ HEADERS += \ $$PWD/qandroidmediaplayercontrol.h \ $$PWD/qandroidmediaservice.h \ $$PWD/qandroidmetadatareadercontrol.h \ - $$PWD/qandroidaudiorolecontrol.h \ - $$PWD/qandroidcustomaudiorolecontrol.h \ $$PWD/qandroidmediaplayervideorenderercontrol.h SOURCES += \ $$PWD/qandroidmediaplayercontrol.cpp \ $$PWD/qandroidmediaservice.cpp \ $$PWD/qandroidmetadatareadercontrol.cpp \ - $$PWD/qandroidaudiorolecontrol.cpp \ - $$PWD/qandroidcustomaudiorolecontrol.cpp \ $$PWD/qandroidmediaplayervideorenderercontrol.cpp diff --git a/src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.cpp deleted file mode 100644 index 5879b0cb9..000000000 --- a/src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidaudiorolecontrol.h" - -QT_BEGIN_NAMESPACE - -QAndroidAudioRoleControl::QAndroidAudioRoleControl(QObject *parent) - : QAudioRoleControl(parent) -{ -} - -QAudio::Role QAndroidAudioRoleControl::audioRole() const -{ - return m_role; -} - -void QAndroidAudioRoleControl::setAudioRole(QAudio::Role role) -{ - if (m_role == role) - return; - - m_role = role; - emit audioRoleChanged(m_role); -} - -QList QAndroidAudioRoleControl::supportedAudioRoles() const -{ - return QList() - << QAudio::VoiceCommunicationRole - << QAudio::MusicRole - << QAudio::VideoRole - << QAudio::SonificationRole - << QAudio::AlarmRole - << QAudio::NotificationRole - << QAudio::RingtoneRole - << QAudio::AccessibilityRole - << QAudio::GameRole; -} - -QT_END_NAMESPACE diff --git a/src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.h b/src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.h deleted file mode 100644 index 89219e026..000000000 --- a/src/plugins/android/src/mediaplayer/qandroidaudiorolecontrol.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDAUDIOROLECONTROL_H -#define QANDROIDAUDIOROLECONTROL_H - -#include - -QT_BEGIN_NAMESPACE - -class QAndroidAudioRoleControl : public QAudioRoleControl -{ - Q_OBJECT -public: - explicit QAndroidAudioRoleControl(QObject *parent = nullptr); - - QAudio::Role audioRole() const override; - void setAudioRole(QAudio::Role role) override; - QList supportedAudioRoles() const override; - -private: - QAudio::Role m_role = QAudio::UnknownRole; -}; - -QT_END_NAMESPACE - -#endif // QANDROIDAUDIOROLECONTROL_H diff --git a/src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.cpp deleted file mode 100644 index cb7b5d0af..000000000 --- a/src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidcustomaudiorolecontrol.h" - -QT_BEGIN_NAMESPACE - -QAndroidCustomAudioRoleControl::QAndroidCustomAudioRoleControl(QObject *parent) - : QCustomAudioRoleControl(parent) -{ -} - -QString QAndroidCustomAudioRoleControl::customAudioRole() const -{ - return m_role; -} - -void QAndroidCustomAudioRoleControl::setCustomAudioRole(const QString &role) -{ - if (m_role == role) - return; - - m_role = role; - emit customAudioRoleChanged(m_role); -} - -QStringList QAndroidCustomAudioRoleControl::supportedCustomAudioRoles() const -{ - return QStringList() - << "CONTENT_TYPE_MOVIE" - << "CONTENT_TYPE_MUSIC" - << "CONTENT_TYPE_SONIFICATION" - << "CONTENT_TYPE_SPEECH" - << "USAGE_ALARM" - << "USAGE_ASSISTANCE_ACCESSIBILITY" - << "USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" - << "USAGE_ASSISTANCE_SONIFICATION" - << "USAGE_ASSISTANT" - << "USAGE_GAME" - << "USAGE_MEDIA" - << "USAGE_NOTIFICATION" - << "USAGE_NOTIFICATION_COMMUNICATION_DELAYED" - << "USAGE_NOTIFICATION_COMMUNICATION_INSTANT" - << "USAGE_NOTIFICATION_COMMUNICATION_REQUEST" - << "USAGE_NOTIFICATION_EVENT" - << "USAGE_NOTIFICATION_RINGTONE" - << "USAGE_VOICE_COMMUNICATION" - << "USAGE_VOICE_COMMUNICATION_SIGNALLING"; -} - -QT_END_NAMESPACE diff --git a/src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.h b/src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.h deleted file mode 100644 index 4604ebe67..000000000 --- a/src/plugins/android/src/mediaplayer/qandroidcustomaudiorolecontrol.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDCUSTOMAUDIOROLECONTROL_H -#define QANDROIDCUSTOMAUDIOROLECONTROL_H - -#include - -QT_BEGIN_NAMESPACE - -class QAndroidCustomAudioRoleControl : public QCustomAudioRoleControl -{ - Q_OBJECT -public: - explicit QAndroidCustomAudioRoleControl(QObject *parent = nullptr); - - QString customAudioRole() const override; - void setCustomAudioRole(const QString &role) override; - QStringList supportedCustomAudioRoles() const override; - -private: - QString m_role; -}; - -QT_END_NAMESPACE - -#endif // QANDROIDCUSTOMAUDIOROLECONTROL_H diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp index 82250b654..e1e6f0049 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp @@ -255,11 +255,49 @@ void QAndroidMediaPlayerControl::setAudioRole(QAudio::Role role) mMediaPlayer->setAudioRole(role); } +QList QAndroidMediaPlayerControl::supportedAudioRoles() const +{ + return QList() + << QAudio::VoiceCommunicationRole + << QAudio::MusicRole + << QAudio::VideoRole + << QAudio::SonificationRole + << QAudio::AlarmRole + << QAudio::NotificationRole + << QAudio::RingtoneRole + << QAudio::AccessibilityRole + << QAudio::GameRole; +} + void QAndroidMediaPlayerControl::setCustomAudioRole(const QString &role) { mMediaPlayer->setCustomAudioRole(role); } +QStringList QAndroidMediaPlayerControl::supportedCustomAudioRoles() const +{ + return QStringList() + << "CONTENT_TYPE_MOVIE" + << "CONTENT_TYPE_MUSIC" + << "CONTENT_TYPE_SONIFICATION" + << "CONTENT_TYPE_SPEECH" + << "USAGE_ALARM" + << "USAGE_ASSISTANCE_ACCESSIBILITY" + << "USAGE_ASSISTANCE_NAVIGATION_GUIDANCE" + << "USAGE_ASSISTANCE_SONIFICATION" + << "USAGE_ASSISTANT" + << "USAGE_GAME" + << "USAGE_MEDIA" + << "USAGE_NOTIFICATION" + << "USAGE_NOTIFICATION_COMMUNICATION_DELAYED" + << "USAGE_NOTIFICATION_COMMUNICATION_INSTANT" + << "USAGE_NOTIFICATION_COMMUNICATION_REQUEST" + << "USAGE_NOTIFICATION_EVENT" + << "USAGE_NOTIFICATION_RINGTONE" + << "USAGE_VOICE_COMMUNICATION" + << "USAGE_VOICE_COMMUNICATION_SIGNALLING"; +} + int QAndroidMediaPlayerControl::bufferStatus() const { return mBufferFilled ? 100 : 0; diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h index 35f56145f..b1bab15da 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.h @@ -73,6 +73,11 @@ public: const QIODevice *mediaStream() const override; void setMedia(const QMediaContent &mediaContent, QIODevice *stream) override; + void setAudioRole(QAudio::Role role) override; + QList supportedAudioRoles() const override; + void setCustomAudioRole(const QString &role) override; + QStringList supportedCustomAudioRoles() const override; + void setVideoOutput(QAndroidVideoOutput *videoOutput); Q_SIGNALS: @@ -85,8 +90,6 @@ public Q_SLOTS: void stop() override; void setVolume(int volume) override; void setMuted(bool muted) override; - void setAudioRole(QAudio::Role role); - void setCustomAudioRole(const QString &role); private Q_SLOTS: void onVideoOutputReady(bool ready); diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp index c057f530a..614d7dc9d 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp +++ b/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp @@ -41,8 +41,6 @@ #include "qandroidmediaplayercontrol.h" #include "qandroidmetadatareadercontrol.h" -#include "qandroidaudiorolecontrol.h" -#include "qandroidcustomaudiorolecontrol.h" #include "qandroidmediaplayervideorenderercontrol.h" QT_BEGIN_NAMESPACE @@ -55,12 +53,6 @@ QAndroidMediaService::QAndroidMediaService(QObject *parent) { mMediaControl = new QAndroidMediaPlayerControl; mMetadataControl = new QAndroidMetaDataReaderControl; - mAudioRoleControl = new QAndroidAudioRoleControl; - mCustomAudioRoleControl = new QAndroidCustomAudioRoleControl; - connect(mAudioRoleControl, &QAndroidAudioRoleControl::audioRoleChanged, - mMediaControl, &QAndroidMediaPlayerControl::setAudioRole); - connect(mCustomAudioRoleControl, &QAndroidCustomAudioRoleControl::customAudioRoleChanged, - mMediaControl, &QAndroidMediaPlayerControl::setCustomAudioRole); connect(mMediaControl, SIGNAL(mediaChanged(QMediaContent)), mMetadataControl, SLOT(onMediaChanged(QMediaContent))); connect(mMediaControl, SIGNAL(metaDataUpdated()), @@ -70,8 +62,6 @@ QAndroidMediaService::QAndroidMediaService(QObject *parent) QAndroidMediaService::~QAndroidMediaService() { delete mVideoRendererControl; - delete mCustomAudioRoleControl; - delete mAudioRoleControl; delete mMetadataControl; delete mMediaControl; } @@ -84,12 +74,6 @@ QMediaControl *QAndroidMediaService::requestControl(const char *name) if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) return mMetadataControl; - if (qstrcmp(name, QAudioRoleControl_iid) == 0) - return mAudioRoleControl; - - if (qstrcmp(name, QCustomAudioRoleControl_iid) == 0) - return mCustomAudioRoleControl; - if (qstrcmp(name, QVideoRendererControl_iid) == 0) { if (!mVideoRendererControl) { mVideoRendererControl = new QAndroidMediaPlayerVideoRendererControl(mMediaControl); diff --git a/src/plugins/qnx/mediaplayer/mediaplayer.pri b/src/plugins/qnx/mediaplayer/mediaplayer.pri index f39b542cc..4c4363a91 100644 --- a/src/plugins/qnx/mediaplayer/mediaplayer.pri +++ b/src/plugins/qnx/mediaplayer/mediaplayer.pri @@ -1,7 +1,6 @@ INCLUDEPATH += $$PWD HEADERS += \ - $$PWD/mmrendereraudiorolecontrol.h \ $$PWD/mmrenderermediaplayercontrol.h \ $$PWD/mmrenderermediaplayerservice.h \ $$PWD/mmrenderermetadata.h \ @@ -10,10 +9,8 @@ HEADERS += \ $$PWD/mmrendererutil.h \ $$PWD/mmrenderervideowindowcontrol.h \ $$PWD/mmreventmediaplayercontrol.h \ - $$PWD/mmreventthread.h \ - $$PWD/mmrenderercustomaudiorolecontrol.h + $$PWD/mmreventthread.h SOURCES += \ - $$PWD/mmrendereraudiorolecontrol.cpp \ $$PWD/mmrenderermediaplayercontrol.cpp \ $$PWD/mmrenderermediaplayerservice.cpp \ $$PWD/mmrenderermetadata.cpp \ @@ -22,7 +19,6 @@ SOURCES += \ $$PWD/mmrendererutil.cpp \ $$PWD/mmrenderervideowindowcontrol.cpp \ $$PWD/mmreventmediaplayercontrol.cpp \ - $$PWD/mmreventthread.cpp \ - $$PWD/mmrenderercustomaudiorolecontrol.cpp + $$PWD/mmreventthread.cpp QMAKE_USE += mmrenderer diff --git a/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp b/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp deleted file mode 100644 index e470ed4c5..000000000 --- a/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 QNX Software Systems. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "mmrendereraudiorolecontrol.h" -#include "mmrendererutil.h" - -QT_BEGIN_NAMESPACE - -MmRendererAudioRoleControl::MmRendererAudioRoleControl(QObject *parent) - : QAudioRoleControl(parent) - , m_role(QAudio::UnknownRole) -{ -} - -QAudio::Role MmRendererAudioRoleControl::audioRole() const -{ - return m_role; -} - -void MmRendererAudioRoleControl::setAudioRole(QAudio::Role role) -{ - if (m_role != role) { - m_role = role; - emit audioRoleChanged(m_role); - } -} - -QList MmRendererAudioRoleControl::supportedAudioRoles() const -{ - return qnxSupportedAudioRoles(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h b/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h deleted file mode 100644 index d0d2165eb..000000000 --- a/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 QNX Software Systems. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef MMRENDERERAUDIOROLECONTROL_H -#define MMRENDERERAUDIOROLECONTROL_H - -#include - -QT_BEGIN_NAMESPACE - -class MmRendererAudioRoleControl : public QAudioRoleControl -{ - Q_OBJECT -public: - explicit MmRendererAudioRoleControl(QObject *parent = 0); - - QAudio::Role audioRole() const override; - void setAudioRole(QAudio::Role role) override; - - QList supportedAudioRoles() const override; - -private: - QAudio::Role m_role; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.cpp deleted file mode 100644 index c8971d41c..000000000 --- a/src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 QNX Software Systems. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "mmrenderercustomaudiorolecontrol.h" -#include "mmrendererutil.h" - -QT_BEGIN_NAMESPACE - -MmRendererCustomAudioRoleControl::MmRendererCustomAudioRoleControl(QObject *parent) - : QCustomAudioRoleControl(parent) -{ -} - -QString MmRendererCustomAudioRoleControl::customAudioRole() const -{ - return m_role; -} - -void MmRendererCustomAudioRoleControl::setCustomAudioRole(const QString &role) -{ - if (m_role != role) { - m_role = role; - emit customAudioRoleChanged(m_role); - } -} - -QStringList MmRendererCustomAudioRoleControl::supportedCustomAudioRoles() const -{ - return QStringList(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.h b/src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.h deleted file mode 100644 index ff16f9355..000000000 --- a/src/plugins/qnx/mediaplayer/mmrenderercustomaudiorolecontrol.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 QNX Software Systems. All rights reserved. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef MMRENDERERCUSTOMAUDIOROLECONTROL_H -#define MMRENDERERCUSTOMAUDIOROLECONTROL_H - -#include - -QT_BEGIN_NAMESPACE - -class MmRendererCustomAudioRoleControl : public QCustomAudioRoleControl -{ - Q_OBJECT -public: - explicit MmRendererCustomAudioRoleControl(QObject *parent = 0); - - QString customAudioRole() const Q_DECL_OVERRIDE; - void setCustomAudioRole(const QString &role) Q_DECL_OVERRIDE; - - QStringList supportedCustomAudioRoles() const Q_DECL_OVERRIDE; - -private: - QString m_role; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp index fc48ed818..f414b5ff3 100644 --- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp @@ -216,11 +216,10 @@ void MmRendererMediaPlayerControl::attach() return; } - if (m_audioId != -1 && m_audioRoleControl) { - QAudio::Role audioRole = m_audioRoleControl->audioRole(); - QString audioType = (audioRole == QAudio::CustomRole && m_customAudioRoleControl) - ? m_customAudioRoleControl->customAudioRole() - : qnxAudioType(audioRole); + if (m_audioId != -1) { + QString audioType = m_role == QAudio::CustomRole + ? m_customRole + : qnxAudioType(m_role); QByteArray latin1AudioType = audioType.toLatin1(); if (!audioType.isEmpty() && latin1AudioType == audioType) { strm_dict_t *dict = strm_dict_new(); @@ -564,6 +563,28 @@ void MmRendererMediaPlayerControl::stop() stopInternal(StopMmRenderer); } +void MmRendererMediaPlayerControl::setAudioRole(QAudio::Role role) +{ + m_role = role; + m_customRole.clear(); +} + +QList MmRendererMediaPlayerControl::supportedAudioRoles() const +{ + return qnxSupportedAudioRoles(); +} + +void MmRendererMediaPlayerControl::setCustomAudioRole(const QString &role) +{ + m_role = QAudio::CustomRole; + m_customRole = role; +} + +QStringList MmRendererMediaPlayerControl::supportedCustomAudioRoles() const +{ + return QStringList(); +} + MmRendererPlayerVideoRendererControl *MmRendererMediaPlayerControl::videoRendererControl() const { return m_videoRendererControl; @@ -584,16 +605,6 @@ void MmRendererMediaPlayerControl::setMetaDataReaderControl(MmRendererMetaDataRe m_metaDataReaderControl = metaDataReaderControl; } -void MmRendererMediaPlayerControl::setAudioRoleControl(MmRendererAudioRoleControl *audioRoleControl) -{ - m_audioRoleControl = audioRoleControl; -} - -void MmRendererMediaPlayerControl::setCustomAudioRoleControl(MmRendererCustomAudioRoleControl *customAudioRoleControl) -{ - m_customAudioRoleControl = customAudioRoleControl; -} - void MmRendererMediaPlayerControl::setMmPosition(qint64 newPosition) { if (newPosition != 0 && newPosition != m_position) { diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h index 3426ef2f2..c193fcd31 100644 --- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h @@ -99,14 +99,18 @@ public: void pause() override; void stop() override; + void setAudioRole(QAudio::Role role) override; + QList supportedAudioRoles() const override; + + void setCustomAudioRole(const QString &role) override; + QStringList supportedCustomAudioRoles() const override; + MmRendererPlayerVideoRendererControl *videoRendererControl() const; void setVideoRendererControl(MmRendererPlayerVideoRendererControl *videoControl); MmRendererVideoWindowControl *videoWindowControl() const; void setVideoWindowControl(MmRendererVideoWindowControl *videoControl); void setMetaDataReaderControl(MmRendererMetaDataReaderControl *metaDataReaderControl); - void setAudioRoleControl(MmRendererAudioRoleControl *audioRoleControl); - void setCustomAudioRoleControl(MmRendererCustomAudioRoleControl *customAudioRoleControl); protected: virtual void startMonitoring() = 0; @@ -164,8 +168,6 @@ private: QPointer m_videoRendererControl; QPointer m_videoWindowControl; QPointer m_metaDataReaderControl; - QPointer m_audioRoleControl; - QPointer m_customAudioRoleControl; MmRendererMetaData m_metaData; qint64 m_position; QMediaPlayer::MediaStatus m_mediaStatus; diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp index 190cb8b80..138d8e74e 100644 --- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp @@ -38,8 +38,6 @@ ****************************************************************************/ #include "mmrenderermediaplayerservice.h" -#include "mmrendereraudiorolecontrol.h" -#include "mmrenderercustomaudiorolecontrol.h" #include "mmrenderermediaplayercontrol.h" #include "mmrenderermetadatareadercontrol.h" #include "mmrendererplayervideorenderercontrol.h" @@ -68,8 +66,6 @@ MmRendererMediaPlayerService::~MmRendererMediaPlayerService() delete m_videoWindowControl; delete m_mediaPlayerControl; delete m_metaDataReaderControl; - delete m_audioRoleControl; - delete m_customAudioRoleControl; } QMediaControl *MmRendererMediaPlayerService::requestControl(const char *name) @@ -86,18 +82,6 @@ QMediaControl *MmRendererMediaPlayerService::requestControl(const char *name) updateControls(); } return m_metaDataReaderControl; - } else if (qstrcmp(name, QAudioRoleControl_iid) == 0) { - if (!m_audioRoleControl) { - m_audioRoleControl = new MmRendererAudioRoleControl(); - updateControls(); - } - return m_audioRoleControl; - } else if (qstrcmp(name, QCustomAudioRoleControl_iid) == 0) { - if (!m_customAudioRoleControl) { - m_customAudioRoleControl = new MmRendererCustomAudioRoleControl(); - updateControls(); - } - return m_customAudioRoleControl; } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) { if (!m_appHasDrmPermissionChecked) { m_appHasDrmPermission = checkForDrmPermission(); @@ -136,10 +120,6 @@ void MmRendererMediaPlayerService::releaseControl(QMediaControl *control) m_mediaPlayerControl = 0; if (control == m_metaDataReaderControl) m_metaDataReaderControl = 0; - if (control == m_audioRoleControl) - m_audioRoleControl = 0; - if (control == m_customAudioRoleControl) - m_customAudioRoleControl = 0; delete control; } @@ -153,12 +133,6 @@ void MmRendererMediaPlayerService::updateControls() if (m_metaDataReaderControl && m_mediaPlayerControl) m_mediaPlayerControl->setMetaDataReaderControl(m_metaDataReaderControl); - - if (m_audioRoleControl && m_mediaPlayerControl) - m_mediaPlayerControl->setAudioRoleControl(m_audioRoleControl); - - if (m_customAudioRoleControl && m_mediaPlayerControl) - m_mediaPlayerControl->setCustomAudioRoleControl(m_customAudioRoleControl); } QT_END_NAMESPACE diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h index ab3054af5..47e8d01d3 100644 --- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h @@ -44,8 +44,6 @@ QT_BEGIN_NAMESPACE -class MmRendererAudioRoleControl; -class MmRendererCustomAudioRoleControl; class MmRendererMediaPlayerControl; class MmRendererMetaDataReaderControl; class MmRendererPlayerVideoRendererControl; @@ -68,8 +66,6 @@ private: QPointer m_videoWindowControl; QPointer m_mediaPlayerControl; QPointer m_metaDataReaderControl; - QPointer m_audioRoleControl; - QPointer m_customAudioRoleControl; bool m_appHasDrmPermission : 1; bool m_appHasDrmPermissionChecked : 1; -- cgit v1.2.1