From 61ed3b06ee082d9f1b4301acf1ee48f98ee785d1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 3 Dec 2000 20:15:24 +0000 Subject: [PATCH] More test cases. Original commit message from CVS: More test cases. --- tests/caps.c | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/tests/caps.c b/tests/caps.c index 56de3553f3..ce7f89c8d4 100644 --- a/tests/caps.c +++ b/tests/caps.c @@ -26,8 +26,8 @@ static GstCapsFactory mp1parse_src_caps = { static GstCapsFactory mpeg2dec_src_caps = { "video/raw", "fourcc", GST_CAPS_LIST ( - GST_CAPS_INT32 (0x32315659), - GST_CAPS_INT32 (0x32314544) + GST_CAPS_FOURCC ('Y','V','1','2'), + GST_CAPS_FOURCC_INT (0x56595559) ), "width", GST_CAPS_INT_RANGE (16, 4096), "height", GST_CAPS_INT_RANGE (16, 4096), @@ -37,15 +37,26 @@ static GstCapsFactory mpeg2dec_src_caps = { static GstCapsFactory raw_sink_caps = { "video/raw", "fourcc", GST_CAPS_LIST ( - GST_CAPS_INT32 (0x32315659) + GST_CAPS_FOURCC_INT (0x32315659) ), "height", GST_CAPS_INT_RANGE (16, 256), NULL }; +static GstCapsFactory raw2_sink_caps = { + "video/raw", + "fourcc", GST_CAPS_LIST ( + GST_CAPS_FOURCC_INT (0x32315659), + GST_CAPS_FOURCC ('Y','U','Y','V') + ), + "height", GST_CAPS_INT_RANGE (16, 4096), + NULL +}; + static GstCaps *sinkcaps = NULL, *rawcaps = NULL, *rawcaps2 = NULL, + *rawcaps3 = NULL, *mp1parsecaps = NULL; int main(int argc,char *argv[]) @@ -55,29 +66,45 @@ int main(int argc,char *argv[]) _gst_type_initialize (); sinkcaps = gst_caps_register (mpeg2dec_sink_caps); + g_print ("caps 1:\n"); gst_caps_dump (sinkcaps); rawcaps = gst_caps_register (mpeg2dec_src_caps); + g_print ("caps 2:\n"); gst_caps_dump (rawcaps); rawcaps2 = gst_caps_register (raw_sink_caps); + g_print ("caps 3:\n"); gst_caps_dump (rawcaps2); mp1parsecaps = gst_caps_register (mp1parse_src_caps); + g_print ("caps 4:\n"); gst_caps_dump (mp1parsecaps); + rawcaps3 = gst_caps_register (raw2_sink_caps); + g_print ("caps 5:\n"); + gst_caps_dump (rawcaps3); testret = gst_caps_check_compatibility (mp1parsecaps, rawcaps); - g_print ("%d\n", testret); + g_print ("4 <-> 2 == %d (invalid, wrong major type)\n", testret); testret = gst_caps_check_compatibility (mp1parsecaps, sinkcaps); - g_print ("%d\n", testret); + g_print ("4 <-> 1 == %d (valid, subset)\n", testret); testret = gst_caps_check_compatibility (sinkcaps, mp1parsecaps); - g_print ("%d\n", testret); + g_print ("1 <-> 4 == %d (invalid, superset)\n", testret); testret = gst_caps_check_compatibility (rawcaps, rawcaps2); - g_print ("%d\n", testret); + g_print ("2 <-> 3 == %d (invalid, ranges)\n", testret); + + testret = gst_caps_check_compatibility (rawcaps, rawcaps3); + g_print ("2 <-> 5 == %d (valid)\n", testret); + + testret = gst_caps_check_compatibility (rawcaps3, rawcaps); + g_print ("5 <-> 2 == %d (invalid)\n", testret); + + testret = gst_caps_check_compatibility (rawcaps2, rawcaps3); + g_print ("3 <-> 5 == %d (valid)\n", testret); testret = gst_caps_check_compatibility (rawcaps2, rawcaps); - g_print ("%d\n", testret); + g_print ("3 <-> 2 == %d (invalid, property missing in source)\n", testret); testret = gst_caps_check_compatibility (rawcaps, rawcaps); - g_print ("%d\n", testret); + g_print ("2 <-> 2 == %d (valid, same caps)\n", testret); }