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 | #ifndef QGSTREAMERCAPTURESERVICE_H |
5 | #define QGSTREAMERCAPTURESERVICE_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <private/qplatformmediacapture_p.h> |
19 | #include <private/qplatformmediaintegration_p.h> |
20 | |
21 | #include <qgst_p.h> |
22 | #include <qgstpipeline_p.h> |
23 | |
24 | #include <qtimer.h> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class QGstreamerCamera; |
29 | class QGstreamerImageCapture; |
30 | class QGstreamerMediaEncoder; |
31 | class QGstreamerAudioInput; |
32 | class QGstreamerAudioOutput; |
33 | class QGstreamerVideoOutput; |
34 | class QGstreamerVideoSink; |
35 | |
36 | class QGstreamerMediaCapture : public QPlatformMediaCaptureSession |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | static QMaybe<QPlatformMediaCaptureSession *> create(); |
42 | virtual ~QGstreamerMediaCapture(); |
43 | |
44 | QPlatformCamera *camera() override; |
45 | void setCamera(QPlatformCamera *camera) override; |
46 | |
47 | QPlatformImageCapture *imageCapture() override; |
48 | void setImageCapture(QPlatformImageCapture *imageCapture) override; |
49 | |
50 | QPlatformMediaRecorder *mediaRecorder() override; |
51 | void setMediaRecorder(QPlatformMediaRecorder *recorder) override; |
52 | |
53 | void setAudioInput(QPlatformAudioInput *input) override; |
54 | QGstreamerAudioInput *audioInput() { return gstAudioInput; } |
55 | |
56 | void setVideoPreview(QVideoSink *sink) override; |
57 | void setAudioOutput(QPlatformAudioOutput *output) override; |
58 | |
59 | void linkEncoder(QGstPad audioSink, QGstPad videoSink); |
60 | void unlinkEncoder(); |
61 | |
62 | QGstPipeline pipeline() const { return gstPipeline; } |
63 | |
64 | QGstreamerVideoSink *gstreamerVideoSink() const; |
65 | |
66 | private: |
67 | QGstreamerMediaCapture(QGstreamerVideoOutput *videoOutput); |
68 | |
69 | friend QGstreamerMediaEncoder; |
70 | // Gst elements |
71 | QGstPipeline gstPipeline; |
72 | |
73 | QGstreamerAudioInput *gstAudioInput = nullptr; |
74 | QGstreamerCamera *gstCamera = nullptr; |
75 | |
76 | QGstElement gstAudioTee; |
77 | QGstElement gstVideoTee; |
78 | QGstElement encoderVideoCapsFilter; |
79 | QGstElement encoderAudioCapsFilter; |
80 | |
81 | QGstPad encoderAudioSink; |
82 | QGstPad encoderVideoSink; |
83 | QGstPad imageCaptureSink; |
84 | |
85 | QGstreamerAudioOutput *gstAudioOutput = nullptr; |
86 | QGstreamerVideoOutput *gstVideoOutput = nullptr; |
87 | |
88 | QGstreamerMediaEncoder *m_mediaEncoder = nullptr; |
89 | QGstreamerImageCapture *m_imageCapture = nullptr; |
90 | }; |
91 | |
92 | QT_END_NAMESPACE |
93 | |
94 | #endif // QGSTREAMERCAPTURESERVICE_H |
95 |