blob: 817aae1c26a45bd7ea268912d80d8ceae64b1fe0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qgstreamerintegration_p.h"
#include "qgstreamervideodevices_p.h"
#include "qgstreamermediaplayer_p.h"
#include "qgstreamermediacapture_p.h"
#include "qgstreameraudiodecoder_p.h"
#include "qgstreamercamera_p.h"
#include "qgstreamermediaencoder_p.h"
#include "qgstreamerimagecapture_p.h"
#include "qgstreamerformatinfo_p.h"
#include "qgstreamervideosink_p.h"
#include "qgstreameraudioinput_p.h"
#include "qgstreameraudiooutput_p.h"
#include <QtMultimedia/private/qplatformmediaplugin_p.h>
#include <memory>
QT_BEGIN_NAMESPACE
class QGstreamerMediaPlugin : public QPlatformMediaPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformMediaPlugin_iid FILE "gstreamer.json")
public:
QGstreamerMediaPlugin()
: QPlatformMediaPlugin()
{}
QPlatformMediaIntegration* create(const QString &name) override
{
if (name == QLatin1String("gstreamer"))
return new QGstreamerIntegration;
return nullptr;
}
};
QGstreamerIntegration::QGstreamerIntegration()
{
gst_init(nullptr, nullptr);
m_videoDevices = new QGstreamerVideoDevices(this);
m_formatsInfo = new QGstreamerFormatInfo();
}
QGstreamerIntegration::~QGstreamerIntegration()
{
delete m_formatsInfo;
}
QPlatformMediaFormatInfo *QGstreamerIntegration::formatInfo()
{
return m_formatsInfo;
}
const QGstreamerFormatInfo *QGstreamerIntegration::gstFormatsInfo() const
{
return m_formatsInfo;
}
QMaybe<QPlatformAudioDecoder *> QGstreamerIntegration::createAudioDecoder(QAudioDecoder *decoder)
{
return new QGstreamerAudioDecoder(decoder);
}
QMaybe<QPlatformMediaCaptureSession *> QGstreamerIntegration::createCaptureSession()
{
return new QGstreamerMediaCapture();
}
QMaybe<QPlatformMediaPlayer *> QGstreamerIntegration::createPlayer(QMediaPlayer *player)
{
return new QGstreamerMediaPlayer(player);
}
QMaybe<QPlatformCamera *> QGstreamerIntegration::createCamera(QCamera *camera)
{
return new QGstreamerCamera(camera);
}
QMaybe<QPlatformMediaRecorder *> QGstreamerIntegration::createRecorder(QMediaRecorder *recorder)
{
return new QGstreamerMediaEncoder(recorder);
}
QMaybe<QPlatformImageCapture *> QGstreamerIntegration::createImageCapture(QImageCapture *imageCapture)
{
return new QGstreamerImageCapture(imageCapture);
}
QMaybe<QPlatformVideoSink *> QGstreamerIntegration::createVideoSink(QVideoSink *sink)
{
return new QGstreamerVideoSink(sink);
}
QMaybe<QPlatformAudioInput *> QGstreamerIntegration::createAudioInput(QAudioInput *q)
{
return new QGstreamerAudioInput(q);
}
QMaybe<QPlatformAudioOutput *> QGstreamerIntegration::createAudioOutput(QAudioOutput *q)
{
return new QGstreamerAudioOutput(q);
}
GstDevice *QGstreamerIntegration::videoDevice(const QByteArray &id) const
{
return m_videoDevices ? static_cast<QGstreamerVideoDevices*>(m_videoDevices)->videoDevice(id) : nullptr;
}
QT_END_NAMESPACE
#include "qgstreamerintegration.moc"
|