gst/: Implement accept_caps.

Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_proxy_getcaps),
(gst_base_transform_event):
* gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_query):
Implement accept_caps.
Fix silly lock/unlock mismatch in base class.
This commit is contained in:
Wim Taymans 2005-05-09 14:47:15 +00:00
parent 8df6cd7243
commit e70ec7b807
4 changed files with 38 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2005-05-09 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasetransform.c: (gst_base_transform_proxy_getcaps),
(gst_base_transform_event):
* gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_query):
Implement accept_caps.
Fix silly lock/unlock mismatch in base class.
2005-05-09 Wim Taymans <wim@fluendo.com>
* docs/design/draft-push-pull.txt:

View file

@ -216,6 +216,7 @@ gst_base_transform_event (GstPad * pad, GstEvent * event)
GstBaseTransform *trans;
GstBaseTransformClass *bclass;
gboolean ret = FALSE;
gboolean unlock;
trans = GST_BASE_TRANSFORM (GST_PAD_PARENT (pad));
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
@ -223,20 +224,25 @@ gst_base_transform_event (GstPad * pad, GstEvent * event)
if (bclass->event)
bclass->event (trans, event);
unlock = FALSE;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH:
if (GST_EVENT_FLUSH_DONE (event)) {
}
GST_STREAM_LOCK (pad);
unlock = TRUE;
break;
case GST_EVENT_EOS:
GST_STREAM_LOCK (pad);
unlock = TRUE;
break;
default:
break;
}
ret = gst_pad_event_default (pad, event);
GST_STREAM_UNLOCK (pad);
if (unlock)
GST_STREAM_UNLOCK (pad);
return ret;
}

View file

@ -1791,8 +1791,22 @@ gst_pad_accept_caps (GstPad * pad, GstCaps * caps)
GST_CAT_DEBUG (GST_CAT_CAPS, "pad accept caps of %s:%s (%p)",
GST_DEBUG_PAD_NAME (realpad), realpad);
/* FIXME, call accept function */
result = FALSE;
if (GST_RPAD_ACCEPTCAPSFUNC (pad)) {
/* we can call the function */
result = GST_RPAD_ACCEPTCAPSFUNC (realpad) (pad, caps);
} else {
/* else see get the caps and see if it intersects to something
* not empty */
GstCaps *intersect;
GstCaps *allowed;
allowed = gst_real_pad_get_caps_unlocked (realpad);
intersect = gst_caps_intersect (allowed, caps);
if (gst_caps_is_empty (intersect))
result = FALSE;
else
result = TRUE;
}
GST_UNLOCK (realpad);
return result;

View file

@ -216,6 +216,7 @@ gst_base_transform_event (GstPad * pad, GstEvent * event)
GstBaseTransform *trans;
GstBaseTransformClass *bclass;
gboolean ret = FALSE;
gboolean unlock;
trans = GST_BASE_TRANSFORM (GST_PAD_PARENT (pad));
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
@ -223,20 +224,25 @@ gst_base_transform_event (GstPad * pad, GstEvent * event)
if (bclass->event)
bclass->event (trans, event);
unlock = FALSE;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH:
if (GST_EVENT_FLUSH_DONE (event)) {
}
GST_STREAM_LOCK (pad);
unlock = TRUE;
break;
case GST_EVENT_EOS:
GST_STREAM_LOCK (pad);
unlock = TRUE;
break;
default:
break;
}
ret = gst_pad_event_default (pad, event);
GST_STREAM_UNLOCK (pad);
if (unlock)
GST_STREAM_UNLOCK (pad);
return ret;
}