gst/gstpad.c: Restore acceptcaps checking behaviour now that good plugins have been released.

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_init), (gst_pad_configure_sink),
(gst_pad_configure_src), (gst_pad_push):
Restore acceptcaps checking behaviour now that good plugins have
been released.
This commit is contained in:
Jan Schmidt 2006-05-04 16:34:20 +00:00
parent 5deab8d3c3
commit eaf6361f23
2 changed files with 12 additions and 23 deletions

View file

@ -1,3 +1,10 @@
2006-05-04 Jan Schmidt <thaytan@mad.scientist.com>
* gst/gstpad.c: (gst_pad_init), (gst_pad_configure_sink),
(gst_pad_configure_src), (gst_pad_push):
Restore acceptcaps checking behaviour now that good plugins have
been released.
2006-05-04 Tim-Philipp Müller <tim at centricular dot net> 2006-05-04 Tim-Philipp Müller <tim at centricular dot net>
Patch by: James Andrewartha <trs80 at tartarus uwa edu au> Patch by: James Andrewartha <trs80 at tartarus uwa edu au>

View file

@ -341,9 +341,7 @@ gst_pad_init (GstPad * pad)
pad->querytypefunc = GST_DEBUG_FUNCPTR (gst_pad_get_query_types_default); pad->querytypefunc = GST_DEBUG_FUNCPTR (gst_pad_get_query_types_default);
pad->queryfunc = GST_DEBUG_FUNCPTR (gst_pad_query_default); pad->queryfunc = GST_DEBUG_FUNCPTR (gst_pad_query_default);
pad->intlinkfunc = GST_DEBUG_FUNCPTR (gst_pad_get_internal_links_default); pad->intlinkfunc = GST_DEBUG_FUNCPTR (gst_pad_get_internal_links_default);
#if 0
GST_PAD_ACCEPTCAPSFUNC (pad) = GST_DEBUG_FUNCPTR (gst_pad_acceptcaps_default); GST_PAD_ACCEPTCAPSFUNC (pad) = GST_DEBUG_FUNCPTR (gst_pad_acceptcaps_default);
#endif
pad->do_buffer_signals = 0; pad->do_buffer_signals = 0;
pad->do_event_signals = 0; pad->do_event_signals = 0;
@ -1337,9 +1335,7 @@ gst_pad_set_getcaps_function (GstPad * pad, GstPadGetCapsFunction getcaps)
* @acceptcaps: the #GstPadAcceptCapsFunction to set. * @acceptcaps: the #GstPadAcceptCapsFunction to set.
* *
* Sets the given acceptcaps function for the pad. The acceptcaps function * Sets the given acceptcaps function for the pad. The acceptcaps function
* will be called to check if the pad can accept the given caps. * will be called to check if the pad can accept the given caps. Setting the
*/
/* Setting the
* acceptcaps function to NULL restores the default behaviour of allowing * acceptcaps function to NULL restores the default behaviour of allowing
* any caps that matches the caps from gst_pad_get_caps. * any caps that matches the caps from gst_pad_get_caps.
*/ */
@ -2266,17 +2262,15 @@ could_not_set:
static gboolean static gboolean
gst_pad_configure_sink (GstPad * pad, GstCaps * caps) gst_pad_configure_sink (GstPad * pad, GstCaps * caps)
{ {
GstPadAcceptCapsFunction acceptcaps;
GstPadSetCapsFunction setcaps; GstPadSetCapsFunction setcaps;
gboolean res; gboolean res;
acceptcaps = GST_PAD_ACCEPTCAPSFUNC (pad);
setcaps = GST_PAD_SETCAPSFUNC (pad); setcaps = GST_PAD_SETCAPSFUNC (pad);
/* See if pad accepts the caps - only needed if /* See if pad accepts the caps - only needed if
* no setcaps function */ * no setcaps function */
if (setcaps == NULL && acceptcaps != NULL) if (setcaps == NULL)
if (!acceptcaps (pad, caps)) if (!gst_pad_accept_caps (pad, caps))
goto not_accepted; goto not_accepted;
/* set caps on pad if call succeeds */ /* set caps on pad if call succeeds */
@ -2297,17 +2291,15 @@ not_accepted:
static gboolean static gboolean
gst_pad_configure_src (GstPad * pad, GstCaps * caps, gboolean dosetcaps) gst_pad_configure_src (GstPad * pad, GstCaps * caps, gboolean dosetcaps)
{ {
GstPadAcceptCapsFunction acceptcaps;
GstPadSetCapsFunction setcaps; GstPadSetCapsFunction setcaps;
gboolean res; gboolean res;
acceptcaps = GST_PAD_ACCEPTCAPSFUNC (pad);
setcaps = GST_PAD_SETCAPSFUNC (pad); setcaps = GST_PAD_SETCAPSFUNC (pad);
/* See if pad accepts the caps - only needed if /* See if pad accepts the caps - only needed if
* no setcaps function */ * no setcaps function */
if (setcaps == NULL && acceptcaps != NULL) if (setcaps == NULL)
if (!acceptcaps (pad, caps)) if (!gst_pad_accept_caps (pad, caps))
goto not_accepted; goto not_accepted;
if (dosetcaps) if (dosetcaps)
@ -3296,10 +3288,8 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
GstPad *peer; GstPad *peer;
GstFlowReturn ret; GstFlowReturn ret;
#if 0
GstCaps *caps; GstCaps *caps;
gboolean caps_changed; gboolean caps_changed;
#endif
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR); g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SRC, GST_FLOW_ERROR); g_return_val_if_fail (GST_PAD_DIRECTION (pad) == GST_PAD_SRC, GST_FLOW_ERROR);
@ -3332,25 +3322,19 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
goto not_linked; goto not_linked;
gst_object_ref (peer); gst_object_ref (peer);
#if 0
/* FIXME, disabled for 0.10.5 release because it caused to much
* regressions */
/* Before pushing the buffer to the peer pad, ensure that caps /* Before pushing the buffer to the peer pad, ensure that caps
* are set on this pad */ * are set on this pad */
caps = GST_BUFFER_CAPS (buffer); caps = GST_BUFFER_CAPS (buffer);
caps_changed = caps && caps != GST_PAD_CAPS (pad); caps_changed = caps && caps != GST_PAD_CAPS (pad);
#endif
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
#if 0
/* we got a new datatype from the pad, it had better handle it */ /* we got a new datatype from the pad, it had better handle it */
if (G_UNLIKELY (caps_changed)) { if (G_UNLIKELY (caps_changed)) {
GST_DEBUG_OBJECT (pad, "caps changed to %" GST_PTR_FORMAT, caps); GST_DEBUG_OBJECT (pad, "caps changed to %" GST_PTR_FORMAT, caps);
if (G_UNLIKELY (!gst_pad_configure_src (pad, caps, TRUE))) if (G_UNLIKELY (!gst_pad_configure_src (pad, caps, TRUE)))
goto not_negotiated; goto not_negotiated;
} }
#endif
ret = gst_pad_chain (peer, buffer); ret = gst_pad_chain (peer, buffer);
@ -3380,7 +3364,6 @@ not_linked:
GST_OBJECT_UNLOCK (pad); GST_OBJECT_UNLOCK (pad);
return GST_FLOW_NOT_LINKED; return GST_FLOW_NOT_LINKED;
} }
#if 0
not_negotiated: not_negotiated:
{ {
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
@ -3389,7 +3372,6 @@ not_negotiated:
"element pushed buffer then refused to accept the caps"); "element pushed buffer then refused to accept the caps");
return GST_FLOW_NOT_NEGOTIATED; return GST_FLOW_NOT_NEGOTIATED;
} }
#endif
} }
/** /**