From 1cff66d5879a5f8ab12fb3d897ac2df21b9c9216 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 18 Apr 2011 18:19:24 +0200 Subject: [PATCH] base{sink,src}: Don't try to fixate ANY caps --- libs/gst/base/gstbasesink.c | 24 ++++++++++++++---------- libs/gst/base/gstbasesrc.c | 16 +++++++++------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 6a340c4..a5feebd 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -4313,10 +4313,8 @@ gst_base_sink_negotiate_pull (GstBaseSink * basesink) caps = gst_caps_make_writable (caps); /* get the first (prefered) format */ gst_caps_truncate (caps); - /* try to fixate */ - gst_pad_fixate_caps (GST_BASE_SINK_PAD (basesink), caps); - GST_DEBUG_OBJECT (basesink, "fixated to: %" GST_PTR_FORMAT, caps); + GST_DEBUG_OBJECT (basesink, "have caps: %" GST_PTR_FORMAT, caps); if (gst_caps_is_any (caps)) { GST_DEBUG_OBJECT (basesink, "caps were ANY after fixating, " @@ -4324,15 +4322,21 @@ gst_base_sink_negotiate_pull (GstBaseSink * basesink) /* neither side has template caps in this case, so they are prepared for pull() without setcaps() */ result = TRUE; - } else if (gst_caps_is_fixed (caps)) { - if (!gst_pad_set_caps (GST_BASE_SINK_PAD (basesink), caps)) - goto could_not_set_caps; + } else { + /* try to fixate */ + gst_pad_fixate_caps (GST_BASE_SINK_PAD (basesink), caps); + GST_DEBUG_OBJECT (basesink, "fixated to: %" GST_PTR_FORMAT, caps); - GST_OBJECT_LOCK (basesink); - gst_caps_replace (&basesink->priv->pull_caps, caps); - GST_OBJECT_UNLOCK (basesink); + if (gst_caps_is_fixed (caps)) { + if (!gst_pad_set_caps (GST_BASE_SINK_PAD (basesink), caps)) + goto could_not_set_caps; - result = TRUE; + GST_OBJECT_LOCK (basesink); + gst_caps_replace (&basesink->priv->pull_caps, caps); + GST_OBJECT_UNLOCK (basesink); + + result = TRUE; + } } gst_caps_unref (caps); diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index d130502..7f12b41 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2632,17 +2632,19 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc) /* now fixate */ if (!gst_caps_is_empty (caps)) { - gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps); - GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps); - + GST_DEBUG_OBJECT (basesrc, "have caps: %" GST_PTR_FORMAT, caps); if (gst_caps_is_any (caps)) { /* hmm, still anything, so element can do anything and * nego is not needed */ result = TRUE; - } else if (gst_caps_is_fixed (caps)) { - /* yay, fixed caps, use those then, it's possible that the subclass does - * not accept this caps after all and we have to fail. */ - result = gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps); + } else { + gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps); + GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps); + if (gst_caps_is_fixed (caps)) { + /* yay, fixed caps, use those then, it's possible that the subclass does + * not accept this caps after all and we have to fail. */ + result = gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps); + } } } gst_caps_unref (caps); -- 2.7.4