summaryrefslogtreecommitdiffstats
path: root/src/multimedia/video
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-03-23 19:18:25 +0100
committerLars Knoll <lars.knoll@qt.io>2021-04-06 08:12:18 +0000
commit706e7f6afe1cce27048500f897378e19484d130b (patch)
tree133f423ee8ca1071fec21c7ff1d3f92eaab03710 /src/multimedia/video
parent1dd3f82348b790aba9eaca6e37ee07702a20a3c8 (diff)
Get rid of QAbstractVideoSurface
We're not using it anymore, QVideoSink is the replacement. Change-Id: I6b29838c39db421d5bca281b28e97e0e0b72caad Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/multimedia/video')
-rw-r--r--src/multimedia/video/qabstractvideosurface.cpp353
-rw-r--r--src/multimedia/video/qabstractvideosurface.h108
-rw-r--r--src/multimedia/video/qvideosurfaces.cpp100
-rw-r--r--src/multimedia/video/qvideosurfaces_p.h77
4 files changed, 0 insertions, 638 deletions
diff --git a/src/multimedia/video/qabstractvideosurface.cpp b/src/multimedia/video/qabstractvideosurface.cpp
deleted file mode 100644
index 74347ce27..000000000
--- a/src/multimedia/video/qabstractvideosurface.cpp
+++ /dev/null
@@ -1,353 +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$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include "qabstractvideosurface.h"
-
-#include "qvideosurfaceformat.h"
-
-#include <QtCore/qvariant.h>
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-class QAbstractVideoSurfacePrivate {
-public:
- QVideoSurfaceFormat surfaceFormat;
- QAbstractVideoSurface::Error error = QAbstractVideoSurface::NoError;
- QSize nativeResolution;
- bool active = false;
-};
-
-/*!
- \class QAbstractVideoSurface
- \brief The QAbstractVideoSurface class is a base class for video presentation surfaces.
- \inmodule QtMultimedia
-
- \ingroup multimedia
- \ingroup multimedia_video
-
- The QAbstractVideoSurface class defines the standard interface that video producers use to
- inter-operate with video presentation surfaces. You can subclass this interface to receive
- video frames from sources like \l {QMediaPlayer}{decoded media} or \l {QCamera}{cameras} to
- perform your own processing.
-
- A video surface presents a continuous stream of identically formatted QVideoFrame instances, where the format
- of each frame is compatible with a stream format supplied when starting a presentation. Each frame
- may have timestamp information that can be used by the surface to decide when to display that
- frame.
-
- A list of pixel formats a surface can present is given by the supportedPixelFormats() function,
- and the isFormatSupported() function will test if a video surface format is supported. If a
- format is not supported the nearestFormat() function may be able to suggest a similar format.
- For example, if a surface supports fixed set of resolutions it may suggest the smallest
- supported resolution that contains the proposed resolution.
-
- The start() function takes a supported format and enables a video surface. Once started a
- surface will begin displaying the frames it receives in the present() function. Surfaces may
- hold a reference to the buffer of a presented video frame until a new frame is presented or
- streaming is stopped. In addition, a video surface may hold a reference to a video frame
- until the \l {QVideoFrame::endTime()}{end timestamp} has passed. The stop() function will
- disable a surface and release any video buffers it holds references to.
-
- \section2 Implementing a subclass of QAbstractVideoSurface
-
- When implementing a subclass of this interface, there are only a handful of functions to
- implement, broken down into two classes:
-
- \list
- \li Format related
- \li Presentation related
- \endlist
-
- For format related functionality, you just have to describe the pixel formats that you
- support (and the nearestFormat() function). For presentation related functionality, you
- have to implement the present() function, and the start() and stop() functions.
-
- \note You must call the base class implementation of start() and stop() in your implementation.
-*/
-
-/*!
- \enum QAbstractVideoSurface::Error
- This enum describes the errors that may be returned by the error() function.
-
- \value NoError No error occurred.
- \value UnsupportedFormatError A video format was not supported.
- \value IncorrectFormatError A video frame was not compatible with the format of the surface.
- \value StoppedError The surface has not been started.
- \value ResourceError The surface could not allocate some resource.
-*/
-
-/*!
- Constructs a video surface with the given \a parent.
-*/
-QAbstractVideoSurface::QAbstractVideoSurface(QObject *parent)
- : QObject(parent),
- d_ptr(new QAbstractVideoSurfacePrivate)
-{
-}
-
-/*!
- Destroys a video surface.
-*/
-QAbstractVideoSurface::~QAbstractVideoSurface() = default;
-
-/*!
- \fn QAbstractVideoSurface::supportedPixelFormats(QVideoFrame::HandleType type) const
-
- Returns a list of pixel formats a video surface can present for a given handle \a type.
-
- The pixel formats returned for the QVideoFrame::NoHandle type are valid for any buffer
- that can be mapped in read-only mode.
-
- Types that are first in the list can be assumed to be faster to render.
-*/
-
-/*!
- Tests a video surface \a format to determine if a surface can accept it.
-
- Returns true if the format is supported by the surface, and false otherwise.
-*/
-bool QAbstractVideoSurface::isFormatSupported(const QVideoSurfaceFormat &format) const
-{
- return supportedPixelFormats(QVideoFrame::NoHandle).contains(format.pixelFormat());
-}
-
-/*!
- \fn QAbstractVideoSurface::supportedFormatsChanged()
-
- Signals that the set of formats supported by a video surface has changed.
-
- \sa supportedPixelFormats(), isFormatSupported()
-*/
-
-/*!
- Returns the format of a video surface.
-*/
-QVideoSurfaceFormat QAbstractVideoSurface::surfaceFormat() const
-{
- Q_D(const QAbstractVideoSurface);
- return d->surfaceFormat;
-}
-
-/*!
- \fn QAbstractVideoSurface::surfaceFormatChanged(const QVideoSurfaceFormat &format)
-
- Signals that the configured \a format of a video surface has changed.
-
- \sa surfaceFormat(), start()
-*/
-
-/*!
- Starts a video surface presenting \a format frames.
-
- Returns true if the surface was started, and false if an error occurred.
-
- \note You must call the base class implementation of start() at the end of your implementation.
- \sa isActive(), stop()
-*/
-bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format)
-{
- Q_D(QAbstractVideoSurface);
- bool wasActive = d->active;
-
- d->active = true;
- d->surfaceFormat = format;
- d->error = NoError;
-
- emit surfaceFormatChanged(format);
-
- if (!wasActive)
- emit activeChanged(true);
-
- return true;
-}
-
-/*!
- Stops a video surface presenting frames and releases any resources acquired in start().
-
- \note You must call the base class implementation of stop() at the start of your implementation.
- \sa isActive(), start()
-*/
-void QAbstractVideoSurface::stop()
-{
- Q_D(QAbstractVideoSurface);
- if (d->active) {
- d->surfaceFormat = QVideoSurfaceFormat();
- d->active = false;
-
- emit activeChanged(false);
- emit surfaceFormatChanged(surfaceFormat());
- }
-}
-
-/*!
- Indicates whether a video surface has been started.
-
- Returns true if the surface has been started, and false otherwise.
-*/
-bool QAbstractVideoSurface::isActive() const
-{
- Q_D(const QAbstractVideoSurface);
- return d->active;
-}
-
-/*!
- \fn QAbstractVideoSurface::activeChanged(bool active)
-
- Signals that the \a active state of a video surface has changed.
-
- \sa isActive(), start(), stop()
-*/
-
-/*!
- \fn QAbstractVideoSurface::present(const QVideoFrame &frame)
-
- Presents a video \a frame.
-
- Returns true if the frame was presented, and false if an error occurred.
-
- Not all surfaces will block until the presentation of a frame has completed. Calling present()
- on a non-blocking surface may fail if called before the presentation of a previous frame has
- completed. In such cases the surface may not return to a ready state until it has had an
- opportunity to process events.
-
- If present() fails for any other reason the surface should immediately enter the stopped state
- and an error() value will be set.
-
- A video surface must be in the started state for present() to succeed, and the format of the
- video frame must be compatible with the current video surface format.
-
- \sa error()
-*/
-
-/*!
- Returns the last error that occurred.
-
- If a surface fails to start(), or stops unexpectedly this function can be called to discover
- what error occurred.
-*/
-
-QAbstractVideoSurface::Error QAbstractVideoSurface::error() const
-{
- Q_D(const QAbstractVideoSurface);
- return d->error;
-}
-
-/*!
- Sets the value of error() to \a error.
-
- This can be called by implementors of this interface to communicate
- what the most recent error was.
-*/
-void QAbstractVideoSurface::setError(Error error)
-{
- Q_D(QAbstractVideoSurface);
- d->error = error;
-}
-
-/*!
- \property QAbstractVideoSurface::nativeResolution
-
- The native resolution of video surface.
- This is the resolution of video frames the surface
- can render with optimal quality and/or performance.
-
- The native resolution is not always known and can be changed during playback.
- */
-QSize QAbstractVideoSurface::nativeResolution() const
-{
- Q_D(const QAbstractVideoSurface);
- return d->nativeResolution;
-}
-
-/*!
- Set the video surface native \a resolution.
-
- This function can be called by implementors of this interface to specify
- to frame producers what the native resolution of this surface is.
- */
-void QAbstractVideoSurface::setNativeResolution(const QSize &resolution)
-{
- Q_D(QAbstractVideoSurface);
-
- if (d->nativeResolution != resolution) {
- d->nativeResolution = resolution;
-
- emit nativeResolutionChanged(resolution);
- }
-}
-/*!
- \fn QAbstractVideoSurface::nativeResolutionChanged(const QSize &resolution);
-
- Signals the native \a resolution of video surface has changed.
-*/
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QAbstractVideoSurface::Error& error)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace();
- switch (error) {
- case QAbstractVideoSurface::UnsupportedFormatError:
- dbg << "UnsupportedFormatError";
- break;
- case QAbstractVideoSurface::IncorrectFormatError:
- dbg << "IncorrectFormatError";
- break;
- case QAbstractVideoSurface::StoppedError:
- dbg << "StoppedError";
- break;
- case QAbstractVideoSurface::ResourceError:
- dbg << "ResourceError";
- break;
- default:
- dbg << "NoError";
- break;
- }
- return dbg;
-}
-#endif
-
-
-QT_END_NAMESPACE
-
-#include "moc_qabstractvideosurface.cpp"
-
diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h
deleted file mode 100644
index a437d7565..000000000
--- a/src/multimedia/video/qabstractvideosurface.h
+++ /dev/null
@@ -1,108 +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 QABSTRACTVIDEOSURFACE_H
-#define QABSTRACTVIDEOSURFACE_H
-
-#include <QtCore/qobject.h>
-#include <QtMultimedia/qvideoframe.h>
-
-QT_BEGIN_NAMESPACE
-
-class QRectF;
-class QVideoSurfaceFormat;
-
-class QAbstractVideoSurfacePrivate;
-
-class Q_MULTIMEDIA_EXPORT QAbstractVideoSurface : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QSize nativeResolution READ nativeResolution NOTIFY nativeResolutionChanged)
-public:
- enum Error
- {
- NoError,
- UnsupportedFormatError,
- IncorrectFormatError,
- StoppedError,
- ResourceError
- };
-
- explicit QAbstractVideoSurface(QObject *parent = nullptr);
- ~QAbstractVideoSurface();
-
- virtual QList<QVideoSurfaceFormat::PixelFormat> supportedPixelFormats(
- QVideoFrame::HandleType type = QVideoFrame::NoHandle) const = 0;
- bool isFormatSupported(const QVideoSurfaceFormat &format) const;
-
- QVideoSurfaceFormat surfaceFormat() const;
-
- QSize nativeResolution() const;
-
- virtual bool start(const QVideoSurfaceFormat &format);
- virtual void stop();
-
- bool isActive() const;
-
- virtual bool present(const QVideoFrame &frame) = 0;
-
- Error error() const;
-
-Q_SIGNALS:
- void activeChanged(bool active);
- void surfaceFormatChanged(const QVideoSurfaceFormat &format);
- void supportedFormatsChanged();
- void nativeResolutionChanged(const QSize &resolution);
-
-protected:
- void setError(Error error);
- void setNativeResolution(const QSize &resolution);
-
-private:
- Q_DECLARE_PRIVATE(QAbstractVideoSurface)
- QScopedPointer<QAbstractVideoSurfacePrivate> d_ptr;
-};
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QAbstractVideoSurface::Error &);
-#endif
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/multimedia/video/qvideosurfaces.cpp b/src/multimedia/video/qvideosurfaces.cpp
deleted file mode 100644
index b3e07fb26..000000000
--- a/src/multimedia/video/qvideosurfaces.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 "qvideosurfaces_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QVideoSurfaces::QVideoSurfaces(const QList<QAbstractVideoSurface *> &s, QObject *parent)
- : QAbstractVideoSurface(parent), m_surfaces(s)
-{
- for (auto a : s) {
- connect(a, &QAbstractVideoSurface::supportedFormatsChanged, this, [this, a] {
- auto context = property("GLContext").value<QObject *>();
- if (!context)
- setProperty("GLContext", a->property("GLContext"));
-
- emit supportedFormatsChanged();
- });
- }
-}
-
-QVideoSurfaces::~QVideoSurfaces() = default;
-
-QList<QVideoSurfaceFormat::PixelFormat> QVideoSurfaces::supportedPixelFormats(QVideoFrame::HandleType type) const
-{
- QList<QVideoSurfaceFormat::PixelFormat> result;
- QMap<QVideoSurfaceFormat::PixelFormat, int> formats;
- for (auto &s : m_surfaces) {
- for (auto &p : s->supportedPixelFormats(type)) {
- if (++formats[p] == m_surfaces.size())
- result << p;
- }
- }
-
- return result;
-}
-
-bool QVideoSurfaces::start(const QVideoSurfaceFormat &format)
-{
- bool result = true;
- for (auto &s : m_surfaces)
- result &= s->start(format);
-
- return result && QAbstractVideoSurface::start(format);
-}
-
-void QVideoSurfaces::stop()
-{
- for (auto &s : m_surfaces)
- s->stop();
-
- QAbstractVideoSurface::stop();
-}
-
-bool QVideoSurfaces::present(const QVideoFrame &frame)
-{
- bool result = true;
- for (auto &s : m_surfaces)
- result &= s->present(frame);
-
- return result;
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideosurfaces_p.h b/src/multimedia/video/qvideosurfaces_p.h
deleted file mode 100644
index 4d9a8a9df..000000000
--- a/src/multimedia/video/qvideosurfaces_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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 QVIDEOSURFACES_P_H
-#define QVIDEOSURFACES_P_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 <QAbstractVideoSurface>
-#include <QList>
-
-QT_BEGIN_NAMESPACE
-
-class QVideoSurfaces : public QAbstractVideoSurface
-{
-public:
- QVideoSurfaces(const QList<QAbstractVideoSurface *> &surfaces, QObject *parent = nullptr);
- ~QVideoSurfaces();
-
- QList<QVideoSurfaceFormat::PixelFormat> supportedPixelFormats(QVideoFrame::HandleType type) const override;
- bool start(const QVideoSurfaceFormat &format) override;
- void stop() override;
- bool present(const QVideoFrame &frame) override;
-
-private:
- QList<QAbstractVideoSurface *> m_surfaces;
- Q_DISABLE_COPY(QVideoSurfaces)
-};
-
-QT_END_NAMESPACE
-
-#endif // QVIDEOSURFACES_P_H