2004-01-26 David Schleef <ds@schleef.org>
+ * gst/gstpad.c: (gst_pad_try_set_caps_nonfixed):
+ * gst/gstpad.h: Add new function to allow element to (somewhat)
+ specify non-fixed caps on a pad.
+ * gst/gstqueue.c: (gst_queue_chain): Remove noisy g_object_notify()
+ that I added a few weeks ago.
+
+2004-01-26 David Schleef <ds@schleef.org>
+
* gst/gstpad.c: (gst_pad_try_set_caps): Revert last change
making try_set_caps() work with non-fixed caps.
return ret;
}
+GstPadLinkReturn
+gst_pad_try_set_caps_nonfixed (GstPad *pad, const GstCaps *caps)
+{
+ GstPadLink *link;
+ GstPadLink *oldlink;
+ GstPadLinkReturn ret;
+ g_return_val_if_fail (pad != NULL, GST_PAD_LINK_REFUSED);
+ g_return_val_if_fail (GST_IS_REAL_PAD (pad), GST_PAD_LINK_REFUSED);
+ g_return_val_if_fail (!GST_FLAG_IS_SET (pad, GST_PAD_NEGOTIATING),
+ GST_PAD_LINK_REFUSED);
+ /* we allow setting caps on non-linked pads. It's ignored */
+ if (!GST_PAD_PEER (pad)) {
+ return GST_PAD_LINK_OK;
+ }
+ /* if the link is already negotiated and the caps are compatible
+ * with what we're setting, it's trivially OK. */
+ if (GST_PAD_CAPS (pad)) {
+ GstCaps *intersection;
+ intersection = gst_caps_intersect (caps, GST_PAD_CAPS (pad));
+ if (!gst_caps_is_empty (intersection)) {
+ gst_caps_free (intersection);
+ return GST_PAD_LINK_OK;
+ }
+ gst_caps_free (intersection);
+ }
+ g_return_val_if_fail (GST_PAD_LINK_SRC (pad), GST_PAD_LINK_REFUSED);
+ g_return_val_if_fail (GST_PAD_LINK_SINK (pad), GST_PAD_LINK_REFUSED);
+ link = gst_pad_link_new ();
+ link->srcpad = GST_PAD_LINK_SRC (pad);
+ link->sinkpad = GST_PAD_LINK_SINK (pad);
+ if (!gst_pad_link_ready_for_negotiation (link)) {
+ gst_pad_link_free (link);
+ return GST_PAD_LINK_DELAYED;
+ }
+
+ oldlink = GST_REAL_PAD(pad)->link;
+ if (oldlink && oldlink->filtercaps) {
+ link->filtercaps = gst_caps_copy (oldlink->filtercaps);
+ }
+ if (link->srcpad == pad) {
+ link->srccaps = gst_caps_copy(caps);
+ link->sinkcaps = gst_pad_get_caps (link->sinkpad);
+ link->srcnotify = FALSE;
+ } else {
+ link->srccaps = gst_pad_get_caps (link->srcpad);
+ link->sinkcaps = gst_caps_copy(caps);
+ link->sinknotify = FALSE;
+ }
+
+ ret = gst_pad_link_try (link);
+
+ return ret;
+}
/**
* gst_pad_can_link_filtered:
GstCaps* gst_pad_get_caps (GstPad *pad);
G_CONST_RETURN GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
GstPadLinkReturn gst_pad_try_set_caps (GstPad *pad, const GstCaps *caps);
+GstPadLinkReturn gst_pad_try_set_caps_nonfixed (GstPad *pad, const GstCaps *caps);
gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps);
* to make things read-only. Also keep our list uptodate. */
queue->cur_level.bytes -= GST_BUFFER_SIZE (data);
queue->cur_level.buffers --;
- g_object_notify (G_OBJECT (queue), "current-level-buffers");
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
queue->cur_level.time -= GST_BUFFER_DURATION (data);
/* Note that we only add buffers (not events) to the statistics */
if (GST_IS_BUFFER (data)) {
queue->cur_level.buffers++;
- g_object_notify (G_OBJECT (queue), "current-level-buffers");
queue->cur_level.bytes += GST_BUFFER_SIZE (data);
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
queue->cur_level.time += GST_BUFFER_DURATION (data);
* to make things read-only. Also keep our list uptodate. */
queue->cur_level.bytes -= GST_BUFFER_SIZE (data);
queue->cur_level.buffers --;
- g_object_notify (G_OBJECT (queue), "current-level-buffers");
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
queue->cur_level.time -= GST_BUFFER_DURATION (data);
/* Note that we only add buffers (not events) to the statistics */
if (GST_IS_BUFFER (data)) {
queue->cur_level.buffers++;
- g_object_notify (G_OBJECT (queue), "current-level-buffers");
queue->cur_level.bytes += GST_BUFFER_SIZE (data);
if (GST_BUFFER_DURATION (data) != GST_CLOCK_TIME_NONE)
queue->cur_level.time += GST_BUFFER_DURATION (data);