gst/base/gstbasetransform.*: Handle the case where we are not negotiated more gracefully.

Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_configure_caps),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_chain), (gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
Handle the case where we are not negotiated more gracefully.
This commit is contained in:
Wim Taymans 2005-08-31 13:41:19 +00:00
parent 09f803fd76
commit 2db910992f
5 changed files with 56 additions and 8 deletions

View file

@ -1,3 +1,11 @@
2005-08-31 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasetransform.c: (gst_base_transform_configure_caps),
(gst_base_transform_setcaps), (gst_base_transform_handle_buffer),
(gst_base_transform_chain), (gst_base_transform_change_state):
* gst/base/gstbasetransform.h:
Handle the case where we are not negotiated more gracefully.
2005-08-31 Tim-Philipp Müller <tim at centricular dot net>
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_init),

View file

@ -368,6 +368,8 @@ gst_base_transform_configure_caps (GstBaseTransform * trans, GstCaps * in,
ret = klass->set_caps (trans, in, out);
}
trans->negotiated = ret;
return ret;
}
@ -381,12 +383,8 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
gboolean ret = TRUE;
gboolean peer_checked = FALSE;
/* caps must be fixed here */
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
otherpeer = gst_pad_get_peer (otherpad);
@ -396,6 +394,10 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
if (GST_PAD_IS_IN_SETCAPS (otherpad))
goto done;
/* caps must be fixed here */
if (!gst_caps_is_fixed (caps))
goto unfixed_caps;
/* see how we can transform the input caps. */
othercaps = gst_base_transform_transform_caps (trans,
GST_PAD_DIRECTION (pad), caps);
@ -543,11 +545,19 @@ done:
if (othercaps)
gst_caps_unref (othercaps);
trans->negotiated = ret;
gst_object_unref (trans);
return ret;
/* ERRORS */
unfixed_caps:
{
GST_DEBUG_OBJECT (trans, "caps are not fixed %" GST_PTR_FORMAT, caps);
ret = FALSE;
goto done;
}
no_transform:
{
GST_DEBUG_OBJECT (trans,
@ -948,6 +958,9 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (!trans->negotiated)
goto not_negotiated;
ret = gst_base_transform_handle_buffer (trans, buffer, &outbuf);
if (ret == GST_FLOW_OK) {
ret = gst_pad_push (trans->srcpad, outbuf);
@ -956,6 +969,11 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
gst_object_unref (trans);
return ret;
not_negotiated:
{
return GST_FLOW_NOT_NEGOTIATED;
}
}
static void
@ -1054,6 +1072,7 @@ gst_base_transform_change_state (GstElement * element)
GST_DEBUG_OBJECT (trans, "in_place %d", trans->in_place);
gst_caps_replace (&trans->cache_caps1, NULL);
gst_caps_replace (&trans->cache_caps2, NULL);
trans->negotiated = FALSE;
GST_UNLOCK (trans);
break;
case GST_STATE_PAUSED_TO_PLAYING:

View file

@ -58,6 +58,7 @@ struct _GstBaseTransform {
gboolean delay_configure;
gboolean pending_configure;
gboolean negotiated;
gboolean have_newsegment;

View file

@ -368,6 +368,8 @@ gst_base_transform_configure_caps (GstBaseTransform * trans, GstCaps * in,
ret = klass->set_caps (trans, in, out);
}
trans->negotiated = ret;
return ret;
}
@ -381,12 +383,8 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
gboolean ret = TRUE;
gboolean peer_checked = FALSE;
/* caps must be fixed here */
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
otherpeer = gst_pad_get_peer (otherpad);
@ -396,6 +394,10 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
if (GST_PAD_IS_IN_SETCAPS (otherpad))
goto done;
/* caps must be fixed here */
if (!gst_caps_is_fixed (caps))
goto unfixed_caps;
/* see how we can transform the input caps. */
othercaps = gst_base_transform_transform_caps (trans,
GST_PAD_DIRECTION (pad), caps);
@ -543,11 +545,19 @@ done:
if (othercaps)
gst_caps_unref (othercaps);
trans->negotiated = ret;
gst_object_unref (trans);
return ret;
/* ERRORS */
unfixed_caps:
{
GST_DEBUG_OBJECT (trans, "caps are not fixed %" GST_PTR_FORMAT, caps);
ret = FALSE;
goto done;
}
no_transform:
{
GST_DEBUG_OBJECT (trans,
@ -948,6 +958,9 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (!trans->negotiated)
goto not_negotiated;
ret = gst_base_transform_handle_buffer (trans, buffer, &outbuf);
if (ret == GST_FLOW_OK) {
ret = gst_pad_push (trans->srcpad, outbuf);
@ -956,6 +969,11 @@ gst_base_transform_chain (GstPad * pad, GstBuffer * buffer)
gst_object_unref (trans);
return ret;
not_negotiated:
{
return GST_FLOW_NOT_NEGOTIATED;
}
}
static void
@ -1054,6 +1072,7 @@ gst_base_transform_change_state (GstElement * element)
GST_DEBUG_OBJECT (trans, "in_place %d", trans->in_place);
gst_caps_replace (&trans->cache_caps1, NULL);
gst_caps_replace (&trans->cache_caps2, NULL);
trans->negotiated = FALSE;
GST_UNLOCK (trans);
break;
case GST_STATE_PAUSED_TO_PLAYING:

View file

@ -58,6 +58,7 @@ struct _GstBaseTransform {
gboolean delay_configure;
gboolean pending_configure;
gboolean negotiated;
gboolean have_newsegment;