Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5
6#include <common/qgst_p.h>
7
9
14
16
17void QGstreamerBufferProbe::addProbeToPad(GstPad *pad, bool downstream)
18{
19 QGstCaps caps{
20 gst_pad_get_current_caps(pad),
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
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
56{
57}
58
60{
61 return true;
62}
63
64GstPadProbeReturn 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
79GstPadProbeReturn 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
virtual bool probeBuffer(GstBuffer *buffer)
QGstreamerBufferProbe(Flags flags=ProbeAll)
virtual ~QGstreamerBufferProbe()
void removeProbeFromPad(GstPad *pad)
virtual void probeCaps(GstCaps *caps)
void addProbeToPad(GstPad *pad, bool downstream=true)
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void * user_data
GLenum GLuint buffer
GLbitfield flags
struct _cl_event * event
QHostInfo info
[0]