diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-12-14 12:53:21 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-01-20 15:08:41 +0000 |
commit | 397cb94d6882940114cb6c96a88e8ac0b64203a4 (patch) | |
tree | d2ac9e1440a208e9fdf2f04d3b2f13d177021c89 /src/plugins/gstreamer | |
parent | 46381711557aad4f264470e555c77f7d6d07cbb9 (diff) |
Get rid of the unused resource policy and availability control
The only implementation of this was using some Nokia specific
library, that hasn't existed since 2012 anymore.
Change-Id: Ieaec2176ad8e4fc170bb5254944fffc41edccefa
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/gstreamer')
13 files changed, 12 insertions, 595 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro index 183ddf2d4..1fa3b3534 100644 --- a/src/plugins/gstreamer/camerabin/camerabin.pro +++ b/src/plugins/gstreamer/camerabin/camerabin.pro @@ -24,7 +24,6 @@ HEADERS += \ $$PWD/camerabinimageprocessing.h \ $$PWD/camerabinmetadata.h \ $$PWD/camerabinvideoencoder.h \ - $$PWD/camerabinresourcepolicy.h \ $$PWD/camerabincapturedestination.h \ $$PWD/camerabincapturebufferformat.h \ $$PWD/camerabinviewfindersettings.h \ @@ -45,7 +44,6 @@ SOURCES += \ $$PWD/camerabinmetadata.cpp \ $$PWD/camerabinrecorder.cpp \ $$PWD/camerabinvideoencoder.cpp \ - $$PWD/camerabinresourcepolicy.cpp \ $$PWD/camerabincapturedestination.cpp \ $$PWD/camerabinviewfindersettings.cpp \ $$PWD/camerabinviewfindersettings2.cpp \ diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp index 155887054..0d9d7ff84 100644 --- a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp +++ b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp @@ -43,7 +43,6 @@ #include "camerabinaudioencoder.h" #include "camerabinvideoencoder.h" #include "camerabinimageencoder.h" -#include "camerabinresourcepolicy.h" #include <QtCore/qdebug.h> #include <QtCore/qfile.h> @@ -70,14 +69,6 @@ CameraBinControl::CameraBinControl(CameraBinSession *session) connect(m_session, SIGNAL(error(int,QString)), SLOT(handleCameraError(int,QString))); - m_resourcePolicy = new CamerabinResourcePolicy(this); - connect(m_resourcePolicy, SIGNAL(resourcesGranted()), - SLOT(handleResourcesGranted())); - connect(m_resourcePolicy, SIGNAL(resourcesDenied()), - SLOT(handleResourcesLost())); - connect(m_resourcePolicy, SIGNAL(resourcesLost()), - SLOT(handleResourcesLost())); - connect(m_session, SIGNAL(busyChanged(bool)), SLOT(handleBusyChanged(bool))); } @@ -96,12 +87,6 @@ void CameraBinControl::setCaptureMode(QCamera::CaptureModes mode) if (m_session->captureMode() != mode) { m_session->setCaptureMode(mode); - if (m_state == QCamera::ActiveState) { - m_resourcePolicy->setResourceSet( - captureMode() == QCamera::CaptureStillImage ? - CamerabinResourcePolicy::ImageCaptureResources : - CamerabinResourcePolicy::VideoCaptureResources); - } emit captureModeChanged(mode); } } @@ -133,36 +118,17 @@ void CameraBinControl::setState(QCamera::State state) return; } - CamerabinResourcePolicy::ResourceSet resourceSet = CamerabinResourcePolicy::NoResources; - switch (state) { - case QCamera::UnloadedState: - resourceSet = CamerabinResourcePolicy::NoResources; - break; - case QCamera::LoadedState: - resourceSet = CamerabinResourcePolicy::LoadedResources; - break; - case QCamera::ActiveState: - resourceSet = captureMode() == QCamera::CaptureStillImage ? - CamerabinResourcePolicy::ImageCaptureResources : - CamerabinResourcePolicy::VideoCaptureResources; - break; - } - - m_resourcePolicy->setResourceSet(resourceSet); - - if (m_resourcePolicy->isResourcesGranted()) { - //postpone changing to Active if the session is nor ready yet - if (state == QCamera::ActiveState) { - if (m_session->isReady()) { - m_session->setState(state); - } else { + //postpone changing to Active if the session is nor ready yet + if (state == QCamera::ActiveState) { + if (m_session->isReady()) { + m_session->setState(state); + } else { #ifdef CAMEABIN_DEBUG - qDebug() << "Camera session is not ready yet, postpone activating"; + qDebug() << "Camera session is not ready yet, postpone activating"; #endif - } - } else - m_session->setState(state); - } + } + } else + m_session->setState(state); emit stateChanged(m_state); } @@ -193,50 +159,10 @@ void CameraBinControl::reloadLater() } } -void CameraBinControl::handleResourcesLost() -{ -#ifdef CAMEABIN_DEBUG - qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", m_state); -#endif - m_session->setState(QCamera::UnloadedState); -} - -void CameraBinControl::handleResourcesGranted() -{ -#ifdef CAMEABIN_DEBUG - qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", m_state); -#endif - - //camera will be started soon by delayedReload() - if (m_reloadPending && m_state == QCamera::ActiveState) - return; - - if (m_state == QCamera::ActiveState && m_session->isReady()) - m_session->setState(QCamera::ActiveState); - else if (m_state == QCamera::LoadedState) - m_session->setState(QCamera::LoadedState); -} - void CameraBinControl::handleBusyChanged(bool busy) { if (!busy && m_session->status() == QCamera::ActiveStatus) { if (m_state != QCamera::ActiveState) { - //handle delayed stop()/unload() because of busy camera - - CamerabinResourcePolicy::ResourceSet resourceSet = CamerabinResourcePolicy::NoResources; - switch (m_state) { - case QCamera::UnloadedState: - resourceSet = CamerabinResourcePolicy::NoResources; - break; - case QCamera::LoadedState: - resourceSet = CamerabinResourcePolicy::LoadedResources; - break; - default: - Q_ASSERT(false); - break; - } - - m_resourcePolicy->setResourceSet(resourceSet); m_session->setState(m_state); } else if (m_reloadPending) { //handle delayed reload because of busy camera @@ -259,11 +185,8 @@ void CameraBinControl::delayedReload() #endif if (m_reloadPending) { m_reloadPending = false; - if (m_state == QCamera::ActiveState && - m_session->isReady() && - m_resourcePolicy->isResourcesGranted()) { + if (m_state == QCamera::ActiveState && m_session->isReady()) m_session->setState(QCamera::ActiveState); - } } } diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.h b/src/plugins/gstreamer/camerabin/camerabincontrol.h index 56c02dad4..7210fa090 100644 --- a/src/plugins/gstreamer/camerabin/camerabincontrol.h +++ b/src/plugins/gstreamer/camerabin/camerabincontrol.h @@ -47,8 +47,6 @@ QT_BEGIN_NAMESPACE -class CamerabinResourcePolicy; - class CameraBinControl : public QCameraControl { Q_OBJECT @@ -71,8 +69,6 @@ public: bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const override; bool viewfinderColorSpaceConversion() const; - CamerabinResourcePolicy *resourcePolicy() { return m_resourcePolicy; } - public slots: void reloadLater(); void setViewfinderColorSpaceConversion(bool enabled); @@ -80,9 +76,6 @@ public slots: private slots: void delayedReload(); - void handleResourcesGranted(); - void handleResourcesLost(); - void handleBusyChanged(bool); void handleCameraError(int error, const QString &errorString); @@ -91,7 +84,6 @@ private: CameraBinSession *m_session; QCamera::State m_state; - CamerabinResourcePolicy *m_resourcePolicy; bool m_reloadPending; }; diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp index b164bc31a..aac5c2c94 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp @@ -42,7 +42,6 @@ #include "camerabincapturedestination.h" #include "camerabincapturebufferformat.h" #include "camerabinsession.h" -#include "camerabinresourcepolicy.h" #include <private/qgstvideobuffer_p.h> #include <private/qvideosurfacegstsink_p.h> #include <private/qgstutils_p.h> @@ -70,7 +69,6 @@ CameraBinImageCapture::CameraBinImageCapture(CameraBinSession *session) connect(m_session, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateState())); connect(m_session, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int))); connect(m_session, SIGNAL(imageCaptured(int,QImage)), this, SIGNAL(imageCaptured(int,QImage))); - connect(m_session->cameraControl()->resourcePolicy(), SIGNAL(canCaptureChanged()), this, SLOT(updateState())); m_session->bus()->installMessageFilter(this); } @@ -106,8 +104,7 @@ void CameraBinImageCapture::cancelCapture() void CameraBinImageCapture::updateState() { - bool ready = m_session->status() == QCamera::ActiveStatus - && m_session->cameraControl()->resourcePolicy()->canCapture(); + bool ready = m_session->status() == QCamera::ActiveStatus; if (m_ready != ready) { #ifdef DEBUG_CAPTURE qDebug() << "readyForCaptureChanged" << ready; diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp index b3505231b..a83971226 100644 --- a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp @@ -39,7 +39,6 @@ #include "camerabinrecorder.h" #include "camerabincontrol.h" -#include "camerabinresourcepolicy.h" #include "camerabinaudioencoder.h" #include "camerabinvideoencoder.h" #include "camerabincontainer.h" @@ -60,8 +59,6 @@ CameraBinRecorder::CameraBinRecorder(CameraBinSession *session) connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); - connect(m_session->cameraControl()->resourcePolicy(), SIGNAL(canCaptureChanged()), - this, SLOT(updateStatus())); } CameraBinRecorder::~CameraBinRecorder() @@ -99,11 +96,7 @@ void CameraBinRecorder::updateStatus() if (sessionStatus == QCamera::ActiveStatus && m_session->captureMode().testFlag(QCamera::CaptureVideo)) { - if (!m_session->cameraControl()->resourcePolicy()->canCapture()) { - m_status = QMediaRecorder::UnavailableStatus; - m_state = QMediaRecorder::StoppedState; - m_session->stopVideoRecording(); - } else if (m_state == QMediaRecorder::RecordingState) { + if (m_state == QMediaRecorder::RecordingState) { m_status = QMediaRecorder::RecordingStatus; } else { m_status = m_session->isBusy() ? @@ -256,8 +249,6 @@ void CameraBinRecorder::setState(QMediaRecorder::State state) if (m_session->status() != QCamera::ActiveStatus) { emit error(QMediaRecorder::ResourceError, tr("Service has not been started")); - } else if (!m_session->cameraControl()->resourcePolicy()->canCapture()) { - emit error(QMediaRecorder::ResourceError, tr("Recording permissions are not available")); } else { m_session->recordVideo(); m_state = state; diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp deleted file mode 100644 index 6da86e569..000000000 --- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp +++ /dev/null @@ -1,242 +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 "QtMultimedia/private/qtmultimediaglobal_p.h" -#include "camerabinresourcepolicy.h" -//#define DEBUG_RESOURCE_POLICY -#include <QtCore/qdebug.h> -#include <QtCore/qset.h> - -#if QT_CONFIG(resourcepolicy) -#include <policy/resource.h> -#include <policy/resources.h> -#include <policy/resource-set.h> -#endif - -QT_BEGIN_NAMESPACE - -CamerabinResourcePolicy::CamerabinResourcePolicy(QObject *parent) : - QObject(parent), - m_resourceSet(NoResources), - m_releasingResources(false), - m_canCapture(false) -{ -#if QT_CONFIG(resourcepolicy) - //loaded resource set is also kept requested for image and video capture sets - m_resource = new ResourcePolicy::ResourceSet("camera"); - m_resource->setAlwaysReply(); - m_resource->initAndConnect(); - - connect(m_resource, SIGNAL(resourcesGranted(QList<ResourcePolicy::ResourceType>)), - SLOT(handleResourcesGranted())); - connect(m_resource, SIGNAL(resourcesDenied()), SIGNAL(resourcesDenied())); - connect(m_resource, SIGNAL(lostResources()), SLOT(handleResourcesLost())); - connect(m_resource, SIGNAL(resourcesReleased()), SLOT(handleResourcesReleased())); - connect(m_resource, SIGNAL(resourcesBecameAvailable(QList<ResourcePolicy::ResourceType>)), - this, SLOT(resourcesAvailable())); - connect(m_resource, SIGNAL(updateOK()), this, SLOT(updateCanCapture())); -#endif -} - -CamerabinResourcePolicy::~CamerabinResourcePolicy() -{ -#if QT_CONFIG(resourcepolicy) - //ensure the resources are released - if (m_resourceSet != NoResources) - setResourceSet(NoResources); - - //don't delete the resource set until resources are released - if (m_releasingResources) { - m_resource->connect(m_resource, SIGNAL(resourcesReleased()), - SLOT(deleteLater())); - } else { - delete m_resource; - m_resource = 0; - } -#endif -} - -CamerabinResourcePolicy::ResourceSet CamerabinResourcePolicy::resourceSet() const -{ - return m_resourceSet; -} - -void CamerabinResourcePolicy::setResourceSet(CamerabinResourcePolicy::ResourceSet set) -{ - CamerabinResourcePolicy::ResourceSet oldSet = m_resourceSet; - m_resourceSet = set; - -#ifdef DEBUG_RESOURCE_POLICY - qDebug() << Q_FUNC_INFO << set; -#endif - -#if QT_CONFIG(resourcepolicy) - QSet<ResourcePolicy::ResourceType> requestedTypes; - - switch (set) { - case NoResources: - break; - case LoadedResources: - requestedTypes << ResourcePolicy::LensCoverType //to detect lens cover is opened/closed - << ResourcePolicy::VideoRecorderType; //to open camera device - break; - case ImageCaptureResources: - requestedTypes << ResourcePolicy::LensCoverType - << ResourcePolicy::VideoPlaybackType - << ResourcePolicy::VideoRecorderType - << ResourcePolicy::LedsType; - break; - case VideoCaptureResources: - requestedTypes << ResourcePolicy::LensCoverType - << ResourcePolicy::VideoPlaybackType - << ResourcePolicy::VideoRecorderType - << ResourcePolicy::AudioPlaybackType - << ResourcePolicy::AudioRecorderType - << ResourcePolicy::LedsType; - break; - } - - QSet<ResourcePolicy::ResourceType> currentTypes; - const auto resources = m_resource->resources(); - currentTypes.reserve(resources.size()); - for (ResourcePolicy::Resource *resource : resources) - currentTypes << resource->type(); - - const auto diffCurrentWithRequested = currentTypes - requestedTypes; - for (ResourcePolicy::ResourceType resourceType : diffCurrentWithRequested) - m_resource->deleteResource(resourceType); - - const auto diffRequestedWithCurrent = requestedTypes - currentTypes; - for (ResourcePolicy::ResourceType resourceType : diffRequestedWithCurrent) { - if (resourceType == ResourcePolicy::LensCoverType) { - ResourcePolicy::LensCoverResource *lensCoverResource = new ResourcePolicy::LensCoverResource; - lensCoverResource->setOptional(true); - m_resource->addResourceObject(lensCoverResource); - } else if (resourceType == ResourcePolicy::AudioPlaybackType) { - ResourcePolicy::Resource *resource = new ResourcePolicy::AudioResource; - resource->setOptional(true); - m_resource->addResourceObject(resource); - } else if (resourceType == ResourcePolicy::AudioRecorderType) { - ResourcePolicy::Resource *resource = new ResourcePolicy::AudioRecorderResource; - resource->setOptional(true); - m_resource->addResourceObject(resource); - } else { - m_resource->addResource(resourceType); - } - } - - m_resource->update(); - if (set != NoResources) { - m_resource->acquire(); - } else { - if (oldSet != NoResources) { - m_releasingResources = true; - m_resource->release(); - } - } -#else - Q_UNUSED(oldSet); - updateCanCapture(); -#endif -} - -bool CamerabinResourcePolicy::isResourcesGranted() const -{ -#if QT_CONFIG(resourcepolicy) - const auto resources = m_resource->resources(); - for (ResourcePolicy::Resource *resource : resources) - if (!resource->isOptional() && !resource->isGranted()) - return false; -#endif - return true; -} - -void CamerabinResourcePolicy::handleResourcesLost() -{ - updateCanCapture(); - emit resourcesLost(); -} - -void CamerabinResourcePolicy::handleResourcesGranted() -{ - updateCanCapture(); - emit resourcesGranted(); -} - -void CamerabinResourcePolicy::handleResourcesReleased() -{ -#if QT_CONFIG(resourcepolicy) -#ifdef DEBUG_RESOURCE_POLICY - qDebug() << Q_FUNC_INFO; -#endif - m_releasingResources = false; -#endif - updateCanCapture(); -} - -void CamerabinResourcePolicy::resourcesAvailable() -{ -#if QT_CONFIG(resourcepolicy) - if (m_resourceSet != NoResources) { - m_resource->acquire(); - } -#endif -} - -bool CamerabinResourcePolicy::canCapture() const -{ - return m_canCapture; -} - -void CamerabinResourcePolicy::updateCanCapture() -{ - const bool wasAbleToRecord = m_canCapture; - m_canCapture = (m_resourceSet == VideoCaptureResources) || (m_resourceSet == ImageCaptureResources); -#if QT_CONFIG(resourcepolicy) - const auto resources = m_resource->resources(); - for (ResourcePolicy::Resource *resource : resources) { - if (resource->type() != ResourcePolicy::LensCoverType) - m_canCapture = m_canCapture && resource->isGranted(); - } -#endif - if (wasAbleToRecord != m_canCapture) - emit canCaptureChanged(); -} - -QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h deleted file mode 100644 index c54595bcc..000000000 --- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h +++ /dev/null @@ -1,95 +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 CAMERARESOURCEPOLICY_H -#define CAMERARESOURCEPOLICY_H - -#include <QtCore/qobject.h> - -namespace ResourcePolicy { -class ResourceSet; -}; - -QT_BEGIN_NAMESPACE - -class CamerabinResourcePolicy : public QObject -{ - Q_OBJECT -public: - enum ResourceSet { - NoResources, - LoadedResources, - ImageCaptureResources, - VideoCaptureResources - }; - - CamerabinResourcePolicy(QObject *parent); - ~CamerabinResourcePolicy(); - - ResourceSet resourceSet() const; - void setResourceSet(ResourceSet set); - - bool isResourcesGranted() const; - - bool canCapture() const; - -Q_SIGNALS: - void resourcesDenied(); - void resourcesGranted(); - void resourcesLost(); - void canCaptureChanged(); - -private Q_SLOTS: - void handleResourcesLost(); - void handleResourcesGranted(); - void handleResourcesReleased(); - void resourcesAvailable(); - void updateCanCapture(); - - -private: - ResourceSet m_resourceSet; - ResourcePolicy::ResourceSet *m_resource; - bool m_releasingResources; - bool m_canCapture; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri index d0c5c7bdd..c81a65c05 100644 --- a/src/plugins/gstreamer/common.pri +++ b/src/plugins/gstreamer/common.pri @@ -7,9 +7,6 @@ qtHaveModule(widgets) { QMAKE_USE += gstreamer -qtConfig(resourcepolicy): \ - QMAKE_USE += libresourceqt5 - qtConfig(gstreamer_app): \ QMAKE_USE += gstreamer_app diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro index 8150d8f5b..c9dadd979 100644 --- a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro +++ b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro @@ -8,14 +8,12 @@ HEADERS += \ $$PWD/qgstreamerplayerservice.h \ $$PWD/qgstreamerstreamscontrol.h \ $$PWD/qgstreamermetadataprovider.h \ - $$PWD/qgstreameravailabilitycontrol.h \ $$PWD/qgstreamerplayerserviceplugin.h SOURCES += \ $$PWD/qgstreamerplayerservice.cpp \ $$PWD/qgstreamerstreamscontrol.cpp \ $$PWD/qgstreamermetadataprovider.cpp \ - $$PWD/qgstreameravailabilitycontrol.cpp \ $$PWD/qgstreamerplayerserviceplugin.cpp OTHER_FILES += \ diff --git a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp deleted file mode 100644 index d2bfbb03a..000000000 --- a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.cpp +++ /dev/null @@ -1,64 +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 "qgstreameravailabilitycontrol.h" -#include <private/qmediaresourceset_p.h> - -QT_BEGIN_NAMESPACE - -QGStreamerAvailabilityControl::QGStreamerAvailabilityControl( - QMediaPlayerResourceSetInterface *resources, QObject *parent) - : QMediaAvailabilityControl(parent) - , m_resources(resources) -{ - Q_ASSERT(m_resources); - connect(m_resources, SIGNAL(availabilityChanged(bool)), this, SLOT(handleAvailabilityChanged())); -} - -void QGStreamerAvailabilityControl::handleAvailabilityChanged() -{ - emit availabilityChanged(this->availability()); -} - -QMultimedia::AvailabilityStatus QGStreamerAvailabilityControl::availability() const -{ - return m_resources->isAvailable() ? QMultimedia::Available : QMultimedia::Busy; -} - -QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h deleted file mode 100644 index e100fccc8..000000000 --- a/src/plugins/gstreamer/mediaplayer/qgstreameravailabilitycontrol.h +++ /dev/null @@ -1,65 +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 QGSTREAMERAVAILABILITYCONTROL_H -#define QGSTREAMERAVAILABILITYCONTROL_H - -#include <QObject> -#include <qmediaavailabilitycontrol.h> - -QT_BEGIN_NAMESPACE - -class QMediaPlayerResourceSetInterface; -class QGStreamerAvailabilityControl : public QMediaAvailabilityControl -{ - Q_OBJECT -public: - QGStreamerAvailabilityControl(QMediaPlayerResourceSetInterface *resources, QObject *parent = 0); - QMultimedia::AvailabilityStatus availability() const override; - -private Q_SLOTS: - void handleAvailabilityChanged(); - -private: - QMediaPlayerResourceSetInterface *m_resources = nullptr; -}; - -QT_END_NAMESPACE - -#endif // QGSTREAMERAVAILABILITYCONTROL_H diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp index 4bf4a0a57..320d6801c 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp @@ -47,7 +47,6 @@ #include "qgstreamerplayerservice.h" #include "qgstreamermetadataprovider.h" -#include "qgstreameravailabilitycontrol.h" #if defined(HAVE_WIDGETS) #include <private/qgstreamervideowidget_p.h> @@ -63,7 +62,6 @@ #include <private/qmediaplaylistnavigator_p.h> #include <qmediaplaylist.h> -#include <private/qmediaresourceset_p.h> QT_BEGIN_NAMESPACE @@ -74,7 +72,6 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent) m_control = new QGstreamerPlayerControl(m_session, this); m_metaData = new QGstreamerMetaDataProvider(m_session, this); m_streamsControl = new QGstreamerStreamsControl(m_session,this); - m_availabilityControl = new QGStreamerAvailabilityControl(m_control->resources(), this); m_videoRenderer = new QGstreamerVideoRenderer(this); m_videoWindow = new QGstreamerVideoWindow(this); // If the GStreamer video sink is not available, don't provide the video window control since @@ -112,9 +109,6 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name) if (qstrcmp(name,QMediaStreamsControl_iid) == 0) return m_streamsControl; - if (qstrcmp(name, QMediaAvailabilityControl_iid) == 0) - return m_availabilityControl; - if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0) { if (!m_videoProbeControl) { increaseVideoRef(); @@ -177,17 +171,11 @@ void QGstreamerPlayerService::releaseControl(QMediaControl *control) void QGstreamerPlayerService::increaseVideoRef() { m_videoReferenceCount++; - if (m_videoReferenceCount == 1) { - m_control->resources()->setVideoEnabled(true); - } } void QGstreamerPlayerService::decreaseVideoRef() { m_videoReferenceCount--; - if (m_videoReferenceCount == 0) { - m_control->resources()->setVideoEnabled(false); - } } QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h index f88f0ae38..3d4923d93 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h @@ -77,7 +77,6 @@ private: QGstreamerPlayerSession *m_session = nullptr; QGstreamerMetaDataProvider *m_metaData = nullptr; QGstreamerStreamsControl *m_streamsControl = nullptr; - QGStreamerAvailabilityControl *m_availabilityControl = nullptr; QGstreamerAudioProbeControl *m_audioProbeControl = nullptr; QGstreamerVideoProbeControl *m_videoProbeControl = nullptr; |