pad: return ANY for a pad without template

Because gst_pad_get_pad_template_caps() returns ANY when there is no template,
the query caps function should also return ANY when there is no template (and no
pad current caps) instead of EMPTY.
This commit is contained in:
Wim Taymans 2012-03-08 09:45:06 +01:00
parent 4232b47685
commit 7b8263de93
2 changed files with 3 additions and 7 deletions

View file

@ -2722,13 +2722,10 @@ gst_pad_query_caps_default (GstPad * pad, GstQuery * query)
if ((result = get_pad_caps (pad)))
goto filter_done_unlock;
}
GST_OBJECT_UNLOCK (pad);
/* this almost never happens */
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "pad has no caps");
result = gst_caps_new_empty ();
goto done;
result = GST_CAPS_ANY;
filter_done_unlock:
GST_OBJECT_UNLOCK (pad);
@ -2748,7 +2745,6 @@ filter_done:
result = gst_caps_ref (result);
}
done:
gst_query_set_caps_result (query, result);
gst_caps_unref (result);

View file

@ -41,11 +41,11 @@ GST_START_TEST (test_link)
sink = gst_pad_new ("sink", GST_PAD_SINK);
fail_if (sink == NULL);
/* linking without templates or caps should fail */
/* linking without templates or caps should work */
ret = gst_pad_link (src, sink);
ASSERT_OBJECT_REFCOUNT (src, "source pad", 1);
ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1);
fail_unless (ret == GST_PAD_LINK_NOFORMAT);
fail_unless (ret == GST_PAD_LINK_OK);
ASSERT_CRITICAL (gst_pad_get_pad_template (NULL));