summaryrefslogtreecommitdiffstats
path: root/src/multimedia/platform/qmediaplatformintegration.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2021-01-13 15:39:29 +0100
committerLars Knoll <lars.knoll@qt.io>2021-01-22 07:03:16 +0000
commit85e2f9712f257627529b3877e0c71dcc344a5313 (patch)
tree68859195970d7374f28074b5cabf458926e2a5fc /src/multimedia/platform/qmediaplatformintegration.cpp
parent98148969b112f82d2b49e77950ea5f6d8b37b8b2 (diff)
Add a QMediaDeviceInfo class to enumerate input/output devices
Use this as the starting point for a new QPA like backend infrastructure. Refactor places that use the device information to use the new infrastructure. Cleanup the audio subsystem part and port it over to the new infrastructure. Android and QNX are not ported yet. Change-Id: I99c459c998f1f05e1c40ad30c700011e41cef533 Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/platform/qmediaplatformintegration.cpp')
-rw-r--r--src/multimedia/platform/qmediaplatformintegration.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/multimedia/platform/qmediaplatformintegration.cpp b/src/multimedia/platform/qmediaplatformintegration.cpp
new file mode 100644
index 000000000..59461148d
--- /dev/null
+++ b/src/multimedia/platform/qmediaplatformintegration.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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 <qtmultimediaglobal_p.h>
+#include "qmediaplatformintegration_p.h"
+
+#if QT_CONFIG(gstreamer)
+#include <private/qgstreamerintegration_p.h>
+using PlatformIntegration = QGstreamerIntegration;
+#elif QT_CONFIG(pulseaudio)
+#include <private/qpulseaudiointegration_p.h>
+using PlatformIntegration = QPulseAudioIntegration;
+#elif QT_CONFIG(alsa)
+#include <private/qalsaintegration_p.h>
+using PlatformIntegration = QAlsaIntegration;
+#elif QT_CONFIG(avfoundation)
+#include <private/qdarwinintegration_p.h>
+using PlatformIntegration = QDarwinIntegration;
+#elif defined(Q_OS_WIN)
+#include <private/qwindowsintegration_p.h>
+using PlatformIntegration = QWindowsIntegration;
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+struct Holder {
+ ~Holder()
+ {
+ delete instance;
+ instance = nullptr;
+ }
+ QMediaPlatformIntegration *instance = nullptr;
+} holder;
+
+}
+
+QMediaPlatformIntegration *QMediaPlatformIntegration::instance()
+{
+ if (!holder.instance) {
+ holder.instance = new PlatformIntegration;
+ }
+ return holder.instance;
+}
+
+QMediaPlatformIntegration::~QMediaPlatformIntegration()
+{
+
+}
+
+QT_END_NAMESPACE