static gboolean
do_event_function (GstPad * pad, GstEvent * event,
- GstPadEventFunction eventfunc)
+ GstPadEventFunction eventfunc, gboolean * caps_notify)
{
gboolean result = TRUE;
GstCaps *caps, *templ;
if (!gst_caps_can_intersect (caps, templ))
goto not_accepted;
- g_object_notify_by_pspec ((GObject *) pad, pspec_caps);
+ *caps_notify = TRUE;
gst_caps_unref (templ);
break;
guint i;
GstPadEventFunction eventfunc;
GstEvent *event;
+ gboolean caps_notify = FALSE;
if (G_UNLIKELY ((eventfunc = GST_PAD_EVENTFUNC (pad)) == NULL))
goto no_function;
gst_event_ref (event);
GST_OBJECT_UNLOCK (pad);
- res = do_event_function (pad, event, eventfunc);
+ res = do_event_function (pad, event, eventfunc, &caps_notify);
- GST_OBJECT_LOCK (pad);
/* things could have changed while we release the lock, check if we still
* are handling the same event, if we don't something changed and we have
* to try again. FIXME. we need a cookie here. FIXME, we also want to remove
if (res) {
/* make the event active */
gst_event_take (&ev->event, event);
+
+ /* notify caps change when needed */
+ if (caps_notify) {
+ g_object_notify_by_pspec ((GObject *) pad, pspec_caps);
+ caps_notify = FALSE;
+ }
} else {
gst_event_unref (event);
ret = GST_FLOW_ERROR;
}
+ GST_OBJECT_LOCK (pad);
}
/* when we get here all events were successfully updated. */
-
return ret;
/* ERRORS */