Unerstanding Capsfilter test 'test_unfixed_downstream_caps' from gst/tests/check

deepthips deepthips at tataelxsi.co.in
Sun Dec 2 23:23:30 PST 2012

Hi I couldnt fully understand the test test_unfixed_downstream_caps from
tests/check/elements/capsfilter.c.  From the code flow, I couldnt get a
picture of the test done.

If some one could help, it would be really helpful.

GST_START_TEST (test_unfixed_downstream_caps)
  GstElement *pipe, *src, *filter;
  GstCaps *filter_caps;
  GstPad *mysinkpad;
  GstMessage *msg;

  pipe = gst_check_setup_element ("pipeline");

  src = gst_check_setup_element ("fakesrc");
  g_object_set (src, "sizetype", 2, "sizemax", 1024, "num-buffers", 1,

  filter = gst_check_setup_element ("capsfilter");
  filter_caps = gst_caps_from_string ("audio/x-raw-int, rate=(int)44100");
  fail_unless (filter_caps != NULL);
  g_object_set (filter, "caps", filter_caps, NULL);

  gst_bin_add_many (GST_BIN (pipe), src, filter, NULL);
  fail_unless (gst_element_link (src, filter));

  mysinkpad = gst_check_setup_sink_pad (filter, &sinktemplate, NULL);
  gst_pad_set_active (mysinkpad, TRUE);

  fail_unless_equals_int (gst_element_set_state (pipe, GST_STATE_PLAYING),

  /* wait for error on bus */
  msg = gst_bus_poll (GST_ELEMENT_BUS (pipe),

      "Expected ERROR message, got EOS message");
  gst_message_unref (msg);

  /* We don't expect any output buffers unless the check fails */
  fail_unless (buffers == NULL);

  /* cleanup */
  GST_DEBUG ("cleanup");

  gst_pad_set_active (mysinkpad, FALSE);
  gst_check_teardown_sink_pad (filter);
  gst_check_teardown_element (pipe);
  gst_caps_unref (filter_caps);

View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Unerstanding-Capsfilter-test-test-unfixed-downstream-caps-from-gst-tests-check-tp4657172.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.

More information about the gstreamer-devel mailing list