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/multimedia/platform | |
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/multimedia/platform')
47 files changed, 56 insertions, 1549 deletions
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; }; |