mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
tests: add unit test for basetransform/videoscale negotiation regression
Turn Rene's test pipeline into a unit test. https://bugzilla.gnome.org/show_bug.cgi?id=648220
This commit is contained in:
parent
d9f1b3736e
commit
0b5e203b19
1 changed files with 51 additions and 4 deletions
|
@ -650,12 +650,8 @@ static void
|
||||||
gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
|
gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
|
||||||
* klass)
|
* klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
|
||||||
GstElementClass *gstelement_class;
|
|
||||||
GstBaseSinkClass *gstbase_sink_class;
|
GstBaseSinkClass *gstbase_sink_class;
|
||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
||||||
gstbase_sink_class = GST_BASE_SINK_CLASS (klass);
|
gstbase_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||||
|
|
||||||
gstbase_sink_class->buffer_alloc =
|
gstbase_sink_class->buffer_alloc =
|
||||||
|
@ -764,6 +760,56 @@ GST_START_TEST (test_reverse_negotiation)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_basetransform_negotiation)
|
||||||
|
{
|
||||||
|
GstElement *pipeline, *src, *sink, *scale, *capsfilter1, *capsfilter2;
|
||||||
|
GstMessage *msg;
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new (NULL);
|
||||||
|
src = gst_element_factory_make ("videotestsrc", NULL);
|
||||||
|
capsfilter1 = gst_element_factory_make ("capsfilter", NULL);
|
||||||
|
scale = gst_element_factory_make ("videoscale", NULL);
|
||||||
|
capsfilter2 = gst_element_factory_make ("capsfilter", NULL);
|
||||||
|
sink = gst_element_factory_make ("fakesink", NULL);
|
||||||
|
fail_unless (pipeline && src && capsfilter1 && scale && capsfilter2 && sink);
|
||||||
|
|
||||||
|
g_object_set (src, "num-buffers", 3, NULL);
|
||||||
|
|
||||||
|
caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
|
||||||
|
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
|
||||||
|
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
|
||||||
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
|
||||||
|
g_object_set (capsfilter1, "caps", caps, NULL);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
/* same caps, just different pixel-aspect-ratio */
|
||||||
|
caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
|
||||||
|
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
|
||||||
|
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
|
||||||
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, 12, 11, NULL);
|
||||||
|
g_object_set (capsfilter2, "caps", caps, NULL);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
gst_bin_add_many (GST_BIN (pipeline), src, capsfilter1, scale, capsfilter2,
|
||||||
|
sink, NULL);
|
||||||
|
fail_unless (gst_element_link_many (src, capsfilter1, scale, capsfilter2,
|
||||||
|
sink, NULL));
|
||||||
|
|
||||||
|
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PLAYING),
|
||||||
|
GST_STATE_CHANGE_ASYNC);
|
||||||
|
|
||||||
|
msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline), -1,
|
||||||
|
GST_MESSAGE_EOS | GST_MESSAGE_ERROR);
|
||||||
|
fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_EOS);
|
||||||
|
gst_message_unref (msg);
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
gst_object_unref (pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
videoscale_suite (void)
|
videoscale_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -811,6 +857,7 @@ videoscale_suite (void)
|
||||||
tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2);
|
tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2);
|
||||||
tcase_add_test (tc_chain, test_negotiation);
|
tcase_add_test (tc_chain, test_negotiation);
|
||||||
tcase_add_test (tc_chain, test_reverse_negotiation);
|
tcase_add_test (tc_chain, test_reverse_negotiation);
|
||||||
|
tcase_add_test (tc_chain, test_basetransform_negotiation);
|
||||||
|
|
||||||
GST_ERROR ("FIXME: test 64-bpp formats as well");
|
GST_ERROR ("FIXME: test 64-bpp formats as well");
|
||||||
return s;
|
return s;
|
||||||
|
|
Loading…
Reference in a new issue