+2006-06-22 Wim Taymans <wim@fluendo.com>
+
+ * gst/gstcaps.c: (gst_caps_replace):
+ Fix crasher when passed NULL. Doc clarification.
+ Optimize for the trivial case.
+
+ * gst/gstpipeline.c: (gst_pipeline_change_state):
+ Small cleanups.
+
+ * libs/gst/base/gstbasesrc.c: (gst_base_src_loop):
+ Small documentation cleanup.
+
+ * libs/gst/base/gstbasetransform.c:
+ (gst_base_transform_buffer_alloc):
+ Don't use silly gst_pad_get_negotiated_caps, GST_PAD_CAPS
+ is what we need and it avoids a whole lot of redundant
+ refcount operations.
+
2006-06-22 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Philip Jägenstedt <philip at lysator liu se>
-Subproject commit bbfa0146961f4ca61ddbca7b42360b5741a6354b
+Subproject commit 123195d3bbcc0b6e1cf867d3a180685f8766a0be
* Replaces *caps with @newcaps. Unrefs the #GstCaps in the location
* pointed to by @caps, if applicable, then modifies @caps to point to
* @newcaps. An additional ref on @newcaps is taken.
+ *
+ * This function does not take any locks so you might want to lock
+ * the object owning @caps pointer.
*/
void
gst_caps_replace (GstCaps ** caps, GstCaps * newcaps)
{
GstCaps *oldcaps;
-#if 0 /* disable this, since too many plugins rely on undefined behavior */
-#ifdef USE_POISONING
- //if (newcaps) CAPS_POISON (newcaps);
-#endif
-#endif
+ g_return_if_fail (caps != NULL);
+
oldcaps = *caps;
- if (newcaps)
- gst_caps_ref (newcaps);
+ if (newcaps != oldcaps) {
+ if (newcaps)
+ gst_caps_ref (newcaps);
- *caps = newcaps;
+ *caps = newcaps;
- if (oldcaps)
- gst_caps_unref (oldcaps);
+ if (oldcaps)
+ gst_caps_unref (oldcaps);
+ }
}
/**
PROP_0,
PROP_DELAY,
PROP_AUTO_FLUSH_BUS
- /* FILL ME */
};
#define GST_PIPELINE_GET_PRIVATE(obj) \
* A flushing seek also resets the stream time to 0 so that when
* we go back to PLAYING after the seek, the base_time is recalculated
* and redistributed to the elements.
- *
*/
static gboolean
do_pipeline_seek (GstElement * element, GstEvent * event)
if (need_reset)
gst_pipeline_set_new_stream_time (pipeline, 0);
- }
+
break;
+ }
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
* @clock: the clock to set
*
* Set the clock for @pipeline. The clock will be distributed
- * to all the elements managed by the pipeline.
+ * to all the elements managed by the pipeline.
*
* Returns: TRUE if the clock could be set on the pipeline. FALSE if
* some element did not accept the clock.
src->priv->last_sent_eos = TRUE;
}
} else {
- /* for fatal errors we post an error message */
+ /* for fatal errors we post an error message, post the error
+ * first so the app knows about the error first. */
GST_ELEMENT_ERROR (src, STREAM, FAILED,
(_("Internal data flow error.")),
("streaming task paused, reason %s", reason));
buf);
} else {
/* if we are configured, request a buffer with the src caps */
- GstCaps *srccaps = gst_pad_get_negotiated_caps (trans->srcpad);
- GstCaps *sinkcaps = gst_pad_get_negotiated_caps (trans->sinkpad);
+ GstCaps *srccaps;
+ GstCaps *sinkcaps;
+ srccaps = GST_PAD_CAPS (trans->srcpad);
if (!srccaps)
goto not_configured;
+ sinkcaps = GST_PAD_CAPS (trans->sinkpad);
if (sinkcaps != NULL) {
if (sinkcaps != caps || !gst_caps_is_equal (sinkcaps, caps)) {
gst_caps_unref (sinkcaps);
gst_caps_unref (srccaps);
goto not_configured;
}
- gst_caps_unref (sinkcaps);
}
GST_DEBUG_OBJECT (trans, "calling transform_size");
if (!gst_base_transform_transform_size (trans,
GST_PAD_DIRECTION (pad), caps, size, srccaps, &new_size)) {
- gst_caps_unref (srccaps);
goto unknown_size;
}
res =
gst_pad_alloc_buffer_and_set_caps (trans->srcpad, offset, new_size,
srccaps, buf);
- gst_caps_unref (srccaps);
}
if (res == GST_FLOW_OK && !trans->have_same_caps) {
the alloc_buffer served to transmit caps information but we can't use the
buffer. fall through and allocate a buffer corresponding to our sink
caps, if any */
- GstCaps *sinkcaps = gst_pad_get_negotiated_caps (trans->sinkpad);
- GstCaps *srccaps = gst_pad_get_negotiated_caps (trans->srcpad);
+ GstCaps *sinkcaps;
+ GstCaps *srccaps;
+ sinkcaps = GST_PAD_CAPS (trans->sinkpad);
if (!sinkcaps)
goto not_configured;
+ srccaps = GST_PAD_CAPS (trans->srcpad);
+
if (!gst_base_transform_transform_size (trans,
GST_PAD_DIRECTION (trans->srcpad), srccaps, GST_BUFFER_SIZE (*buf),
- sinkcaps, &new_size)) {
- gst_caps_unref (srccaps);
- gst_caps_unref (sinkcaps);
+ sinkcaps, &new_size))
goto unknown_size;
- }
gst_buffer_unref (*buf);
gst_buffer_set_caps (*buf, sinkcaps);
GST_BUFFER_OFFSET (*buf) = offset;
res = GST_FLOW_OK;
-
- gst_caps_unref (srccaps);
- gst_caps_unref (sinkcaps);
}
done: