diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-01-12 09:37:27 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-01-22 07:02:21 +0000 |
commit | bf1eb37ac8e569ab929c0c2ab8655f07594ef4e9 (patch) | |
tree | a1d47d5790dabbefbcbf3d2d0ba3a08bd844e559 | |
parent | 778886e93e7525ad3b485c15a1a2cc84ca80b016 (diff) |
Get rid of the QMediaServiceFeaturesInterface
Replace it by one virtual method in the media player control.
Change-Id: I18778d2f56b9af8a16418c30c75c973e54b6add8
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
33 files changed, 43 insertions, 296 deletions
diff --git a/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp b/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp index a3daec3aa..2c2286d72 100644 --- a/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp +++ b/examples/multimediawidgets/customvideosurface/customvideoitem/videoplayer.cpp @@ -60,7 +60,7 @@ VideoPlayer::VideoPlayer(QWidget *parent) : QWidget(parent) - , mediaPlayer(nullptr, QMediaPlayer::VideoSurface) + , mediaPlayer(nullptr) , videoItem(nullptr) , playButton(nullptr) , positionSlider(nullptr) diff --git a/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp b/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp index 4ee3c5ea9..260daa7c2 100644 --- a/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp +++ b/examples/multimediawidgets/customvideosurface/customvideowidget/videoplayer.cpp @@ -57,7 +57,7 @@ VideoPlayer::VideoPlayer(QWidget *parent) : QWidget(parent) - , mediaPlayer(nullptr, QMediaPlayer::VideoSurface) + , mediaPlayer(nullptr) , playButton(nullptr) , positionSlider(nullptr) { diff --git a/examples/multimediawidgets/videographicsitem/videoplayer.cpp b/examples/multimediawidgets/videographicsitem/videoplayer.cpp index 917a71f64..1b263c3bb 100644 --- a/examples/multimediawidgets/videographicsitem/videoplayer.cpp +++ b/examples/multimediawidgets/videographicsitem/videoplayer.cpp @@ -56,7 +56,7 @@ VideoPlayer::VideoPlayer(QWidget *parent) : QWidget(parent) { - m_mediaPlayer = new QMediaPlayer(this, QMediaPlayer::VideoSurface); + m_mediaPlayer = new QMediaPlayer(this); const QSize screenGeometry = screen()->availableSize(); m_videoItem = new QGraphicsVideoItem; m_videoItem->setSize(QSizeF(screenGeometry.width() / 3, screenGeometry.height() / 2)); diff --git a/examples/multimediawidgets/videowidget/videoplayer.cpp b/examples/multimediawidgets/videowidget/videoplayer.cpp index 1db269503..879637603 100644 --- a/examples/multimediawidgets/videowidget/videoplayer.cpp +++ b/examples/multimediawidgets/videowidget/videoplayer.cpp @@ -56,7 +56,7 @@ VideoPlayer::VideoPlayer(QWidget *parent) : QWidget(parent) { - m_mediaPlayer = new QMediaPlayer(this, QMediaPlayer::VideoSurface); + m_mediaPlayer = new QMediaPlayer(this); QVideoWidget *videoWidget = new QVideoWidget; QAbstractButton *openButton = new QPushButton(tr("Open...")); diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index 2f98dae60..4b2dce631 100644 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -969,7 +969,7 @@ void QDeclarativeAudio::_q_statusChanged() } } -void QDeclarativeAudio::_q_mediaChanged(const QUrl &media) +void QDeclarativeAudio::_q_mediaChanged(const QUrl &) { emit sourceChanged(); } diff --git a/src/multimedia/controls/qmediaplayercontrol.cpp b/src/multimedia/controls/qmediaplayercontrol.cpp index a41e67ec5..237bf64e1 100644 --- a/src/multimedia/controls/qmediaplayercontrol.cpp +++ b/src/multimedia/controls/qmediaplayercontrol.cpp @@ -318,10 +318,12 @@ QMediaPlayerControl::QMediaPlayerControl(QObject *parent) information relating to the current media source and to cease all I/O operations related to that media. - Qt resource files are never passed as is. If the service supports - QMediaServiceFeaturesInterface::StreamPlayback, a \a stream is supplied, pointing to an opened + Qt resource files are never passed as is. If the control supports + stream playback, a \a stream is supplied, pointing to an opened QFile. Otherwise, the resource is copied into a temporary file and \a media contains the url to that file. + + \sa streamPlaybackSupported() */ /*! diff --git a/src/multimedia/controls/qmediaplayercontrol.h b/src/multimedia/controls/qmediaplayercontrol.h index 8c4005dc1..f796ec300 100644 --- a/src/multimedia/controls/qmediaplayercontrol.h +++ b/src/multimedia/controls/qmediaplayercontrol.h @@ -94,6 +94,8 @@ public: virtual void setCustomAudioRole(const QString &/*role*/) {} virtual QStringList supportedCustomAudioRoles() const { return {}; } + virtual bool streamPlaybackSupported() const { return false; } + Q_SIGNALS: void audioRoleChanged(QAudio::Role role); void customAudioRoleChanged(const QString &role); diff --git a/src/multimedia/gstreamer/qgstreamerplayercontrol_p.h b/src/multimedia/gstreamer/qgstreamerplayercontrol_p.h index d06eb7526..dbc6e3151 100644 --- a/src/multimedia/gstreamer/qgstreamerplayercontrol_p.h +++ b/src/multimedia/gstreamer/qgstreamerplayercontrol_p.h @@ -93,6 +93,8 @@ public: const QIODevice *mediaStream() const override; void setMedia(const QUrl&, QIODevice *) override; + bool streamPlaybackSupported() const override { return true; } + public Q_SLOTS: void setPosition(qint64 pos) override; diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 096670b6d..895595def 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -261,13 +261,12 @@ static QMediaService *playerService() parented to \a parent and with \a flags. */ -QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags): +QMediaPlayer::QMediaPlayer(QObject *parent): QMediaSource(*new QMediaPlayerPrivate, parent, playerService()) { Q_D(QMediaPlayer); - Q_UNUSED(flags); d->provider = QMediaServiceProvider::defaultServiceProvider(); if (d->service == nullptr) { @@ -300,7 +299,7 @@ QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags): if (d->status == StalledMedia || d->status == BufferingMedia) addPropertyWatch("bufferStatus"); - d->hasStreamPlaybackFeature = d->provider->supportedFeatures(d->service).testFlag(QMediaServiceFeaturesInterface::StreamPlayback); + d->hasStreamPlaybackFeature = d->control->streamPlaybackSupported(); } } } @@ -626,13 +625,11 @@ void QMediaPlayer::setMedia(const QUrl &media, QIODevice *stream) specified. */ QMultimedia::SupportEstimate QMediaPlayer::hasSupport(const QString &mimeType, - const QStringList& codecs, - Flags flags) + const QStringList& codecs) { return QMediaServiceProvider::defaultServiceProvider()->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), mimeType, - codecs, - flags); + codecs); } /*! @@ -647,10 +644,9 @@ QMultimedia::SupportEstimate QMediaPlayer::hasSupport(const QString &mimeType, cases this function will need to load all available media plugins and query them for their support, which may take some time. */ -QStringList QMediaPlayer::supportedMimeTypes(Flags flags) +QStringList QMediaPlayer::supportedMimeTypes() { - return QMediaServiceProvider::defaultServiceProvider()->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), - flags); + return QMediaServiceProvider::defaultServiceProvider()->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)); } /*! @@ -1128,21 +1124,6 @@ QStringList QMediaPlayer::supportedCustomAudioRoles() const Signal the amount of the local buffer filled as a percentage by \a percentFilled. */ -/*! - \enum QMediaPlayer::Flag - - \value LowLatency The player is expected to be used with simple audio formats, - but playback should start without significant delay. - Such playback service can be used for beeps, ringtones, etc. - - \value StreamPlayback The player is expected to play QIODevice based streams. - If passed to QMediaPlayer constructor, the service supporting - streams playback will be chosen. - - \value VideoSurface The player is expected to be able to render to a - QAbstractVideoSurface \l {setVideoOutput()}{output}. -*/ - QT_END_NAMESPACE #include "moc_qmediaplayer.cpp" diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h index 7fc6d35e2..71fc242e7 100644 --- a/src/multimedia/playback/qmediaplayer.h +++ b/src/multimedia/playback/qmediaplayer.h @@ -95,15 +95,6 @@ public: InvalidMedia }; - // ### Go away - enum Flag - { - LowLatency = 0x01, - StreamPlayback = 0x02, - VideoSurface = 0x04 - }; - Q_DECLARE_FLAGS(Flags, Flag) - enum Error { NoError, @@ -114,14 +105,13 @@ public: ServiceMissingError }; - explicit QMediaPlayer(QObject *parent = nullptr, Flags flags = Flags()); + explicit QMediaPlayer(QObject *parent = nullptr); ~QMediaPlayer(); // ### this needs a better solution static QMultimedia::SupportEstimate hasSupport(const QString &mimeType, - const QStringList& codecs = QStringList(), - Flags flags = Flags()); - static QStringList supportedMimeTypes(Flags flags = Flags()); + const QStringList& codecs = QStringList()); + static QStringList supportedMimeTypes(); // new API // bool enableLowLatencyPlayback(bool tryEnable); diff --git a/src/multimedia/qmediaserviceprovider.cpp b/src/multimedia/qmediaserviceprovider.cpp index a424c8380..f729e3876 100644 --- a/src/multimedia/qmediaserviceprovider.cpp +++ b/src/multimedia/qmediaserviceprovider.cpp @@ -101,27 +101,9 @@ public: } } - QMediaServiceFeaturesInterface::Features supportedFeatures(const QMediaService *service) const override - { - if (service) { - MediaServiceData d = mediaServiceData.value(service); - - if (d.plugin) { - QMediaServiceFeaturesInterface *iface = - qobject_cast<QMediaServiceFeaturesInterface*>(d.plugin); - - if (iface) - return iface->supportedFeatures(d.type); - } - } - - return QMediaServiceFeaturesInterface::Features(); - } - [[nodiscard]] QMultimedia::SupportEstimate hasSupport(const QByteArray &serviceType, const QString &mimeType, - const QStringList& codecs, - int flags) const override + const QStringList& codecs) const override { QObject *instance = loader()->instance(QLatin1String(serviceType)); @@ -133,31 +115,11 @@ public: if (iface) supportEstimate = qMax(supportEstimate, iface->hasSupport(mimeType, codecs)); - if (flags && supportEstimate == QMultimedia::ProbablySupported) { - QMediaServiceFeaturesInterface *iface = qobject_cast<QMediaServiceFeaturesInterface*>(instance); - - if (iface) { - QMediaServiceFeaturesInterface::Features features = iface->supportedFeatures(serviceType); - - //if low latency playback was asked, skip services known - //not to provide low latency playback - if ((flags & QMediaPlayer::LowLatency) && - !(features & QMediaServiceFeaturesInterface::LowLatencyPlayback)) - supportEstimate = QMultimedia::MaybeSupported; - - //the same for QIODevice based streams support - if ((flags & QMediaPlayer::StreamPlayback) && - !(features & QMediaServiceFeaturesInterface::StreamPlayback)) - supportEstimate = QMultimedia::MaybeSupported; - } - } - return supportEstimate; } - [[nodiscard]] QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const override + [[nodiscard]] QStringList supportedMimeTypes(const QByteArray &serviceType) const override { - Q_UNUSED(flags); QObject *instance = loader()->instance(QLatin1String(serviceType)); if (!instance) return {}; @@ -279,19 +241,6 @@ Q_GLOBAL_STATIC(QPluginServiceProvider, pluginProvider); /*! \internal - \fn QMediaServiceProvider::supportedFeatures(const QMediaService *service) const - - Returns the features supported by a given \a service. -*/ -QMediaServiceFeaturesInterface::Features QMediaServiceProvider::supportedFeatures(const QMediaService *service) const -{ - Q_UNUSED(service); - - return {}; -} - -/*! - \internal Returns how confident a media service provider is that is can provide a \a serviceType service that is able to play media of a specific \a mimeType that is encoded using the listed \a codecs while adhering to constraints @@ -299,13 +248,11 @@ QMediaServiceFeaturesInterface::Features QMediaServiceProvider::supportedFeature */ QMultimedia::SupportEstimate QMediaServiceProvider::hasSupport(const QByteArray &serviceType, const QString &mimeType, - const QStringList& codecs, - int flags) const + const QStringList& codecs) const { Q_UNUSED(serviceType); Q_UNUSED(mimeType); Q_UNUSED(codecs); - Q_UNUSED(flags); return QMultimedia::MaybeSupported; } @@ -320,10 +267,9 @@ QMultimedia::SupportEstimate QMediaServiceProvider::hasSupport(const QByteArray The resultant list is restricted to MIME types which can be supported given the constraints in \a flags. */ -QStringList QMediaServiceProvider::supportedMimeTypes(const QByteArray &serviceType, int flags) const +QStringList QMediaServiceProvider::supportedMimeTypes(const QByteArray &serviceType) const { Q_UNUSED(serviceType); - Q_UNUSED(flags); return QStringList(); } @@ -421,8 +367,7 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider() plug-ins. A media service provider plug-in may implement one or more of - QMediaServiceSupportedFormatsInterface, - QMediaServiceSupportedDevicesInterface, and QMediaServiceFeaturesInterface + QMediaServiceSupportedFormatsInterface and QMediaServiceSupportedDevicesInterface to identify the features it supports. */ @@ -504,27 +449,6 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider() Returns the default device for a \a service type. */ -/*! - \class QMediaServiceFeaturesInterface - \obsolete - \inmodule QtMultimedia - \brief The QMediaServiceFeaturesInterface class interface identifies - features supported by a media service plug-in. - - A QMediaServiceProviderPlugin may implement this interface. -*/ - -/*! - \fn QMediaServiceFeaturesInterface::~QMediaServiceFeaturesInterface() - - Destroys a media service features interface. -*/ -/*! - \fn QMediaServiceFeaturesInterface::supportedFeatures(const QByteArray &service) const - - Returns a set of features supported by a plug-in \a service. -*/ - QT_END_NAMESPACE #include "moc_qmediaserviceprovider_p.cpp" diff --git a/src/multimedia/qmediaserviceprovider_p.h b/src/multimedia/qmediaserviceprovider_p.h index a896bf4a2..61ae01c19 100644 --- a/src/multimedia/qmediaserviceprovider_p.h +++ b/src/multimedia/qmediaserviceprovider_p.h @@ -70,13 +70,10 @@ public: virtual QMediaService* requestService(const QByteArray &type) = 0; virtual void releaseService(QMediaService *service) = 0; - virtual QMediaServiceFeaturesInterface::Features supportedFeatures(const QMediaService *service) const; - virtual QMultimedia::SupportEstimate hasSupport(const QByteArray &serviceType, const QString &mimeType, - const QStringList& codecs, - int flags = 0) const; - virtual QStringList supportedMimeTypes(const QByteArray &serviceType, int flags = 0) const; + const QStringList& codecs) const; + virtual QStringList supportedMimeTypes(const QByteArray &serviceType) const; virtual QByteArray defaultDevice(const QByteArray &serviceType) const; virtual QList<QByteArray> devices(const QByteArray &serviceType) const; diff --git a/src/multimedia/qmediaserviceproviderplugin.h b/src/multimedia/qmediaserviceproviderplugin.h index c89a4fe4d..dcdc7c500 100644 --- a/src/multimedia/qmediaserviceproviderplugin.h +++ b/src/multimedia/qmediaserviceproviderplugin.h @@ -103,29 +103,6 @@ Q_DECLARE_INTERFACE(QMediaServiceSupportedDevicesInterface, QMediaServiceSupport // Required for QDoc workaround class QString; -struct Q_MULTIMEDIA_EXPORT QMediaServiceFeaturesInterface -{ - enum Feature { - LowLatencyPlayback = 0x01, - RecordingSupport = 0x02, - StreamPlayback = 0x04, - VideoSurface = 0x08 - }; - Q_DECLARE_FLAGS(Features, Feature) - - virtual ~QMediaServiceFeaturesInterface() {} - virtual QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const = 0; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QMediaServiceFeaturesInterface::Features) - -#define QMediaServiceFeaturesInterface_iid \ - "org.qt-project.qt.mediaservicefeatures/5.0" -Q_DECLARE_INTERFACE(QMediaServiceFeaturesInterface, QMediaServiceFeaturesInterface_iid) - -// Required for QDoc workaround -class QString; - class Q_MULTIMEDIA_EXPORT QMediaServiceProviderPlugin : public QObject, public QMediaServiceProviderFactoryInterface { Q_OBJECT diff --git a/src/plugins/android/src/qandroidmediaserviceplugin.cpp b/src/plugins/android/src/qandroidmediaserviceplugin.cpp index e8bc20ec2..99af8b3d4 100644 --- a/src/plugins/android/src/qandroidmediaserviceplugin.cpp +++ b/src/plugins/android/src/qandroidmediaserviceplugin.cpp @@ -82,20 +82,6 @@ void QAndroidMediaServicePlugin::release(QMediaService *service) delete service; } -QMediaServiceFeaturesInterface::Features QAndroidMediaServicePlugin::supportedFeatures(const QByteArray &service) const -{ - if (service == Q_MEDIASERVICE_MEDIAPLAYER) - return QMediaServiceFeaturesInterface::VideoSurface; - - if (service == Q_MEDIASERVICE_CAMERA) - return QMediaServiceFeaturesInterface::VideoSurface | QMediaServiceFeaturesInterface::RecordingSupport; - - if (service == Q_MEDIASERVICE_AUDIOSOURCE) - return QMediaServiceFeaturesInterface::RecordingSupport; - - return QMediaServiceFeaturesInterface::Features(); -} - QByteArray QAndroidMediaServicePlugin::defaultDevice(const QByteArray &service) const { if (service == Q_MEDIASERVICE_CAMERA && !QAndroidCameraSession::availableCameras().isEmpty()) diff --git a/src/plugins/android/src/qandroidmediaserviceplugin.h b/src/plugins/android/src/qandroidmediaserviceplugin.h index c1bf63bac..7320042d2 100644 --- a/src/plugins/android/src/qandroidmediaserviceplugin.h +++ b/src/plugins/android/src/qandroidmediaserviceplugin.h @@ -47,11 +47,9 @@ QT_BEGIN_NAMESPACE class QAndroidMediaServicePlugin : public QMediaServiceProviderPlugin , public QMediaServiceSupportedDevicesInterface - , public QMediaServiceFeaturesInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedDevicesInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "android_mediaservice.json") @@ -62,8 +60,6 @@ public: QMediaService* create(QString const& key) override; void release(QMediaService *service) override; - QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override; - QByteArray defaultDevice(const QByteArray &service) const override; QList<QByteArray> devices(const QByteArray &service) const override; QString deviceDescription(const QByteArray &service, const QByteArray &device) override; diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.h b/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.h index 5e4bd5376..07f30d3d6 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.h +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.h @@ -49,11 +49,9 @@ QT_BEGIN_NAMESPACE class AVFMediaPlayerServicePlugin : public QMediaServiceProviderPlugin , public QMediaServiceSupportedFormatsInterface - , public QMediaServiceFeaturesInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedFormatsInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "avfmediaplayer.json") public: @@ -62,7 +60,6 @@ public: QMediaService* create(QString const& key) override; void release(QMediaService *service) override; - QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override; QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const override; QStringList supportedMimeTypes() const override; diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.mm index 1216fc173..d91956e69 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayerserviceplugin.mm @@ -68,14 +68,6 @@ void AVFMediaPlayerServicePlugin::release(QMediaService *service) delete service; } -QMediaServiceFeaturesInterface::Features AVFMediaPlayerServicePlugin::supportedFeatures(const QByteArray &service) const -{ - if (service == Q_MEDIASERVICE_MEDIAPLAYER) - return QMediaServiceFeaturesInterface::VideoSurface; - else - return QMediaServiceFeaturesInterface::Features(); -} - QMultimedia::SupportEstimate AVFMediaPlayerServicePlugin::hasSupport(const QString &mimeType, const QStringList &codecs) const { Q_UNUSED(codecs); diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp index c54dc16d4..f8d9b5a37 100644 --- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp @@ -89,15 +89,6 @@ void CameraBinServicePlugin::release(QMediaService *service) delete service; } -QMediaServiceFeaturesInterface::Features CameraBinServicePlugin::supportedFeatures( - const QByteArray &service) const -{ - if (service == Q_MEDIASERVICE_CAMERA) - return QMediaServiceFeaturesInterface::VideoSurface; - - return QMediaServiceFeaturesInterface::Features(); -} - QByteArray CameraBinServicePlugin::defaultDevice(const QByteArray &service) const { return service == Q_MEDIASERVICE_CAMERA diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h index 79ec59685..2c1b1a207 100644 --- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h +++ b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h @@ -51,11 +51,9 @@ QT_BEGIN_NAMESPACE class CameraBinServicePlugin : public QMediaServiceProviderPlugin , public QMediaServiceSupportedDevicesInterface - , public QMediaServiceFeaturesInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedDevicesInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "camerabin.json") public: CameraBinServicePlugin(); @@ -64,8 +62,6 @@ public: QMediaService* create(const QString &key) override; void release(QMediaService *service) override; - QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override; - QByteArray defaultDevice(const QByteArray &service) const override; QList<QByteArray> devices(const QByteArray &service) const override; QString deviceDescription(const QByteArray &service, const QByteArray &device) override; diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp index f40cd2918..31f6c871c 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp @@ -71,15 +71,6 @@ void QGstreamerCaptureServicePlugin::release(QMediaService *service) } #if defined(USE_GSTREAMER_CAMERA) -QMediaServiceFeaturesInterface::Features QGstreamerCaptureServicePlugin::supportedFeatures( - const QByteArray &service) const -{ - if (service == Q_MEDIASERVICE_CAMERA) - return QMediaServiceFeaturesInterface::VideoSurface; - - return QMediaServiceFeaturesInterface::Features(); -} - QByteArray QGstreamerCaptureServicePlugin::defaultDevice(const QByteArray &service) const { return service == Q_MEDIASERVICE_CAMERA diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h index ece0b00e6..0acc01257 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h @@ -51,14 +51,12 @@ class QGstreamerCaptureServicePlugin : public QMediaServiceProviderPlugin #if defined(USE_GSTREAMER_CAMERA) , public QMediaServiceSupportedDevicesInterface - , public QMediaServiceFeaturesInterface #endif , public QMediaServiceSupportedFormatsInterface { Q_OBJECT #if defined(USE_GSTREAMER_CAMERA) Q_INTERFACES(QMediaServiceSupportedDevicesInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) #endif Q_INTERFACES(QMediaServiceSupportedFormatsInterface) #if defined(USE_GSTREAMER_CAMERA) @@ -71,8 +69,6 @@ public: void release(QMediaService *service) override; #if defined(USE_GSTREAMER_CAMERA) - QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override; - QByteArray defaultDevice(const QByteArray &service) const override; QList<QByteArray> devices(const QByteArray &service) const override; QString deviceDescription(const QByteArray &service, const QByteArray &device) override; diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp index 010009016..48f23b1f7 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp @@ -66,19 +66,6 @@ void QGstreamerPlayerServicePlugin::release(QMediaService *service) delete service; } -QMediaServiceFeaturesInterface::Features QGstreamerPlayerServicePlugin::supportedFeatures( - const QByteArray &service) const -{ - if (service == Q_MEDIASERVICE_MEDIAPLAYER) - return -#if QT_CONFIG(gstreamer_app) - QMediaServiceFeaturesInterface::StreamPlayback | -#endif - QMediaServiceFeaturesInterface::VideoSurface; - - return QMediaServiceFeaturesInterface::Features(); -} - QMultimedia::SupportEstimate QGstreamerPlayerServicePlugin::hasSupport(const QString &mimeType, const QStringList &codecs) const { diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h index 6cc7a7007..a1f7cc293 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.h @@ -50,19 +50,15 @@ QT_BEGIN_NAMESPACE class QGstreamerPlayerServicePlugin : public QMediaServiceProviderPlugin - , public QMediaServiceFeaturesInterface , public QMediaServiceSupportedFormatsInterface { Q_OBJECT - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_INTERFACES(QMediaServiceSupportedFormatsInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mediaplayer.json") public: QMediaService* create(const QString &key) override; void release(QMediaService *service) override; - QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override; - QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList &codecs) const override; QStringList supportedMimeTypes() const override; diff --git a/src/plugins/qnx/neutrinoserviceplugin.cpp b/src/plugins/qnx/neutrinoserviceplugin.cpp index 99d3fcc3d..25a26d28f 100644 --- a/src/plugins/qnx/neutrinoserviceplugin.cpp +++ b/src/plugins/qnx/neutrinoserviceplugin.cpp @@ -59,10 +59,4 @@ void NeutrinoServicePlugin::release(QMediaService *service) delete service; } -QMediaServiceFeaturesInterface::Features NeutrinoServicePlugin::supportedFeatures(const QByteArray &service) const -{ - Q_UNUSED(service); - return QMediaServiceFeaturesInterface::Features(); -} - QT_END_NAMESPACE diff --git a/src/plugins/qnx/neutrinoserviceplugin.h b/src/plugins/qnx/neutrinoserviceplugin.h index 0a239f75c..6fd9752ee 100644 --- a/src/plugins/qnx/neutrinoserviceplugin.h +++ b/src/plugins/qnx/neutrinoserviceplugin.h @@ -44,18 +44,15 @@ QT_BEGIN_NAMESPACE class NeutrinoServicePlugin - : public QMediaServiceProviderPlugin, - public QMediaServiceFeaturesInterface + : public QMediaServiceProviderPlugin { Q_OBJECT - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "neutrino_mediaservice.json") public: NeutrinoServicePlugin(); QMediaService *create(const QString &key) override; void release(QMediaService *service) override; - QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override; }; QT_END_NAMESPACE diff --git a/src/plugins/wmf/player/mfplayercontrol.h b/src/plugins/wmf/player/mfplayercontrol.h index 87e1a1f2d..f74f414da 100644 --- a/src/plugins/wmf/player/mfplayercontrol.h +++ b/src/plugins/wmf/player/mfplayercontrol.h @@ -91,6 +91,9 @@ public: void pause(); void stop(); + bool streamPlaybackSupported() const { return true; } + + private Q_SLOTS: void handleStatusChanged(); void handleVideoAvailable(); diff --git a/src/plugins/wmf/wmfserviceplugin.cpp b/src/plugins/wmf/wmfserviceplugin.cpp index 3e48cab2f..09cade82f 100644 --- a/src/plugins/wmf/wmfserviceplugin.cpp +++ b/src/plugins/wmf/wmfserviceplugin.cpp @@ -91,15 +91,6 @@ void WMFServicePlugin::release(QMediaService *service) releaseRefCount(); } -QMediaServiceFeaturesInterface::Features WMFServicePlugin::supportedFeatures( - const QByteArray &service) const -{ - if (service == Q_MEDIASERVICE_MEDIAPLAYER) - return QMediaServiceFeaturesInterface::StreamPlayback; - else - return QMediaServiceFeaturesInterface::Features(); -} - QByteArray WMFServicePlugin::defaultDevice(const QByteArray &) const { return QByteArray(); diff --git a/src/plugins/wmf/wmfserviceplugin.h b/src/plugins/wmf/wmfserviceplugin.h index d42cf25e1..a9a722043 100644 --- a/src/plugins/wmf/wmfserviceplugin.h +++ b/src/plugins/wmf/wmfserviceplugin.h @@ -48,11 +48,9 @@ QT_USE_NAMESPACE class WMFServicePlugin : public QMediaServiceProviderPlugin , public QMediaServiceSupportedDevicesInterface - , public QMediaServiceFeaturesInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedDevicesInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "wmf.json") public: diff --git a/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp index a05fee67b..c98d2a9e5 100644 --- a/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp +++ b/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp @@ -839,7 +839,7 @@ void tst_QMediaPlayer::debugEnums() void tst_QMediaPlayer::testSupportedMimeTypes() { - QStringList mimeList = QMediaPlayer::supportedMimeTypes(QMediaPlayer::LowLatency); + QStringList mimeList = QMediaPlayer::supportedMimeTypes(); // This is empty on some platforms, and not on others, so can't test something here at the moment. } @@ -850,7 +850,6 @@ void tst_QMediaPlayer::testQrc_data() QTest::addColumn<QMediaPlayer::MediaStatus>("status"); QTest::addColumn<QMediaPlayer::Error>("error"); QTest::addColumn<int>("errorCount"); - QTest::addColumn<bool>("hasStreamFeature"); QTest::addColumn<QString>("backendMediaContentScheme"); QTest::addColumn<bool>("backendHasStream"); @@ -858,7 +857,6 @@ void tst_QMediaPlayer::testQrc_data() << QMediaPlayer::InvalidMedia << QMediaPlayer::ResourceError << 1 // error count - << false // No StreamPlayback support << QString() // backend should not have got any media (empty URL scheme) << false; // backend should not have got any stream @@ -866,7 +864,6 @@ void tst_QMediaPlayer::testQrc_data() << QMediaPlayer::LoadingMedia << QMediaPlayer::NoError << 0 // error count - << false // No StreamPlayback support << QStringLiteral("file") // backend should have a got a temporary file << false; // backend should not have got any stream @@ -874,7 +871,6 @@ void tst_QMediaPlayer::testQrc_data() << QMediaPlayer::LoadingMedia << QMediaPlayer::NoError << 0 // error count - << true // StreamPlayback support << QStringLiteral("qrc") << true; // backend should have got a stream (QFile opened from the resource) } @@ -885,13 +881,9 @@ void tst_QMediaPlayer::testQrc() QFETCH(QMediaPlayer::MediaStatus, status); QFETCH(QMediaPlayer::Error, error); QFETCH(int, errorCount); - QFETCH(bool, hasStreamFeature); QFETCH(QString, backendMediaContentScheme); QFETCH(bool, backendHasStream); - if (hasStreamFeature) - mockProvider->setSupportedFeatures(QMediaServiceFeaturesInterface::StreamPlayback); - QMediaPlayer player; mockService->setState(QMediaPlayer::PlayingState, QMediaPlayer::NoMedia); diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp index a0e9f61ab..89a14f82c 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin2/mockserviceplugin2.cpp @@ -31,12 +31,10 @@ #include "../mockservice.h" class MockServicePlugin2 : public QMediaServiceProviderPlugin, - public QMediaServiceSupportedFormatsInterface, - public QMediaServiceFeaturesInterface + public QMediaServiceSupportedFormatsInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedFormatsInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mockserviceplugin2.json") public: [[nodiscard]] QStringList keys() const @@ -71,14 +69,6 @@ public: { return QStringList("audio/wav"); } - - [[nodiscard]] QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override - { - QMediaServiceFeaturesInterface::Features result; - if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)) - result |= QMediaServiceFeaturesInterface::LowLatencyPlayback; - return result; - } }; #include "mockserviceplugin2.moc" diff --git a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp index e56667550..4873b74e2 100644 --- a/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp +++ b/tests/auto/unit/qmediaserviceprovider/mockserviceplugin4/mockserviceplugin4.cpp @@ -31,12 +31,10 @@ #include "../mockservice.h" class MockServicePlugin4 : public QMediaServiceProviderPlugin, - public QMediaServiceSupportedFormatsInterface, - public QMediaServiceFeaturesInterface + public QMediaServiceSupportedFormatsInterface { Q_OBJECT Q_INTERFACES(QMediaServiceSupportedFormatsInterface) - Q_INTERFACES(QMediaServiceFeaturesInterface) Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "mockserviceplugin4.json") public: [[nodiscard]] QStringList keys() const @@ -72,14 +70,6 @@ public: { return QStringList() << "video/mp4" << "video/quicktime"; } - - [[nodiscard]] QMediaServiceFeaturesInterface::Features supportedFeatures(const QByteArray &service) const override - { - QMediaServiceFeaturesInterface::Features result; - if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)) - result |= QMediaServiceFeaturesInterface::StreamPlayback; - return result; - } }; #include "mockserviceplugin4.moc" diff --git a/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp b/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp index e94a9d7b1..2323bd990 100644 --- a/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp +++ b/tests/auto/unit/qmediaserviceprovider/tst_qmediaserviceprovider.cpp @@ -142,30 +142,30 @@ void tst_QMediaServiceProvider::testHasSupport() QCOMPARE(QMediaPlayer::hasSupport("audio/wav"), QMultimedia::ProbablySupported); //test low latency flag support - QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::LowLatency), + QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList()), QMultimedia::ProbablySupported); //plugin1 probably supports audio/ogg, it checked because it doesn't provide features iface - QCOMPARE(QMediaPlayer::hasSupport("audio/ogg", QStringList(), QMediaPlayer::LowLatency), + QCOMPARE(QMediaPlayer::hasSupport("audio/ogg", QStringList()), QMultimedia::ProbablySupported); //Plugin4 is not checked here, sine it's known not support low latency - QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::LowLatency), + QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList()), QMultimedia::MaybeSupported); //test streaming flag support - QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::StreamPlayback), + QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList()), QMultimedia::ProbablySupported); //Plugin2 is not checked here, sine it's known not support streaming - QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::StreamPlayback), + QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList()), QMultimedia::MaybeSupported); //ensure the correct media player plugin is chosen for mime type - QMediaPlayer simplePlayer(nullptr, QMediaPlayer::LowLatency); + QMediaPlayer simplePlayer(nullptr); QCOMPARE(simplePlayer.service()->objectName(), QLatin1String("MockServicePlugin2")); QMediaPlayer mediaPlayer; QVERIFY(mediaPlayer.service()->objectName() != QLatin1String("MockServicePlugin2")); - QMediaPlayer streamPlayer(nullptr, QMediaPlayer::StreamPlayback); + QMediaPlayer streamPlayer(nullptr); QCOMPARE(streamPlayer.service()->objectName(), QLatin1String("MockServicePlugin4")); } diff --git a/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h b/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h index 7be88a9fa..1683a3654 100644 --- a/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h +++ b/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h @@ -55,16 +55,6 @@ public: } } - QMediaServiceFeaturesInterface::Features supportedFeatures(const QMediaService *) const - { - return features; - } - - void setSupportedFeatures(QMediaServiceFeaturesInterface::Features f) - { - features = f; - } - QByteArray defaultDevice(const QByteArray &serviceType) const { if (serviceType == Q_MEDIASERVICE_CAMERA) @@ -91,7 +81,6 @@ public: QMediaService *service; bool deleteServiceOnRelease; - QMediaServiceFeaturesInterface::Features features; }; #endif // MOCKMEDIASERVICEPROVIDER_H |