From 8ab394773339e1975a1f0ff688cd266899df2248 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 19 Sep 2011 18:32:26 +0100 Subject: [PATCH] videorate: Add tests for the max-rate case --- tests/check/elements/videorate.c | 104 ++++++++++++++++++++++++++++++- 1 file changed, 101 insertions(+), 3 deletions(-) diff --git a/tests/check/elements/videorate.c b/tests/check/elements/videorate.c index 07f2fb7bc7..db6793ca14 100644 --- a/tests/check/elements/videorate.c +++ b/tests/check/elements/videorate.c @@ -780,6 +780,7 @@ typedef struct { const gchar *caps; gboolean drop_only; + int max_rate; /* Result of the videomaxrate caps after transforming */ const gchar *expected_sink_caps; const gchar *expected_src_caps; @@ -790,22 +791,52 @@ static TestInfo caps_negotiation_tests[] = { .caps = "video/x-raw-yuv", .drop_only = FALSE, .expected_sink_caps = "video/x-raw-yuv", - .expected_src_caps = "video/x-raw-yuv"}, + .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]"}, + { + .caps = "video/x-raw-yuv", + .drop_only = FALSE, + .max_rate = 15, + .expected_sink_caps = "video/x-raw-yuv", + .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, 15]"}, { .caps = "video/x-raw-yuv", .drop_only = TRUE, - .expected_sink_caps = "video/x-raw-yuv", - .expected_src_caps = "video/x-raw-yuv"}, + .expected_sink_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", + .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]"}, + { + .caps = "video/x-raw-yuv", + .drop_only = TRUE, + .max_rate = 15, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction)[0/1, 15];" + "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", + .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, 15]"}, + + { .caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", .drop_only = FALSE, .expected_sink_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]"}, + { + .caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", + .drop_only = FALSE, + .max_rate = 15, + .expected_sink_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", + .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, 15]"}, { .caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", .drop_only = TRUE, .expected_sink_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]"}, + { + .caps = "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", + .drop_only = TRUE, + .max_rate = 15, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction)[0/1, 15];" + "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", + .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[0/1, 15]"}, { .caps = "video/x-raw-yuv, framerate=15/1", .drop_only = FALSE, @@ -815,6 +846,16 @@ static TestInfo caps_negotiation_tests[] = { .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)15/1;" "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]"}, + { + .caps = "video/x-raw-yuv, framerate=15/1", + .drop_only = FALSE, + .max_rate = 20, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction)15/1;" + "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]", + .expected_src_caps = + "video/x-raw-yuv, framerate=(fraction)15/1;" + "video/x-raw-yuv, framerate=(fraction)[0/1, 20/1]"}, { .caps = "video/x-raw-yuv, framerate=15/1", .drop_only = TRUE, @@ -825,6 +866,17 @@ static TestInfo caps_negotiation_tests[] = { .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)15/1;" "video/x-raw-yuv, framerate=(fraction)[0/1, 15/1]"}, + { + .caps = "video/x-raw-yuv, framerate=15/1", + .drop_only = TRUE, + .max_rate = 20, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction)15/1;" + "video/x-raw-yuv, framerate=(fraction)[15/1, MAX];" + "video/x-raw-yuv, framerate=(fraction)0/1", + .expected_src_caps = + "video/x-raw-yuv, framerate=(fraction)15/1;" + "video/x-raw-yuv, framerate=(fraction)[0/1, 15/1];"}, { .caps = "video/x-raw-yuv, framerate=[15/1, 30/1]", .drop_only = FALSE, @@ -834,6 +886,16 @@ static TestInfo caps_negotiation_tests[] = { .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[15/1, 30/1];" "video/x-raw-yuv, framerate=(fraction)[0/1, MAX];"}, + { + .caps = "video/x-raw-yuv, framerate=[15/1, 30/1]", + .drop_only = FALSE, + .max_rate = 20, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction)[15/1, 30/1];" + "video/x-raw-yuv, framerate=(fraction)[0/1, MAX];", + .expected_src_caps = + "video/x-raw-yuv, framerate=(fraction)[15/1, 20/1];" + "video/x-raw-yuv, framerate=(fraction)[0/1, 20/1];"}, { .caps = "video/x-raw-yuv, framerate=[15/1, 30/1]", .drop_only = TRUE, @@ -844,6 +906,18 @@ static TestInfo caps_negotiation_tests[] = { .expected_src_caps = "video/x-raw-yuv, framerate=(fraction)[15/1, 30/1];" "video/x-raw-yuv, framerate=(fraction)[0/1, 30/1]"}, + { + .caps = "video/x-raw-yuv, framerate=[15/1, 30/1]", + .drop_only = TRUE, + .max_rate = 20, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction)[15/1, 20/1];" + "video/x-raw-yuv, framerate=(fraction)[15/1, 30/1];" + "video/x-raw-yuv, framerate=(fraction)[15/1, MAX];" + "video/x-raw-yuv, framerate=(fraction)0/1", + .expected_src_caps = + "video/x-raw-yuv, framerate=(fraction)[15/1, 20/1];" + "video/x-raw-yuv, framerate=(fraction)[0/1, 20/1]"}, { .caps = "video/x-raw-yuv, framerate={15/1, 30/1}", .drop_only = FALSE, @@ -853,6 +927,16 @@ static TestInfo caps_negotiation_tests[] = { .expected_src_caps = "video/x-raw-yuv, framerate=(fraction){15/1, 30/1};" "video/x-raw-yuv, framerate=(fraction)[0/1, MAX]"}, + { + .caps = "video/x-raw-yuv, framerate={15/1, 30/1}", + .drop_only = FALSE, + .max_rate = 20, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction){15/1, 30/1};" + "video/x-raw-yuv, framerate=(fraction)[0/1, MAX];", + .expected_src_caps = + "video/x-raw-yuv, framerate=(fraction)15/1;" + "video/x-raw-yuv, framerate=(fraction)[0/1, 20/1];"}, { .caps = "video/x-raw-yuv, framerate={15/1, 30/1}", .drop_only = TRUE, @@ -863,6 +947,18 @@ static TestInfo caps_negotiation_tests[] = { .expected_src_caps = "video/x-raw-yuv, framerate=(fraction){15/1, 30/1};" "video/x-raw-yuv, framerate=(fraction)[0/1, 30/1];"}, + { + .caps = "video/x-raw-yuv, framerate={15/1, 30/1}", + .drop_only = TRUE, + .max_rate = 20, + .expected_sink_caps = + "video/x-raw-yuv, framerate=(fraction)15/1;" + "video/x-raw-yuv, framerate=(fraction){15/1, 30/1};" + "video/x-raw-yuv, framerate=(fraction)[15/1, MAX];" + "video/x-raw-yuv, framerate=(fraction)0/1", + .expected_src_caps = + "video/x-raw-yuv, framerate=(fraction)15/1;" + "video/x-raw-yuv, framerate=(fraction)[0/1, 20/1]"}, }; static GstCaps * @@ -934,6 +1030,8 @@ GST_START_TEST (test_caps_negotiation) gst_caps_unref (caps); g_object_set (videorate, "drop-only", test->drop_only, NULL); + if (test->max_rate != 0) + g_object_set (videorate, "max-rate", test->max_rate, NULL); gst_pad_set_getcaps_function (mysrcpad, _getcaps_function); gst_pad_set_getcaps_function (mysinkpad, _getcaps_function);