diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-01-19 17:37:31 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-01-29 08:46:58 +0000 |
commit | efc1d31a228a8f3466e5e9e9ff1154fd41c7a7f3 (patch) | |
tree | e4dfce2bc2b0ef7f1b41ecf623df3eb524325014 /src | |
parent | 27196488d8016d920da84cb6eba33b90c606d778 (diff) |
Get rid of QVideoWidgetControl
QVideoWindowControl offers more or less the same functionality,
as both require a native surface to use for an overlay.
This should in the longer term be re-architected towards a
"native surface" interface for rendering. And the only platforms
that did try to implement this were gstreamer and AVFoundation.
Change-Id: I3adcc38dde9ccd20273c7a7fb1712ce97bbdad48
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
18 files changed, 4 insertions, 1478 deletions
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp index 46327e3d6..6308b5eb0 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp @@ -42,7 +42,6 @@ #include "qmediaservice.h" #include "qmediaplayer.h" #include "qabstractvideosurface.h" -#include "qvideowidgetcontrol.h" #include "qvideowindowcontrol.h" #include "qgraphicsvideoitem.h" #include "qmediaplaylist.h" @@ -186,14 +185,6 @@ void VideoExample::VideoSurface() //! [GraphicsVideoItem Surface] } -void VideoExample::VideoWidgetControl() -{ - //! [Video widget control] - QVideoWidgetControl *widgetControl = mediaService->requestControl<QVideoWidgetControl *>(); - layout->addWidget(widgetControl->videoWidget()); - //! [Video widget control] -} - void VideoExample::VideoWindowControl() { //! [Video window control] diff --git a/src/multimedia/qmediaserviceproviderplugin.h b/src/multimedia/qmediaserviceproviderplugin.h index dcdc7c500..a7eedd63f 100644 --- a/src/multimedia/qmediaserviceproviderplugin.h +++ b/src/multimedia/qmediaserviceproviderplugin.h @@ -119,7 +119,7 @@ public: Optional Controls: QAudioDeviceControl Video Output Controls (used by QWideoWidget and QGraphicsVideoItem): Required: QVideoOutputControl - Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl + Optional: QVideoWindowControl, QVideoRendererControl */ #define Q_MEDIASERVICE_MEDIAPLAYER "org.qt-project.qt.mediaplayer" @@ -143,7 +143,7 @@ public: Recommended: QAudioEncoderSettingsControl, QVideoEncoderSettingsControl, QMediaContainerControl Viewfinder Video Output Controls (used by QCameraViewfinder and QGraphicsVideoItem): Required: QVideoOutputControl - Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl + Optional: QVideoWindowControl, QVideoRendererControl */ #define Q_MEDIASERVICE_CAMERA "org.qt-project.qt.camera" diff --git a/src/multimediawidgets/.prev_CMakeLists.txt b/src/multimediawidgets/.prev_CMakeLists.txt index 143773f31..ba9460457 100644 --- a/src/multimediawidgets/.prev_CMakeLists.txt +++ b/src/multimediawidgets/.prev_CMakeLists.txt @@ -9,7 +9,6 @@ qt_add_module(MultimediaWidgets qpaintervideosurface.cpp qpaintervideosurface_p.h qtmultimediawidgetdefs.h qvideowidget.cpp qvideowidget.h qvideowidget_p.h - qvideowidgetcontrol.cpp qvideowidgetcontrol.h LIBRARIES Qt::MultimediaPrivate Qt::WidgetsPrivate @@ -37,23 +36,3 @@ qt_extend_target(MultimediaWidgets CONDITION QT_FEATURE_graphicsview SOURCES qgraphicsvideoitem.cpp qgraphicsvideoitem.h ) - -qt_extend_target(MultimediaWidgets CONDITION QT_FEATURE_gstreamer - SOURCES - platform/gstreamer/qgstreamervideowidget.cpp platform/gstreamer/qgstreamervideowidget_p.h - LIBRARIES - gstreamer -) - -qt_extend_target(MultimediaWidgets CONDITION APPLE - SOURCES - platform/darwin/avfvideowidget.mm platform/darwin/avfvideowidget_p.h - platform/darwin/avfvideowidgetcontrol.mm platform/darwin/avfvideowidgetcontrol_p.h - PUBLIC_LIBRARIES - ${FWCoreFoundation} - ${FWCoreVideo} - ${FWFoundation} - ${FWMetal} - ${FWQuartzCore} - AVFoundation::AVFoundation -) diff --git a/src/multimediawidgets/CMakeLists.txt b/src/multimediawidgets/CMakeLists.txt index 42c8df69c..ba9460457 100644 --- a/src/multimediawidgets/CMakeLists.txt +++ b/src/multimediawidgets/CMakeLists.txt @@ -9,7 +9,6 @@ qt_add_module(MultimediaWidgets qpaintervideosurface.cpp qpaintervideosurface_p.h qtmultimediawidgetdefs.h qvideowidget.cpp qvideowidget.h qvideowidget_p.h - qvideowidgetcontrol.cpp qvideowidgetcontrol.h LIBRARIES Qt::MultimediaPrivate Qt::WidgetsPrivate @@ -37,21 +36,3 @@ qt_extend_target(MultimediaWidgets CONDITION QT_FEATURE_graphicsview SOURCES qgraphicsvideoitem.cpp qgraphicsvideoitem.h ) - -qt_extend_target(MultimediaWidgets CONDITION QT_FEATURE_gstreamer - SOURCES - platform/gstreamer/qgstreamervideowidget.cpp platform/gstreamer/qgstreamervideowidget_p.h -) - -qt_extend_target(MultimediaWidgets CONDITION APPLE - SOURCES - platform/darwin/avfvideowidget.mm platform/darwin/avfvideowidget_p.h - platform/darwin/avfvideowidgetcontrol.mm platform/darwin/avfvideowidgetcontrol_p.h - PUBLIC_LIBRARIES - ${FWCoreFoundation} - ${FWCoreVideo} - ${FWFoundation} - ${FWMetal} - ${FWQuartzCore} - AVFoundation::AVFoundation -) diff --git a/src/multimediawidgets/multimediawidgets.pro b/src/multimediawidgets/multimediawidgets.pro index 555606997..2a9377872 100644 --- a/src/multimediawidgets/multimediawidgets.pro +++ b/src/multimediawidgets/multimediawidgets.pro @@ -10,12 +10,10 @@ HEADERS += \ qvideowidget_p.h \ qpaintervideosurface_p.h \ qtmultimediawidgetdefs.h \ - qvideowidgetcontrol.h \ qvideowidget.h SOURCES += \ qpaintervideosurface.cpp \ - qvideowidgetcontrol.cpp \ qvideowidget.cpp qtConfig(graphicsview) { @@ -23,6 +21,4 @@ qtConfig(graphicsview) { HEADERS += qgraphicsvideoitem.h } -include(platform/platform.pri) - load(qt_module) diff --git a/src/multimediawidgets/platform/darwin/avfvideowidget.mm b/src/multimediawidgets/platform/darwin/avfvideowidget.mm deleted file mode 100644 index 874751ec1..000000000 --- a/src/multimediawidgets/platform/darwin/avfvideowidget.mm +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). -** 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 "avfvideowidget_p.h" - -#import <AVFoundation/AVFoundation.h> -#import <QuartzCore/CATransaction.h> - -#if defined(Q_OS_MACOS) -#import <AppKit/AppKit.h> -#else -#import <UIKit/UIKit.h> -#endif - -#include <QtCore/QDebug> -#include <QtGui/QResizeEvent> -#include <QtGui/QPaintEvent> -#include <QtGui/QPainter> - -QT_USE_NAMESPACE - -AVFVideoWidget::AVFVideoWidget(QWidget *parent) - : QWidget(parent) - , m_aspectRatioMode(Qt::KeepAspectRatio) - , m_playerLayer(nullptr) - , m_nativeView(nullptr) -{ - setAutoFillBackground(false); -} - -AVFVideoWidget::~AVFVideoWidget() -{ -#ifdef QT_DEBUG_AVF - qDebug() << Q_FUNC_INFO; -#endif - - if (m_playerLayer) { - [m_playerLayer removeFromSuperlayer]; - [m_playerLayer release]; - } -} - -QSize AVFVideoWidget::sizeHint() const -{ - return m_nativeSize; -} - -Qt::AspectRatioMode AVFVideoWidget::aspectRatioMode() const -{ - return m_aspectRatioMode; -} - -void AVFVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - if (m_aspectRatioMode != mode) { - m_aspectRatioMode = mode; - - updateAspectRatio(); - } -} - -void AVFVideoWidget::setPlayerLayer(AVPlayerLayer *layer) -{ - if (m_playerLayer == layer) - return; - - if (!m_nativeView) { - //make video widget a native window -#if defined(Q_OS_OSX) - m_nativeView = (NSView*)this->winId(); - [m_nativeView setWantsLayer:YES]; -#else - m_nativeView = (UIView*)this->winId(); -#endif - } - - if (m_playerLayer) { - [m_playerLayer removeFromSuperlayer]; - [m_playerLayer release]; - } - - m_playerLayer = layer; - - CALayer *nativeLayer = [m_nativeView layer]; - - if (layer) { - [layer retain]; - - m_nativeSize = QSize(m_playerLayer.bounds.size.width, - m_playerLayer.bounds.size.height); - - updateAspectRatio(); - [nativeLayer addSublayer:m_playerLayer]; - updatePlayerLayerBounds(this->size()); - } -#ifdef QT_DEBUG_AVF - NSArray *sublayers = [nativeLayer sublayers]; - qDebug() << "playerlayer: " << "at z:" << [m_playerLayer zPosition] - << " frame: " << m_playerLayer.frame.size.width << "x" << m_playerLayer.frame.size.height; - qDebug() << "superlayer: " << "at z:" << [nativeLayer zPosition] - << " frame: " << nativeLayer.frame.size.width << "x" << nativeLayer.frame.size.height; - int i = 0; - for (CALayer *layer in sublayers) { - qDebug() << "layer " << i << ": at z:" << [layer zPosition] - << " frame: " << layer.frame.size.width << "x" << layer.frame.size.height; - i++; - } -#endif - -} - -void AVFVideoWidget::resizeEvent(QResizeEvent *event) -{ - updatePlayerLayerBounds(event->size()); - QWidget::resizeEvent(event); -} - -void AVFVideoWidget::paintEvent(QPaintEvent *event) -{ - QPainter painter(this); - painter.fillRect(rect(), Qt::black); - - QWidget::paintEvent(event); -} - -void AVFVideoWidget::updateAspectRatio() -{ - if (m_playerLayer) { - switch (m_aspectRatioMode) { - case Qt::IgnoreAspectRatio: - [m_playerLayer setVideoGravity:AVLayerVideoGravityResize]; - break; - case Qt::KeepAspectRatio: - [m_playerLayer setVideoGravity:AVLayerVideoGravityResizeAspect]; - break; - case Qt::KeepAspectRatioByExpanding: - [m_playerLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill]; - break; - default: - break; - } - } -} - -void AVFVideoWidget::updatePlayerLayerBounds(const QSize &size) -{ - [CATransaction begin]; - [CATransaction setDisableActions: YES]; // disable animation/flicks - m_playerLayer.bounds = QRect(QPoint(0, 0), size).toCGRect(); - [CATransaction commit]; -} diff --git a/src/multimediawidgets/platform/darwin/avfvideowidget_p.h b/src/multimediawidgets/platform/darwin/avfvideowidget_p.h deleted file mode 100644 index dbbe343ec..000000000 --- a/src/multimediawidgets/platform/darwin/avfvideowidget_p.h +++ /dev/null @@ -1,96 +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 AVFVIDEOWIDGET_H -#define AVFVIDEOWIDGET_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtWidgets/QWidget> - -@class AVPlayerLayer; -#if defined(Q_OS_OSX) -@class NSView; -#else -@class UIView; -#endif - -QT_BEGIN_NAMESPACE - -class AVFVideoWidget : public QWidget -{ -public: - AVFVideoWidget(QWidget *parent); - virtual ~AVFVideoWidget(); - - QSize sizeHint() const override; - Qt::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(Qt::AspectRatioMode mode); - void setPlayerLayer(AVPlayerLayer *layer); - -protected: - void resizeEvent(QResizeEvent *) override; - void paintEvent(QPaintEvent *) override; - -private: - void updateAspectRatio(); - void updatePlayerLayerBounds(const QSize &size); - - QSize m_nativeSize; - Qt::AspectRatioMode m_aspectRatioMode; - AVPlayerLayer *m_playerLayer; -#if defined(Q_OS_OSX) - NSView *m_nativeView; -#else - UIView *m_nativeView; -#endif -}; - -QT_END_NAMESPACE - -#endif // AVFVIDEOWIDGET_H diff --git a/src/multimediawidgets/platform/darwin/avfvideowidgetcontrol.mm b/src/multimediawidgets/platform/darwin/avfvideowidgetcontrol.mm deleted file mode 100644 index ec1c04a09..000000000 --- a/src/multimediawidgets/platform/darwin/avfvideowidgetcontrol.mm +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). -** 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 "avfvideowidgetcontrol_p.h" -#include "avfvideowidget_p.h" - -#ifdef QT_DEBUG_AVF -#include <QtCore/QDebug> -#endif - -#import <AVFoundation/AVFoundation.h> - -QT_USE_NAMESPACE - -AVFVideoWidgetControl::AVFVideoWidgetControl(QObject *parent) - : QVideoWidgetControl(parent) - , m_fullscreen(false) - , m_brightness(0) - , m_contrast(0) - , m_hue(0) - , m_saturation(0) -{ - m_videoWidget = new AVFVideoWidget(nullptr); -} - -AVFVideoWidgetControl::~AVFVideoWidgetControl() -{ -#ifdef QT_DEBUG_AVF - qDebug() << Q_FUNC_INFO; -#endif - delete m_videoWidget; -} - -void AVFVideoWidgetControl::setLayer(void *playerLayer) -{ -#ifdef QT_DEBUG_AVF - qDebug() << Q_FUNC_INFO << playerLayer; -#endif - - m_videoWidget->setPlayerLayer(static_cast<AVPlayerLayer*>(playerLayer)); - -} - -QWidget *AVFVideoWidgetControl::videoWidget() -{ - return m_videoWidget; -} - -bool AVFVideoWidgetControl::isFullScreen() const -{ - return m_fullscreen; -} - -void AVFVideoWidgetControl::setFullScreen(bool fullScreen) -{ - m_fullscreen = fullScreen; -} - -Qt::AspectRatioMode AVFVideoWidgetControl::aspectRatioMode() const -{ - return m_videoWidget->aspectRatioMode(); -} - -void AVFVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - m_videoWidget->setAspectRatioMode(mode); -} - -int AVFVideoWidgetControl::brightness() const -{ - return m_brightness; -} - -void AVFVideoWidgetControl::setBrightness(int brightness) -{ - m_brightness = brightness; -} - -int AVFVideoWidgetControl::contrast() const -{ - return m_contrast; -} - -void AVFVideoWidgetControl::setContrast(int contrast) -{ - m_contrast = contrast; -} - -int AVFVideoWidgetControl::hue() const -{ - return m_hue; -} - -void AVFVideoWidgetControl::setHue(int hue) -{ - m_hue = hue; -} - -int AVFVideoWidgetControl::saturation() const -{ - return m_saturation; -} - -void AVFVideoWidgetControl::setSaturation(int saturation) -{ - m_saturation = saturation; -} - -#include "moc_avfvideowidgetcontrol_p.cpp" diff --git a/src/multimediawidgets/platform/darwin/avfvideowidgetcontrol_p.h b/src/multimediawidgets/platform/darwin/avfvideowidgetcontrol_p.h deleted file mode 100644 index 60c94e72d..000000000 --- a/src/multimediawidgets/platform/darwin/avfvideowidgetcontrol_p.h +++ /dev/null @@ -1,106 +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 AVFVIDEOWIDGETCONTROL_H -#define AVFVIDEOWIDGETCONTROL_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qvideowidgetcontrol.h> -#include "private/avfvideooutput_p.h" - -Q_FORWARD_DECLARE_OBJC_CLASS(AVPlayerLayer); - -QT_BEGIN_NAMESPACE - -class AVFVideoWidget; - -class AVFVideoWidgetControl : public QVideoWidgetControl, public AVFVideoOutput -{ - Q_OBJECT - Q_INTERFACES(AVFVideoOutput) -public: - AVFVideoWidgetControl(QObject *parent = nullptr); - virtual ~AVFVideoWidgetControl(); - - void setLayer(void *playerLayer) override; - - QWidget *videoWidget() override; - - bool isFullScreen() const override; - void setFullScreen(bool fullScreen) override; - - Qt::AspectRatioMode aspectRatioMode() const override; - void setAspectRatioMode(Qt::AspectRatioMode mode) override; - - int brightness() const override; - void setBrightness(int brightness) override; - - int contrast() const override; - void setContrast(int contrast) override; - - int hue() const override; - void setHue(int hue) override; - - int saturation() const override; - void setSaturation(int saturation) override; - -private: - AVFVideoWidget *m_videoWidget; - - bool m_fullscreen; - int m_brightness; - int m_contrast; - int m_hue; - int m_saturation; - -}; - -QT_END_NAMESPACE - -#endif // AVFVIDEOWIDGETCONTROL_H diff --git a/src/multimediawidgets/platform/darwin/darwin.pri b/src/multimediawidgets/platform/darwin/darwin.pri deleted file mode 100644 index 21bbe36c2..000000000 --- a/src/multimediawidgets/platform/darwin/darwin.pri +++ /dev/null @@ -1,15 +0,0 @@ -HEADERS += \ - $$PWD/avfvideowidgetcontrol_p.h \ - $$PWD/avfvideowidget_p.h - -SOURCES += \ - $$PWD/avfvideowidgetcontrol.mm \ - $$PWD/avfvideowidget.mm - -LIBS += -framework CoreFoundation \ - -framework Foundation \ - -framework QuartzCore \ - -framework CoreVideo \ - -framework Metal - -QMAKE_USE += avfoundation diff --git a/src/multimediawidgets/platform/gstreamer/gstreamer.pri b/src/multimediawidgets/platform/gstreamer/gstreamer.pri deleted file mode 100644 index c45f116ae..000000000 --- a/src/multimediawidgets/platform/gstreamer/gstreamer.pri +++ /dev/null @@ -1,4 +0,0 @@ -QMAKE_USE_PRIVATE += gstreamer - -SOURCES += $$PWD/qgstreamervideowidget.cpp -HEADERS += $$PWD/qgstreamervideowidget_p.h diff --git a/src/multimediawidgets/platform/gstreamer/qgstreamervideowidget.cpp b/src/multimediawidgets/platform/gstreamer/qgstreamervideowidget.cpp deleted file mode 100644 index e1c8fe47c..000000000 --- a/src/multimediawidgets/platform/gstreamer/qgstreamervideowidget.cpp +++ /dev/null @@ -1,280 +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 "qgstreamervideowidget_p.h" -#include "private/qgstutils_p.h" - -#include <QtCore/qcoreevent.h> -#include <QtCore/qdebug.h> -#include <QtGui/qpainter.h> - -QT_BEGIN_NAMESPACE - -class QGstreamerVideoWidget : public QWidget -{ -public: - QGstreamerVideoWidget(QWidget *parent = 0) - :QWidget(parent) - { - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - QPalette palette; - palette.setColor(QPalette::Window, Qt::black); - setPalette(palette); - } - - virtual ~QGstreamerVideoWidget() {} - - QSize sizeHint() const override - { - return m_nativeSize; - } - - void setNativeSize( const QSize &size) - { - if (size != m_nativeSize) { - m_nativeSize = size; - if (size.isEmpty()) - setMinimumSize(0,0); - else - setMinimumSize(160,120); - - updateGeometry(); - } - } - - void paint_helper() - { - QPainter painter(this); - painter.fillRect(rect(), palette().window()); - } - -protected: - void paintEvent(QPaintEvent *) override - { - paint_helper(); - } - - QSize m_nativeSize; -}; - -QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent, const QByteArray &elementName) - : QVideoWidgetControl(parent) - , m_videoOverlay(this, !elementName.isEmpty() ? elementName : qgetenv("QT_GSTREAMER_WIDGET_VIDEOSINK")) -{ - connect(&m_videoOverlay, &QGstreamerVideoOverlay::activeChanged, - this, &QGstreamerVideoWidgetControl::onOverlayActiveChanged); - connect(&m_videoOverlay, &QGstreamerVideoOverlay::nativeVideoSizeChanged, - this, &QGstreamerVideoWidgetControl::onNativeVideoSizeChanged); - connect(&m_videoOverlay, &QGstreamerVideoOverlay::brightnessChanged, - this, &QGstreamerVideoWidgetControl::brightnessChanged); - connect(&m_videoOverlay, &QGstreamerVideoOverlay::contrastChanged, - this, &QGstreamerVideoWidgetControl::contrastChanged); - connect(&m_videoOverlay, &QGstreamerVideoOverlay::hueChanged, - this, &QGstreamerVideoWidgetControl::hueChanged); - connect(&m_videoOverlay, &QGstreamerVideoOverlay::saturationChanged, - this, &QGstreamerVideoWidgetControl::saturationChanged); -} - -QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl() -{ - delete m_widget; -} - -void QGstreamerVideoWidgetControl::createVideoWidget() -{ - if (m_widget) - return; - - m_widget = new QGstreamerVideoWidget; - - m_widget->installEventFilter(this); - m_videoOverlay.setWindowHandle(m_windowId = m_widget->winId()); -} - -GstElement *QGstreamerVideoWidgetControl::videoSink() -{ - return m_videoOverlay.videoSink(); -} - -void QGstreamerVideoWidgetControl::setVideoSink(GstElement *sink) -{ - m_videoOverlay.setVideoSink(sink); -} - -void QGstreamerVideoWidgetControl::onOverlayActiveChanged() -{ - updateWidgetAttributes(); -} - -void QGstreamerVideoWidgetControl::stopRenderer() -{ - m_stopped = true; - updateWidgetAttributes(); - m_widget->setNativeSize(QSize()); -} - -void QGstreamerVideoWidgetControl::onNativeVideoSizeChanged() -{ - const QSize &size = m_videoOverlay.nativeVideoSize(); - - if (size.isValid()) - m_stopped = false; - - if (m_widget) - m_widget->setNativeSize(size); -} - -bool QGstreamerVideoWidgetControl::eventFilter(QObject *object, QEvent *e) -{ - if (m_widget && object == m_widget) { - if (e->type() == QEvent::ParentChange || e->type() == QEvent::Show || e->type() == QEvent::WinIdChange) { - WId newWId = m_widget->winId(); - if (newWId != m_windowId) - m_videoOverlay.setWindowHandle(m_windowId = newWId); - } - - if (e->type() == QEvent::Paint) { - // Update overlay by new size if any. - if (QGstUtils::useOpenGL()) - m_videoOverlay.setRenderRectangle(QRect(0, 0, m_widget->width(), m_widget->height())); - if (m_videoOverlay.isActive()) - m_videoOverlay.expose(); // triggers a repaint of the last frame - else - m_widget->paint_helper(); // paints the black background - - return true; - } - } - - return false; -} - -void QGstreamerVideoWidgetControl::updateWidgetAttributes() -{ - // When frames are being rendered (sink is active), we need the WA_PaintOnScreen attribute to - // be set in order to avoid flickering when the widget is repainted (for example when resized). - // We need to clear that flag when the the sink is inactive to allow the widget to paint its - // background, otherwise some garbage will be displayed. - if (m_videoOverlay.isActive() && !m_stopped) { - m_widget->setAttribute(Qt::WA_NoSystemBackground, true); - m_widget->setAttribute(Qt::WA_PaintOnScreen, true); - } else { - m_widget->setAttribute(Qt::WA_NoSystemBackground, false); - m_widget->setAttribute(Qt::WA_PaintOnScreen, false); - m_widget->update(); - } -} - -bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &message) -{ - return m_videoOverlay.processSyncMessage(message); -} - -bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &message) -{ - return m_videoOverlay.processBusMessage(message); -} - -QWidget *QGstreamerVideoWidgetControl::videoWidget() -{ - createVideoWidget(); - return m_widget; -} - -Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const -{ - return m_videoOverlay.aspectRatioMode(); -} - -void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - m_videoOverlay.setAspectRatioMode(mode); -} - -bool QGstreamerVideoWidgetControl::isFullScreen() const -{ - return m_fullScreen; -} - -void QGstreamerVideoWidgetControl::setFullScreen(bool fullScreen) -{ - emit fullScreenChanged(m_fullScreen = fullScreen); -} - -int QGstreamerVideoWidgetControl::brightness() const -{ - return m_videoOverlay.brightness(); -} - -void QGstreamerVideoWidgetControl::setBrightness(int brightness) -{ - m_videoOverlay.setBrightness(brightness); -} - -int QGstreamerVideoWidgetControl::contrast() const -{ - return m_videoOverlay.contrast(); -} - -void QGstreamerVideoWidgetControl::setContrast(int contrast) -{ - m_videoOverlay.setContrast(contrast); -} - -int QGstreamerVideoWidgetControl::hue() const -{ - return m_videoOverlay.hue(); -} - -void QGstreamerVideoWidgetControl::setHue(int hue) -{ - m_videoOverlay.setHue(hue); -} - -int QGstreamerVideoWidgetControl::saturation() const -{ - return m_videoOverlay.saturation(); -} - -void QGstreamerVideoWidgetControl::setSaturation(int saturation) -{ - m_videoOverlay.setSaturation(saturation); -} - -QT_END_NAMESPACE diff --git a/src/multimediawidgets/platform/gstreamer/qgstreamervideowidget_p.h b/src/multimediawidgets/platform/gstreamer/qgstreamervideowidget_p.h deleted file mode 100644 index 38985ebd0..000000000 --- a/src/multimediawidgets/platform/gstreamer/qgstreamervideowidget_p.h +++ /dev/null @@ -1,128 +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 QGSTREAMERVIDEOWIDGET_H -#define QGSTREAMERVIDEOWIDGET_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qtmultimediaglobal_p.h> -#include <qvideowidgetcontrol.h> - -#include <private/qgstreamervideorendererinterface_p.h> -#include <private/qgstreamerbushelper_p.h> -#include <private/qgstreamervideooverlay_p.h> - -QT_BEGIN_NAMESPACE - -class Q_MULTIMEDIA_EXPORT QGstreamerVideoWidget; - -class Q_MULTIMEDIA_EXPORT QGstreamerVideoWidgetControl - : public QVideoWidgetControl - , public QGstreamerVideoRendererInterface - , public QGstreamerSyncMessageFilter - , public QGstreamerBusMessageFilter -{ - Q_OBJECT - Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter) -public: - explicit QGstreamerVideoWidgetControl(QObject *parent = 0, const QByteArray &elementName = QByteArray()); - virtual ~QGstreamerVideoWidgetControl(); - - GstElement *videoSink() override; - void setVideoSink(GstElement *) override; - - QWidget *videoWidget() override; - - void stopRenderer() override; - - Qt::AspectRatioMode aspectRatioMode() const override; - void setAspectRatioMode(Qt::AspectRatioMode mode) override; - - bool isFullScreen() const override; - void setFullScreen(bool fullScreen) override; - - int brightness() const override; - void setBrightness(int brightness) override; - - int contrast() const override; - void setContrast(int contrast) override; - - int hue() const override; - void setHue(int hue) override; - - int saturation() const override; - void setSaturation(int saturation) override; - - bool eventFilter(QObject *object, QEvent *event) override; - -signals: - void sinkChanged(); - void readyChanged(bool); - -private Q_SLOTS: - void onOverlayActiveChanged(); - void onNativeVideoSizeChanged(); - -private: - void createVideoWidget(); - void updateWidgetAttributes(); - - bool processSyncMessage(const QGstreamerMessage &message) override; - bool processBusMessage(const QGstreamerMessage &message) override; - - QGstreamerVideoOverlay m_videoOverlay; - QGstreamerVideoWidget *m_widget = nullptr; - bool m_stopped = false; - WId m_windowId = 0; - bool m_fullScreen = false; -}; - -QT_END_NAMESPACE - -#endif // QGSTREAMERVIDEOWIDGET_H diff --git a/src/multimediawidgets/platform/platform.pri b/src/multimediawidgets/platform/platform.pri deleted file mode 100644 index b14ac64b8..000000000 --- a/src/multimediawidgets/platform/platform.pri +++ /dev/null @@ -1,2 +0,0 @@ -qtConfig(gstreamer):include(gstreamer/gstreamer.pri) -darwin:include(darwin/darwin.pri) diff --git a/src/multimediawidgets/qvideowidget.cpp b/src/multimediawidgets/qvideowidget.cpp index 2edbd6af6..eafabd856 100644 --- a/src/multimediawidgets/qvideowidget.cpp +++ b/src/multimediawidgets/qvideowidget.cpp @@ -44,7 +44,6 @@ #include <qmediasource.h> #include <qmediaservice.h> #include <qvideowindowcontrol.h> -#include <qvideowidgetcontrol.h> #include <qvideorenderercontrol.h> #include <qvideosurfaceformat.h> @@ -58,11 +57,6 @@ #include <qwindow.h> #include <private/qhighdpiscaling_p.h> -#if QT_CONFIG(gstreamer) -#include <private/qgstreamervideowidget_p.h> -#elif QT_CONFIG(avfoundation) -#include <private/avfvideowidgetcontrol_p.h> -#endif #ifdef Q_OS_WIN #include <QtCore/qt_windows.h> #endif @@ -71,69 +65,6 @@ using namespace Qt; QT_BEGIN_NAMESPACE -QVideoWidgetControlBackend::QVideoWidgetControlBackend( - QMediaService *service, QVideoWidgetControl *control, QWidget *widget) - : m_service(service) - , m_widgetControl(control) -{ - connect(control, SIGNAL(brightnessChanged(int)), widget, SLOT(_q_brightnessChanged(int))); - connect(control, SIGNAL(contrastChanged(int)), widget, SLOT(_q_contrastChanged(int))); - connect(control, SIGNAL(hueChanged(int)), widget, SLOT(_q_hueChanged(int))); - connect(control, SIGNAL(saturationChanged(int)), widget, SLOT(_q_saturationChanged(int))); - connect(control, SIGNAL(fullScreenChanged(bool)), widget, SLOT(_q_fullScreenChanged(bool))); - - QBoxLayout *layout = new QVBoxLayout; - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - - QWidget *videoWidget = control->videoWidget(); - videoWidget->setMouseTracking(widget->hasMouseTracking()); - layout->addWidget(videoWidget); - - widget->setLayout(layout); -} - -void QVideoWidgetControlBackend::releaseControl() -{ - m_service->releaseControl(m_widgetControl); -} - -void QVideoWidgetControlBackend::setBrightness(int brightness) -{ - m_widgetControl->setBrightness(brightness); -} - -void QVideoWidgetControlBackend::setContrast(int contrast) -{ - m_widgetControl->setContrast(contrast); -} - -void QVideoWidgetControlBackend::setHue(int hue) -{ - m_widgetControl->setHue(hue); -} - -void QVideoWidgetControlBackend::setSaturation(int saturation) -{ - m_widgetControl->setSaturation(saturation); -} - -void QVideoWidgetControlBackend::setFullScreen(bool fullScreen) -{ - m_widgetControl->setFullScreen(fullScreen); -} - - -Qt::AspectRatioMode QVideoWidgetControlBackend::aspectRatioMode() const -{ - return m_widgetControl->aspectRatioMode(); -} - -void QVideoWidgetControlBackend::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - m_widgetControl->setAspectRatioMode(mode); -} - QRendererVideoWidgetBackend::QRendererVideoWidgetBackend( QMediaService *service, QVideoRendererControl *control, QWidget *widget) : m_service(service) @@ -463,20 +394,7 @@ void QVideoWidgetPrivate::clearService() if (service) { QObject::disconnect(service, SIGNAL(destroyed()), q_func(), SLOT(_q_serviceDestroyed())); - if (widgetBackend) { - QLayout *layout = q_func()->layout(); - - for (QLayoutItem *item = layout->takeAt(0); item; item = layout->takeAt(0)) { - item->widget()->setParent(nullptr); - delete item; - } - delete layout; - - widgetBackend->releaseControl(); - - delete widgetBackend; - widgetBackend = nullptr; - } else if (rendererBackend) { + if (rendererBackend) { rendererBackend->clearSurface(); rendererBackend->releaseControl(); @@ -495,28 +413,6 @@ void QVideoWidgetPrivate::clearService() } } -bool QVideoWidgetPrivate::createWidgetBackend() -{ - QVideoWidgetControl *widgetControl = nullptr; -#if QT_CONFIG(gstreamer) -// widgetControl = new QGstreamerVideoWidgetControl(q_ptr); - // If the GStreamer video sink is not available, don't provide the video widget control since - // it won't work anyway. QVideoWidget will fall back to QVideoRendererControl in that case. -// if (!widgetControl->videoSink()) { -// delete widgetControl; -// widgetControl = nullptr; -// } - // ### need to set the widget as the video output on the service currently -#elif QT_CONFIG(avfoundation) -// widgetControl = new AVFVideoWidgetControl(q_ptr); - // #####m_session->setVideoOutput(qobject_cast<AVFVideoOutput*>(m_videoOutput)); -#endif - if (widgetControl) - setCurrentControl(widgetBackend); - - return widgetControl != nullptr; -} - bool QVideoWidgetPrivate::createWindowBackend() { if (QObject *control = service->requestControl(QVideoWindowControl_iid)) { @@ -548,14 +444,9 @@ bool QVideoWidgetPrivate::createRendererBackend() void QVideoWidgetPrivate::_q_serviceDestroyed() { - if (widgetBackend) - delete q_func()->layout(); - - delete widgetBackend; delete windowBackend; delete rendererBackend; - widgetBackend = nullptr; windowBackend = nullptr; rendererBackend = nullptr; currentControl = nullptr; @@ -686,9 +577,7 @@ bool QVideoWidget::setMediaSource(QMediaSource *object) d->service = d->mediaSource->service(); if (d->service) { - if (d->createWidgetBackend()) { - // Nothing to do here. - } else if ((!window() || !window()->testAttribute(Qt::WA_DontShowOnScreen)) + if ((!window() || !window()->testAttribute(Qt::WA_DontShowOnScreen)) && d->createWindowBackend()) { if (isVisible()) d->windowBackend->showEvent(); diff --git a/src/multimediawidgets/qvideowidget_p.h b/src/multimediawidgets/qvideowidget_p.h index 1f12ef4da..1946a13a9 100644 --- a/src/multimediawidgets/qvideowidget_p.h +++ b/src/multimediawidgets/qvideowidget_p.h @@ -96,31 +96,6 @@ public: virtual void paintEvent(QPaintEvent *event) = 0; }; -class QVideoWidgetControl; - -class QVideoWidgetControlBackend : public QObject, public QVideoWidgetControlInterface -{ - Q_OBJECT -public: - QVideoWidgetControlBackend(QMediaService *service, QVideoWidgetControl *control, QWidget *widget); - - void releaseControl(); - - void setBrightness(int brightness) override; - void setContrast(int contrast) override; - void setHue(int hue) override; - void setSaturation(int saturation) override; - - void setFullScreen(bool fullScreen) override; - - Qt::AspectRatioMode aspectRatioMode() const override; - void setAspectRatioMode(Qt::AspectRatioMode mode) override; - -private: - QMediaService *m_service; - QVideoWidgetControl *m_widgetControl; -}; - class QVideoRendererControl; @@ -227,7 +202,6 @@ public: QVideoWidget *q_ptr = nullptr; QPointer<QMediaSource> mediaSource; QMediaService *service = nullptr; - QVideoWidgetControlBackend *widgetBackend = nullptr; QWindowVideoWidgetBackend *windowBackend = nullptr; QRendererVideoWidgetBackend *rendererBackend = nullptr; QVideoWidgetControlInterface *currentControl = nullptr; @@ -240,7 +214,6 @@ public: Qt::WindowFlags nonFullScreenFlags; bool wasFullScreen = false; - bool createWidgetBackend(); bool createWindowBackend(); bool createRendererBackend(); diff --git a/src/multimediawidgets/qvideowidgetcontrol.cpp b/src/multimediawidgets/qvideowidgetcontrol.cpp deleted file mode 100644 index f46703c4b..000000000 --- a/src/multimediawidgets/qvideowidgetcontrol.cpp +++ /dev/null @@ -1,223 +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 "qvideowidgetcontrol.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QVideoWidgetControl - - - \brief The QVideoWidgetControl class provides a media control which - implements a video widget. - - \inmodule QtMultimediaWidgets - \ingroup multimedia-serv - - The videoWidget() property of QVideoWidgetControl provides a pointer to a - video widget implemented by the control's media service. This widget is - owned by the media service and so care should be taken not to delete it. - - \snippet multimedia-snippets/video.cpp Video widget control - - QVideoWidgetControl is one of number of possible video output controls. - - The interface name of QVideoWidgetControl is \c org.qt-project.qt.videowidgetcontrol/5.0 as - defined in QVideoWidgetControl_iid. - - \sa QMediaService::requestControl(), QVideoWidget -*/ - -/*! - \macro QVideoWidgetControl_iid - - \c org.qt-project.qt.videowidgetcontrol/5.0 - - Defines the interface name of the QVideoWidgetControl class. - - \relates QVideoWidgetControl -*/ - -/*! - Constructs a new video widget control with the given \a parent. -*/ -QVideoWidgetControl::QVideoWidgetControl(QObject *parent) - :QObject(parent) -{ -} - -/*! - Destroys a video widget control. -*/ -QVideoWidgetControl::~QVideoWidgetControl() -{ -} - -/*! - \fn QVideoWidgetControl::isFullScreen() const - - Returns true if the video is shown using the complete screen. -*/ - -/*! - \fn QVideoWidgetControl::setFullScreen(bool fullScreen) - - Sets whether a video widget is in \a fullScreen mode. -*/ - -/*! - \fn QVideoWidgetControl::fullScreenChanged(bool fullScreen) - - Signals that the \a fullScreen state of a video widget has changed. -*/ - -/*! - \fn QVideoWidgetControl::aspectRatioMode() const - - Returns how video is scaled to fit the widget with respect to its aspect ratio. -*/ - -/*! - \fn QVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode) - - Sets the aspect ratio \a mode which determines how video is scaled to the fit the widget with - respect to its aspect ratio. -*/ - -/*! - \fn QVideoWidgetControl::brightness() const - - Returns the brightness adjustment applied to a video. - - Valid brightness values range between -100 and 100, the default is 0. -*/ - -/*! - \fn QVideoWidgetControl::setBrightness(int brightness) - - Sets a \a brightness adjustment for a video. - - Valid brightness values range between -100 and 100, the default is 0. -*/ - -/*! - \fn QVideoWidgetControl::brightnessChanged(int brightness) - - Signals that a video widget's \a brightness adjustment has changed. -*/ - -/*! - \fn QVideoWidgetControl::contrast() const - - Returns the contrast adjustment applied to a video. - - Valid contrast values range between -100 and 100, the default is 0. -*/ - -/*! - \fn QVideoWidgetControl::setContrast(int contrast) - - Sets the contrast adjustment for a video widget to \a contrast. - - Valid contrast values range between -100 and 100, the default is 0. -*/ - - -/*! - \fn QVideoWidgetControl::contrastChanged(int contrast) - - Signals that a video widget's \a contrast adjustment has changed. -*/ - -/*! - \fn QVideoWidgetControl::hue() const - - Returns the hue adjustment applied to a video widget. - - Value hue values range between -100 and 100, the default is 0. -*/ - -/*! - \fn QVideoWidgetControl::setHue(int hue) - - Sets a \a hue adjustment for a video widget. - - Valid hue values range between -100 and 100, the default is 0. -*/ - - -/*! - \fn QVideoWidgetControl::hueChanged(int hue) - - Signals that a video widget's \a hue adjustment has changed. -*/ - -/*! - \fn QVideoWidgetControl::saturation() const - - Returns the saturation adjustment applied to a video widget. - - Value saturation values range between -100 and 100, the default is 0. -*/ - - -/*! - \fn QVideoWidgetControl::setSaturation(int saturation) - - Sets a \a saturation adjustment for a video widget. - - Valid saturation values range between -100 and 100, the default is 0. -*/ - -/*! - \fn QVideoWidgetControl::saturationChanged(int saturation) - - Signals that a video widget's \a saturation adjustment has changed. -*/ - -/*! - \fn QVideoWidgetControl::videoWidget() - - Returns the QWidget. -*/ - -QT_END_NAMESPACE - -#include "moc_qvideowidgetcontrol.cpp" diff --git a/src/multimediawidgets/qvideowidgetcontrol.h b/src/multimediawidgets/qvideowidgetcontrol.h deleted file mode 100644 index a7e750a52..000000000 --- a/src/multimediawidgets/qvideowidgetcontrol.h +++ /dev/null @@ -1,97 +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 QVIDEOWIDGETCONTROL_H -#define QVIDEOWIDGETCONTROL_H - -#include <QtMultimediaWidgets/qvideowidget.h> -#include <QtMultimedia/qmediaservice.h> - -#include <QtWidgets/qwidget.h> - -QT_BEGIN_NAMESPACE - - -class QVideoWidgetControlPrivate; - -class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWidgetControl : public QObject -{ - Q_OBJECT - -public: - virtual ~QVideoWidgetControl(); - - virtual QWidget *videoWidget() = 0; - - virtual Qt::AspectRatioMode aspectRatioMode() const = 0; - virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0; - - virtual bool isFullScreen() const = 0; - virtual void setFullScreen(bool fullScreen) = 0; - - virtual int brightness() const = 0; - virtual void setBrightness(int brightness) = 0; - - virtual int contrast() const = 0; - virtual void setContrast(int contrast) = 0; - - virtual int hue() const = 0; - virtual void setHue(int hue) = 0; - - virtual int saturation() const = 0; - virtual void setSaturation(int saturation) = 0; - -Q_SIGNALS: - void fullScreenChanged(bool fullScreen); - void brightnessChanged(int brightness); - void contrastChanged(int contrast); - void hueChanged(int hue); - void saturationChanged(int saturation); - -protected: - explicit QVideoWidgetControl(QObject *parent = nullptr); -}; - -#define QVideoWidgetControl_iid "org.qt-project.qt.videowidgetcontrol/5.0" -Q_MEDIA_DECLARE_CONTROL(QVideoWidgetControl, QVideoWidgetControl_iid) - -QT_END_NAMESPACE - - -#endif |