tests: Update for negotiation related API changes

This commit is contained in:
Sebastian Dröge 2011-05-13 08:34:33 +02:00
parent 43e165c93c
commit 6bff1f968a
7 changed files with 34 additions and 18 deletions

View file

@ -290,9 +290,9 @@ GST_START_TEST (test_request_pads_named)
GST_END_TEST;
static GstCaps *
mq_dummypad_getcaps (GstPad * sinkpad)
mq_dummypad_getcaps (GstPad * sinkpad, GstCaps * filter)
{
return gst_caps_new_any ();
return (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
}
struct PadData

View file

@ -392,7 +392,7 @@ GST_START_TEST (test_output_selector_no_srcpad_negotiation);
* setcaps should accept any caps when there are no srcpads */
g_object_set (sel, "pad-negotiation-mode", i, NULL);
caps = gst_pad_get_caps (pad);
caps = gst_pad_get_caps (pad, NULL);
fail_unless (gst_caps_is_any (caps));
gst_caps_unref (caps);
@ -469,7 +469,7 @@ GST_START_TEST (test_output_selector_getcaps_none);
g_object_set (sel, "active-pad", pad, NULL);
caps = gst_pad_peer_get_caps (input_pad);
caps = gst_pad_peer_get_caps (input_pad, NULL);
/* in 'none' mode, the getcaps returns the template, which is ANY */
g_assert (gst_caps_is_any (caps));
@ -509,7 +509,7 @@ GST_START_TEST (test_output_selector_getcaps_all);
g_object_set (sel, "active-pad", pad, NULL);
caps = gst_pad_peer_get_caps (input_pad);
caps = gst_pad_peer_get_caps (input_pad, NULL);
g_assert (gst_caps_is_equal (caps, expected));
gst_caps_unref (caps);
@ -550,7 +550,7 @@ GST_START_TEST (test_output_selector_getcaps_active);
expected = gst_pad_template_get_caps (gst_pad_get_pad_template ((GstPad *)
walker->data));
caps = gst_pad_peer_get_caps (input_pad);
caps = gst_pad_peer_get_caps (input_pad, NULL);
g_assert (gst_caps_is_equal (caps, expected));
gst_caps_unref (caps);

View file

@ -70,7 +70,7 @@ GST_START_TEST (test_valve_basic)
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (g_list_length (buffers) == 2);
caps = gst_pad_get_caps (src);
caps = gst_pad_get_caps (src, NULL);
fail_unless (caps && gst_caps_is_equal (caps,
gst_pad_get_pad_template_caps (src)));
gst_caps_unref (caps);
@ -84,7 +84,7 @@ GST_START_TEST (test_valve_basic)
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (buffers == NULL);
caps = gst_pad_get_caps (src);
caps = gst_pad_get_caps (src, NULL);
fail_unless (caps && gst_caps_is_equal (caps,
gst_pad_get_pad_template_caps (src)));
gst_caps_unref (caps);

View file

@ -191,7 +191,7 @@ GST_START_TEST (test_ghost_pads_notarget)
/* check caps, untargetted pad should return ANY or the padtemplate caps
* when it was created from a template */
caps = gst_pad_get_caps (srcpad);
caps = gst_pad_get_caps (srcpad, NULL);
fail_unless (gst_caps_is_any (caps));
gst_caps_unref (caps);
@ -592,7 +592,7 @@ GST_START_TEST (test_ghost_pads_new_from_template)
fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl);
/* check ghostpad caps are from the sinkpad */
newcaps = gst_pad_get_caps (ghostpad);
newcaps = gst_pad_get_caps (ghostpad, NULL);
fail_unless (newcaps != NULL);
fail_unless (gst_caps_is_equal (newcaps, padcaps));
gst_caps_unref (newcaps);
@ -638,7 +638,7 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template)
fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl);
/* check ghostpad caps are from the ghostpad template */
newcaps = gst_pad_get_caps (ghostpad);
newcaps = gst_pad_get_caps (ghostpad, NULL);
fail_unless (newcaps != NULL);
fail_unless (gst_caps_is_equal (newcaps, ghostcaps));
gst_caps_unref (newcaps);
@ -646,7 +646,7 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template)
fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad));
/* check ghostpad caps are now from the target pad */
newcaps = gst_pad_get_caps (ghostpad);
newcaps = gst_pad_get_caps (ghostpad, NULL);
fail_unless (newcaps != NULL);
fail_unless (gst_caps_is_equal (newcaps, padcaps));
gst_caps_unref (newcaps);

View file

@ -975,7 +975,7 @@ GST_START_TEST (test_pad_proxy_getcaps_aggregation)
tee_sink = gst_element_get_static_pad (tee, "sink");
/* by default, ANY caps should intersect to ANY */
caps = gst_pad_get_caps (tee_sink);
caps = gst_pad_get_caps (tee_sink, NULL);
GST_INFO ("got caps: %" GST_PTR_FORMAT, caps);
fail_unless (caps != NULL);
fail_unless (gst_caps_is_any (caps));
@ -992,7 +992,7 @@ GST_START_TEST (test_pad_proxy_getcaps_aggregation)
gst_pad_use_fixed_caps (sink2_sink);
gst_caps_unref (caps);
caps = gst_pad_get_caps (tee_sink);
caps = gst_pad_get_caps (tee_sink, NULL);
GST_INFO ("got caps: %" GST_PTR_FORMAT, caps);
fail_unless (caps != NULL);
fail_unless (gst_caps_is_empty (caps));
@ -1004,7 +1004,7 @@ GST_START_TEST (test_pad_proxy_getcaps_aggregation)
gst_pad_use_fixed_caps (sink2_sink);
gst_caps_unref (caps);
caps = gst_pad_get_caps (tee_sink);
caps = gst_pad_get_caps (tee_sink, NULL);
GST_INFO ("got caps: %" GST_PTR_FORMAT, caps);
fail_unless (caps != NULL);
fail_if (gst_caps_is_empty (caps));

View file

@ -64,7 +64,7 @@ static GstFlowReturn (*klass_transform_ip) (GstBaseTransform * trans,
static gboolean (*klass_set_caps) (GstBaseTransform * trans, GstCaps * incaps,
GstCaps * outcaps) = NULL;
static GstCaps *(*klass_transform_caps) (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps) = NULL;
GstPadDirection direction, GstCaps * caps, GstCaps * filter) = NULL;
static gboolean (*klass_transform_size) (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps, gsize size, GstCaps * othercaps,
gsize * othersize) = NULL;

View file

@ -581,7 +581,7 @@ transform_ct1 (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
static GstCaps *
transform_caps_ct1 (GstBaseTransform * trans, GstPadDirection dir,
GstCaps * caps)
GstCaps * caps, GstCaps * filter)
{
GstCaps *res;
@ -590,6 +590,14 @@ transform_caps_ct1 (GstBaseTransform * trans, GstPadDirection dir,
} else {
res = gst_caps_new_simple ("baz/x-foo", NULL);
}
if (filter) {
GstCaps *temp =
gst_caps_intersect_full (filter, res, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (res);
res = temp;
}
return res;
}
@ -849,7 +857,7 @@ transform_ct2 (GstBaseTransform * trans, GstBuffer * in, GstBuffer * out)
static GstCaps *
transform_caps_ct2 (GstBaseTransform * trans, GstPadDirection dir,
GstCaps * caps)
GstCaps * caps, GstCaps * filter)
{
GstCaps *res;
@ -860,6 +868,14 @@ transform_caps_ct2 (GstBaseTransform * trans, GstPadDirection dir,
/* all on the srcpad can be transformed to the format of the sinkpad */
res = gst_caps_new_simple ("foo/x-bar", NULL);
}
if (filter) {
GstCaps *temp =
gst_caps_intersect_full (filter, res, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (res);
res = temp;
}
return res;
}