diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-01-25 11:48:44 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-01-29 08:53:45 +0000 |
commit | efde83895668224823218076051226023203a378 (patch) | |
tree | a51e3adb74327d03c73ec55dbef619b049ad3068 /src | |
parent | a835c3a9fabc0928571e9646d3d44b3a1e924083 (diff) |
Remove QAudioProbe and QVideoProbe
They worked very inconsistently between platforms (or not at all)
and made the implementation quite a bit more complex.
Longer term they will get replaced by adding the possibility
to have multiple audio/video outputs and implementing monitoring
output classes that can deliver QAudioBuffers and QVideoFrames to
the app.
Change-Id: Ic5b4506e7392d352d33b51f01ff0d5169d7b5129
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
66 files changed, 59 insertions, 2612 deletions
diff --git a/src/imports/multimedia/qmldir b/src/imports/multimedia/qmldir index d68049f63..e7dcc3dd6 100644 --- a/src/imports/multimedia/qmldir +++ b/src/imports/multimedia/qmldir @@ -4,3 +4,4 @@ classname QMultimediaDeclarativeModule typeinfo plugins.qmltypes typeinfo plugins.qmltypes Video 5.0 Video.qml + diff --git a/src/multimedia/CMakeLists.txt b/src/multimedia/CMakeLists.txt index 6446135c2..7f7d573e4 100644 --- a/src/multimedia/CMakeLists.txt +++ b/src/multimedia/CMakeLists.txt @@ -20,7 +20,6 @@ qt_internal_add_module(Multimedia audio/qaudiohelpers.cpp audio/qaudiohelpers_p.h audio/qaudioinput.cpp audio/qaudioinput.h audio/qaudiooutput.cpp audio/qaudiooutput.h - audio/qaudioprobe.cpp audio/qaudioprobe.h audio/qaudiosystem.cpp audio/qaudiosystem_p.h audio/qsamplecache_p.cpp audio/qsamplecache_p.h audio/qsoundeffect.cpp audio/qsoundeffect.h @@ -40,12 +39,10 @@ qt_internal_add_module(Multimedia controls/qcameraimagecapturecontrol.cpp controls/qcameraimagecapturecontrol.h controls/qcameraimageprocessingcontrol.cpp controls/qcameraimageprocessingcontrol.h controls/qimageencodercontrol.cpp controls/qimageencodercontrol.h - controls/qmediaaudioprobecontrol.cpp controls/qmediaaudioprobecontrol.h controls/qmediacontainercontrol.cpp controls/qmediacontainercontrol.h controls/qmediaplayercontrol.cpp controls/qmediaplayercontrol.h controls/qmediarecordercontrol.cpp controls/qmediarecordercontrol.h controls/qmediastreamscontrol.cpp controls/qmediastreamscontrol.h - controls/qmediavideoprobecontrol.cpp controls/qmediavideoprobecontrol.h controls/qmetadatareadercontrol.cpp controls/qmetadatareadercontrol.h controls/qmetadatawritercontrol.cpp controls/qmetadatawritercontrol.h controls/qvideoencodersettingscontrol.cpp controls/qvideoencodersettingscontrol.h @@ -80,7 +77,6 @@ qt_internal_add_module(Multimedia video/qvideoframe.cpp video/qvideoframe.h video/qvideoframeconversionhelper.cpp video/qvideoframeconversionhelper_p.h video/qvideooutputorientationhandler.cpp video/qvideooutputorientationhandler_p.h - video/qvideoprobe.cpp video/qvideoprobe.h video/qvideosurfaceformat.cpp video/qvideosurfaceformat.h video/qvideosurfaceoutput.cpp video/qvideosurfaceoutput_p.h video/qvideosurfaces.cpp video/qvideosurfaces_p.h @@ -158,14 +154,12 @@ qt_internal_extend_target(Multimedia CONDITION WIN32 platform/windows/evr/evrvideowindowcontrol.cpp platform/windows/evr/evrvideowindowcontrol_p.h platform/windows/mfstream.cpp platform/windows/mfstream_p.h platform/windows/player/mfactivate.cpp platform/windows/player/mfactivate_p.h - platform/windows/player/mfaudioprobecontrol.cpp platform/windows/player/mfaudioprobecontrol_p.h platform/windows/player/mfevrvideowindowcontrol.cpp platform/windows/player/mfevrvideowindowcontrol_p.h platform/windows/player/mfmetadatacontrol.cpp platform/windows/player/mfmetadatacontrol_p.h platform/windows/player/mfplayercontrol.cpp platform/windows/player/mfplayercontrol_p.h platform/windows/player/mfplayerservice.cpp platform/windows/player/mfplayerservice_p.h platform/windows/player/mfplayersession.cpp platform/windows/player/mfplayersession_p.h platform/windows/player/mftvideo.cpp platform/windows/player/mftvideo_p.h - platform/windows/player/mfvideoprobecontrol.cpp platform/windows/player/mfvideoprobecontrol_p.h platform/windows/player/mfvideorenderercontrol.cpp platform/windows/player/mfvideorenderercontrol_p.h platform/windows/player/samplegrabber.cpp platform/windows/player/samplegrabber_p.h platform/windows/qwindowsdevicemanager.cpp platform/windows/qwindowsdevicemanager_p.h @@ -209,14 +203,12 @@ qt_internal_extend_target(Multimedia CONDITION QT_FEATURE_gstreamer platform/gstreamer/audio/qgstreameraudiodecodercontrol.cpp platform/gstreamer/audio/qgstreameraudiodecodercontrol_p.h platform/gstreamer/common/qgstappsrc.cpp platform/gstreamer/common/qgstappsrc_p.h platform/gstreamer/common/qgstcodecsinfo.cpp platform/gstreamer/common/qgstcodecsinfo_p.h - platform/gstreamer/common/qgstreameraudioprobecontrol.cpp platform/gstreamer/common/qgstreameraudioprobecontrol_p.h platform/gstreamer/common/qgstreamerbufferprobe.cpp platform/gstreamer/common/qgstreamerbufferprobe_p.h platform/gstreamer/common/qgstreamerbushelper.cpp platform/gstreamer/common/qgstreamerbushelper_p.h platform/gstreamer/common/qgstreamermessage.cpp platform/gstreamer/common/qgstreamermessage_p.h platform/gstreamer/common/qgstreamerplayercontrol.cpp platform/gstreamer/common/qgstreamerplayercontrol_p.h platform/gstreamer/common/qgstreamerplayersession.cpp platform/gstreamer/common/qgstreamerplayersession_p.h platform/gstreamer/common/qgstreamervideooverlay.cpp platform/gstreamer/common/qgstreamervideooverlay_p.h - platform/gstreamer/common/qgstreamervideoprobecontrol.cpp platform/gstreamer/common/qgstreamervideoprobecontrol_p.h platform/gstreamer/common/qgstreamervideorenderer.cpp platform/gstreamer/common/qgstreamervideorenderer_p.h platform/gstreamer/common/qgstreamervideorendererinterface.cpp platform/gstreamer/common/qgstreamervideorendererinterface_p.h platform/gstreamer/common/qgstreamervideowindow.cpp platform/gstreamer/common/qgstreamervideowindow_p.h @@ -370,7 +362,6 @@ qt_internal_extend_target(Multimedia CONDITION ANDROID platform/android/mediacapture/qandroidimageencodercontrol.cpp platform/android/mediacapture/qandroidimageencodercontrol_p.h platform/android/mediacapture/qandroidmediacontainercontrol.cpp platform/android/mediacapture/qandroidmediacontainercontrol_p.h platform/android/mediacapture/qandroidmediarecordercontrol.cpp platform/android/mediacapture/qandroidmediarecordercontrol_p.h - platform/android/mediacapture/qandroidmediavideoprobecontrol.cpp platform/android/mediacapture/qandroidmediavideoprobecontrol_p.h platform/android/mediacapture/qandroidvideoencodersettingscontrol.cpp platform/android/mediacapture/qandroidvideoencodersettingscontrol_p.h platform/android/mediaplayer/qandroidmediaplayercontrol.cpp platform/android/mediaplayer/qandroidmediaplayercontrol_p.h platform/android/mediaplayer/qandroidmediaplayervideorenderercontrol.cpp platform/android/mediaplayer/qandroidmediaplayervideorenderercontrol_p.h @@ -468,7 +459,6 @@ qt_internal_extend_target(Multimedia CONDITION APPLE AND NOT TVOS AND NOT WATCHO platform/darwin/camera/avfimagecapturecontrol.mm platform/darwin/camera/avfimagecapturecontrol_p.h platform/darwin/camera/avfimageencodercontrol.mm platform/darwin/camera/avfimageencodercontrol_p.h platform/darwin/camera/avfmediacontainercontrol.mm platform/darwin/camera/avfmediacontainercontrol_p.h - platform/darwin/camera/avfmediavideoprobecontrol.mm platform/darwin/camera/avfmediavideoprobecontrol_p.h platform/darwin/camera/avfstoragelocation.mm platform/darwin/camera/avfstoragelocation_p.h platform/darwin/camera/avfvideoencodersettingscontrol.mm platform/darwin/camera/avfvideoencodersettingscontrol_p.h ) diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index 6b9bc59cf..f180a806b 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -8,7 +8,6 @@ PUBLIC_HEADERS += \ audio/qaudiooutput.h \ audio/qaudiodeviceinfo.h \ audio/qsoundeffect.h \ - audio/qaudioprobe.h \ audio/qaudiodecoder.h PRIVATE_HEADERS += \ @@ -30,6 +29,5 @@ SOURCES += \ audio/qwavedecoder_p.cpp \ audio/qsamplecache_p.cpp \ audio/qaudiobuffer.cpp \ - audio/qaudioprobe.cpp \ audio/qaudiodecoder.cpp \ audio/qaudiohelpers.cpp diff --git a/src/multimedia/audio/qaudioprobe.cpp b/src/multimedia/audio/qaudioprobe.cpp deleted file mode 100644 index 3bf2a90e1..000000000 --- a/src/multimedia/audio/qaudioprobe.cpp +++ /dev/null @@ -1,205 +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$ -** -****************************************************************************/ - -/*! - \class QAudioProbe - \inmodule QtMultimedia - - \ingroup multimedia - \ingroup multimedia_audio - - \brief The QAudioProbe class allows you to monitor audio being played or recorded. - - \snippet multimedia-snippets/qaudioprobe.cpp desc - - \sa QVideoProbe, QMediaPlayer, QCamera -*/ - -#include "qaudioprobe.h" -#include "qmediaaudioprobecontrol.h" -#include "qmediaservice.h" -#include "qmediarecorder.h" -#include "qsharedpointer.h" -#include "qpointer.h" - -QT_BEGIN_NAMESPACE - -class QAudioProbePrivate { -public: - QPointer<QMediaSource> source; - QPointer<QMediaAudioProbeControl> probee; -}; - -/*! - Creates a new QAudioProbe class with a \a parent. After setting the - source to monitor with \l setSource(), the \l audioBufferProbed() - signal will be emitted when audio buffers are flowing in the - source media object. - */ -QAudioProbe::QAudioProbe(QObject *parent) - : QObject(parent) - , d(new QAudioProbePrivate) -{ -} - -/*! - Destroys this probe and disconnects from any - media object. - */ -QAudioProbe::~QAudioProbe() -{ - if (d->source) { - // Disconnect - if (d->probee) { - disconnect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer))); - disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - } - d->source.data()->service()->releaseControl(d->probee.data()); - } -} - -/*! - Sets the media object to monitor to \a source. - - If \a source is zero, this probe will be deactivated - and this function wil return true. - - If the media object does not support monitoring - audio, this function will return false. - - The previous object will no longer be monitored. - Passing in the same object will be ignored, but - monitoring will continue. - */ -bool QAudioProbe::setSource(QMediaSource *source) -{ - // Need to: - // 1) disconnect from current source if necessary - // 2) see if new one has the probe control - // 3) connect if so - - // in case source was destroyed but probe control is still valid - if (!d->source && d->probee) { - disconnect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer))); - disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - d->probee.clear(); - } - - if (source != d->source.data()) { - if (d->source) { - Q_ASSERT(d->probee); - disconnect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer))); - disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - d->source.data()->service()->releaseControl(d->probee.data()); - d->source.clear(); - d->probee.clear(); - } - - if (source) { - QMediaService *service = source->service(); - if (service) { - d->probee = service->requestControl<QMediaAudioProbeControl*>(); - } - - if (d->probee) { - connect(d->probee.data(), SIGNAL(audioBufferProbed(QAudioBuffer)), this, SIGNAL(audioBufferProbed(QAudioBuffer))); - connect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - d->source = source; - } - } - } - - return (!source || d->probee != nullptr); -} - -/*! - Starts monitoring the given \a mediaRecorder. - - Returns true on success. - - If there is no mediaSource associated with \a mediaRecorder, or if it is - zero, this probe will be deactivated and this function wil return true. - - If the media recorder instance does not support monitoring - audio, this function will return false. - - Any previously monitored objects will no longer be monitored. - Passing in the same (valid) object will be ignored, but - monitoring will continue. - */ -bool QAudioProbe::setSource(QMediaRecorder *mediaRecorder) -{ - QMediaSource *source = mediaRecorder ? mediaRecorder->mediaSource() : nullptr; - bool result = setSource(source); - - if (!mediaRecorder) - return true; - - if (mediaRecorder && !source) - return false; - - return result; -} - -/*! - Returns true if this probe is monitoring something, or false otherwise. - - The source being monitored does not need to be active. - */ -bool QAudioProbe::isActive() const -{ - return d->probee != nullptr; -} - -/*! - \fn QAudioProbe::audioBufferProbed(const QAudioBuffer &buffer) - - This signal should be emitted when an audio \a buffer is processed in the - media service. -*/ - - -/*! - \fn QAudioProbe::flush() - - This signal should be emitted when it is required to release all buffers. - Application must release all outstanding references to audio buffers. -*/ - -QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudioprobe.h b/src/multimedia/audio/qaudioprobe.h deleted file mode 100644 index 656561fd9..000000000 --- a/src/multimedia/audio/qaudioprobe.h +++ /dev/null @@ -1,74 +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 QAUDIOPROBE_H -#define QAUDIOPROBE_H - -#include <QtCore/qobject.h> -#include <QtMultimedia/qaudiobuffer.h> - -QT_BEGIN_NAMESPACE - -class QMediaSource; -class QMediaRecorder; - -class QAudioProbePrivate; -class Q_MULTIMEDIA_EXPORT QAudioProbe : public QObject -{ - Q_OBJECT -public: - explicit QAudioProbe(QObject *parent = nullptr); - ~QAudioProbe(); - - bool setSource(QMediaSource *source); - bool setSource(QMediaRecorder *source); - - bool isActive() const; - -Q_SIGNALS: - void audioBufferProbed(const QAudioBuffer &buffer); - void flush(); - -private: - QAudioProbePrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QAUDIOPROBE_H diff --git a/src/multimedia/controls/controls.pri b/src/multimedia/controls/controls.pri index 5a477a702..3f5b32c72 100644 --- a/src/multimedia/controls/controls.pri +++ b/src/multimedia/controls/controls.pri @@ -19,8 +19,6 @@ PUBLIC_HEADERS += \ controls/qvideoencodersettingscontrol.h \ controls/qvideorenderercontrol.h \ controls/qvideowindowcontrol.h \ - controls/qmediaaudioprobecontrol.h \ - controls/qmediavideoprobecontrol.h \ SOURCES += \ controls/qcameracontrol.cpp \ @@ -37,8 +35,6 @@ SOURCES += \ controls/qmetadatawritercontrol.cpp \ controls/qvideorenderercontrol.cpp \ controls/qvideowindowcontrol.cpp \ - controls/qmediaaudioprobecontrol.cpp \ - controls/qmediavideoprobecontrol.cpp \ controls/qaudiodecodercontrol.cpp \ controls/qvideoencodersettingscontrol.cpp \ controls/qaudioencodersettingscontrol.cpp \ diff --git a/src/multimedia/controls/qmediaaudioprobecontrol.cpp b/src/multimedia/controls/qmediaaudioprobecontrol.cpp deleted file mode 100644 index 9bd028573..000000000 --- a/src/multimedia/controls/qmediaaudioprobecontrol.cpp +++ /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$ -** -****************************************************************************/ - -#include "qmediaaudioprobecontrol.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QMediaAudioProbeControl - \obsolete - \inmodule QtMultimedia - - - \ingroup multimedia_control - - \brief The QMediaAudioProbeControl class allows control over probing audio data in media objects. - - \l QAudioProbe is the client facing class for probing audio - this class is implemented by - media backends to provide this functionality. - - The interface name of QMediaAudioProbeControl is \c org.qt-project.qt.mediaaudioprobecontrol/5.0 as - defined in QMediaAudioProbeControl_iid. - - \sa QAudioProbe, QMediaService::requestControl(), QMediaPlayer, QCamera -*/ - -/*! - \macro QMediaAudioProbeControl_iid - - \c org.qt-project.qt.mediaaudioprobecontrol/5.0 - - Defines the interface name of the QMediaAudioProbeControl class. - - \relates QMediaAudioProbeControl -*/ - -/*! - Create a new media audio probe control object with the given \a parent. -*/ -QMediaAudioProbeControl::QMediaAudioProbeControl(QObject *parent) - : QObject(parent) -{ -} - -/*! - \fn QMediaAudioProbeControl::audioBufferProbed(const QAudioBuffer &buffer) - - This signal should be emitted when an audio \a buffer is processed in the - media service. -*/ - - -/*! - \fn QMediaAudioProbeControl::flush() - - This signal should be emitted when it is required to release all frames. -*/ - -QT_END_NAMESPACE - -#include "moc_qmediaaudioprobecontrol.cpp" diff --git a/src/multimedia/controls/qmediaaudioprobecontrol.h b/src/multimedia/controls/qmediaaudioprobecontrol.h deleted file mode 100644 index 7067b809e..000000000 --- a/src/multimedia/controls/qmediaaudioprobecontrol.h +++ /dev/null @@ -1,66 +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 QMEDIAAUDIOPROBECONTROL_H -#define QMEDIAAUDIOPROBECONTROL_H - -#include <QtMultimedia/qmediaservice.h> - -QT_BEGIN_NAMESPACE - -class QAudioBuffer; -class Q_MULTIMEDIA_EXPORT QMediaAudioProbeControl : public QObject -{ - Q_OBJECT - -Q_SIGNALS: - void audioBufferProbed(const QAudioBuffer &buffer); - void flush(); - -protected: - explicit QMediaAudioProbeControl(QObject *parent = nullptr); -}; - -#define QMediaAudioProbeControl_iid "org.qt-project.qt.mediaaudioprobecontrol/5.0" -Q_MEDIA_DECLARE_CONTROL(QMediaAudioProbeControl, QMediaAudioProbeControl_iid) - -QT_END_NAMESPACE - - -#endif // QMEDIAAUDIOPROBECONTROL_H diff --git a/src/multimedia/controls/qmediavideoprobecontrol.cpp b/src/multimedia/controls/qmediavideoprobecontrol.cpp deleted file mode 100644 index d0a7640be..000000000 --- a/src/multimedia/controls/qmediavideoprobecontrol.cpp +++ /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$ -** -****************************************************************************/ - -#include "qmediavideoprobecontrol.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QMediaVideoProbeControl - \obsolete - \inmodule QtMultimedia - - - \ingroup multimedia_control - - \brief The QMediaVideoProbeControl class allows control over probing video frames in media objects. - - \l QVideoProbe is the client facing class for probing video - this class is implemented by - media backends to provide this functionality. - - The interface name of QMediaVideoProbeControl is \c org.qt-project.qt.mediavideoprobecontrol/5.0 as - defined in QMediaVideoProbeControl_iid. - - \sa QVideoProbe, QMediaService::requestControl(), QMediaPlayer, QCamera -*/ - -/*! - \macro QMediaVideoProbeControl_iid - - \c org.qt-project.qt.mediavideoprobecontrol/5.0 - - Defines the interface name of the QMediaVideoProbeControl class. - - \relates QMediaVideoProbeControl -*/ - -/*! - Create a new media video probe control object with the given \a parent. -*/ -QMediaVideoProbeControl::QMediaVideoProbeControl(QObject *parent) - : QObject(parent) -{ -} - -/*! - \fn QMediaVideoProbeControl::videoFrameProbed(const QVideoFrame &frame) - - This signal should be emitted when a video \a frame is processed in the - media service. -*/ - -/*! - \fn QMediaVideoProbeControl::flush() - - This signal should be emitted when it is required to release all frames. -*/ - -QT_END_NAMESPACE - -#include "moc_qmediavideoprobecontrol.cpp" diff --git a/src/multimedia/controls/qmediavideoprobecontrol.h b/src/multimedia/controls/qmediavideoprobecontrol.h deleted file mode 100644 index f291a3e0a..000000000 --- a/src/multimedia/controls/qmediavideoprobecontrol.h +++ /dev/null @@ -1,68 +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 QMEDIAVIDEOPROBECONTROL_H -#define QMEDIAVIDEOPROBECONTROL_H - -#include <QtMultimedia/qmediaservice.h> - -QT_BEGIN_NAMESPACE - -class QVideoFrame; -class Q_MULTIMEDIA_EXPORT QMediaVideoProbeControl : public QObject -{ - Q_OBJECT - -Q_SIGNALS: - void videoFrameProbed(const QVideoFrame &frame); - void flush(); - -protected: - explicit QMediaVideoProbeControl(QObject *parent = nullptr); -}; - -#define QMediaVideoProbeControl_iid "org.qt-project.qt.mediavideoprobecontrol/5.0" -Q_MEDIA_DECLARE_CONTROL(QMediaVideoProbeControl, QMediaVideoProbeControl_iid) - -QT_END_NAMESPACE - - -#endif // QMEDIAVIDEOPROBECONTROL_H diff --git a/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp b/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp index 71057448e..571c824b0 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp @@ -45,7 +45,6 @@ #include "qaudiodeviceinfo.h" #include "qaudioinput.h" #include "qaudiooutput.h" -#include "qaudioprobe.h" #include "qaudiodecoder.h" #include "qmediaplayer.h" diff --git a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp index 5ba7fcc25..f72679606 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp @@ -51,9 +51,7 @@ #include "qcameraimagecapture.h" #include "qcamera.h" #include "qcameraviewfinder.h" -#include "qaudioprobe.h" #include "qaudiorecorder.h" -#include "qvideoprobe.h" #include <QAbstractVideoSurface> class MediaExample : public QObject { @@ -65,9 +63,7 @@ class MediaExample : public QObject { void AudioRecorder(); void EncoderSettings(); void ImageEncoderSettings(); - void AudioProbe(); - void VideoProbe(); - + private: // Common naming QMediaService *mediaService; @@ -82,8 +78,6 @@ private: QCameraImageCapture *imageCapture; QString fileName; QAudioRecorder *audioRecorder; - QAudioProbe *audioProbe; - QVideoProbe *videoProbe; QMediaContent image1; QMediaContent image2; @@ -291,59 +285,3 @@ void MediaExample::AudioRecorder() //! [Audio recorder inputs] } -void MediaExample::AudioProbe() -{ - //! [Audio probe] - audioRecorder = new QAudioRecorder; - - QAudioEncoderSettings audioSettings; - audioSettings.setCodec("audio/amr"); - audioSettings.setQuality(QMultimedia::HighQuality); - - audioRecorder->setEncodingSettings(audioSettings); - - audioRecorder->setOutputLocation(QUrl::fromLocalFile("test.amr")); - - audioProbe = new QAudioProbe(this); - if (audioProbe->setSource(audioRecorder)) { - // Probing succeeded, audioProbe->isValid() should be true. - connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)), - this, SLOT(calculateLevel(QAudioBuffer))); - } - - audioRecorder->record(); - // Now audio buffers being recorded should be signaled - // by the probe, so we can do things like calculating the - // audio power level, or performing a frequency transform - //! [Audio probe] -} - -void MediaExample::VideoProbe() -{ - //! [Video probe] - camera = new QCamera; - viewfinder = new QCameraViewfinder(); - camera->setViewfinder(viewfinder); - - camera->setCaptureMode(QCamera::CaptureVideo); - - videoProbe = new QVideoProbe(this); - - if (videoProbe->setSource(camera)) { - // Probing succeeded, videoProbe->isValid() should be true. - connect(videoProbe, SIGNAL(videoFrameProbed(QVideoFrame)), - this, SLOT(detectBarcodes(QVideoFrame))); - } - - camera->start(); - // Viewfinder frames should now also be emitted by - // the video probe, even in still image capture mode. - // Another alternative is to install the probe on a - // QMediaRecorder connected to the camera to get the - // recorded frames, if they are different from the - // viewfinder frames. - - //! [Video probe] -} - - diff --git a/src/multimedia/doc/snippets/multimedia-snippets/qaudioprobe.cpp b/src/multimedia/doc/snippets/multimedia-snippets/qaudioprobe.cpp deleted file mode 100644 index 8543395f3..000000000 --- a/src/multimedia/doc/snippets/multimedia-snippets/qaudioprobe.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [desc] -QAudioRecorder *recorder = new QAudioRecorder(); -QAudioProbe *probe = new QAudioProbe; - -// ... configure the audio recorder (skipped) - -connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer))); - -probe->setSource(recorder); // Returns true, hopefully. - -recorder->record(); // Now we can do things like calculating levels or performing an FFT -//! [desc] diff --git a/src/multimedia/doc/src/audiooverview.qdoc b/src/multimedia/doc/src/audiooverview.qdoc index 8fedaab4c..30f94d548 100644 --- a/src/multimedia/doc/src/audiooverview.qdoc +++ b/src/multimedia/doc/src/audiooverview.qdoc @@ -72,20 +72,6 @@ SoundEffect have essentially the same API. You can adjust the number of \l {QSoundEffect::loopCount()}{loops} a sound effect is played, as well as the \l {QSoundEffect::setVolume()}{volume} (or \l {QSoundEffect::setMuted()}{muting}) of the effect. -\section2 Monitoring Audio Data During Playback or Recording - -The \l QAudioProbe class allows you to monitor audio data being played or -recorded in the higher level classes like \l QMediaPlayer, \l QCamera and -\l QAudioRecorder. After creating your high level class, you can simply -set the source of the probe to your class, and receive audio buffers as they -are processed. This is useful for several audio processing tasks, particularly -for visualization or adjusting gain. You cannot modify the buffers, and -they may arrive at a slightly different time than the media pipeline -processes them. - -Here's an example of installing a probe during recording: - \snippet multimedia-snippets/media.cpp Audio probe - \section2 Low Level Audio Playback and Recording Qt Multimedia offers classes for raw access to audio input and output facilities, allowing applications to receive raw data from devices like diff --git a/src/multimedia/doc/src/platform-notes-windows.qdoc b/src/multimedia/doc/src/platform-notes-windows.qdoc index a69e96d99..3b8d6aa18 100644 --- a/src/multimedia/doc/src/platform-notes-windows.qdoc +++ b/src/multimedia/doc/src/platform-notes-windows.qdoc @@ -55,8 +55,5 @@ plugin. Basic features such as displaying a viewfinder and capturing a still image are supported, however, majority of camera controls are not implemented. -Video recording is currently not supported. Additionally, the DirectShow -plugin does not support any low-level video functionality such as -monitoring video frames being played or recorded using \l QVideoProbe or -related classes. +Video recording is currently not supported. */ diff --git a/src/multimedia/doc/src/videooverview.qdoc b/src/multimedia/doc/src/videooverview.qdoc index c3fa50f04..1811e4991 100644 --- a/src/multimedia/doc/src/videooverview.qdoc +++ b/src/multimedia/doc/src/videooverview.qdoc @@ -104,20 +104,6 @@ You can use the \l QMediaRecorder class in conjunction with other classes to record video to disk. Primarily this is used with the camera, so consult the \l {Camera Overview} for more information. -\section2 Monitoring Video Frames -You can use the \l QVideoProbe class to access video frames as they -flow through different parts of a media pipeline when using other -classes like \l QMediaPlayer, \l QMediaRecorder or \l QCamera. After -creating the high level media class, you can set the source of the -video probe to that instance. This can be useful for performing -some video processing tasks (like barcode recognition, or object -detection) while the video is rendered normally. You can not affect -the video frames using this class, and they may arrive at a slightly -different time than they are being rendered. - -Here's an example of installing a video probe while recording the camera: - \snippet multimedia-snippets/media.cpp Video probe - \section1 Examples There are both C++ and QML examples available. diff --git a/src/multimedia/platform/android/mediacapture/mediacapture.pri b/src/multimedia/platform/android/mediacapture/mediacapture.pri index 5f39c8b9e..8a6959d94 100644 --- a/src/multimedia/platform/android/mediacapture/mediacapture.pri +++ b/src/multimedia/platform/android/mediacapture/mediacapture.pri @@ -14,7 +14,6 @@ SOURCES += \ $$PWD/qandroidaudioencodersettingscontrol.cpp \ $$PWD/qandroidmediacontainercontrol.cpp \ $$PWD/qandroidvideoencodersettingscontrol.cpp \ - $$PWD/qandroidmediavideoprobecontrol.cpp \ $$PWD/qandroidcameravideorenderercontrol.cpp HEADERS += \ @@ -31,5 +30,4 @@ HEADERS += \ $$PWD/qandroidaudioencodersettingscontrol_p.h \ $$PWD/qandroidmediacontainercontrol_p.h \ $$PWD/qandroidvideoencodersettingscontrol_p.h \ - $$PWD/qandroidmediavideoprobecontrol_p.h \ $$PWD/qandroidcameravideorenderercontrol_p.h diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp index a9829ce4b..3172ba7fd 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp +++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession.cpp @@ -43,7 +43,6 @@ #include "androidcamera_p.h" #include "androidmultimediautils_p.h" #include "qandroidvideooutput_p.h" -#include "qandroidmediavideoprobecontrol_p.h" #include "qandroidmultimediautils_p.h" #include "qandroidcameravideorenderercontrol_p.h" #include <qabstractvideosurface.h> @@ -207,7 +206,7 @@ bool QAndroidCameraSession::open() if (m_camera->getPreviewFormat() != AndroidCamera::NV21) m_camera->setPreviewFormat(AndroidCamera::NV21); - m_camera->notifyNewFrames(m_videoProbes.count() || m_previewCallback); + m_camera->notifyNewFrames(m_previewCallback); emit opened(); emit statusChanged(m_status); @@ -530,25 +529,6 @@ int QAndroidCameraSession::currentCameraRotation() const return rotation; } -void QAndroidCameraSession::addProbe(QAndroidMediaVideoProbeControl *probe) -{ - m_videoProbesMutex.lock(); - if (probe) - m_videoProbes << probe; - if (m_camera) - m_camera->notifyNewFrames(m_videoProbes.count() || m_previewCallback); - m_videoProbesMutex.unlock(); -} - -void QAndroidCameraSession::removeProbe(QAndroidMediaVideoProbeControl *probe) -{ - m_videoProbesMutex.lock(); - m_videoProbes.remove(probe); - if (m_camera) - m_camera->notifyNewFrames(m_videoProbes.count() || m_previewCallback); - m_videoProbesMutex.unlock(); -} - void QAndroidCameraSession::setPreviewFormat(AndroidCamera::ImageFormat format) { if (format == AndroidCamera::UnknownImageFormat) @@ -559,11 +539,11 @@ void QAndroidCameraSession::setPreviewFormat(AndroidCamera::ImageFormat format) void QAndroidCameraSession::setPreviewCallback(PreviewCallback *callback) { - m_videoProbesMutex.lock(); + m_videoFrameCallbackMutex.lock(); m_previewCallback = callback; if (m_camera) - m_camera->notifyNewFrames(m_videoProbes.count() || m_previewCallback); - m_videoProbesMutex.unlock(); + m_camera->notifyNewFrames(m_previewCallback); + m_videoFrameCallbackMutex.unlock(); } void QAndroidCameraSession::applyImageSettings() @@ -754,15 +734,12 @@ void QAndroidCameraSession::onNewPreviewFrame(const QVideoFrame &frame) if (!m_camera) return; - m_videoProbesMutex.lock(); - - for (QAndroidMediaVideoProbeControl *probe : qAsConst(m_videoProbes)) - probe->newFrameProbed(frame); + m_videoFrameCallbackMutex.lock(); if (m_previewCallback) m_previewCallback->onFrameAvailable(frame); - m_videoProbesMutex.unlock(); + m_videoFrameCallbackMutex.unlock(); } void QAndroidCameraSession::onCameraPictureCaptured(const QByteArray &data) diff --git a/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h b/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h index 2aacad58f..cd2382987 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h +++ b/src/multimedia/platform/android/mediacapture/qandroidcamerasession_p.h @@ -63,7 +63,6 @@ QT_BEGIN_NAMESPACE class QAndroidVideoOutput; -class QAndroidMediaVideoProbeControl; class QAndroidCameraSession : public QObject { @@ -113,9 +112,6 @@ public: int currentCameraRotation() const; - void addProbe(QAndroidMediaVideoProbeControl *probe); - void removeProbe(QAndroidMediaVideoProbeControl *probe); - void setPreviewFormat(AndroidCamera::ImageFormat format); struct PreviewCallback @@ -205,8 +201,7 @@ private: QMediaStorageLocation m_mediaStorageLocation; - QSet<QAndroidMediaVideoProbeControl *> m_videoProbes; - QMutex m_videoProbesMutex; + QMutex m_videoFrameCallbackMutex; PreviewCallback *m_previewCallback; bool m_keepActive; }; diff --git a/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp b/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp index fbcfa3d76..bbd69ff49 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp +++ b/src/multimedia/platform/android/mediacapture/qandroidcaptureservice.cpp @@ -53,7 +53,6 @@ #include "qandroidaudioencodersettingscontrol_p.h" #include "qandroidvideoencodersettingscontrol_p.h" #include "qandroidmediacontainercontrol_p.h" -#include "qandroidmediavideoprobecontrol_p.h" QT_BEGIN_NAMESPACE @@ -145,15 +144,6 @@ QObject *QAndroidCaptureService::requestControl(const char *name) return m_videoRendererControl; } - if (qstrcmp(name,QMediaVideoProbeControl_iid) == 0) { - QAndroidMediaVideoProbeControl *videoProbe = 0; - if (m_cameraSession) { - videoProbe = new QAndroidMediaVideoProbeControl(this); - m_cameraSession->addProbe(videoProbe); - } - return videoProbe; - } - return 0; } @@ -165,14 +155,6 @@ void QAndroidCaptureService::releaseControl(QObject *control) m_videoRendererControl = 0; return; } - - QAndroidMediaVideoProbeControl *videoProbe = qobject_cast<QAndroidMediaVideoProbeControl *>(control); - if (videoProbe) { - if (m_cameraSession) - m_cameraSession->removeProbe(videoProbe); - delete videoProbe; - return; - } } } diff --git a/src/multimedia/platform/android/mediacapture/qandroidmediavideoprobecontrol.cpp b/src/multimedia/platform/android/mediacapture/qandroidmediavideoprobecontrol.cpp deleted file mode 100644 index 86321271a..000000000 --- a/src/multimedia/platform/android/mediacapture/qandroidmediavideoprobecontrol.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Integrated Computer Solutions, Inc -** 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 "qandroidmediavideoprobecontrol_p.h" -#include <qvideoframe.h> - -QT_BEGIN_NAMESPACE - -QAndroidMediaVideoProbeControl::QAndroidMediaVideoProbeControl(QObject *parent) : - QMediaVideoProbeControl(parent) -{ -} - -QAndroidMediaVideoProbeControl::~QAndroidMediaVideoProbeControl() -{ - -} - -void QAndroidMediaVideoProbeControl::newFrameProbed(const QVideoFrame &frame) -{ - emit videoFrameProbed(frame); -} - -QT_END_NAMESPACE diff --git a/src/multimedia/platform/android/mediacapture/qandroidmediavideoprobecontrol_p.h b/src/multimedia/platform/android/mediacapture/qandroidmediavideoprobecontrol_p.h deleted file mode 100644 index 324370e97..000000000 --- a/src/multimedia/platform/android/mediacapture/qandroidmediavideoprobecontrol_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Integrated Computer Solutions, Inc -** 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 QANDROIDMEDIAVIDEOPROBECONTROL_H -#define QANDROIDMEDIAVIDEOPROBECONTROL_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 <qmediavideoprobecontrol.h> - -QT_BEGIN_NAMESPACE - -class QAndroidMediaVideoProbeControl : public QMediaVideoProbeControl -{ - Q_OBJECT -public: - explicit QAndroidMediaVideoProbeControl(QObject *parent = 0); - virtual ~QAndroidMediaVideoProbeControl(); - - void newFrameProbed(const QVideoFrame& frame); - -}; - -QT_END_NAMESPACE - -#endif // QANDROIDMEDIAVIDEOPROBECONTROL_H diff --git a/src/multimedia/platform/android/mediaplayer/qandroidmediaservice_p.h b/src/multimedia/platform/android/mediaplayer/qandroidmediaservice_p.h index 24ecc7aab..2a238e676 100644 --- a/src/multimedia/platform/android/mediaplayer/qandroidmediaservice_p.h +++ b/src/multimedia/platform/android/mediaplayer/qandroidmediaservice_p.h @@ -73,10 +73,6 @@ public: QMediaPlayerControl *player() override; QMetaDataReaderControl *dataReader() override; // QMediaStreamsControl *streams() override; -// QMediaVideoProbeControl *videoProbe() override; -// void releaseVideoProbe(QMediaVideoProbeControl *) override; -// QMediaAudioProbeControl *audioProbe() override; -// void releaseAudioProbe(QMediaAudioProbeControl *) override; QVideoRendererControl *createVideoRenderer() override; // QVideoWindowControl *createVideoWindow() override;; diff --git a/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm b/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm index 13131766c..f04b0af41 100644 --- a/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm +++ b/src/multimedia/platform/darwin/camera/avfcamerarenderercontrol.mm @@ -349,9 +349,6 @@ void AVFCameraRendererControl::syncHandleViewfinderFrame(const QVideoFrame &fram } m_lastViewfinderFrame = frame; - - if (m_cameraSession && m_lastViewfinderFrame.isValid()) - m_cameraSession->onCameraFrameFetched(m_lastViewfinderFrame); } AVCaptureVideoDataOutput *AVFCameraRendererControl::videoDataOutput() const diff --git a/src/multimedia/platform/darwin/camera/avfcameraservice.mm b/src/multimedia/platform/darwin/camera/avfcameraservice.mm index ca2b31142..a536889cb 100644 --- a/src/multimedia/platform/darwin/camera/avfcameraservice.mm +++ b/src/multimedia/platform/darwin/camera/avfcameraservice.mm @@ -49,7 +49,6 @@ #include "avfcamerarenderercontrol_p.h" #include "avfmediarecordercontrol_p.h" #include "avfimagecapturecontrol_p.h" -#include "avfmediavideoprobecontrol_p.h" #include "avfcamerafocuscontrol_p.h" #include "avfcameraexposurecontrol_p.h" #include "avfimageencodercontrol_p.h" @@ -162,13 +161,6 @@ QObject *AVFCameraService::requestControl(const char *name) if (qstrcmp(name, QMediaContainerControl_iid) == 0) return m_mediaContainerControl; - if (qstrcmp(name,QMediaVideoProbeControl_iid) == 0) { - AVFMediaVideoProbeControl *videoProbe = nullptr; - videoProbe = new AVFMediaVideoProbeControl(this); - m_session->addProbe(videoProbe); - return videoProbe; - } - if (!m_captureWindowControl) { if (qstrcmp(name, QVideoWindowControl_iid) == 0) { m_captureWindowControl = new AVFCameraWindowControl(this); @@ -192,11 +184,7 @@ QObject *AVFCameraService::requestControl(const char *name) void AVFCameraService::releaseControl(QObject *control) { - AVFMediaVideoProbeControl *videoProbe = qobject_cast<AVFMediaVideoProbeControl *>(control); - if (videoProbe) { - m_session->removeProbe(videoProbe); - delete videoProbe; - } else if (m_videoOutput == control) { + if (m_videoOutput == control) { m_session->setVideoOutput(nullptr); delete m_videoOutput; m_videoOutput = nullptr; diff --git a/src/multimedia/platform/darwin/camera/avfcamerasession.mm b/src/multimedia/platform/darwin/camera/avfcamerasession.mm index cc7201a7d..aef0321f5 100644 --- a/src/multimedia/platform/darwin/camera/avfcamerasession.mm +++ b/src/multimedia/platform/darwin/camera/avfcamerasession.mm @@ -42,7 +42,6 @@ #include "avfcameraservice_p.h" #include "avfcameracontrol_p.h" #include "avfcamerarenderercontrol_p.h" -#include "avfmediavideoprobecontrol_p.h" #include "avfimageencodercontrol_p.h" #include "avfcamerautility_p.h" #include "avfcamerawindowcontrol_p.h" @@ -385,21 +384,6 @@ bool AVFCameraSession::applyViewfinderSettings() return false; } -void AVFCameraSession::addProbe(AVFMediaVideoProbeControl *probe) -{ - m_videoProbesMutex.lock(); - if (probe) - m_videoProbes << probe; - m_videoProbesMutex.unlock(); -} - -void AVFCameraSession::removeProbe(AVFMediaVideoProbeControl *probe) -{ - m_videoProbesMutex.lock(); - m_videoProbes.remove(probe); - m_videoProbesMutex.unlock(); -} - FourCharCode AVFCameraSession::defaultCodec() { if (!m_defaultCodec) { @@ -413,17 +397,4 @@ FourCharCode AVFCameraSession::defaultCodec() return m_defaultCodec; } -void AVFCameraSession::onCameraFrameFetched(const QVideoFrame &frame) -{ - Q_EMIT newViewfinderFrame(frame); - - m_videoProbesMutex.lock(); - QSet<AVFMediaVideoProbeControl *>::const_iterator i = m_videoProbes.constBegin(); - while (i != m_videoProbes.constEnd()) { - (*i)->newFrameProbed(frame); - ++i; - } - m_videoProbesMutex.unlock(); -} - #include "moc_avfcamerasession_p.cpp" diff --git a/src/multimedia/platform/darwin/camera/avfcamerasession_p.h b/src/multimedia/platform/darwin/camera/avfcamerasession_p.h index 584bd9b1b..d1a61ee81 100644 --- a/src/multimedia/platform/darwin/camera/avfcamerasession_p.h +++ b/src/multimedia/platform/darwin/camera/avfcamerasession_p.h @@ -65,7 +65,6 @@ QT_BEGIN_NAMESPACE class AVFCameraControl; class AVFCameraService; class AVFCameraRendererControl; -class AVFMediaVideoProbeControl; class AVFCameraWindowControl; struct AVFCameraInfo @@ -98,8 +97,6 @@ public: QCamera::State requestedState() const { return m_state; } bool isActive() const { return m_active; } - void addProbe(AVFMediaVideoProbeControl *probe); - void removeProbe(AVFMediaVideoProbeControl *probe); FourCharCode defaultCodec(); AVCaptureDeviceInput *videoInput() const {return m_videoInput;} @@ -113,8 +110,6 @@ public Q_SLOTS: void onCaptureModeChanged(QCamera::CaptureModes mode); - void onCameraFrameFetched(const QVideoFrame &frame); - Q_SIGNALS: void readyToConfigureConnections(); void stateChanged(QCamera::State newState); @@ -142,9 +137,6 @@ private: AVCaptureDeviceInput *m_videoInput; AVFCameraSessionObserver *m_observer; - QSet<AVFMediaVideoProbeControl *> m_videoProbes; - QMutex m_videoProbesMutex; - FourCharCode m_defaultCodec; }; diff --git a/src/multimedia/platform/darwin/camera/avfmediavideoprobecontrol.mm b/src/multimedia/platform/darwin/camera/avfmediavideoprobecontrol.mm deleted file mode 100644 index c97ab1919..000000000 --- a/src/multimedia/platform/darwin/camera/avfmediavideoprobecontrol.mm +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). -** Copyright (C) 2016 Integrated Computer Solutions, Inc -** 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 "avfmediavideoprobecontrol_p.h" -#include <qvideoframe.h> - -QT_BEGIN_NAMESPACE - -AVFMediaVideoProbeControl::AVFMediaVideoProbeControl(QObject *parent) : - QMediaVideoProbeControl(parent) -{ -} - -AVFMediaVideoProbeControl::~AVFMediaVideoProbeControl() -{ - -} - -void AVFMediaVideoProbeControl::newFrameProbed(const QVideoFrame &frame) -{ - Q_EMIT videoFrameProbed(frame); -} - -QT_END_NAMESPACE diff --git a/src/multimedia/platform/darwin/camera/avfmediavideoprobecontrol_p.h b/src/multimedia/platform/darwin/camera/avfmediavideoprobecontrol_p.h deleted file mode 100644 index c18bc4181..000000000 --- a/src/multimedia/platform/darwin/camera/avfmediavideoprobecontrol_p.h +++ /dev/null @@ -1,71 +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 AVFMEDIAVIDEOPROBECONTROL_H -#define AVFMEDIAVIDEOPROBECONTROL_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 <qmediavideoprobecontrol.h> - -QT_BEGIN_NAMESPACE - -class AVFMediaVideoProbeControl : public QMediaVideoProbeControl -{ - Q_OBJECT -public: - explicit AVFMediaVideoProbeControl(QObject *parent = nullptr); - ~AVFMediaVideoProbeControl(); - - void newFrameProbed(const QVideoFrame& frame); - -}; - -QT_END_NAMESPACE - -#endif // AVFMEDIAVIDEOPROBECONTROL_H diff --git a/src/multimedia/platform/darwin/camera/camera.pri b/src/multimedia/platform/darwin/camera/camera.pri index 9c1404c78..16953d07a 100644 --- a/src/multimedia/platform/darwin/camera/camera.pri +++ b/src/multimedia/platform/darwin/camera/camera.pri @@ -6,7 +6,6 @@ HEADERS += \ $$PWD/avfcameraservice_p.h \ $$PWD/avfcamerasession_p.h \ $$PWD/avfstoragelocation_p.h \ - $$PWD/avfmediavideoprobecontrol_p.h \ $$PWD/avfcamerarenderercontrol_p.h \ $$PWD/avfcamerafocuscontrol_p.h \ $$PWD/avfcameraexposurecontrol_p.h \ @@ -24,7 +23,6 @@ SOURCES += \ $$PWD/avfcameraservice.mm \ $$PWD/avfcamerasession.mm \ $$PWD/avfstoragelocation.mm \ - $$PWD/avfmediavideoprobecontrol.mm \ $$PWD/avfcamerarenderercontrol.mm \ $$PWD/avfcamerafocuscontrol.mm \ $$PWD/avfcameraexposurecontrol.mm \ diff --git a/src/multimedia/platform/darwin/mediaplayer/avfmediaplayerservice_p.h b/src/multimedia/platform/darwin/mediaplayer/avfmediaplayerservice_p.h index 927726cc3..f37c1e50f 100644 --- a/src/multimedia/platform/darwin/mediaplayer/avfmediaplayerservice_p.h +++ b/src/multimedia/platform/darwin/mediaplayer/avfmediaplayerservice_p.h @@ -73,10 +73,6 @@ public: QMediaPlayerControl *player() override; QMetaDataReaderControl *dataReader() override; // QMediaStreamsControl *streams() override; -// QMediaVideoProbeControl *videoProbe() override; -// void releaseVideoProbe(QMediaVideoProbeControl *) override; -// QMediaAudioProbeControl *audioProbe() override; -// void releaseAudioProbe(QMediaAudioProbeControl *) override; QVideoRendererControl *createVideoRenderer() override; QVideoWindowControl *createVideoWindow() override;; diff --git a/src/multimedia/platform/gstreamer/camerabin/camerabinservice.cpp b/src/multimedia/platform/gstreamer/camerabin/camerabinservice.cpp index f759aa83d..131ab36cd 100644 --- a/src/multimedia/platform/gstreamer/camerabin/camerabinservice.cpp +++ b/src/multimedia/platform/gstreamer/camerabin/camerabinservice.cpp @@ -116,9 +116,6 @@ QObject *CameraBinService::requestControl(const char *name) } } - if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0) - return m_captureSession->videoProbe(); - if (qstrcmp(name,QMediaRecorderControl_iid) == 0) return m_captureSession->recorderControl(); diff --git a/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp b/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp index 2450bad0c..84113ec85 100644 --- a/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp +++ b/src/multimedia/platform/gstreamer/camerabin/camerabinsession.cpp @@ -713,7 +713,7 @@ QCameraViewfinderSettings CameraBinSession::viewfinderSettings() const void CameraBinSession::ViewfinderProbe::probeCaps(GstCaps *caps) { - QGstreamerVideoProbeControl::probeCaps(caps); + QGstreamerBufferProbe::probeCaps(caps); // Update actual viewfinder settings on viewfinder caps change const GstStructure *s = gst_caps_get_structure(caps, 0); @@ -1114,11 +1114,6 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message) return false; } -QGstreamerVideoProbeControl *CameraBinSession::videoProbe() -{ - return &m_viewfinderProbe; -} - QString CameraBinSession::currentContainerFormat() const { if (!m_muxer) diff --git a/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h b/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h index 8d9634146..27cedc59c 100644 --- a/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h +++ b/src/multimedia/platform/gstreamer/camerabin/camerabinsession_p.h @@ -63,7 +63,7 @@ #endif #include <private/qgstreamerbushelper_p.h> -#include <private/qgstreamervideoprobecontrol_p.h> +#include <private/qgstreamerbufferprobe_p.h> #include <private/qmediastoragelocation_p.h> #include "qcamera.h" @@ -171,8 +171,6 @@ public: bool processSyncMessage(const QGstreamerMessage &message) override; bool processBusMessage(const QGstreamerMessage &message) override; - QGstreamerVideoProbeControl *videoProbe(); - signals: void statusChanged(QCamera::Status status); void pendingStateChanged(QCamera::State state); @@ -260,11 +258,10 @@ private: bool m_inputDeviceHasChanged; bool m_usingWrapperCameraBinSrc; - class ViewfinderProbe : public QGstreamerVideoProbeControl { + class ViewfinderProbe : public QGstreamerBufferProbe { public: ViewfinderProbe(CameraBinSession *s) - : QGstreamerVideoProbeControl(s) - , session(s) + : session(s) {} void probeCaps(GstCaps *caps) override; diff --git a/src/multimedia/platform/gstreamer/common/common.pri b/src/multimedia/platform/gstreamer/common/common.pri index 785fcecf4..3fe902b51 100644 --- a/src/multimedia/platform/gstreamer/common/common.pri +++ b/src/multimedia/platform/gstreamer/common/common.pri @@ -8,8 +8,6 @@ HEADERS += \ $$PWD/qgstreamervideorendererinterface_p.h \ $$PWD/qgstreamervideorenderer_p.h \ $$PWD/qgstcodecsinfo_p.h \ - $$PWD/qgstreamervideoprobecontrol_p.h \ - $$PWD/qgstreameraudioprobecontrol_p.h \ $$PWD/qgstreamervideowindow_p.h \ $$PWD/qgstreamervideooverlay_p.h \ $$PWD/qgstreamerplayersession_p.h \ @@ -27,8 +25,6 @@ SOURCES += \ $$PWD/qgstreamervideorendererinterface.cpp \ $$PWD/qgstreamervideorenderer.cpp \ $$PWD/qgstcodecsinfo.cpp \ - $$PWD/qgstreamervideoprobecontrol.cpp \ - $$PWD/qgstreameraudioprobecontrol.cpp \ $$PWD/qgstreamervideowindow.cpp \ $$PWD/qgstreamervideooverlay.cpp \ $$PWD/qgstreamerplayersession.cpp \ diff --git a/src/multimedia/platform/gstreamer/common/qgstreameraudioprobecontrol.cpp b/src/multimedia/platform/gstreamer/common/qgstreameraudioprobecontrol.cpp deleted file mode 100644 index 8b0415bde..000000000 --- a/src/multimedia/platform/gstreamer/common/qgstreameraudioprobecontrol.cpp +++ /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$ -** -****************************************************************************/ - -#include "qgstreameraudioprobecontrol_p.h" -#include <private/qgstutils_p.h> - -QGstreamerAudioProbeControl::QGstreamerAudioProbeControl(QObject *parent) - : QMediaAudioProbeControl(parent) -{ -} - -QGstreamerAudioProbeControl::~QGstreamerAudioProbeControl() -{ -} - -void QGstreamerAudioProbeControl::probeCaps(GstCaps *caps) -{ - QAudioFormat format = QGstUtils::audioFormatForCaps(caps); - - QMutexLocker locker(&m_bufferMutex); - m_format = format; -} - -bool QGstreamerAudioProbeControl::probeBuffer(GstBuffer *buffer) -{ - qint64 position = GST_BUFFER_TIMESTAMP(buffer); - position = position >= 0 - ? position / G_GINT64_CONSTANT(1000) // microseconds - : -1; - - QByteArray data; - GstMapInfo info; - if (gst_buffer_map(buffer, &info, GST_MAP_READ)) { - data = QByteArray(reinterpret_cast<const char *>(info.data), info.size); - gst_buffer_unmap(buffer, &info); - } else { - return true; - } - - QMutexLocker locker(&m_bufferMutex); - if (m_format.isValid()) { - if (!m_pendingBuffer.isValid()) - QMetaObject::invokeMethod(this, "bufferProbed", Qt::QueuedConnection); - m_pendingBuffer = QAudioBuffer(data, m_format, position); - } - - return true; -} - -void QGstreamerAudioProbeControl::bufferProbed() -{ - QAudioBuffer audioBuffer; - { - QMutexLocker locker(&m_bufferMutex); - if (!m_pendingBuffer.isValid()) - return; - audioBuffer = m_pendingBuffer; - m_pendingBuffer = QAudioBuffer(); - } - emit audioBufferProbed(audioBuffer); -} diff --git a/src/multimedia/platform/gstreamer/common/qgstreameraudioprobecontrol_p.h b/src/multimedia/platform/gstreamer/common/qgstreameraudioprobecontrol_p.h deleted file mode 100644 index b641929cd..000000000 --- a/src/multimedia/platform/gstreamer/common/qgstreameraudioprobecontrol_p.h +++ /dev/null @@ -1,90 +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 QGSTREAMERAUDIOPROBECONTROL_H -#define QGSTREAMERAUDIOPROBECONTROL_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 <gst/gst.h> -#include <qmediaaudioprobecontrol.h> -#include <QtCore/qmutex.h> -#include <qaudiobuffer.h> -#include <qshareddata.h> - -#include <private/qgstreamerbufferprobe_p.h> - -QT_BEGIN_NAMESPACE - -class Q_MULTIMEDIA_EXPORT QGstreamerAudioProbeControl - : public QMediaAudioProbeControl - , public QGstreamerBufferProbe - , public QSharedData -{ - Q_OBJECT -public: - explicit QGstreamerAudioProbeControl(QObject *parent); - virtual ~QGstreamerAudioProbeControl(); - -protected: - void probeCaps(GstCaps *caps) override; - bool probeBuffer(GstBuffer *buffer) override; - -private slots: - void bufferProbed(); - -private: - QAudioBuffer m_pendingBuffer; - QAudioFormat m_format; - QMutex m_bufferMutex; -}; - -QT_END_NAMESPACE - -#endif // QGSTREAMERAUDIOPROBECONTROL_H diff --git a/src/multimedia/platform/gstreamer/common/qgstreamerbufferprobe_p.h b/src/multimedia/platform/gstreamer/common/qgstreamerbufferprobe_p.h index 5d66f7320..d3ca9db2e 100644 --- a/src/multimedia/platform/gstreamer/common/qgstreamerbufferprobe_p.h +++ b/src/multimedia/platform/gstreamer/common/qgstreamerbufferprobe_p.h @@ -89,4 +89,4 @@ private: QT_END_NAMESPACE -#endif // QGSTREAMERAUDIOPROBECONTROL_H +#endif // QGSTREAMERBUFFERPROBE_H diff --git a/src/multimedia/platform/gstreamer/common/qgstreamerplayersession.cpp b/src/multimedia/platform/gstreamer/common/qgstreamerplayersession.cpp index 3dfa20577..f7fd1647e 100644 --- a/src/multimedia/platform/gstreamer/common/qgstreamerplayersession.cpp +++ b/src/multimedia/platform/gstreamer/common/qgstreamerplayersession.cpp @@ -40,8 +40,6 @@ #include <private/qgstreamerplayersession_p.h> #include <private/qgstreamerbushelper_p.h> -#include <private/qgstreameraudioprobecontrol_p.h> -#include <private/qgstreamervideoprobecontrol_p.h> #include <private/qgstreamervideorendererinterface_p.h> #include <private/qgstutils_p.h> #include <private/qgstvideorenderersink_p.h> @@ -179,8 +177,6 @@ QGstreamerPlayerSession::~QGstreamerPlayerSession() if (m_pipeline) { stop(); - removeVideoBufferProbe(); - removeAudioBufferProbe(); delete m_busHelper; m_busHelper = nullptr; @@ -624,13 +620,10 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) qDebug() << "The pipeline has not started yet, pending state:" << m_pendingState; #endif //the pipeline has not started yet - flushVideoProbes(); m_pendingVideoSink = 0; gst_element_set_state(m_videoSink, GST_STATE_NULL); gst_element_set_state(m_playbin, GST_STATE_NULL); - removeVideoBufferProbe(); - gst_bin_remove(GST_BIN(m_videoOutputBin), m_videoSink); m_videoSink = videoSink; @@ -646,8 +639,6 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) g_object_set(G_OBJECT(m_videoSink), "show-preroll-frame", value, nullptr); } - addVideoBufferProbe(); - switch (m_pendingState) { case QMediaPlayer::PausedState: gst_element_set_state(m_playbin, GST_STATE_PAUSED); @@ -659,8 +650,6 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) break; } - resumeVideoProbes(); - } else { if (m_pendingVideoSink) { #ifdef DEBUG_PLAYBIN @@ -730,8 +719,6 @@ void QGstreamerPlayerSession::finishVideoOutputChange() gst_element_set_state(m_videoSink, GST_STATE_NULL); gst_element_unlink(m_videoIdentity, m_videoSink); - removeVideoBufferProbe(); - gst_bin_remove(GST_BIN(m_videoOutputBin), m_videoSink); m_videoSink = m_pendingVideoSink; @@ -739,8 +726,6 @@ void QGstreamerPlayerSession::finishVideoOutputChange() gst_bin_add(GST_BIN(m_videoOutputBin), m_videoSink); - addVideoBufferProbe(); - bool linked = gst_element_link(m_videoIdentity, m_videoSink); if (!linked) @@ -766,16 +751,10 @@ void QGstreamerPlayerSession::finishVideoOutputChange() gst_element_set_state(m_videoSink, state); - if (state == GST_STATE_NULL) - flushVideoProbes(); - // Set state change that was deferred due the video output // change being pending gst_element_set_state(m_playbin, state); - if (state != GST_STATE_NULL) - resumeVideoProbes(); - //don't have to wait here, it will unblock eventually if (gst_pad_is_blocked(srcPad)) gst_pad_remove_probe(srcPad, this->pad_probe_id); @@ -811,7 +790,6 @@ bool QGstreamerPlayerSession::play() m_pendingState = m_state = QMediaPlayer::StoppedState; emit stateChanged(m_state); } else { - resumeVideoProbes(); return true; } } @@ -834,7 +812,6 @@ bool QGstreamerPlayerSession::pause() m_pendingState = m_state = QMediaPlayer::StoppedState; emit stateChanged(m_state); } else { - resumeVideoProbes(); return true; } } @@ -853,7 +830,6 @@ void QGstreamerPlayerSession::stop() if (m_renderer) m_renderer->stopRenderer(); - flushVideoProbes(); gst_element_set_state(m_pipeline, GST_STATE_NULL); m_lastPosition = 0; @@ -1589,34 +1565,6 @@ void QGstreamerPlayerSession::showPrerollFrames(bool enabled) } } -void QGstreamerPlayerSession::addProbe(QGstreamerVideoProbeControl* probe) -{ - Q_ASSERT(!m_videoProbe); - m_videoProbe = probe; - addVideoBufferProbe(); -} - -void QGstreamerPlayerSession::removeProbe(QGstreamerVideoProbeControl* probe) -{ - Q_ASSERT(m_videoProbe == probe); - removeVideoBufferProbe(); - m_videoProbe = 0; -} - -void QGstreamerPlayerSession::addProbe(QGstreamerAudioProbeControl* probe) -{ - Q_ASSERT(!m_audioProbe); - m_audioProbe = probe; - addAudioBufferProbe(); -} - -void QGstreamerPlayerSession::removeProbe(QGstreamerAudioProbeControl* probe) -{ - Q_ASSERT(m_audioProbe == probe); - removeAudioBufferProbe(); - m_audioProbe = 0; -} - // This function is similar to stop(), // but does not set m_everPlayed, m_lastPosition, // and setSeekable() values. @@ -1625,7 +1573,6 @@ void QGstreamerPlayerSession::endOfMediaReset() if (m_renderer) m_renderer->stopRenderer(); - flushVideoProbes(); gst_element_set_state(m_pipeline, GST_STATE_PAUSED); QMediaPlayer::State oldState = m_state; @@ -1647,30 +1594,6 @@ void QGstreamerPlayerSession::setAudioOutputDevice(const QAudioDeviceInfo &audio updateAudioSink(); } -void QGstreamerPlayerSession::removeVideoBufferProbe() -{ - if (!m_videoProbe) - return; - - GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); - if (pad) { - m_videoProbe->removeProbeFromPad(pad); - gst_object_unref(GST_OBJECT(pad)); - } -} - -void QGstreamerPlayerSession::addVideoBufferProbe() -{ - if (!m_videoProbe) - return; - - GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); - if (pad) { - m_videoProbe->addProbeToPad(pad); - gst_object_unref(GST_OBJECT(pad)); - } -} - void QGstreamerPlayerSession::updateAudioSink() { QAudioDeviceInfo info = m_audioDevice; @@ -1752,40 +1675,5 @@ void QGstreamerPlayerSession::finishAudioOutputChange() } } -void QGstreamerPlayerSession::removeAudioBufferProbe() -{ - if (!m_audioProbe) - return; - - GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(m_volumeElement), "src"); - if (pad) { - m_audioProbe->removeProbeFromPad(pad); - gst_object_unref(GST_OBJECT(pad)); - } -} - -void QGstreamerPlayerSession::addAudioBufferProbe() -{ - if (!m_audioProbe) - return; - - GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(m_volumeElement), "src"); - if (pad) { - m_audioProbe->addProbeToPad(pad); - gst_object_unref(GST_OBJECT(pad)); - } -} - -void QGstreamerPlayerSession::flushVideoProbes() -{ - if (m_videoProbe) - m_videoProbe->startFlushing(); -} - -void QGstreamerPlayerSession::resumeVideoProbes() -{ - if (m_videoProbe) - m_videoProbe->stopFlushing(); -} QT_END_NAMESPACE diff --git a/src/multimedia/platform/gstreamer/common/qgstreamerplayersession_p.h b/src/multimedia/platform/gstreamer/common/qgstreamerplayersession_p.h index ebcc9e018..187d942e7 100644 --- a/src/multimedia/platform/gstreamer/common/qgstreamerplayersession_p.h +++ b/src/multimedia/platform/gstreamer/common/qgstreamerplayersession_p.h @@ -73,8 +73,6 @@ class QGstreamerBusHelper; class QGstreamerMessage; class QGstreamerVideoRendererInterface; -class QGstreamerVideoProbeControl; -class QGstreamerAudioProbeControl; typedef enum { GST_AUTOPLUG_SELECT_TRY, @@ -138,12 +136,6 @@ public: bool isLiveSource() const; - void addProbe(QGstreamerVideoProbeControl* probe); - void removeProbe(QGstreamerVideoProbeControl* probe); - - void addProbe(QGstreamerAudioProbeControl* probe); - void removeProbe(QGstreamerAudioProbeControl* probe); - void endOfMediaReset(); QAudioDeviceInfo audioOutputDevice() const { return m_audioDevice; } @@ -202,13 +194,7 @@ private: static GstPadProbeReturn change_audio_sink_cb(GstPad *pad, GstPadProbeInfo *info, gpointer user_data); - void removeVideoBufferProbe(); - void addVideoBufferProbe(); void updateAudioSink(); - void removeAudioBufferProbe(); - void addAudioBufferProbe(); - void flushVideoProbes(); - void resumeVideoProbes(); bool parsePipeline(); bool setPipeline(GstElement *pipeline); void resetElements(); @@ -248,9 +234,6 @@ private: QList<QMediaStreamsControl::StreamType> m_streamTypes; QMap<QMediaStreamsControl::StreamType, int> m_playbin2StreamOffset; - QGstreamerVideoProbeControl *m_videoProbe = nullptr; - QGstreamerAudioProbeControl *m_audioProbe = nullptr; - int m_volume = 100; qreal m_playbackRate = 1.0; bool m_muted = false; diff --git a/src/multimedia/platform/gstreamer/common/qgstreamervideoprobecontrol.cpp b/src/multimedia/platform/gstreamer/common/qgstreamervideoprobecontrol.cpp deleted file mode 100644 index 3d587eb2c..000000000 --- a/src/multimedia/platform/gstreamer/common/qgstreamervideoprobecontrol.cpp +++ /dev/null @@ -1,117 +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 "qgstreamervideoprobecontrol_p.h" - -#include "qgstutils_p.h" -#include <private/qgstvideobuffer_p.h> - -QGstreamerVideoProbeControl::QGstreamerVideoProbeControl(QObject *parent) - : QMediaVideoProbeControl(parent) -{ -} - -QGstreamerVideoProbeControl::~QGstreamerVideoProbeControl() -{ -} - -void QGstreamerVideoProbeControl::startFlushing() -{ - m_flushing = true; - - { - QMutexLocker locker(&m_frameMutex); - m_pendingFrame = QVideoFrame(); - } - - // only emit flush if at least one frame was probed - if (m_frameProbed) - emit flush(); -} - -void QGstreamerVideoProbeControl::stopFlushing() -{ - m_flushing = false; -} - -void QGstreamerVideoProbeControl::probeCaps(GstCaps *caps) -{ - GstVideoInfo videoInfo; - QVideoSurfaceFormat format = QGstUtils::formatForCaps(caps, &videoInfo); - - QMutexLocker locker(&m_frameMutex); - m_videoInfo = videoInfo; - m_format = format; -} - -bool QGstreamerVideoProbeControl::probeBuffer(GstBuffer *buffer) -{ - QMutexLocker locker(&m_frameMutex); - - if (m_flushing || !m_format.isValid()) - return true; - - QVideoFrame frame( - new QGstVideoBuffer(buffer, m_videoInfo), - m_format.frameSize(), - m_format.pixelFormat()); - - QGstUtils::setFrameTimeStamps(&frame, buffer); - - m_frameProbed = true; - - if (!m_pendingFrame.isValid()) - QMetaObject::invokeMethod(this, "frameProbed", Qt::QueuedConnection); - m_pendingFrame = frame; - - return true; -} - -void QGstreamerVideoProbeControl::frameProbed() -{ - QVideoFrame frame; - { - QMutexLocker locker(&m_frameMutex); - if (!m_pendingFrame.isValid()) - return; - frame = m_pendingFrame; - m_pendingFrame = QVideoFrame(); - } - emit videoFrameProbed(frame); -} diff --git a/src/multimedia/platform/gstreamer/common/qgstreamervideoprobecontrol_p.h b/src/multimedia/platform/gstreamer/common/qgstreamervideoprobecontrol_p.h deleted file mode 100644 index 0c4b734b2..000000000 --- a/src/multimedia/platform/gstreamer/common/qgstreamervideoprobecontrol_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 QGSTREAMERVIDEOPROBECONTROL_H -#define QGSTREAMERVIDEOPROBECONTROL_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 <gst/gst.h> -#include <gst/video/video.h> -#include <qmediavideoprobecontrol.h> -#include <QtCore/qmutex.h> -#include <qvideoframe.h> -#include <qvideosurfaceformat.h> - -#include <private/qgstreamerbufferprobe_p.h> - -QT_BEGIN_NAMESPACE - -class Q_MULTIMEDIA_EXPORT QGstreamerVideoProbeControl - : public QMediaVideoProbeControl - , public QGstreamerBufferProbe - , public QSharedData -{ - Q_OBJECT -public: - explicit QGstreamerVideoProbeControl(QObject *parent); - virtual ~QGstreamerVideoProbeControl(); - - void probeCaps(GstCaps *caps) override; - bool probeBuffer(GstBuffer *buffer) override; - - void startFlushing(); - void stopFlushing(); - -private slots: - void frameProbed(); - -private: - QVideoSurfaceFormat m_format; - QVideoFrame m_pendingFrame; - QMutex m_frameMutex; - GstVideoInfo m_videoInfo; - bool m_flushing = false; - bool m_frameProbed = false; // true if at least one frame was probed -}; - -QT_END_NAMESPACE - -#endif // QGSTREAMERVIDEOPROBECONTROL_H diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp index aef73ea55..26df7676c 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice.cpp @@ -53,7 +53,6 @@ #endif #include "qgstreamerimagecapturecontrol_p.h" -#include <private/qgstreameraudioprobecontrol_p.h> #include <private/qgstreamervideorenderer_p.h> #include <private/qgstreamervideowindow_p.h> @@ -127,15 +126,6 @@ QObject *QGstreamerCaptureService::requestControl(const char *name) if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0) return m_imageCaptureControl; - if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) { - if (!m_audioProbeControl) { - m_audioProbeControl = new QGstreamerAudioProbeControl(this); - m_captureSession->addProbe(m_audioProbeControl); - } - m_audioProbeControl->ref.ref(); - return m_audioProbeControl; - } - if (!m_videoOutput) { if (qstrcmp(name, QVideoRendererControl_iid) == 0) { m_videoOutput = m_videoRenderer; @@ -159,10 +149,6 @@ void QGstreamerCaptureService::releaseControl(QObject *control) } else if (control == m_videoOutput) { m_videoOutput = 0; m_captureSession->setVideoPreview(0); - } else if (control == m_audioProbeControl && !m_audioProbeControl->ref.deref()) { - m_captureSession->removeProbe(m_audioProbeControl); - delete m_audioProbeControl; - m_audioProbeControl = 0; } } diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h index 878f5b030..598f805ef 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercaptureservice_p.h @@ -58,7 +58,6 @@ QT_BEGIN_NAMESPACE -class QGstreamerAudioProbeControl; class QGstreamerCaptureSession; class QGstreamerCameraControl; class QGstreamerMessage; @@ -96,8 +95,6 @@ private: QGstreamerVideoRenderer *m_videoRenderer = nullptr; QGstreamerVideoWindow *m_videoWindow = nullptr; QGstreamerImageCaptureControl *m_imageCaptureControl = nullptr; - - QGstreamerAudioProbeControl *m_audioProbeControl = nullptr; }; QT_END_NAMESPACE diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp index 46c3f9607..d0fccf001 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession.cpp @@ -46,7 +46,6 @@ #include <qmediarecorder.h> #include <qmediadevicemanager.h> #include <private/qgstreamervideorendererinterface_p.h> -#include <private/qgstreameraudioprobecontrol_p.h> #include <private/qgstreamerbushelper_p.h> #include <private/qaudiodeviceinfo_gstreamer_p.h> #include <private/qgstutils_p.h> @@ -72,7 +71,6 @@ QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::Cap m_waitingForEos(false), m_pipelineMode(EmptyPipeline), m_captureMode(captureMode), - m_audioProbe(0), m_audioPreviewFactory(0), m_videoInputFactory(0), m_viewfinder(0), @@ -456,7 +454,6 @@ void QGstreamerCaptureSession::captureImage(int requestId, const QString &fileNa bool QGstreamerCaptureSession::rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode) { - removeAudioBufferProbe(); REMOVE_ELEMENT(m_audioSrc); REMOVE_ELEMENT(m_audioPreview); REMOVE_ELEMENT(m_audioPreviewQueue); @@ -615,7 +612,6 @@ bool QGstreamerCaptureSession::rebuildGraph(QGstreamerCaptureSession::PipelineMo #endif if (ok) { - addAudioBufferProbe(); m_pipelineMode = newMode; } else { m_pipelineMode = EmptyPipeline; @@ -934,66 +930,4 @@ void QGstreamerCaptureSession::setVolume(qreal volume) } } -void QGstreamerCaptureSession::addProbe(QGstreamerAudioProbeControl* probe) -{ - Q_ASSERT(!m_audioProbe); - m_audioProbe = probe; - addAudioBufferProbe(); -} - -void QGstreamerCaptureSession::removeProbe(QGstreamerAudioProbeControl* probe) -{ - Q_ASSERT(m_audioProbe == probe); - removeAudioBufferProbe(); - m_audioProbe = 0; -} - -GstPad *QGstreamerCaptureSession::getAudioProbePad() -{ - // first see if preview element is available - if (m_audioPreview) { - GstPad *pad = gst_element_get_static_pad(m_audioPreview, "sink"); - if (pad) - return pad; - } - - // preview element is not available, - // try to use sink pin of audio encoder. - if (m_encodeBin) { - GstElement *audioEncoder = gst_bin_get_by_name(GST_BIN(m_encodeBin), "audio-encoder-bin"); - if (audioEncoder) { - GstPad *pad = gst_element_get_static_pad(audioEncoder, "sink"); - gst_object_unref(audioEncoder); - if (pad) - return pad; - } - } - - return 0; -} - -void QGstreamerCaptureSession::removeAudioBufferProbe() -{ - if (!m_audioProbe) - return; - - GstPad *pad = getAudioProbePad(); - if (pad) { - m_audioProbe->removeProbeFromPad(pad); - gst_object_unref(GST_OBJECT(pad)); - } -} - -void QGstreamerCaptureSession::addAudioBufferProbe() -{ - if (!m_audioProbe) - return; - - GstPad *pad = getAudioProbePad(); - if (pad) { - m_audioProbe->addProbeToPad(pad); - gst_object_unref(GST_OBJECT(pad)); - } -} - QT_END_NAMESPACE diff --git a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h index a943b9c65..04fc7c26e 100644 --- a/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h +++ b/src/multimedia/platform/gstreamer/mediacapture/qgstreamercapturesession_p.h @@ -74,7 +74,6 @@ class QGstreamerImageEncode; class QGstreamerRecorderControl; class QGstreamerMediaContainerControl; class QGstreamerVideoRendererInterface; -class QGstreamerAudioProbeControl; class QGstreamerElementFactory { @@ -152,8 +151,6 @@ public: bool processBusMessage(const QGstreamerMessage &message) override; - void addProbe(QGstreamerAudioProbeControl* probe); - void removeProbe(QGstreamerAudioProbeControl* probe); QAudioDeviceInfo audioCaptureDevice() const { return m_audioDevice; } signals: @@ -193,10 +190,6 @@ private: bool rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode); - GstPad *getAudioProbePad(); - void removeAudioBufferProbe(); - void addAudioBufferProbe(); - QAudioDeviceInfo m_audioDevice; QUrl m_sink; State m_state; @@ -206,8 +199,6 @@ private: QGstreamerCaptureSession::CaptureMode m_captureMode; QMap<QByteArray, QVariant> m_metaData; - QGstreamerAudioProbeControl *m_audioProbe; - QGstreamerElementFactory *m_audioPreviewFactory; QGstreamerVideoInput *m_videoInputFactory; QObject *m_viewfinder; diff --git a/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice.cpp index acc7958ae..6da43f03b 100644 --- a/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice.cpp +++ b/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice.cpp @@ -49,8 +49,6 @@ #include <private/qgstreamervideorenderer_p.h> #include "qgstreamerstreamscontrol_p.h" -#include <private/qgstreameraudioprobecontrol_p.h> -#include <private/qgstreamervideoprobecontrol_p.h> #include <private/qgstreamerplayersession_p.h> #include <private/qgstreamerplayercontrol_p.h> @@ -85,25 +83,6 @@ QObject *QGstreamerPlayerService::requestControl(const char *name) if (qstrcmp(name,QMetaDataReaderControl_iid) == 0) return m_metaData; - if (qstrcmp(name, QMediaVideoProbeControl_iid) == 0) { - if (!m_videoProbeControl) { - increaseVideoRef(); - m_videoProbeControl = new QGstreamerVideoProbeControl(this); - m_session->addProbe(m_videoProbeControl); - } - m_videoProbeControl->ref.ref(); - return m_videoProbeControl; - } - - if (qstrcmp(name, QMediaAudioProbeControl_iid) == 0) { - if (!m_audioProbeControl) { - m_audioProbeControl = new QGstreamerAudioProbeControl(this); - m_session->addProbe(m_audioProbeControl); - } - m_audioProbeControl->ref.ref(); - return m_audioProbeControl; - } - if (!m_videoOutput) { if (qstrcmp(name, QVideoRendererControl_iid) == 0) m_videoOutput = m_videoRenderer; @@ -129,15 +108,6 @@ void QGstreamerPlayerService::releaseControl(QObject *control) m_videoOutput = 0; m_control->setVideoOutput(0); decreaseVideoRef(); - } else if (control == m_videoProbeControl && !m_videoProbeControl->ref.deref()) { - m_session->removeProbe(m_videoProbeControl); - delete m_videoProbeControl; - m_videoProbeControl = 0; - decreaseVideoRef(); - } else if (control == m_audioProbeControl && !m_audioProbeControl->ref.deref()) { - m_session->removeProbe(m_audioProbeControl); - delete m_audioProbeControl; - m_audioProbeControl = 0; } } @@ -156,47 +126,6 @@ QMediaStreamsControl *QGstreamerPlayerService::streams() return m_streamsControl; } -QMediaVideoProbeControl *QGstreamerPlayerService::videoProbe() -{ - if (!m_videoProbeControl) { - increaseVideoRef(); - m_videoProbeControl = new QGstreamerVideoProbeControl(this); - m_session->addProbe(m_videoProbeControl); - } - return m_videoProbeControl; -} - -void QGstreamerPlayerService::releaseVideoProbe(QMediaVideoProbeControl *) -{ - Q_ASSERT(m_videoProbeControl); - if (!m_videoProbeControl->ref.deref()) { - m_session->removeProbe(m_videoProbeControl); - delete m_videoProbeControl; - m_videoProbeControl = nullptr; - decreaseVideoRef(); - } -} - -QMediaAudioProbeControl *QGstreamerPlayerService::audioProbe() -{ - if (!m_audioProbeControl) { - m_audioProbeControl = new QGstreamerAudioProbeControl(this); - m_session->addProbe(m_audioProbeControl); - } - m_audioProbeControl->ref.ref(); - return m_audioProbeControl; -} - -void QGstreamerPlayerService::releaseAudioProbe(QMediaAudioProbeControl *) -{ - Q_ASSERT(m_audioProbeControl); - if (!m_audioProbeControl->ref.deref()) { - m_session->removeProbe(m_audioProbeControl); - delete m_audioProbeControl; - m_audioProbeControl = nullptr; - } -} - QVideoRendererControl *QGstreamerPlayerService::createVideoRenderer() { if (!m_videoOutput) { diff --git a/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice_p.h b/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice_p.h index 816f84830..0a7663e51 100644 --- a/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice_p.h +++ b/src/multimedia/platform/gstreamer/mediaplayer/qgstreamerplayerservice_p.h @@ -67,8 +67,6 @@ class QGstreamerStreamsControl; class QGstreamerVideoRenderer; class QGstreamerVideoWindow; class QGStreamerAvailabilityControl; -class QGstreamerAudioProbeControl; -class QGstreamerVideoProbeControl; class QGstreamerPlayerService : public QMediaPlatformPlayerInterface { @@ -85,10 +83,6 @@ public: QMediaPlayerControl *player() override; QMetaDataReaderControl *dataReader() override; QMediaStreamsControl *streams() override; - QMediaVideoProbeControl *videoProbe() override; - void releaseVideoProbe(QMediaVideoProbeControl *) override; - QMediaAudioProbeControl *audioProbe() override; - void releaseAudioProbe(QMediaAudioProbeControl *) override; QVideoRendererControl *createVideoRenderer() override; QVideoWindowControl *createVideoWindow() override;; @@ -99,9 +93,6 @@ private: QGstreamerMetaDataProvider *m_metaData = nullptr; QGstreamerStreamsControl *m_streamsControl = nullptr; - QGstreamerAudioProbeControl *m_audioProbeControl = nullptr; - QGstreamerVideoProbeControl *m_videoProbeControl = nullptr; - QObject *m_videoOutput = nullptr; QVideoRendererControl *m_videoRenderer = nullptr; QGstreamerVideoWindow *m_videoWindow = nullptr; diff --git a/src/multimedia/platform/qmediaplatformplayerinterface_p.h b/src/multimedia/platform/qmediaplatformplayerinterface_p.h index d1f6b9a35..a58cae316 100644 --- a/src/multimedia/platform/qmediaplatformplayerinterface_p.h +++ b/src/multimedia/platform/qmediaplatformplayerinterface_p.h @@ -58,8 +58,6 @@ QT_BEGIN_NAMESPACE class QMediaPlayerControl; class QMetaDataReaderControl; class QMediaStreamsControl; -class QMediaVideoProbeControl; -class QMediaAudioProbeControl; class QVideoRendererControl; class QVideoWindowControl; @@ -74,10 +72,6 @@ public: // ### nothing in the frontend uses the stream info currently. Needs implementation in QMediaPlayer virtual QMediaStreamsControl *streams() { return nullptr; } - virtual QMediaVideoProbeControl *videoProbe() { return nullptr; } - virtual void releaseVideoProbe(QMediaVideoProbeControl *) {} - virtual QMediaAudioProbeControl *audioProbe() { return nullptr; } - virtual void releaseAudioProbe(QMediaAudioProbeControl *) {} virtual QVideoRendererControl *createVideoRenderer() = 0; virtual QVideoWindowControl *createVideoWindow() { return nullptr; }; diff --git a/src/multimedia/platform/qnx/mediaplayer/mmrenderermediaplayerservice_p.h b/src/multimedia/platform/qnx/mediaplayer/mmrenderermediaplayerservice_p.h index 6ea1c3b0a..eeb3b024a 100644 --- a/src/multimedia/platform/qnx/mediaplayer/mmrenderermediaplayerservice_p.h +++ b/src/multimedia/platform/qnx/mediaplayer/mmrenderermediaplayerservice_p.h @@ -74,10 +74,6 @@ public: QMediaPlayerControl *player() override; QMetaDataReaderControl *dataReader() override; // QMediaStreamsControl *streams() override; -// QMediaVideoProbeControl *videoProbe() override; -// void releaseVideoProbe(QMediaVideoProbeControl *) override; -// QMediaAudioProbeControl *audioProbe() override; -// void releaseAudioProbe(QMediaAudioProbeControl *) override; QVideoRendererControl *createVideoRenderer() override; QVideoWindowControl *createVideoWindow() override;; diff --git a/src/multimedia/platform/windows/player/mfaudioprobecontrol.cpp b/src/multimedia/platform/windows/player/mfaudioprobecontrol.cpp deleted file mode 100644 index a371629da..000000000 --- a/src/multimedia/platform/windows/player/mfaudioprobecontrol.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mfaudioprobecontrol_p.h" - -MFAudioProbeControl::MFAudioProbeControl(QObject *parent): - QMediaAudioProbeControl(parent) -{ -} - -MFAudioProbeControl::~MFAudioProbeControl() -{ -} - -void MFAudioProbeControl::bufferProbed(const char *data, quint32 size, const QAudioFormat& format, qint64 startTime) -{ - if (!format.isValid()) - return; - - QAudioBuffer audioBuffer = QAudioBuffer(QByteArray(data, size), format, startTime); - - { - QMutexLocker locker(&m_bufferMutex); - m_pendingBuffer = audioBuffer; - QMetaObject::invokeMethod(this, "bufferProbed", Qt::QueuedConnection); - } -} - -void MFAudioProbeControl::bufferProbed() -{ - QAudioBuffer audioBuffer; - { - QMutexLocker locker(&m_bufferMutex); - if (!m_pendingBuffer.isValid()) - return; - audioBuffer = m_pendingBuffer; - } - emit audioBufferProbed(audioBuffer); -} diff --git a/src/multimedia/platform/windows/player/mfaudioprobecontrol_p.h b/src/multimedia/platform/windows/player/mfaudioprobecontrol_p.h deleted file mode 100644 index 0ccf151ad..000000000 --- a/src/multimedia/platform/windows/player/mfaudioprobecontrol_p.h +++ /dev/null @@ -1,77 +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 MFAUDIOPROBECONTROL_H -#define MFAUDIOPROBECONTROL_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 <qmediaaudioprobecontrol.h> -#include <QtCore/qmutex.h> -#include <qaudiobuffer.h> - -QT_USE_NAMESPACE - -class MFAudioProbeControl : public QMediaAudioProbeControl -{ - Q_OBJECT -public: - explicit MFAudioProbeControl(QObject *parent); - virtual ~MFAudioProbeControl(); - - void bufferProbed(const char *data, quint32 size, const QAudioFormat& format, qint64 startTime); - -private slots: - void bufferProbed(); - -private: - QAudioBuffer m_pendingBuffer; - QMutex m_bufferMutex; -}; - -#endif diff --git a/src/multimedia/platform/windows/player/mfplayerservice.cpp b/src/multimedia/platform/windows/player/mfplayerservice.cpp index 3cbcc2aa2..0a0096fb1 100644 --- a/src/multimedia/platform/windows/player/mfplayerservice.cpp +++ b/src/multimedia/platform/windows/player/mfplayerservice.cpp @@ -44,8 +44,6 @@ #include "mfplayercontrol_p.h" #include "mfevrvideowindowcontrol_p.h" #include "mfvideorenderercontrol_p.h" -#include "mfaudioprobecontrol_p.h" -#include "mfvideoprobecontrol_p.h" #include "mfplayerservice_p.h" #include "mfplayersession_p.h" #include "mfmetadatacontrol_p.h" @@ -86,20 +84,6 @@ QObject *MFPlayerService::requestControl(const char *name) m_videoWindowControl = new MFEvrVideoWindowControl; return m_videoWindowControl; } - } else if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) { - if (m_session) { - MFAudioProbeControl *probe = new MFAudioProbeControl(this); - m_session->addProbe(probe); - return probe; - } - return 0; - } else if (qstrcmp(name,QMediaVideoProbeControl_iid) == 0) { - if (m_session) { - MFVideoProbeControl *probe = new MFVideoProbeControl(this); - m_session->addProbe(probe); - return probe; - } - return 0; } return 0; @@ -120,22 +104,6 @@ void MFPlayerService::releaseControl(QObject *control) m_videoWindowControl = 0; return; } - - MFAudioProbeControl* audioProbe = qobject_cast<MFAudioProbeControl*>(control); - if (audioProbe) { - if (m_session) - m_session->removeProbe(audioProbe); - delete audioProbe; - return; - } - - MFVideoProbeControl* videoProbe = qobject_cast<MFVideoProbeControl*>(control); - if (videoProbe) { - if (m_session) - m_session->removeProbe(videoProbe); - delete videoProbe; - return; - } } QMediaPlayerControl *MFPlayerService::player() @@ -148,41 +116,6 @@ QMetaDataReaderControl *MFPlayerService::dataReader() return m_metaDataControl; } -QMediaVideoProbeControl *MFPlayerService::videoProbe() -{ - if (m_session) { - MFVideoProbeControl *probe = new MFVideoProbeControl(this); - m_session->addProbe(probe); - return probe; - } - return 0; -} - -void MFPlayerService::releaseVideoProbe(QMediaVideoProbeControl *probe) -{ - MFVideoProbeControl* videoProbe = qobject_cast<MFVideoProbeControl*>(probe); - if (m_session) - m_session->removeProbe(videoProbe); - delete videoProbe; -} - -QMediaAudioProbeControl *MFPlayerService::audioProbe() -{ - if (m_session) { - MFAudioProbeControl *probe = new MFAudioProbeControl(this); - m_session->addProbe(probe); - return probe; - } -} - -void MFPlayerService::releaseAudioProbe(QMediaAudioProbeControl *probe) -{ - MFAudioProbeControl* audioProbe = qobject_cast<MFAudioProbeControl*>(probe); - if (m_session) - m_session->removeProbe(audioProbe); - delete audioProbe; -} - QVideoRendererControl *MFPlayerService::createVideoRenderer() { return m_videoRendererControl; diff --git a/src/multimedia/platform/windows/player/mfplayerservice_p.h b/src/multimedia/platform/windows/player/mfplayerservice_p.h index 26fd2d8df..e896660d5 100644 --- a/src/multimedia/platform/windows/player/mfplayerservice_p.h +++ b/src/multimedia/platform/windows/player/mfplayerservice_p.h @@ -84,10 +84,6 @@ public: QMediaPlayerControl *player() override; QMetaDataReaderControl *dataReader() override; // ### QMediaStreamsControl *streams() override; - QMediaVideoProbeControl *videoProbe() override; - void releaseVideoProbe(QMediaVideoProbeControl *) override; - QMediaAudioProbeControl *audioProbe() override; - void releaseAudioProbe(QMediaAudioProbeControl *) override; virtual QVideoRendererControl *createVideoRenderer() override; virtual QVideoWindowControl *createVideoWindow() override; diff --git a/src/multimedia/platform/windows/player/mfplayersession.cpp b/src/multimedia/platform/windows/player/mfplayersession.cpp index c5aca11cb..0c3f10b9f 100644 --- a/src/multimedia/platform/windows/player/mfplayersession.cpp +++ b/src/multimedia/platform/windows/player/mfplayersession.cpp @@ -157,35 +157,6 @@ void MFPlayerSession::close() m_hCloseEvent = 0; } -void MFPlayerSession::addProbe(MFAudioProbeControl *probe) -{ - m_audioSampleGrabber->addProbe(probe); -} - -void MFPlayerSession::removeProbe(MFAudioProbeControl *probe) -{ - m_audioSampleGrabber->removeProbe(probe); -} - -void MFPlayerSession::addProbe(MFVideoProbeControl* probe) -{ - if (m_videoProbes.contains(probe)) - return; - - m_videoProbes.append(probe); - - if (m_videoProbeMFT) - m_videoProbeMFT->addProbe(probe); -} - -void MFPlayerSession::removeProbe(MFVideoProbeControl* probe) -{ - m_videoProbes.removeOne(probe); - - if (m_videoProbeMFT) - m_videoProbeMFT->removeProbe(probe); -} - MFPlayerSession::~MFPlayerSession() { if (m_currentAudioActivate) @@ -1076,8 +1047,8 @@ void MFPlayerSession::createSession() QObject::connect(m_sourceResolver, SIGNAL(error(long)), this, SLOT(handleSourceError(long))); m_videoProbeMFT = new MFTransform; - for (int i = 0; i < m_videoProbes.size(); ++i) - m_videoProbeMFT->addProbe(m_videoProbes.at(i)); +// for (int i = 0; i < m_videoProbes.size(); ++i) +// m_videoProbeMFT->addProbe(m_videoProbes.at(i)); Q_ASSERT(m_session == NULL); HRESULT hr = MFCreateMediaSession(NULL, &m_session); diff --git a/src/multimedia/platform/windows/player/mfplayersession_p.h b/src/multimedia/platform/windows/player/mfplayersession_p.h index 4231b7641..302f22556 100644 --- a/src/multimedia/platform/windows/player/mfplayersession_p.h +++ b/src/multimedia/platform/windows/player/mfplayersession_p.h @@ -79,8 +79,6 @@ class MFMetaDataControl; class MFPlayerService; class AudioSampleGrabberCallback; class MFTransform; -class MFAudioProbeControl; -class MFVideoProbeControl; class MFPlayerSession : public QObject, public IMFAsyncCallback { @@ -126,11 +124,6 @@ public: void close(); - void addProbe(MFAudioProbeControl* probe); - void removeProbe(MFAudioProbeControl* probe); - void addProbe(MFVideoProbeControl* probe); - void removeProbe(MFVideoProbeControl* probe); - bool setAudioOutput(const QAudioDeviceInfo &device); QAudioDeviceInfo audioOutput() const { return m_audioOutput; } @@ -243,14 +236,15 @@ private: bool addAudioSampleGrabberNode(IMFTopology* topology); bool setupAudioSampleGrabber(IMFTopology *topology, IMFTopologyNode *sourceNode, IMFTopologyNode *outputNode); QAudioFormat audioFormatForMFMediaType(IMFMediaType *mediaType) const; + // ### Below can be used to monitor the audio channel. Currently unused. AudioSampleGrabberCallback *m_audioSampleGrabber; IMFTopologyNode *m_audioSampleGrabberNode; IMFTopology *insertMFT(IMFTopology *topology, TOPOID outputNodeId); bool insertResizer(IMFTopology *topology); void insertColorConverter(IMFTopology *topology, TOPOID outputNodeId); + // ### Below can be used to monitor the video channel. Functionality currently unused. MFTransform *m_videoProbeMFT; - QList<MFVideoProbeControl*> m_videoProbes; }; diff --git a/src/multimedia/platform/windows/player/mftvideo.cpp b/src/multimedia/platform/windows/player/mftvideo.cpp index b2ff27f80..8bb2f86be 100644 --- a/src/multimedia/platform/windows/player/mftvideo.cpp +++ b/src/multimedia/platform/windows/player/mftvideo.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "mftvideo_p.h" -#include "mfvideoprobecontrol_p.h" #include <private/qmemoryvideobuffer_p.h> #include <mferror.h> #include <strmif.h> @@ -75,21 +74,21 @@ MFTransform::~MFTransform() m_videoSinkTypeHandler->Release(); } -void MFTransform::addProbe(MFVideoProbeControl *probe) -{ - QMutexLocker locker(&m_videoProbeMutex); +//void MFTransform::addProbe(MFVideoProbeControl *probe) +//{ +// QMutexLocker locker(&m_videoProbeMutex); - if (m_videoProbes.contains(probe)) - return; +// if (m_videoProbes.contains(probe)) +// return; - m_videoProbes.append(probe); -} +// m_videoProbes.append(probe); +//} -void MFTransform::removeProbe(MFVideoProbeControl *probe) -{ - QMutexLocker locker(&m_videoProbeMutex); - m_videoProbes.removeOne(probe); -} +//void MFTransform::removeProbe(MFVideoProbeControl *probe) +//{ +// QMutexLocker locker(&m_videoProbeMutex); +// m_videoProbes.removeOne(probe); +//} void MFTransform::setVideoSink(IUnknown *videoSink) { @@ -519,12 +518,12 @@ STDMETHODIMP MFTransform::ProcessInput(DWORD dwInputStreamID, IMFSample *pSample QMutexLocker lockerProbe(&m_videoProbeMutex); - if (!m_videoProbes.isEmpty()) { - QVideoFrame frame = makeVideoFrame(); +// if (!m_videoProbes.isEmpty()) { +// QVideoFrame frame = makeVideoFrame(); - for (MFVideoProbeControl* probe : qAsConst(m_videoProbes)) - probe->bufferProbed(frame); - } +// for (MFVideoProbeControl* probe : qAsConst(m_videoProbes)) +// probe->bufferProbed(frame); +// } return S_OK; } @@ -570,12 +569,12 @@ STDMETHODIMP MFTransform::ProcessOutput(DWORD dwFlags, DWORD cOutputBufferCount, // We do it here (instead of inside ProcessInput) to make sure samples discarded by the renderer // are not sent. m_videoProbeMutex.lock(); - if (!m_videoProbes.isEmpty()) { - QVideoFrame frame = makeVideoFrame(); +// if (!m_videoProbes.isEmpty()) { +// QVideoFrame frame = makeVideoFrame(); - for (MFVideoProbeControl* probe : qAsConst(m_videoProbes)) - probe->bufferProbed(frame); - } +// for (MFVideoProbeControl* probe : qAsConst(m_videoProbes)) +// probe->bufferProbed(frame); +// } m_videoProbeMutex.unlock(); done: diff --git a/src/multimedia/platform/windows/player/mftvideo_p.h b/src/multimedia/platform/windows/player/mftvideo_p.h index e08f0977f..359fc8391 100644 --- a/src/multimedia/platform/windows/player/mftvideo_p.h +++ b/src/multimedia/platform/windows/player/mftvideo_p.h @@ -118,7 +118,7 @@ private: IMFMediaTypeHandler *m_videoSinkTypeHandler; - QList<MFVideoProbeControl*> m_videoProbes; +// QList<MFVideoProbeControl*> m_videoProbes; QMutex m_videoProbeMutex; QVideoSurfaceFormat m_format; diff --git a/src/multimedia/platform/windows/player/mfvideoprobecontrol.cpp b/src/multimedia/platform/windows/player/mfvideoprobecontrol.cpp deleted file mode 100644 index e4d1a8b23..000000000 --- a/src/multimedia/platform/windows/player/mfvideoprobecontrol.cpp +++ /dev/null @@ -1,54 +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 "mfvideoprobecontrol_p.h" - -MFVideoProbeControl::MFVideoProbeControl(QObject *parent) - : QMediaVideoProbeControl(parent) -{ -} - -MFVideoProbeControl::~MFVideoProbeControl() -{ -} - -void MFVideoProbeControl::bufferProbed(const QVideoFrame& frame) -{ - QMetaObject::invokeMethod(this, "videoFrameProbed", Qt::QueuedConnection, Q_ARG(QVideoFrame, frame)); -} diff --git a/src/multimedia/platform/windows/player/mfvideoprobecontrol_p.h b/src/multimedia/platform/windows/player/mfvideoprobecontrol_p.h deleted file mode 100644 index a7f79ef92..000000000 --- a/src/multimedia/platform/windows/player/mfvideoprobecontrol_p.h +++ /dev/null @@ -1,70 +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 MFVIDEOPROBECONTROL_H -#define MFVIDEOPROBECONTROL_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 <qmediavideoprobecontrol.h> -#include <QtCore/qmutex.h> -#include <qvideoframe.h> - -QT_USE_NAMESPACE - -class MFVideoProbeControl : public QMediaVideoProbeControl -{ - Q_OBJECT -public: - explicit MFVideoProbeControl(QObject *parent); - virtual ~MFVideoProbeControl(); - - void bufferProbed(const QVideoFrame& frame); -}; - -#endif diff --git a/src/multimedia/platform/windows/player/player.pri b/src/multimedia/platform/windows/player/player.pri index 9aea6fb4a..b7990b21d 100644 --- a/src/multimedia/platform/windows/player/player.pri +++ b/src/multimedia/platform/windows/player/player.pri @@ -9,8 +9,6 @@ HEADERS += \ $$PWD/mfplayercontrol_p.h \ $$PWD/mfvideorenderercontrol_p.h \ $$PWD/mfmetadatacontrol_p.h \ - $$PWD/mfaudioprobecontrol_p.h \ - $$PWD/mfvideoprobecontrol_p.h \ $$PWD/mfevrvideowindowcontrol_p.h \ $$PWD/samplegrabber_p.h \ $$PWD/mftvideo_p.h \ @@ -22,8 +20,6 @@ SOURCES += \ $$PWD/mfplayercontrol.cpp \ $$PWD/mfvideorenderercontrol.cpp \ $$PWD/mfmetadatacontrol.cpp \ - $$PWD/mfaudioprobecontrol.cpp \ - $$PWD/mfvideoprobecontrol.cpp \ $$PWD/mfevrvideowindowcontrol.cpp \ $$PWD/samplegrabber.cpp \ $$PWD/mftvideo.cpp \ diff --git a/src/multimedia/platform/windows/player/samplegrabber.cpp b/src/multimedia/platform/windows/player/samplegrabber.cpp index 6c14dc152..ef039a902 100644 --- a/src/multimedia/platform/windows/player/samplegrabber.cpp +++ b/src/multimedia/platform/windows/player/samplegrabber.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "samplegrabber_p.h" -#include "mfaudioprobecontrol_p.h" STDMETHODIMP SampleGrabberCallback::QueryInterface(REFIID riid, void** ppv) { @@ -120,21 +119,21 @@ STDMETHODIMP SampleGrabberCallback::OnShutdown() return S_OK; } -void AudioSampleGrabberCallback::addProbe(MFAudioProbeControl* probe) -{ - QMutexLocker locker(&m_audioProbeMutex); +//void AudioSampleGrabberCallback::addProbe(MFAudioProbeControl* probe) +//{ +// QMutexLocker locker(&m_audioProbeMutex); - if (m_audioProbes.contains(probe)) - return; +// if (m_audioProbes.contains(probe)) +// return; - m_audioProbes.append(probe); -} +// m_audioProbes.append(probe); +//} -void AudioSampleGrabberCallback::removeProbe(MFAudioProbeControl* probe) -{ - QMutexLocker locker(&m_audioProbeMutex); - m_audioProbes.removeOne(probe); -} +//void AudioSampleGrabberCallback::removeProbe(MFAudioProbeControl* probe) +//{ +// QMutexLocker locker(&m_audioProbeMutex); +// m_audioProbes.removeOne(probe); +//} void AudioSampleGrabberCallback::setFormat(const QAudioFormat& format) { @@ -154,7 +153,7 @@ STDMETHODIMP AudioSampleGrabberCallback::OnProcessSample(REFGUID guidMajorMediaT QMutexLocker locker(&m_audioProbeMutex); - if (m_audioProbes.isEmpty()) +// if (m_audioProbes.isEmpty()) return S_OK; // Check if sample has a presentation time @@ -166,8 +165,8 @@ STDMETHODIMP AudioSampleGrabberCallback::OnProcessSample(REFGUID guidMajorMediaT llSampleTime /= 10; } - for (MFAudioProbeControl* probe : qAsConst(m_audioProbes)) - probe->bufferProbed((const char*)pSampleBuffer, dwSampleSize, m_format, llSampleTime); +// for (MFAudioProbeControl* probe : qAsConst(m_audioProbes)) +// probe->bufferProbed((const char*)pSampleBuffer, dwSampleSize, m_format, llSampleTime); return S_OK; } diff --git a/src/multimedia/platform/windows/player/samplegrabber_p.h b/src/multimedia/platform/windows/player/samplegrabber_p.h index 74eb62065..31e00987c 100644 --- a/src/multimedia/platform/windows/player/samplegrabber_p.h +++ b/src/multimedia/platform/windows/player/samplegrabber_p.h @@ -57,8 +57,6 @@ #include <mfapi.h> #include <mfidl.h> -class MFAudioProbeControl; - class SampleGrabberCallback : public IMFSampleGrabberSinkCallback { public: @@ -90,8 +88,6 @@ private: class AudioSampleGrabberCallback: public SampleGrabberCallback { public: - void addProbe(MFAudioProbeControl* probe); - void removeProbe(MFAudioProbeControl* probe); void setFormat(const QAudioFormat& format); STDMETHODIMP OnProcessSample(REFGUID guidMajorMediaType, DWORD dwSampleFlags, @@ -99,7 +95,7 @@ public: DWORD dwSampleSize); private: - QList<MFAudioProbeControl*> m_audioProbes; +// QList<MFAudioProbeControl*> m_audioProbes; QMutex m_audioProbeMutex; QAudioFormat m_format; }; diff --git a/src/multimedia/video/qvideoprobe.cpp b/src/multimedia/video/qvideoprobe.cpp deleted file mode 100644 index e6b7c4dd7..000000000 --- a/src/multimedia/video/qvideoprobe.cpp +++ /dev/null @@ -1,218 +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$ -** -****************************************************************************/ - - -/*! - \class QVideoProbe - \inmodule QtMultimedia - - \ingroup multimedia - \ingroup multimedia_video - - \brief The QVideoProbe class allows you to monitor video frames being played or recorded. - - \code - QMediaPlayer *player = new QMediaPlayer(); - QVideoProbe *probe = new QVideoProbe; - - connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(processFrame(QVideoFrame))); - - probe->setSource(player); // Returns true, hopefully. - - player->setVideoOutput(myVideoSurface); - player->setMedia(QUrl::fromLocalFile("observation.mp4")); - player->play(); // Start receiving frames as they get presented to myVideoSurface - \endcode - - This same approach works with the QCamera object as well, to receive viewfinder or video - frames as they are captured. - - \sa QAudioProbe, QMediaPlayer, QCamera -*/ - -#include "qvideoprobe.h" -#include "qmediavideoprobecontrol.h" -#include "qmediaservice.h" -#include "qmediarecorder.h" -#include "qsharedpointer.h" -#include "qpointer.h" - -QT_BEGIN_NAMESPACE - -class QVideoProbePrivate { -public: - QPointer<QMediaSource> source; - QPointer<QMediaVideoProbeControl> probee; -}; - -/*! - Creates a new QVideoProbe class with \a parent. After setting the - source to monitor with \l setSource(), the \l videoFrameProbed() - signal will be emitted when video frames are flowing in the - source media object. - */ -QVideoProbe::QVideoProbe(QObject *parent) - : QObject(parent) - , d(new QVideoProbePrivate) -{ - -} - -/*! - Destroys this probe and disconnects from any - media object. - */ -QVideoProbe::~QVideoProbe() -{ - if (d->source) { - // Disconnect - if (d->probee) { - disconnect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame))); - disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - } - d->source.data()->service()->releaseControl(d->probee.data()); - } -} - -/*! - Sets the media object to monitor to \a source. - - If \a source is zero, this probe will be deactivated - and this function wil return true. - - If the media object does not support monitoring - video, this function will return false. - - Any previously monitored objects will no longer be monitored. - Passing in the same object will be ignored, but - monitoring will continue. - */ -bool QVideoProbe::setSource(QMediaSource *source) -{ - // Need to: - // 1) disconnect from current source if necessary - // 2) see if new one has the probe control - // 3) connect if so - - // in case source was destroyed but probe control is still valid - if (!d->source && d->probee) { - disconnect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame))); - disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - d->probee.clear(); - } - - if (source != d->source.data()) { - if (d->source) { - Q_ASSERT(d->probee); - disconnect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame))); - disconnect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - d->source.data()->service()->releaseControl(d->probee.data()); - d->source.clear(); - d->probee.clear(); - } - - if (source) { - QMediaService *service = source->service(); - if (service) { - d->probee = service->requestControl<QMediaVideoProbeControl*>(); - } - - if (d->probee) { - connect(d->probee.data(), SIGNAL(videoFrameProbed(QVideoFrame)), this, SIGNAL(videoFrameProbed(QVideoFrame))); - connect(d->probee.data(), SIGNAL(flush()), this, SIGNAL(flush())); - d->source = source; - } - } - } - - return (!source || d->probee != nullptr); -} - -/*! - Starts monitoring the given \a mediaRecorder. - - If there is no mediaSource associated with \a mediaRecorder, or if it is - zero, this probe will be deactivated and this function wil return true. - - If the media recorder instance does not support monitoring - video, this function will return false. - - Any previously monitored objects will no longer be monitored. - Passing in the same object will be ignored, but - monitoring will continue. - */ -bool QVideoProbe::setSource(QMediaRecorder *mediaRecorder) -{ - QMediaSource *source = mediaRecorder ? mediaRecorder->mediaSource() : nullptr; - bool result = setSource(source); - - if (!mediaRecorder) - return true; - - if (mediaRecorder && !source) - return false; - - return result; -} - -/*! - Returns true if this probe is monitoring something, or false otherwise. - - The source being monitored does not need to be active. - */ -bool QVideoProbe::isActive() const -{ - return d->probee != nullptr; -} - -/*! - \fn QVideoProbe::videoFrameProbed(const QVideoFrame &frame) - - This signal should be emitted when a video \a frame is processed in the - media service. -*/ - -/*! - \fn QVideoProbe::flush() - - This signal should be emitted when it is required to release all frames. - Application must release all outstanding references to video frames. -*/ - -QT_END_NAMESPACE diff --git a/src/multimedia/video/qvideoprobe.h b/src/multimedia/video/qvideoprobe.h deleted file mode 100644 index 3ccab2326..000000000 --- a/src/multimedia/video/qvideoprobe.h +++ /dev/null @@ -1,74 +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 QVIDEOPROBE_H -#define QVIDEOPROBE_H - -#include <QtCore/QObject> -#include <QtMultimedia/qvideoframe.h> - -QT_BEGIN_NAMESPACE - -class QMediaSource; -class QMediaRecorder; - -class QVideoProbePrivate; -class Q_MULTIMEDIA_EXPORT QVideoProbe : public QObject -{ - Q_OBJECT -public: - explicit QVideoProbe(QObject *parent = nullptr); - ~QVideoProbe(); - - bool setSource(QMediaSource *source); - bool setSource(QMediaRecorder *source); - - bool isActive() const; - -Q_SIGNALS: - void videoFrameProbed(const QVideoFrame &frame); - void flush(); - -private: - QVideoProbePrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QVIDEOPROBE_H diff --git a/src/multimedia/video/video.pri b/src/multimedia/video/video.pri index a3668ba4a..829442a24 100644 --- a/src/multimedia/video/video.pri +++ b/src/multimedia/video/video.pri @@ -6,7 +6,6 @@ PUBLIC_HEADERS += \ video/qabstractvideosurface.h \ video/qvideoframe.h \ video/qvideosurfaceformat.h \ - video/qvideoprobe.h \ video/qabstractvideofilter.h PRIVATE_HEADERS += \ @@ -27,7 +26,6 @@ SOURCES += \ video/qvideooutputorientationhandler.cpp \ video/qvideosurfaceformat.cpp \ video/qvideosurfaceoutput.cpp \ - video/qvideoprobe.cpp \ video/qabstractvideofilter.cpp \ video/qvideoframeconversionhelper.cpp \ video/qvideosurfaces.cpp |