| 1 | // Copyright (C) 2021 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 QGSTREAMERINTEGRATION_H |
| 5 | #define QGSTREAMERINTEGRATION_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 <QtMultimedia/private/qplatformmediaintegration_p.h> |
| 19 | #include <QtMultimedia/private/qgstreamer_platformspecificinterface_p.h> |
| 20 | |
| 21 | #include <gst/gst.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | class QGstreamerFormatInfo; |
| 26 | |
| 27 | class QGStreamerPlatformSpecificInterfaceImplementation : public QGStreamerPlatformSpecificInterface |
| 28 | { |
| 29 | public: |
| 30 | ~QGStreamerPlatformSpecificInterfaceImplementation() override; |
| 31 | |
| 32 | QAudioDevice makeCustomGStreamerAudioInput(const QByteArray &gstreamerPipeline) override; |
| 33 | QAudioDevice makeCustomGStreamerAudioOutput(const QByteArray &gstreamerPipeline) override; |
| 34 | QCamera *makeCustomGStreamerCamera(const QByteArray &gstreamerPipeline, |
| 35 | QObject *parent) override; |
| 36 | |
| 37 | QCamera *makeCustomGStreamerCamera(GstElement *, QObject *parent) override; |
| 38 | |
| 39 | GstPipeline *gstPipeline(QMediaPlayer *) override; |
| 40 | GstPipeline *gstPipeline(QMediaCaptureSession *) override; |
| 41 | }; |
| 42 | |
| 43 | class QGstreamerIntegration : public QPlatformMediaIntegration |
| 44 | { |
| 45 | public: |
| 46 | QGstreamerIntegration(); |
| 47 | ~QGstreamerIntegration() override; |
| 48 | |
| 49 | static QGstreamerIntegration *instance() |
| 50 | { |
| 51 | return static_cast<QGstreamerIntegration *>(QPlatformMediaIntegration::instance()); |
| 52 | } |
| 53 | |
| 54 | q23::expected<QPlatformAudioDecoder *, QString> createAudioDecoder(QAudioDecoder *decoder) override; |
| 55 | q23::expected<QPlatformMediaCaptureSession *, QString> createCaptureSession() override; |
| 56 | q23::expected<QPlatformMediaPlayer *, QString> createPlayer(QMediaPlayer *player) override; |
| 57 | q23::expected<QPlatformCamera *, QString> createCamera(QCamera *) override; |
| 58 | q23::expected<QPlatformMediaRecorder *, QString> createRecorder(QMediaRecorder *) override; |
| 59 | q23::expected<QPlatformImageCapture *, QString> createImageCapture(QImageCapture *) override; |
| 60 | |
| 61 | q23::expected<QPlatformVideoSink *, QString> createVideoSink(QVideoSink *sink) override; |
| 62 | |
| 63 | q23::expected<QPlatformAudioInput *, QString> createAudioInput(QAudioInput *) override; |
| 64 | q23::expected<QPlatformAudioOutput *, QString> createAudioOutput(QAudioOutput *) override; |
| 65 | |
| 66 | const QGstreamerFormatInfo *gstFormatsInfo(); |
| 67 | GstDevice *videoDevice(const QByteArray &id); |
| 68 | |
| 69 | QAbstractPlatformSpecificInterface *platformSpecificInterface() override; |
| 70 | |
| 71 | protected: |
| 72 | QPlatformMediaFormatInfo *createFormatInfo() override; |
| 73 | QPlatformVideoDevices *createVideoDevices() override; |
| 74 | |
| 75 | QGStreamerPlatformSpecificInterfaceImplementation m_platformSpecificImplementation; |
| 76 | }; |
| 77 | |
| 78 | QT_END_NAMESPACE |
| 79 | |
| 80 | #endif |
| 81 | |