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 qgstpipeline_p_H
5#define qgstpipeline_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 <private/qtmultimediaglobal_p.h>
19#include <QObject>
20
21#include <qgst_p.h>
22
23QT_BEGIN_NAMESPACE
24
25class QGstreamerMessage;
26
27class QGstreamerSyncMessageFilter {
28public:
29 //returns true if message was processed and should be dropped, false otherwise
30 virtual bool processSyncMessage(const QGstreamerMessage &message) = 0;
31};
32
33
34class QGstreamerBusMessageFilter {
35public:
36 //returns true if message was processed and should be dropped, false otherwise
37 virtual bool processBusMessage(const QGstreamerMessage &message) = 0;
38};
39
40class QGstPipelinePrivate;
41
42class QGstPipeline : public QGstBin
43{
44 QGstPipelinePrivate *d = nullptr;
45public:
46 constexpr QGstPipeline() = default;
47 QGstPipeline(const QGstPipeline &o);
48 QGstPipeline &operator=(const QGstPipeline &o);
49 QGstPipeline(const char *name);
50 QGstPipeline(GstPipeline *p);
51 ~QGstPipeline() override;
52
53 // This is needed to help us avoid sending QVideoFrames or audio buffers to the
54 // application while we're prerolling the pipeline.
55 // QMediaPlayer is still in a stopped state, while we put the gstreamer pipeline into a
56 // Paused state so that we can get the required metadata of the stream and also have a fast
57 // transition to play.
58 bool inStoppedState() const;
59 void setInStoppedState(bool stopped);
60
61 void setFlushOnConfigChanges(bool flush);
62
63 void installMessageFilter(QGstreamerSyncMessageFilter *filter);
64 void removeMessageFilter(QGstreamerSyncMessageFilter *filter);
65 void installMessageFilter(QGstreamerBusMessageFilter *filter);
66 void removeMessageFilter(QGstreamerBusMessageFilter *filter);
67
68 GstStateChangeReturn setState(GstState state);
69
70 GstPipeline *pipeline() const { return GST_PIPELINE_CAST(m_object); }
71
72 void dumpGraph(const char *fileName)
73 {
74 if (isNull())
75 return;
76
77#if 1 //def QT_GST_CAPTURE_DEBUG
78 GST_DEBUG_BIN_TO_DOT_FILE(bin(),
79 GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL |
80 GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES),
81 fileName);
82#else
83 Q_UNUSED(fileName);
84#endif
85 }
86
87 void beginConfig();
88 void endConfig();
89
90 void flush();
91
92 bool seek(qint64 pos, double rate);
93 bool setPlaybackRate(double rate);
94 double playbackRate() const;
95
96 bool setPosition(qint64 pos);
97 qint64 position() const;
98
99 qint64 duration() const;
100};
101
102QT_END_NAMESPACE
103
104#endif
105

source code of qtmultimedia/src/plugins/multimedia/gstreamer/common/qgstpipeline_p.h