gdkpixbuf: fix event handling

This commit is contained in:
Wim Taymans 2012-03-05 13:31:44 +01:00
parent e637cfb212
commit 4d8002e9c4

View file

@ -376,7 +376,7 @@ static gboolean
gst_gdk_pixbuf_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) gst_gdk_pixbuf_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{ {
GstFlowReturn res = GST_FLOW_OK; GstFlowReturn res = GST_FLOW_OK;
gboolean ret = TRUE; gboolean ret = TRUE, forward = TRUE;
GstGdkPixbuf *pixbuf; GstGdkPixbuf *pixbuf;
pixbuf = GST_GDK_PIXBUF (parent); pixbuf = GST_GDK_PIXBUF (parent);
@ -387,8 +387,8 @@ gst_gdk_pixbuf_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
GstCaps *caps; GstCaps *caps;
gst_event_parse_caps (event, &caps); gst_event_parse_caps (event, &caps);
res = gst_gdk_pixbuf_sink_setcaps (pixbuf, caps); ret = gst_gdk_pixbuf_sink_setcaps (pixbuf, caps);
gst_event_unref (event); forward = FALSE;
break; break;
} }
case GST_EVENT_EOS: case GST_EVENT_EOS:
@ -403,6 +403,8 @@ gst_gdk_pixbuf_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
if (res != GST_FLOW_OK && res != GST_FLOW_FLUSHING) { if (res != GST_FLOW_OK && res != GST_FLOW_FLUSHING) {
GST_ELEMENT_ERROR (pixbuf, STREAM, FAILED, (NULL), GST_ELEMENT_ERROR (pixbuf, STREAM, FAILED, (NULL),
("Flow: %s", gst_flow_get_name (res))); ("Flow: %s", gst_flow_get_name (res)));
forward = FALSE;
ret = FALSE;
} }
} }
break; break;
@ -417,13 +419,11 @@ gst_gdk_pixbuf_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
default: default:
break; break;
} }
if (forward) {
if (res == GST_FLOW_OK) {
ret = gst_pad_event_default (pad, parent, event); ret = gst_pad_event_default (pad, parent, event);
} else { } else {
ret = FALSE; gst_event_unref (event);
} }
return ret; return ret;
} }