| 1 | // Copyright (C) 2021 The Qt Company |
|---|---|
| 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 QGSTSUBTITLESINK_P_H |
| 5 | #define QGSTSUBTITLESINK_P_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/qtmultimediaglobal_p.h> |
| 19 | |
| 20 | #include <QtCore/qstring.h> |
| 21 | #include <common/qgst_p.h> |
| 22 | #include <gst/base/gstbasesink.h> |
| 23 | |
| 24 | QT_BEGIN_NAMESPACE |
| 25 | |
| 26 | class QAbstractSubtitleObserver |
| 27 | { |
| 28 | public: |
| 29 | virtual ~QAbstractSubtitleObserver() = default; |
| 30 | virtual void updateSubtitle(QString) = 0; |
| 31 | }; |
| 32 | |
| 33 | class QGstSubtitleSink |
| 34 | { |
| 35 | public: |
| 36 | GstBaseSink parent{}; |
| 37 | |
| 38 | static QGstElement createSink(QAbstractSubtitleObserver *observer); |
| 39 | |
| 40 | private: |
| 41 | static GType get_type(); |
| 42 | static void class_init(gpointer g_class, gpointer class_data); |
| 43 | static void base_init(gpointer g_class); |
| 44 | static void instance_init(GTypeInstance *instance, gpointer g_class); |
| 45 | |
| 46 | static void finalize(GObject *object); |
| 47 | |
| 48 | static GstStateChangeReturn change_state(GstElement *element, GstStateChange transition); |
| 49 | |
| 50 | static GstCaps *get_caps(GstBaseSink *sink, GstCaps *filter); |
| 51 | static gboolean set_caps(GstBaseSink *sink, GstCaps *caps); |
| 52 | |
| 53 | static gboolean propose_allocation(GstBaseSink *sink, GstQuery *query); |
| 54 | |
| 55 | static GstFlowReturn wait_event(GstBaseSink * sink, GstEvent * event); |
| 56 | static GstFlowReturn render(GstBaseSink *sink, GstBuffer *buffer); |
| 57 | |
| 58 | private: |
| 59 | QAbstractSubtitleObserver *observer = nullptr; |
| 60 | }; |
| 61 | |
| 62 | QT_END_NAMESPACE |
| 63 | |
| 64 | #endif |
| 65 |
