mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
icydemux: Fix sticky event handling
This commit is contained in:
parent
9ac456bd43
commit
6dee7d3a06
1 changed files with 33 additions and 6 deletions
|
@ -207,6 +207,28 @@ gst_icydemux_dispose (GObject * object)
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GstCaps *caps;
|
||||||
|
GstPad *pad;
|
||||||
|
} CopyStickyEventsData;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
copy_sticky_events (GstPad * pad, GstEvent ** event, gpointer user_data)
|
||||||
|
{
|
||||||
|
CopyStickyEventsData *data = user_data;
|
||||||
|
|
||||||
|
if (GST_EVENT_TYPE (*event) >= GST_EVENT_CAPS && data->caps) {
|
||||||
|
gst_pad_set_caps (data->pad, data->caps);
|
||||||
|
data->caps = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GST_EVENT_TYPE (*event) != GST_EVENT_CAPS)
|
||||||
|
gst_pad_push_event (data->pad, gst_event_ref (*event));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_icydemux_add_srcpad (GstICYDemux * icydemux, GstCaps * new_caps)
|
gst_icydemux_add_srcpad (GstICYDemux * icydemux, GstCaps * new_caps)
|
||||||
{
|
{
|
||||||
|
@ -225,6 +247,8 @@ gst_icydemux_add_srcpad (GstICYDemux * icydemux, GstCaps * new_caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icydemux->srcpad == NULL) {
|
if (icydemux->srcpad == NULL) {
|
||||||
|
CopyStickyEventsData data;
|
||||||
|
|
||||||
icydemux->srcpad =
|
icydemux->srcpad =
|
||||||
gst_pad_new_from_template (gst_element_class_get_pad_template
|
gst_pad_new_from_template (gst_element_class_get_pad_template
|
||||||
(GST_ELEMENT_GET_CLASS (icydemux), "src"), "src");
|
(GST_ELEMENT_GET_CLASS (icydemux), "src"), "src");
|
||||||
|
@ -233,10 +257,12 @@ gst_icydemux_add_srcpad (GstICYDemux * icydemux, GstCaps * new_caps)
|
||||||
gst_pad_use_fixed_caps (icydemux->srcpad);
|
gst_pad_use_fixed_caps (icydemux->srcpad);
|
||||||
gst_pad_set_active (icydemux->srcpad, TRUE);
|
gst_pad_set_active (icydemux->srcpad, TRUE);
|
||||||
|
|
||||||
if (icydemux->src_caps) {
|
data.pad = icydemux->srcpad;
|
||||||
if (!gst_pad_set_caps (icydemux->srcpad, icydemux->src_caps))
|
data.caps = icydemux->src_caps;
|
||||||
GST_WARNING_OBJECT (icydemux, "Failed to set caps on src pad");
|
gst_pad_sticky_events_foreach (icydemux->sinkpad, copy_sticky_events,
|
||||||
}
|
&data);
|
||||||
|
if (data.caps)
|
||||||
|
gst_pad_set_caps (data.pad, data.caps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (icydemux, "Adding src pad with caps %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (icydemux, "Adding src pad with caps %" GST_PTR_FORMAT,
|
||||||
icydemux->src_caps);
|
icydemux->src_caps);
|
||||||
|
@ -383,8 +409,9 @@ gst_icydemux_handle_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
|
|
||||||
return gst_pad_event_default (pad, parent, event);
|
return gst_pad_event_default (pad, parent, event);
|
||||||
default:
|
default:
|
||||||
icydemux->cached_events = g_list_append (icydemux->cached_events,
|
if (!GST_EVENT_IS_STICKY (event))
|
||||||
event);
|
icydemux->cached_events =
|
||||||
|
g_list_append (icydemux->cached_events, event);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue