summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-01-12 13:09:52 +0100
committerLars Knoll <lars.knoll@qt.io>2021-01-22 07:02:37 +0000
commit805b10624ced9b97283e94594a5c7db4c10c63c4 (patch)
tree4373df233c649604d9cae93b47b8347762183ab0 /src/plugins
parent03364bdfea98bfab6e02098f4c77619ecec63b97 (diff)
Get rid of QAudioRecorder and the audiocapture plugin
QMediaRecorder will need to get an audio-only mode instead. Change-Id: I7c4ee72e96de16cc1536f46a59ad18509607fa22 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/audiocapture/CMakeLists.txt25
-rw-r--r--src/plugins/audiocapture/audiocapture.json4
-rw-r--r--src/plugins/audiocapture/audiocapture.pro25
-rw-r--r--src/plugins/audiocapture/audiocaptureprobecontrol.cpp62
-rw-r--r--src/plugins/audiocapture/audiocaptureprobecontrol.h61
-rw-r--r--src/plugins/audiocapture/audiocaptureservice.cpp94
-rw-r--r--src/plugins/audiocapture/audiocaptureservice.h73
-rw-r--r--src/plugins/audiocapture/audiocaptureserviceplugin.cpp62
-rw-r--r--src/plugins/audiocapture/audiocaptureserviceplugin.h61
-rw-r--r--src/plugins/audiocapture/audiocontainercontrol.cpp82
-rw-r--r--src/plugins/audiocapture/audiocontainercontrol.h70
-rw-r--r--src/plugins/audiocapture/audioencodercontrol.cpp174
-rw-r--r--src/plugins/audiocapture/audioencodercontrol.h77
-rw-r--r--src/plugins/audiocapture/audioinputselector.cpp111
-rw-r--r--src/plugins/audiocapture/audioinputselector.h77
-rw-r--r--src/plugins/audiocapture/audiomediarecordercontrol.cpp456
-rw-r--r--src/plugins/audiocapture/audiomediarecordercontrol.h188
-rw-r--r--src/plugins/plugins.pro6
18 files changed, 0 insertions, 1708 deletions
diff --git a/src/plugins/audiocapture/CMakeLists.txt b/src/plugins/audiocapture/CMakeLists.txt
deleted file mode 100644
index 95d82c5ce..000000000
--- a/src/plugins/audiocapture/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-# Generated from audiocapture.pro.
-
-#####################################################################
-## AudioCaptureServicePlugin Plugin:
-#####################################################################
-
-qt_internal_add_plugin(AudioCaptureServicePlugin
- OUTPUT_NAME qtmedia_audioengine
- TYPE mediaservice
- SOURCES
- audiocaptureprobecontrol.cpp audiocaptureprobecontrol.h
- audiocaptureservice.cpp audiocaptureservice.h
- audiocaptureserviceplugin.cpp audiocaptureserviceplugin.h
- audiocontainercontrol.cpp audiocontainercontrol.h
- audioencodercontrol.cpp audioencodercontrol.h
- audioinputselector.cpp audioinputselector.h
- audiomediarecordercontrol.cpp audiomediarecordercontrol.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Gui
- Qt::MultimediaPrivate
-)
-
-#### Keys ignored in scope 1:.:.:audiocapture.pro:<TRUE>:
-# OTHER_FILES = "audiocapture.json"
diff --git a/src/plugins/audiocapture/audiocapture.json b/src/plugins/audiocapture/audiocapture.json
deleted file mode 100644
index 4c7673da2..000000000
--- a/src/plugins/audiocapture/audiocapture.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "Keys": ["audiocapture"],
- "Services": ["org.qt-project.qt.audiosource"]
-}
diff --git a/src/plugins/audiocapture/audiocapture.pro b/src/plugins/audiocapture/audiocapture.pro
deleted file mode 100644
index 9a5785c1e..000000000
--- a/src/plugins/audiocapture/audiocapture.pro
+++ /dev/null
@@ -1,25 +0,0 @@
-TARGET = qtmedia_audioengine
-QT += multimedia-private
-
-HEADERS += audioencodercontrol.h \
- audiocontainercontrol.h \
- audiomediarecordercontrol.h \
- audioinputselector.h \
- audiocaptureservice.h \
- audiocaptureserviceplugin.h \
- audiocaptureprobecontrol.h
-
-SOURCES += audioencodercontrol.cpp \
- audiocontainercontrol.cpp \
- audiomediarecordercontrol.cpp \
- audioinputselector.cpp \
- audiocaptureservice.cpp \
- audiocaptureserviceplugin.cpp \
- audiocaptureprobecontrol.cpp
-
-OTHER_FILES += \
- audiocapture.json
-
-PLUGIN_TYPE = mediaservice
-PLUGIN_CLASS_NAME = AudioCaptureServicePlugin
-load(qt_plugin)
diff --git a/src/plugins/audiocapture/audiocaptureprobecontrol.cpp b/src/plugins/audiocapture/audiocaptureprobecontrol.cpp
deleted file mode 100644
index dbd0da0a1..000000000
--- a/src/plugins/audiocapture/audiocaptureprobecontrol.cpp
+++ /dev/null
@@ -1,62 +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 "audiocaptureprobecontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-AudioCaptureProbeControl::AudioCaptureProbeControl(QObject *parent):
- QMediaAudioProbeControl(parent)
-{
-}
-
-AudioCaptureProbeControl::~AudioCaptureProbeControl()
-{
-}
-
-void AudioCaptureProbeControl::bufferProbed(const char *data, quint32 size, const QAudioFormat& format)
-{
- if (!format.isValid())
- return;
-
- QAudioBuffer audioBuffer = QAudioBuffer(QByteArray::fromRawData(data, size), format);
- QMetaObject::invokeMethod(this, "audioBufferProbed", Qt::QueuedConnection, Q_ARG(QAudioBuffer, audioBuffer));
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audiocapture/audiocaptureprobecontrol.h b/src/plugins/audiocapture/audiocaptureprobecontrol.h
deleted file mode 100644
index 00a21f031..000000000
--- a/src/plugins/audiocapture/audiocaptureprobecontrol.h
+++ /dev/null
@@ -1,61 +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 AUDIOCAPTUREPROBECONTROL_H
-#define AUDIOCAPTUREPROBECONTROL_H
-
-#include <qmediaaudioprobecontrol.h>
-#include <QtCore/qmutex.h>
-#include <qaudiobuffer.h>
-
-QT_BEGIN_NAMESPACE
-
-class AudioCaptureProbeControl : public QMediaAudioProbeControl
-{
- Q_OBJECT
-public:
- explicit AudioCaptureProbeControl(QObject *parent);
- virtual ~AudioCaptureProbeControl();
-
- void bufferProbed(const char *data, quint32 size, const QAudioFormat& format);
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audiocapture/audiocaptureservice.cpp b/src/plugins/audiocapture/audiocaptureservice.cpp
deleted file mode 100644
index f8fe9726a..000000000
--- a/src/plugins/audiocapture/audiocaptureservice.cpp
+++ /dev/null
@@ -1,94 +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 "audiocaptureservice.h"
-#include "audioinputselector.h"
-#include "audioencodercontrol.h"
-#include "audiocontainercontrol.h"
-#include "audiomediarecordercontrol.h"
-#include "audiocaptureprobecontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-AudioCaptureService::AudioCaptureService(QObject *parent):
- QMediaService(parent)
-{
- m_mediaControl = new AudioCaptureSession(this);
- m_encoderControl = new AudioEncoderControl(m_mediaControl);
- m_containerControl = new AudioContainerControl(m_mediaControl);
- m_inputSelector = new AudioInputSelector(m_mediaControl);
-}
-
-AudioCaptureService::~AudioCaptureService()
-{
- delete m_encoderControl;
- delete m_containerControl;
- delete m_inputSelector;
- delete m_mediaControl;
-}
-
-QObject *AudioCaptureService::requestControl(const char *name)
-{
- if (qstrcmp(name,QMediaRecorderControl_iid) == 0)
- return m_mediaControl;
-
- if (qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0)
- return m_encoderControl;
-
- if (qstrcmp(name,QAudioInputSelectorControl_iid) == 0)
- return m_inputSelector;
-
- if (qstrcmp(name,QMediaContainerControl_iid) == 0)
- return m_containerControl;
-
- if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) {
- AudioCaptureProbeControl *probe = new AudioCaptureProbeControl(this);
- m_mediaControl->addProbe(probe);
- return probe;
- }
-
- return nullptr;
-}
-
-void AudioCaptureService::releaseControl(QObject *control)
-{
- Q_UNUSED(control);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audiocapture/audiocaptureservice.h b/src/plugins/audiocapture/audiocaptureservice.h
deleted file mode 100644
index 4a2dd006d..000000000
--- a/src/plugins/audiocapture/audiocaptureservice.h
+++ /dev/null
@@ -1,73 +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 AUDIOCAPTURESERVICE_H
-#define AUDIOCAPTURESERVICE_H
-
-#include <QtCore/qobject.h>
-
-#include "qmediaservice.h"
-
-QT_BEGIN_NAMESPACE
-
-class AudioCaptureSession;
-class AudioEncoderControl;
-class AudioContainerControl;
-class AudioMediaRecorderControl;
-class AudioInputSelector;
-
-class AudioCaptureService : public QMediaService
-{
- Q_OBJECT
-public:
- AudioCaptureService(QObject *parent = 0);
- ~AudioCaptureService();
-
- QObject *requestControl(const char *interface);
- void releaseControl(QObject *control);
-private:
- AudioEncoderControl *m_encoderControl;
- AudioContainerControl *m_containerControl;
- AudioInputSelector *m_inputSelector;
- AudioCaptureSession *m_mediaControl;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audiocapture/audiocaptureserviceplugin.cpp b/src/plugins/audiocapture/audiocaptureserviceplugin.cpp
deleted file mode 100644
index 7c6471bc6..000000000
--- a/src/plugins/audiocapture/audiocaptureserviceplugin.cpp
+++ /dev/null
@@ -1,62 +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 <QtCore/qstring.h>
-
-#include "audiocaptureserviceplugin.h"
-#include "audiocaptureservice.h"
-
-#include "qmediaserviceproviderplugin.h"
-
-QT_BEGIN_NAMESPACE
-
-QMediaService* AudioCaptureServicePlugin::create(QString const& key)
-{
- if (key == QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE))
- return new AudioCaptureService;
-
- return nullptr;
-}
-
-void AudioCaptureServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audiocapture/audiocaptureserviceplugin.h b/src/plugins/audiocapture/audiocaptureserviceplugin.h
deleted file mode 100644
index 8d2e41924..000000000
--- a/src/plugins/audiocapture/audiocaptureserviceplugin.h
+++ /dev/null
@@ -1,61 +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 AUDIOCAPTURESERVICEPLUGIN_H
-#define AUDIOCAPTURESERVICEPLUGIN_H
-
-#include "qmediaserviceproviderplugin.h"
-
-QT_BEGIN_NAMESPACE
-
-class AudioCaptureServicePlugin : public QMediaServiceProviderPlugin
-{
- Q_OBJECT
-
- Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "audiocapture.json")
-
-public:
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-};
-
-QT_END_NAMESPACE
-
-#endif // AUDIOCAPTURESERVICEPLUGIN_H
diff --git a/src/plugins/audiocapture/audiocontainercontrol.cpp b/src/plugins/audiocapture/audiocontainercontrol.cpp
deleted file mode 100644
index 2f8b382d2..000000000
--- a/src/plugins/audiocapture/audiocontainercontrol.cpp
+++ /dev/null
@@ -1,82 +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 "audiocontainercontrol.h"
-#include "audiomediarecordercontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-AudioContainerControl::AudioContainerControl(QObject *parent)
- :QMediaContainerControl(parent)
-{
- m_session = qobject_cast<AudioCaptureSession*>(parent);
-}
-
-AudioContainerControl::~AudioContainerControl()
-{
-}
-
-QStringList AudioContainerControl::supportedContainers() const
-{
- return QStringList() << QStringLiteral("audio/x-wav")
- << QStringLiteral("audio/x-raw");
-}
-
-QString AudioContainerControl::containerFormat() const
-{
- return m_session->containerFormat();
-}
-
-void AudioContainerControl::setContainerFormat(const QString &formatMimeType)
-{
- if (formatMimeType.isEmpty() || supportedContainers().contains(formatMimeType))
- m_session->setContainerFormat(formatMimeType);
-}
-
-QString AudioContainerControl::containerDescription(const QString &formatMimeType) const
-{
- if (QString::compare(formatMimeType, QLatin1String("audio/x-raw")) == 0)
- return tr("RAW (headerless) file format");
- if (QString::compare(formatMimeType, QLatin1String("audio/x-wav")) == 0)
- return tr("WAV file format");
-
- return QString();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audiocapture/audiocontainercontrol.h b/src/plugins/audiocapture/audiocontainercontrol.h
deleted file mode 100644
index 169b3c189..000000000
--- a/src/plugins/audiocapture/audiocontainercontrol.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 AUDIOCONTAINERCONTROL_H
-#define AUDIOCONTAINERCONTROL_H
-
-#include "qmediacontainercontrol.h"
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-QT_BEGIN_NAMESPACE
-
-class AudioCaptureSession;
-
-class AudioContainerControl : public QMediaContainerControl
-{
- Q_OBJECT
-public:
- AudioContainerControl(QObject *parent);
- virtual ~AudioContainerControl();
-
- QStringList supportedContainers() const;
- QString containerFormat() const;
- void setContainerFormat(const QString &formatMimeType);
- QString containerDescription(const QString &formatMimeType) const;
-
-private:
- AudioCaptureSession* m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audiocapture/audioencodercontrol.cpp b/src/plugins/audiocapture/audioencodercontrol.cpp
deleted file mode 100644
index 58700fc12..000000000
--- a/src/plugins/audiocapture/audioencodercontrol.cpp
+++ /dev/null
@@ -1,174 +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 "audioencodercontrol.h"
-#include "audiomediarecordercontrol.h"
-
-#include <qaudioformat.h>
-
-#include <QtCore/qdebug.h>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-static QAudioFormat audioSettingsToAudioFormat(const QAudioEncoderSettings &settings)
-{
- QAudioFormat fmt;
- fmt.setCodec(settings.codec());
- fmt.setChannelCount(settings.channelCount());
- fmt.setSampleRate(settings.sampleRate());
- int sampleSize = 16;
- if (settings.bitRate() && settings.channelCount() && settings.sampleRate())
- sampleSize = settings.bitRate() / settings.channelCount() / settings.sampleRate();
- fmt.setSampleSize(sampleSize);
- fmt.setSampleType(sampleSize == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
-
- fmt.setByteOrder(QAudioDeviceInfo::defaultInputDevice().preferredFormat().byteOrder());
- return fmt;
-}
-
-static QAudioEncoderSettings audioFormatToAudioSettings(const QAudioFormat &format)
-{
- QAudioEncoderSettings settings;
- settings.setCodec(format.codec());
- settings.setChannelCount(format.channelCount());
- settings.setSampleRate(format.sampleRate());
- settings.setEncodingMode(QMultimedia::ConstantBitRateEncoding);
- settings.setBitRate(format.channelCount()
- * format.sampleSize()
- * format.sampleRate());
- return settings;
-}
-
-AudioEncoderControl::AudioEncoderControl(QObject *parent)
- :QAudioEncoderSettingsControl(parent)
-{
- m_session = qobject_cast<AudioCaptureSession*>(parent);
- update();
-}
-
-AudioEncoderControl::~AudioEncoderControl()
-{
-}
-
-QStringList AudioEncoderControl::supportedAudioCodecs() const
-{
- return QStringList() << QStringLiteral("audio/x-raw");
-}
-
-QString AudioEncoderControl::codecDescription(const QString &codecName) const
-{
- if (QString::compare(codecName, QLatin1String("audio/x-raw")) == 0)
- return tr("Linear PCM audio data");
-
- return QString();
-}
-
-QList<int> AudioEncoderControl::supportedSampleRates(const QAudioEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- if (settings.codec().isEmpty() || settings.codec() == QLatin1String("audio/x-raw"))
- return m_sampleRates;
-
- return QList<int>();
-}
-
-QAudioEncoderSettings AudioEncoderControl::audioSettings() const
-{
- return audioFormatToAudioSettings(m_session->format());
-}
-
-void AudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &settings)
-{
- QAudioFormat fmt = audioSettingsToAudioFormat(settings);
-
- if (settings.encodingMode() == QMultimedia::ConstantQualityEncoding) {
- fmt.setCodec("audio/x-raw");
- switch (settings.quality()) {
- case QMultimedia::VeryLowQuality:
- fmt.setSampleSize(8);
- fmt.setSampleRate(8000);
- fmt.setSampleType(QAudioFormat::UnSignedInt);
- break;
- case QMultimedia::LowQuality:
- fmt.setSampleSize(8);
- fmt.setSampleRate(22050);
- fmt.setSampleType(QAudioFormat::UnSignedInt);
- break;
- case QMultimedia::HighQuality:
- fmt.setSampleSize(16);
- fmt.setSampleRate(48000);
- fmt.setSampleType(QAudioFormat::SignedInt);
- break;
- case QMultimedia::VeryHighQuality:
- fmt.setSampleSize(16);
- fmt.setSampleRate(96000);
- fmt.setSampleType(QAudioFormat::SignedInt);
- break;
- case QMultimedia::NormalQuality:
- default:
- fmt.setSampleSize(16);
- fmt.setSampleRate(44100);
- fmt.setSampleType(QAudioFormat::SignedInt);
- break;
- }
- }
-
- m_session->setFormat(fmt);
-}
-
-void AudioEncoderControl::update()
-{
- m_sampleRates.clear();
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- for (int i = 0; i < devices.size(); ++i) {
- QList<int> rates = devices.at(i).supportedSampleRates();
- for (int j = 0; j < rates.size(); ++j) {
- int rate = rates.at(j);
- if (!m_sampleRates.contains(rate))
- m_sampleRates.append(rate);
- }
- }
- std::sort(m_sampleRates.begin(), m_sampleRates.end());
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audiocapture/audioencodercontrol.h b/src/plugins/audiocapture/audioencodercontrol.h
deleted file mode 100644
index 30de92e96..000000000
--- a/src/plugins/audiocapture/audioencodercontrol.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 AUDIOENCODERCONTROL_H
-#define AUDIOENCODERCONTROL_H
-
-#include "qaudioencodersettingscontrol.h"
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-#include <qaudioformat.h>
-
-QT_BEGIN_NAMESPACE
-
-class AudioCaptureSession;
-
-class AudioEncoderControl : public QAudioEncoderSettingsControl
-{
- Q_OBJECT
-public:
- AudioEncoderControl(QObject *parent);
- virtual ~AudioEncoderControl();
-
- QStringList supportedAudioCodecs() const;
- QString codecDescription(const QString &codecName) const;
- QList<int> supportedSampleRates(const QAudioEncoderSettings &, bool *continuous = 0) const;
-
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
-
-private:
- void update();
-
- AudioCaptureSession* m_session;
- QList<int> m_sampleRates;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audiocapture/audioinputselector.cpp b/src/plugins/audiocapture/audioinputselector.cpp
deleted file mode 100644
index 9ea3e2d5c..000000000
--- a/src/plugins/audiocapture/audioinputselector.cpp
+++ /dev/null
@@ -1,111 +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 "audiomediarecordercontrol.h"
-#include "audioinputselector.h"
-
-#include <qaudiodeviceinfo.h>
-
-QT_BEGIN_NAMESPACE
-
-AudioInputSelector::AudioInputSelector(QObject *parent)
- :QAudioInputSelectorControl(parent)
-{
- m_session = qobject_cast<AudioCaptureSession*>(parent);
-
- update();
-
- m_audioInput = defaultInput();
-}
-
-AudioInputSelector::~AudioInputSelector()
-{
-}
-
-QList<QString> AudioInputSelector::availableInputs() const
-{
- return m_names;
-}
-
-QString AudioInputSelector::inputDescription(const QString& name) const
-{
- QString desc;
-
- for(int i = 0; i < m_names.count(); i++) {
- if (m_names.at(i).compare(name) == 0) {
- desc = m_names.at(i);
- break;
- }
- }
- return desc;
-}
-
-QString AudioInputSelector::defaultInput() const
-{
- return QAudioDeviceInfo::defaultInputDevice().deviceName();
-}
-
-QString AudioInputSelector::activeInput() const
-{
- return m_audioInput;
-}
-
-void AudioInputSelector::setActiveInput(const QString& name)
-{
- if (m_audioInput.compare(name) != 0) {
- m_audioInput = name;
- m_session->setCaptureDevice(name);
- emit activeInputChanged(name);
- }
-}
-
-void AudioInputSelector::update()
-{
- m_names.clear();
- m_descriptions.clear();
-
- QList<QAudioDeviceInfo> devices;
- devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- for(int i = 0; i < devices.size(); ++i) {
- m_names.append(devices.at(i).deviceName());
- m_descriptions.append(devices.at(i).deviceName());
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audiocapture/audioinputselector.h b/src/plugins/audiocapture/audioinputselector.h
deleted file mode 100644
index 7a0829223..000000000
--- a/src/plugins/audiocapture/audioinputselector.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 AUDIOINPUTSELECTOR_H
-#define AUDIOINPUTSELECTOR_H
-
-#include <QStringList>
-
-#include "qaudioinputselectorcontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-class AudioCaptureSession;
-
-class AudioInputSelector : public QAudioInputSelectorControl
-{
-Q_OBJECT
-public:
- AudioInputSelector(QObject *parent);
- virtual ~AudioInputSelector();
-
- QList<QString> availableInputs() const;
- QString inputDescription(const QString& name) const;
- QString defaultInput() const;
- QString activeInput() const;
-
-public Q_SLOTS:
- void setActiveInput(const QString& name);
-
-private:
- void update();
-
- QString m_audioInput;
- QList<QString> m_names;
- QList<QString> m_descriptions;
- AudioCaptureSession* m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif // AUDIOINPUTSELECTOR_H
diff --git a/src/plugins/audiocapture/audiomediarecordercontrol.cpp b/src/plugins/audiocapture/audiomediarecordercontrol.cpp
deleted file mode 100644
index a1ca83701..000000000
--- a/src/plugins/audiocapture/audiomediarecordercontrol.cpp
+++ /dev/null
@@ -1,456 +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 <QtCore/qdebug.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qdir.h>
-#include <qaudiodeviceinfo.h>
-
-#include "qmediarecorder.h"
-
-#include "audiomediarecordercontrol.h"
-#include "audiocaptureprobecontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-void FileProbeProxy::startProbes(const QAudioFormat &format)
-{
- m_format = format;
-}
-
-void FileProbeProxy::stopProbes()
-{
- m_format = QAudioFormat();
-}
-
-void FileProbeProxy::addProbe(AudioCaptureProbeControl *probe)
-{
- QMutexLocker locker(&m_probeMutex);
-
- if (m_probes.contains(probe))
- return;
-
- m_probes.append(probe);
-}
-
-void FileProbeProxy::removeProbe(AudioCaptureProbeControl *probe)
-{
- QMutexLocker locker(&m_probeMutex);
- m_probes.removeOne(probe);
-}
-
-qint64 FileProbeProxy::writeData(const char *data, qint64 len)
-{
- if (m_format.isValid()) {
- QMutexLocker locker(&m_probeMutex);
-
- for (AudioCaptureProbeControl* probe : qAsConst(m_probes))
- probe->bufferProbed(data, len, m_format);
- }
-
- return QFile::writeData(data, len);
-}
-
-AudioCaptureSession::AudioCaptureSession(QObject *parent)
- : QMediaRecorderControl(parent)
- , m_state(QMediaRecorder::StoppedState)
- , m_status(QMediaRecorder::UnloadedStatus)
- , m_audioInput(nullptr)
- , m_deviceInfo(QAudioDeviceInfo::defaultInputDevice())
- , m_wavFile(true)
- , m_volume(1.0)
- , m_muted(false)
-{
- m_format = m_deviceInfo.preferredFormat();
-}
-
-AudioCaptureSession::~AudioCaptureSession()
-{
- setState(QMediaRecorder::StoppedState);
-}
-
-QAudioFormat AudioCaptureSession::format() const
-{
- return m_format;
-}
-
-void AudioCaptureSession::setFormat(const QAudioFormat &format)
-{
- m_format = format;
-}
-
-void AudioCaptureSession::setContainerFormat(const QString &formatMimeType)
-{
- m_wavFile = (formatMimeType.isEmpty()
- || QString::compare(formatMimeType, QLatin1String("audio/x-wav")) == 0);
-}
-
-QString AudioCaptureSession::containerFormat() const
-{
- if (m_wavFile)
- return QStringLiteral("audio/x-wav");
-
- return QStringLiteral("audio/x-raw");
-}
-
-QUrl AudioCaptureSession::outputLocation() const
-{
- return m_actualOutputLocation;
-}
-
-bool AudioCaptureSession::setOutputLocation(const QUrl& location)
-{
- if (m_requestedOutputLocation == location)
- return false;
-
- m_actualOutputLocation = QUrl();
- m_requestedOutputLocation = location;
-
- if (m_requestedOutputLocation.isEmpty())
- return true;
-
- if (m_requestedOutputLocation.isValid() && (m_requestedOutputLocation.isLocalFile()
- || m_requestedOutputLocation.isRelative())) {
- emit actualLocationChanged(m_requestedOutputLocation);
- return true;
- }
-
- m_requestedOutputLocation = QUrl();
- return false;
-}
-
-qint64 AudioCaptureSession::duration() const
-{
- if (m_audioInput)
- return m_audioInput->processedUSecs() / 1000;
- return 0;
-}
-
-void AudioCaptureSession::setState(QMediaRecorder::State state)
-{
- if (m_state == state)
- return;
-
- m_state = state;
- emit stateChanged(m_state);
-
- switch (m_state) {
- case QMediaRecorder::StoppedState:
- stop();
- break;
- case QMediaRecorder::PausedState:
- pause();
- break;
- case QMediaRecorder::RecordingState:
- record();
- break;
- }
-}
-
-QMediaRecorder::State AudioCaptureSession::state() const
-{
- return m_state;
-}
-
-void AudioCaptureSession::setStatus(QMediaRecorder::Status status)
-{
- if (m_status == status)
- return;
-
- m_status = status;
- emit statusChanged(m_status);
-}
-
-QMediaRecorder::Status AudioCaptureSession::status() const
-{
- return m_status;
-}
-
-QDir AudioCaptureSession::defaultDir() const
-{
- QStringList dirCandidates;
-
- dirCandidates << QDir::home().filePath("Documents");
- dirCandidates << QDir::home().filePath("My Documents");
- dirCandidates << QDir::homePath();
- dirCandidates << QDir::currentPath();
- dirCandidates << QDir::tempPath();
-
- for (const QString &path : qAsConst(dirCandidates)) {
- QDir dir(path);
- if (dir.exists() && QFileInfo(path).isWritable())
- return dir;
- }
-
- return QDir();
-}
-
-QString AudioCaptureSession::generateFileName(const QString &requestedName,
- const QString &extension) const
-{
- if (requestedName.isEmpty())
- return generateFileName(defaultDir(), extension);
-
- QString path = requestedName;
-
- if (QFileInfo(path).isRelative())
- path = defaultDir().absoluteFilePath(path);
-
- if (QFileInfo(path).isDir())
- return generateFileName(QDir(path), extension);
-
- if (!path.endsWith(extension))
- path.append(QString(".%1").arg(extension));
-
- return path;
-}
-
-QString AudioCaptureSession::generateFileName(const QDir &dir,
- const QString &ext) const
-{
- int lastClip = 0;
- const auto list = dir.entryList(QStringList() << QString("clip_*.%1").arg(ext));
- for (const QString &fileName : list) {
- int imgNumber = QStringView{fileName}.mid(5, fileName.size()-6-ext.length()).toInt();
- lastClip = qMax(lastClip, imgNumber);
- }
-
- QString name = QString("clip_%1.%2").arg(lastClip+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0')).arg(ext);
-
- return dir.absoluteFilePath(name);
-}
-
-void AudioCaptureSession::record()
-{
- if (m_status == QMediaRecorder::PausedStatus) {
- m_audioInput->resume();
- } else {
- if (m_deviceInfo.isNull()) {
- emit error(QMediaRecorder::ResourceError,
- QStringLiteral("No input device available."));
- m_state = QMediaRecorder::StoppedState;
- emit stateChanged(m_state);
- setStatus(QMediaRecorder::UnavailableStatus);
- return;
- }
-
- setStatus(QMediaRecorder::LoadingStatus);
-
- m_format = m_deviceInfo.nearestFormat(m_format);
- m_audioInput = new QAudioInput(m_deviceInfo, m_format);
- connect(m_audioInput, SIGNAL(stateChanged(QAudio::State)),
- this, SLOT(audioInputStateChanged(QAudio::State)));
- connect(m_audioInput, SIGNAL(notify()),
- this, SLOT(notify()));
-
-
- QString filePath = generateFileName(
- m_requestedOutputLocation.isLocalFile() ? m_requestedOutputLocation.toLocalFile()
- : m_requestedOutputLocation.toString(),
- m_wavFile ? QLatin1String("wav")
- : QLatin1String("raw"));
-
- m_actualOutputLocation = QUrl::fromLocalFile(filePath);
- if (m_actualOutputLocation != m_requestedOutputLocation)
- emit actualLocationChanged(m_actualOutputLocation);
-
- file.setFileName(filePath);
-
- setStatus(QMediaRecorder::LoadedStatus);
- setStatus(QMediaRecorder::StartingStatus);
-
- if (file.open(QIODevice::WriteOnly)) {
- if (m_wavFile) {
- memset(&header,0,sizeof(CombinedHeader));
- memcpy(header.riff.descriptor.id,"RIFF",4);
- header.riff.descriptor.size = 0xFFFFFFFF; // This should be updated on stop(), filesize-8
- memcpy(header.riff.type,"WAVE",4);
- memcpy(header.wave.descriptor.id,"fmt ",4);
- header.wave.descriptor.size = 16;
- header.wave.audioFormat = 1; // for PCM data
- header.wave.numChannels = m_format.channelCount();
- header.wave.sampleRate = m_format.sampleRate();
- header.wave.byteRate = m_format.sampleRate()*m_format.channelCount()*m_format.sampleSize()/8;
- header.wave.blockAlign = m_format.channelCount()*m_format.sampleSize()/8;
- header.wave.bitsPerSample = m_format.sampleSize();
- memcpy(header.data.descriptor.id,"data",4);
- header.data.descriptor.size = 0xFFFFFFFF; // This should be updated on stop(),samples*channels*sampleSize/8
- file.write((char*)&header,sizeof(CombinedHeader));
- }
-
- setVolumeHelper(m_muted ? 0 : m_volume);
-
- file.startProbes(m_format);
- m_audioInput->start(qobject_cast<QIODevice*>(&file));
- } else {
- delete m_audioInput;
- m_audioInput = nullptr;
- emit error(QMediaRecorder::ResourceError,
- QStringLiteral("Can't open output location"));
- m_state = QMediaRecorder::StoppedState;
- emit stateChanged(m_state);
- setStatus(QMediaRecorder::UnloadedStatus);
- }
- }
-}
-
-void AudioCaptureSession::pause()
-{
- m_audioInput->suspend();
-}
-
-void AudioCaptureSession::stop()
-{
- if(m_audioInput) {
- m_audioInput->stop();
- file.stopProbes();
- file.close();
- if (m_wavFile) {
- qint32 fileSize = file.size();
- file.open(QIODevice::ReadWrite | QIODevice::Unbuffered);
- file.read((char*)&header,sizeof(CombinedHeader));
- header.riff.descriptor.size = fileSize - 8; // The RIFF chunk size is the file size minus
- // the first two RIFF fields (8 bytes)
- header.data.descriptor.size = fileSize - 44; // dataSize = fileSize - headerSize (44 bytes)
- file.seek(0);
- file.write((char*)&header,sizeof(CombinedHeader));
- file.close();
- }
- delete m_audioInput;
- m_audioInput = nullptr;
- setStatus(QMediaRecorder::UnloadedStatus);
- }
-}
-
-void AudioCaptureSession::addProbe(AudioCaptureProbeControl *probe)
-{
- file.addProbe(probe);
-}
-
-void AudioCaptureSession::removeProbe(AudioCaptureProbeControl *probe)
-{
- file.removeProbe(probe);
-}
-
-void AudioCaptureSession::audioInputStateChanged(QAudio::State state)
-{
- switch(state) {
- case QAudio::ActiveState:
- setStatus(QMediaRecorder::RecordingStatus);
- break;
- case QAudio::SuspendedState:
- setStatus(QMediaRecorder::PausedStatus);
- break;
- case QAudio::StoppedState:
- setStatus(QMediaRecorder::FinalizingStatus);
- break;
- default:
- break;
- }
-}
-
-void AudioCaptureSession::notify()
-{
- emit durationChanged(duration());
-}
-
-void AudioCaptureSession::setCaptureDevice(const QString &deviceName)
-{
- m_captureDevice = deviceName;
-
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- for (int i = 0; i < devices.size(); ++i) {
- QAudioDeviceInfo info = devices.at(i);
- if (m_captureDevice == info.deviceName()){
- m_deviceInfo = info;
- return;
- }
- }
- m_deviceInfo = QAudioDeviceInfo::defaultInputDevice();
-}
-
-qreal AudioCaptureSession::volume() const
-{
- return m_volume;
-}
-
-bool AudioCaptureSession::isMuted() const
-{
- return m_muted;
-}
-
-void AudioCaptureSession::setVolume(qreal v)
-{
- qreal boundedVolume = qBound(qreal(0), v, qreal(1));
-
- if (m_volume == boundedVolume)
- return;
-
- m_volume = boundedVolume;
-
- if (!m_muted)
- setVolumeHelper(m_volume);
-
- emit volumeChanged(m_volume);
-}
-
-void AudioCaptureSession::setMuted(bool muted)
-{
- if (m_muted == muted)
- return;
-
- m_muted = muted;
-
- setVolumeHelper(m_muted ? 0 : m_volume);
-
- emit mutedChanged(m_muted);
-}
-
-void AudioCaptureSession::setVolumeHelper(qreal volume)
-{
- if (!m_audioInput)
- return;
-
- m_audioInput->setVolume(volume);
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audiocapture/audiomediarecordercontrol.h b/src/plugins/audiocapture/audiomediarecordercontrol.h
deleted file mode 100644
index d2e0a99fc..000000000
--- a/src/plugins/audiocapture/audiomediarecordercontrol.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOCAPTURESESSION_H
-#define AUDIOCAPTURESESSION_H
-
-#include <QFile>
-#include <QUrl>
-#include <QDir>
-#include <QMutex>
-
-#include "audioencodercontrol.h"
-#include "audioinputselector.h"
-#include "qmediarecordercontrol.h"
-
-#include <qaudioformat.h>
-#include <qaudioinput.h>
-#include <qaudiodeviceinfo.h>
-
-QT_BEGIN_NAMESPACE
-
-class AudioCaptureProbeControl;
-
-class FileProbeProxy: public QFile {
-public:
- void startProbes(const QAudioFormat& format);
- void stopProbes();
- void addProbe(AudioCaptureProbeControl *probe);
- void removeProbe(AudioCaptureProbeControl *probe);
-
-protected:
- virtual qint64 writeData(const char *data, qint64 len);
-
-private:
- QAudioFormat m_format;
- QList<AudioCaptureProbeControl*> m_probes;
- QMutex m_probeMutex;
-};
-
-
-class AudioCaptureSession : public QMediaRecorderControl
-{
- Q_OBJECT
-
-public:
- AudioCaptureSession(QObject *parent = 0);
- ~AudioCaptureSession();
-
- // QMediaRecorderControl interface
- QUrl outputLocation() const override;
- bool setOutputLocation(const QUrl& location) override;
-
- void setState(QMediaRecorder::State state) override;
- QMediaRecorder::State state() const override;
- QMediaRecorder::Status status() const override;
-
- void setVolume(qreal v) override;
- qreal volume() const override;
-
- void setMuted(bool muted) override;
- bool isMuted() const override;
-
- qint64 duration() const override;
-
- void applySettings() override {}
-
- QAudioFormat format() const;
- void setFormat(const QAudioFormat &format);
-
- QString containerFormat() const;
- void setContainerFormat(const QString &formatMimeType);
-
- void addProbe(AudioCaptureProbeControl *probe);
- void removeProbe(AudioCaptureProbeControl *probe);
-
- void setCaptureDevice(const QString &deviceName);
-
-private slots:
- void audioInputStateChanged(QAudio::State state);
- void notify();
-
-private:
- void record();
- void pause();
- void stop();
-
- void setStatus(QMediaRecorder::Status status);
-
- void setVolumeHelper(qreal volume);
-
- QDir defaultDir() const;
- QString generateFileName(const QString &requestedName,
- const QString &extension) const;
- QString generateFileName(const QDir &dir, const QString &extension) const;
-
- FileProbeProxy file;
- QString m_captureDevice;
- QUrl m_requestedOutputLocation;
- QUrl m_actualOutputLocation;
- QMediaRecorder::State m_state;
- QMediaRecorder::Status m_status;
- QAudioInput *m_audioInput;
- QAudioDeviceInfo m_deviceInfo;
- QAudioFormat m_format;
- bool m_wavFile;
- qreal m_volume;
- bool m_muted;
-
- // WAV header stuff
-
- struct chunk
- {
- char id[4];
- quint32 size;
- };
-
- struct RIFFHeader
- {
- chunk descriptor;
- char type[4];
- };
-
- struct WAVEHeader
- {
- chunk descriptor;
- quint16 audioFormat; // PCM = 1
- quint16 numChannels;
- quint32 sampleRate;
- quint32 byteRate;
- quint16 blockAlign;
- quint16 bitsPerSample;
- };
-
- struct DATAHeader
- {
- chunk descriptor;
-// quint8 data[];
- };
-
- struct CombinedHeader
- {
- RIFFHeader riff;
- WAVEHeader wave;
- DATAHeader data;
- };
-
- CombinedHeader header;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 96ec31ddf..64e0edeb0 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -17,22 +17,16 @@ android {
qnx {
qtConfig(mmrenderer): SUBDIRS += qnx
- SUBDIRS += audiocapture
}
win32: {
- SUBDIRS += audiocapture
-
qtConfig(wmf): SUBDIRS += wmf
}
qtConfig(gstreamer): SUBDIRS += gstreamer
-unix:!mac:!android:!qtConfig(gstreamer): SUBDIRS += audiocapture
-
darwin:!watchos {
qtConfig(avfoundation): SUBDIRS += avfoundation
- SUBDIRS += audiocapture
}