mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 16:18:16 +00:00
rtpdepayloade: add support for getting events
Add support for intercepting sink events in the depayloader by adding a new vmethod.
This commit is contained in:
parent
1dafd7136d
commit
9e787a0211
2 changed files with 26 additions and 5 deletions
|
@ -97,6 +97,8 @@ static void gst_base_rtp_depayload_set_gst_timestamp
|
||||||
(GstBaseRTPDepayload * filter, guint32 rtptime, GstBuffer * buf);
|
(GstBaseRTPDepayload * filter, guint32 rtptime, GstBuffer * buf);
|
||||||
static gboolean gst_base_rtp_depayload_packet_lost (GstBaseRTPDepayload *
|
static gboolean gst_base_rtp_depayload_packet_lost (GstBaseRTPDepayload *
|
||||||
filter, GstEvent * event);
|
filter, GstEvent * event);
|
||||||
|
static gboolean gst_base_rtp_depayload_handle_event (GstBaseRTPDepayload *
|
||||||
|
filter, GstEvent * event);
|
||||||
|
|
||||||
GST_BOILERPLATE (GstBaseRTPDepayload, gst_base_rtp_depayload, GstElement,
|
GST_BOILERPLATE (GstBaseRTPDepayload, gst_base_rtp_depayload, GstElement,
|
||||||
GST_TYPE_ELEMENT);
|
GST_TYPE_ELEMENT);
|
||||||
|
@ -142,6 +144,7 @@ gst_base_rtp_depayload_class_init (GstBaseRTPDepayloadClass * klass)
|
||||||
|
|
||||||
klass->set_gst_timestamp = gst_base_rtp_depayload_set_gst_timestamp;
|
klass->set_gst_timestamp = gst_base_rtp_depayload_set_gst_timestamp;
|
||||||
klass->packet_lost = gst_base_rtp_depayload_packet_lost;
|
klass->packet_lost = gst_base_rtp_depayload_packet_lost;
|
||||||
|
klass->handle_event = gst_base_rtp_depayload_handle_event;
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (basertpdepayload_debug, "basertpdepayload", 0,
|
GST_DEBUG_CATEGORY_INIT (basertpdepayload_debug, "basertpdepayload", 0,
|
||||||
"Base class for RTP Depayloaders");
|
"Base class for RTP Depayloaders");
|
||||||
|
@ -407,14 +410,12 @@ no_process:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
|
gst_base_rtp_depayload_handle_event (GstBaseRTPDepayload * filter,
|
||||||
|
GstEvent * event)
|
||||||
{
|
{
|
||||||
GstBaseRTPDepayload *filter;
|
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
gboolean forward = TRUE;
|
gboolean forward = TRUE;
|
||||||
|
|
||||||
filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
|
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
|
gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
|
||||||
|
@ -474,6 +475,22 @@ gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
|
{
|
||||||
|
gboolean res = FALSE;
|
||||||
|
GstBaseRTPDepayload *filter;
|
||||||
|
GstBaseRTPDepayloadClass *bclass;
|
||||||
|
|
||||||
|
filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
|
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
||||||
|
if (bclass->handle_event)
|
||||||
|
res = bclass->handle_event (filter, event);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static GstEvent *
|
static GstEvent *
|
||||||
create_segment_event (GstBaseRTPDepayload * filter, gboolean update,
|
create_segment_event (GstBaseRTPDepayload * filter, gboolean update,
|
||||||
GstClockTime position)
|
GstClockTime position)
|
||||||
|
|
|
@ -119,8 +119,12 @@ struct _GstBaseRTPDepayloadClass
|
||||||
* The default implementation of this message pushes a segment update. */
|
* The default implementation of this message pushes a segment update. */
|
||||||
gboolean (*packet_lost) (GstBaseRTPDepayload *filter, GstEvent *event);
|
gboolean (*packet_lost) (GstBaseRTPDepayload *filter, GstEvent *event);
|
||||||
|
|
||||||
|
/* the default implementation does the default actions for events but
|
||||||
|
* implementation can override. */
|
||||||
|
gboolean (*handle_event) (GstBaseRTPDepayload * filter, GstEvent * event);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer _gst_reserved[GST_PADDING-1];
|
gpointer _gst_reserved[GST_PADDING-2];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_base_rtp_depayload_get_type (void);
|
GType gst_base_rtp_depayload_get_type (void);
|
||||||
|
|
Loading…
Reference in a new issue