Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qgstreamerbufferprobe.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 Jolla 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
#
include
<
common
/
qgstreamerbufferprobe_p
.
h
>
5
6
#
include
<
common
/
qgst_p
.
h
>
7
8
QT_BEGIN_NAMESPACE
9
10
QGstreamerBufferProbe::QGstreamerBufferProbe(Flags flags)
11
: m_flags(flags)
12
{
13
}
14
15
QGstreamerBufferProbe::~QGstreamerBufferProbe() =
default
;
16
17
void
QGstreamerBufferProbe::addProbeToPad(GstPad *pad,
bool
downstream)
18
{
19
QGstCaps
caps{
20
gst_pad_get_current_caps(pad),
21
QGstCaps::HasRef,
22
};
23
24
if
(caps)
25
probeCaps(caps.caps());
26
27
if
(m_flags & ProbeCaps) {
28
m_capsProbeId = gst_pad_add_probe(
29
pad,
30
downstream
31
? GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM
32
: GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
33
capsProbe,
34
this
,
35
nullptr
);
36
}
37
if
(m_flags & ProbeBuffers) {
38
m_bufferProbeId = gst_pad_add_probe(
39
pad, GST_PAD_PROBE_TYPE_BUFFER, bufferProbe,
this
,
nullptr
);
40
}
41
}
42
43
void
QGstreamerBufferProbe::removeProbeFromPad(GstPad *pad)
44
{
45
if
(m_capsProbeId != -1) {
46
gst_pad_remove_probe(pad, m_capsProbeId);
47
m_capsProbeId = -1;
48
}
49
if
(m_bufferProbeId != -1) {
50
gst_pad_remove_probe(pad, m_bufferProbeId);
51
m_bufferProbeId = -1;
52
}
53
}
54
55
void
QGstreamerBufferProbe::probeCaps(GstCaps *)
56
{
57
}
58
59
bool
QGstreamerBufferProbe::probeBuffer(GstBuffer *)
60
{
61
return
true
;
62
}
63
64
GstPadProbeReturn QGstreamerBufferProbe::capsProbe(GstPad *, GstPadProbeInfo *info, gpointer user_data)
65
{
66
QGstreamerBufferProbe *
const
control =
static_cast
<QGstreamerBufferProbe *>(user_data);
67
68
if
(GstEvent *
const
event = gst_pad_probe_info_get_event(info)) {
69
if
(GST_EVENT_TYPE(event) == GST_EVENT_CAPS) {
70
GstCaps *caps;
71
gst_event_parse_caps(event, &caps);
72
73
control->probeCaps(caps);
74
}
75
}
76
return
GST_PAD_PROBE_OK;
77
}
78
79
GstPadProbeReturn QGstreamerBufferProbe::bufferProbe(
80
GstPad *, GstPadProbeInfo *info, gpointer user_data)
81
{
82
QGstreamerBufferProbe *
const
control =
static_cast
<QGstreamerBufferProbe *>(user_data);
83
if
(GstBuffer *
const
buffer = gst_pad_probe_info_get_buffer(info))
84
return
control->probeBuffer(buffer) ? GST_PAD_PROBE_OK : GST_PAD_PROBE_DROP;
85
return
GST_PAD_PROBE_OK;
86
}
87
88
QT_END_NAMESPACE
QGstCaps
Definition
qgst_p.h:384
qtmultimedia
src
plugins
multimedia
gstreamer
common
qgstreamerbufferprobe.cpp
Generated on
for Qt by
1.18.0