1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "qgstreameraudiodevice_p.h" |
5 | |
6 | #include <common/qgst_p.h> |
7 | #include <common/qgstutils_p.h> |
8 | #include <private/qplatformmediaintegration_p.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | QGStreamerCustomAudioDeviceInfo::QGStreamerCustomAudioDeviceInfo(const QByteArray &gstreamerPipeline, |
13 | QAudioDevice::Mode mode) |
14 | : QAudioDevicePrivate{ |
15 | gstreamerPipeline, |
16 | mode, |
17 | QString::fromUtf8(ba: gstreamerPipeline), |
18 | } |
19 | { |
20 | } |
21 | |
22 | QAudioDevice qMakeCustomGStreamerAudioInput(const QByteArray &gstreamerPipeline) |
23 | { |
24 | auto deviceInfo = std::make_unique<QGStreamerCustomAudioDeviceInfo>(args: gstreamerPipeline, |
25 | args: QAudioDevice::Mode::Input); |
26 | |
27 | return deviceInfo.release()->create(); |
28 | } |
29 | |
30 | QAudioDevice qMakeCustomGStreamerAudioOutput(const QByteArray &gstreamerPipeline) |
31 | { |
32 | auto deviceInfo = std::make_unique<QGStreamerCustomAudioDeviceInfo>(args: gstreamerPipeline, |
33 | args: QAudioDevice::Mode::Output); |
34 | |
35 | return deviceInfo.release()->create(); |
36 | } |
37 | |
38 | bool isCustomAudioDevice(const QAudioDevicePrivate *device) |
39 | { |
40 | return dynamic_cast<const QGStreamerCustomAudioDeviceInfo *>(device); |
41 | } |
42 | |
43 | bool isCustomAudioDevice(const QAudioDevice &device) |
44 | { |
45 | return isCustomAudioDevice(device: device.handle()); |
46 | } |
47 | |
48 | QT_END_NAMESPACE |
49 |