+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),
ret = klass->set_caps (trans, in, out);
}
+ trans->negotiated = ret;
+
return ret;
}
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);
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);
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,
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);
gst_object_unref (trans);
return ret;
+
+not_negotiated:
+ {
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
}
static void
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:
gboolean delay_configure;
gboolean pending_configure;
+ gboolean negotiated;
gboolean have_newsegment;
ret = klass->set_caps (trans, in, out);
}
+ trans->negotiated = ret;
+
return ret;
}
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);
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);
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,
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);
gst_object_unref (trans);
return ret;
+
+not_negotiated:
+ {
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
}
static void
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:
gboolean delay_configure;
gboolean pending_configure;
+ gboolean negotiated;
gboolean have_newsegment;