3 * Common code for GStreamer unittests
5 * Copyright (C) 2004,2006 Thomas Vander Stichele <thomas at apestaart dot org>
6 * Copyright (C) 2008 Thijs Vermeir <thijsvermeir@gmail.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
25 * @short_description: Common code for GStreamer unit tests
27 * These macros and functions are for internal use of the unit tests found
28 * inside the 'check' directories of various GStreamer packages.
36 GST_DEBUG_CATEGORY (check_debug);
38 /* logging function for tests
39 * a test uses g_message() to log a debug line
40 * a gst unit test can be run with GST_TEST_DEBUG env var set to see the
44 gboolean _gst_check_threads_running = FALSE;
45 GList *thread_list = NULL;
47 GCond start_cond; /* used to notify main thread of thread startups */
48 GCond sync_cond; /* used to synchronize all threads and main thread */
50 GList *buffers = NULL;
54 /* FIXME 0.11: shouldn't _gst_check_debug be static? Not used anywhere */
55 gboolean _gst_check_debug = FALSE;
56 gboolean _gst_check_raised_critical = FALSE;
57 gboolean _gst_check_raised_warning = FALSE;
58 gboolean _gst_check_expecting_log = FALSE;
60 static void gst_check_log_message_func
61 (const gchar * log_domain, GLogLevelFlags log_level,
62 const gchar * message, gpointer user_data)
64 if (_gst_check_debug) {
65 g_print ("%s", message);
69 static void gst_check_log_critical_func
70 (const gchar * log_domain, GLogLevelFlags log_level,
71 const gchar * message, gpointer user_data)
73 if (!_gst_check_expecting_log) {
74 g_print ("\n\nUnexpected critical/warning: %s\n", message);
75 fail ("Unexpected critical/warning: %s", message);
78 if (_gst_check_debug) {
79 g_print ("\nExpected critical/warning: %s\n", message);
82 if (log_level & G_LOG_LEVEL_CRITICAL)
83 _gst_check_raised_critical = TRUE;
84 if (log_level & G_LOG_LEVEL_WARNING)
85 _gst_check_raised_warning = TRUE;
89 sort_plugins (GstPlugin * a, GstPlugin * b)
93 ret = strcmp (gst_plugin_get_source (a), gst_plugin_get_source (b));
95 ret = strcmp (gst_plugin_get_name (a), gst_plugin_get_name (b));
104 plugins = gst_registry_get_plugin_list (gst_registry_get ());
105 plugins = g_list_sort (plugins, (GCompareFunc) sort_plugins);
106 for (l = plugins; l != NULL; l = l->next) {
107 GstPlugin *plugin = GST_PLUGIN (l->data);
109 if (strcmp (gst_plugin_get_source (plugin), "BLACKLIST") != 0) {
110 GST_LOG ("%20s@%s", gst_plugin_get_name (plugin),
111 GST_STR_NULL (gst_plugin_get_filename (plugin)));
114 gst_plugin_list_free (plugins);
117 /* initialize GStreamer testing */
119 gst_check_init (int *argc, char **argv[])
121 guint timeout_multiplier = 1;
123 gst_init (argc, argv);
125 GST_DEBUG_CATEGORY_INIT (check_debug, "check", 0, "check regression tests");
127 if (atexit (gst_deinit) != 0) {
128 GST_ERROR ("failed to set gst_deinit as exit function");
131 if (g_getenv ("GST_TEST_DEBUG"))
132 _gst_check_debug = TRUE;
134 g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, gst_check_log_message_func,
136 g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
137 gst_check_log_critical_func, NULL);
138 g_log_set_handler ("GStreamer", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
139 gst_check_log_critical_func, NULL);
140 g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
141 gst_check_log_critical_func, NULL);
142 g_log_set_handler ("GLib-GIO", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
143 gst_check_log_critical_func, NULL);
144 g_log_set_handler ("GLib", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
145 gst_check_log_critical_func, NULL);
150 GST_INFO ("target CPU: %s", TARGET_CPU);
154 timeout_multiplier = 10;
157 if (timeout_multiplier > 1) {
158 const gchar *tmult = g_getenv ("CK_TIMEOUT_MULTIPLIER");
163 g_snprintf (num_str, sizeof (num_str), "%d", timeout_multiplier);
164 GST_INFO ("slow CPU, setting CK_TIMEOUT_MULTIPLIER to %s", num_str);
165 g_setenv ("CK_TIMEOUT_MULTIPLIER", num_str, TRUE);
167 GST_INFO ("CK_TIMEOUT_MULTIPLIER already set to '%s'", tmult);
172 /* message checking */
174 gst_check_message_error (GstMessage * message, GstMessageType type,
175 GQuark domain, gint code)
180 fail_unless (GST_MESSAGE_TYPE (message) == type,
181 "message is of type %s instead of expected type %s",
182 gst_message_type_get_name (GST_MESSAGE_TYPE (message)),
183 gst_message_type_get_name (type));
184 gst_message_parse_error (message, &error, &debug);
185 fail_unless_equals_int (error->domain, domain);
186 fail_unless_equals_int (error->code, code);
187 g_error_free (error);
191 /* helper functions */
193 gst_check_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer)
195 GST_DEBUG_OBJECT (pad, "chain_func: received buffer %p", buffer);
196 buffers = g_list_append (buffers, buffer);
198 g_mutex_lock (&check_mutex);
199 g_cond_signal (&check_cond);
200 g_mutex_unlock (&check_mutex);
206 * gst_check_setup_element:
209 * setup an element for a filter test with mysrcpad and mysinkpad
211 * Returns: (transfer full): a new element
214 gst_check_setup_element (const gchar * factory)
218 GST_DEBUG ("setup_element");
220 element = gst_element_factory_make (factory, factory);
221 fail_if (element == NULL, "Could not create a '%s' element", factory);
222 ASSERT_OBJECT_REFCOUNT (element, factory, 1);
227 gst_check_teardown_element (GstElement * element)
229 GST_DEBUG ("teardown_element");
231 fail_unless (gst_element_set_state (element, GST_STATE_NULL) ==
232 GST_STATE_CHANGE_SUCCESS, "could not set to null");
233 ASSERT_OBJECT_REFCOUNT (element, "element", 1);
234 gst_object_unref (element);
238 * gst_check_setup_src_pad:
239 * @element: element to setup pad on
240 * @tmpl: pad template
242 * Returns: (transfer full): a new pad
245 gst_check_setup_src_pad (GstElement * element, GstStaticPadTemplate * tmpl)
247 return gst_check_setup_src_pad_by_name (element, tmpl, "sink");
251 * gst_check_setup_src_pad_by_name:
252 * @element: element to setup pad on
253 * @tmpl: pad template
256 * Returns: (transfer full): a new pad
259 gst_check_setup_src_pad_by_name (GstElement * element,
260 GstStaticPadTemplate * tmpl, const gchar * name)
262 GstPad *srcpad, *sinkpad;
265 srcpad = gst_pad_new_from_static_template (tmpl, "src");
266 GST_DEBUG_OBJECT (element, "setting up sending pad %p", srcpad);
267 fail_if (srcpad == NULL, "Could not create a srcpad");
268 ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
270 sinkpad = gst_element_get_static_pad (element, name);
272 sinkpad = gst_element_get_request_pad (element, name);
273 fail_if (sinkpad == NULL, "Could not get sink pad from %s",
274 GST_ELEMENT_NAME (element));
275 ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
276 fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
277 "Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
278 gst_object_unref (sinkpad); /* because we got it higher up */
279 ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
285 gst_check_teardown_pad_by_name (GstElement * element, const gchar * name)
287 GstPad *pad_peer, *pad_element;
289 /* clean up floating src pad */
290 pad_element = gst_element_get_static_pad (element, name);
291 /* We don't check the refcount here since there *might* be
292 * a pad cache holding an extra reference on pad_element.
293 * To get to a state where no pad cache will exist,
294 * we first unlink that pad. */
295 pad_peer = gst_pad_get_peer (pad_element);
298 if (gst_pad_get_direction (pad_element) == GST_PAD_SINK)
299 gst_pad_unlink (pad_peer, pad_element);
301 gst_pad_unlink (pad_element, pad_peer);
304 /* pad refs held by both creator and this function (through _get) */
305 ASSERT_OBJECT_REFCOUNT (pad_element, "element pad_element", 2);
306 gst_object_unref (pad_element);
307 /* one more ref is held by element itself */
310 /* pad refs held by both creator and this function (through _get_peer) */
311 ASSERT_OBJECT_REFCOUNT (pad_peer, "check pad_peer", 2);
312 gst_object_unref (pad_peer);
313 gst_object_unref (pad_peer);
318 gst_check_teardown_src_pad (GstElement * element)
320 gst_check_teardown_pad_by_name (element, "sink");
324 * gst_check_setup_sink_pad:
325 * @element: element to setup pad on
326 * @tmpl: pad template
328 * Returns: (transfer full): a new pad
331 gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * tmpl)
333 return gst_check_setup_sink_pad_by_name (element, tmpl, "src");
337 * gst_check_setup_sink_pad_by_name:
338 * @element: element to setup pad on
339 * @tmpl: pad template
342 * Returns: (transfer full): a new pad
345 gst_check_setup_sink_pad_by_name (GstElement * element,
346 GstStaticPadTemplate * tmpl, const gchar * name)
348 GstPad *srcpad, *sinkpad;
351 sinkpad = gst_pad_new_from_static_template (tmpl, "sink");
352 GST_DEBUG_OBJECT (element, "setting up receiving pad %p", sinkpad);
353 fail_if (sinkpad == NULL, "Could not create a sinkpad");
355 srcpad = gst_element_get_static_pad (element, name);
357 srcpad = gst_element_get_request_pad (element, name);
358 fail_if (srcpad == NULL, "Could not get source pad from %s",
359 GST_ELEMENT_NAME (element));
360 gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
362 GST_DEBUG_OBJECT (element, "Linking element src pad and receiving sink pad");
363 fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
364 "Could not link %s source and sink pads", GST_ELEMENT_NAME (element));
365 gst_object_unref (srcpad); /* because we got it higher up */
366 ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
368 GST_DEBUG_OBJECT (element, "set up srcpad, refcount is 1");
373 gst_check_teardown_sink_pad (GstElement * element)
375 gst_check_teardown_pad_by_name (element, "src");
379 * gst_check_drop_buffers:
381 * Unref and remove all buffers that are in the global @buffers GList,
385 gst_check_drop_buffers (void)
387 while (buffers != NULL) {
388 gst_buffer_unref (GST_BUFFER (buffers->data));
389 buffers = g_list_delete_link (buffers, buffers);
394 * gst_check_caps_equal:
395 * @caps1: first caps to compare
396 * @caps2: second caps to compare
398 * Compare two caps with gst_caps_is_equal and fail unless they are
402 gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2)
404 gchar *name1 = gst_caps_to_string (caps1);
405 gchar *name2 = gst_caps_to_string (caps2);
407 fail_unless (gst_caps_is_equal (caps1, caps2),
408 "caps ('%s') is not equal to caps ('%s')", name1, name2);
415 * gst_check_buffer_data:
416 * @buffer: buffer to compare
417 * @data: data to compare to
418 * @size: size of data to compare
420 * Compare the buffer contents with @data and @size.
423 gst_check_buffer_data (GstBuffer * buffer, gconstpointer data, gsize size)
427 gst_buffer_map (buffer, &info, GST_MAP_READ);
428 GST_MEMDUMP ("Converted data", info.data, info.size);
429 GST_MEMDUMP ("Expected data", data, size);
430 if (memcmp (info.data, data, size) != 0) {
431 g_print ("\nConverted data:\n");
432 gst_util_dump_mem (info.data, info.size);
433 g_print ("\nExpected data:\n");
434 gst_util_dump_mem (data, size);
436 fail_unless (memcmp (info.data, data, size) == 0,
437 "buffer contents not equal");
438 gst_buffer_unmap (buffer, &info);
442 buffer_event_function (GstPad * pad, GstObject * noparent, GstEvent * event)
444 if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) {
446 GstCaps *expected_caps = gst_pad_get_element_private (pad);
448 gst_event_parse_caps (event, &event_caps);
449 fail_unless (gst_caps_is_fixed (expected_caps));
450 fail_unless (gst_caps_is_fixed (event_caps));
451 fail_unless (gst_caps_is_equal_fixed (event_caps, expected_caps));
452 gst_event_unref (event);
456 return gst_pad_event_default (pad, noparent, event);
460 * gst_check_element_push_buffer_list:
461 * @element_name: name of the element that needs to be created
462 * @buffer_in: (element-type GstBuffer) (transfer full): a list of buffers that needs to be
463 * puched to the element
464 * @buffer_out: (element-type GstBuffer) (transfer full): a list of buffers that we expect from
466 * @last_flow_return: the last buffer push needs to give this GstFlowReturn
468 * Create an @element with the factory with the name and push the buffers in
469 * @buffer_in to this element. The element should create the buffers equal to
470 * the buffers in @buffer_out. We only check the caps, size and the data of the
471 * buffers. This function unrefs the buffers in the two lists.
472 * The last_flow_return parameter indicates the expected flow return value from
473 * pushing the final buffer in the list.
474 * This can be used to set up a test which pushes some buffers and then an
475 * invalid buffer, when the final buffer is expected to fail, for example.
477 /* FIXME 0.11: rename this function now that there's GstBufferList? */
479 gst_check_element_push_buffer_list (const gchar * element_name,
480 GList * buffer_in, GstCaps * caps_in, GList * buffer_out,
481 GstCaps * caps_out, GstFlowReturn last_flow_return)
485 GstPad *sink_pad = NULL;
489 /* check that there are no buffers waiting */
490 gst_check_drop_buffers ();
491 /* create the element */
492 element = gst_check_setup_element (element_name);
493 fail_if (element == NULL, "failed to create the element '%s'", element_name);
494 fail_unless (GST_IS_ELEMENT (element), "the element is no element");
495 /* create the src pad */
496 buffer = GST_BUFFER (buffer_in->data);
498 fail_unless (GST_IS_BUFFER (buffer), "There should be a buffer in buffer_in");
499 src_pad = gst_pad_new ("src", GST_PAD_SRC);
501 fail_unless (gst_caps_is_fixed (caps_in));
502 gst_pad_use_fixed_caps (src_pad);
504 /* activate the pad */
505 gst_pad_set_active (src_pad, TRUE);
506 GST_DEBUG ("src pad activated");
507 gst_check_setup_events (src_pad, element, caps_in, GST_FORMAT_BYTES);
508 pad_peer = gst_element_get_static_pad (element, "sink");
509 fail_if (pad_peer == NULL);
510 fail_unless (gst_pad_link (src_pad, pad_peer) == GST_PAD_LINK_OK,
511 "Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
512 gst_object_unref (pad_peer);
513 /* don't create the sink_pad if there is no buffer_out list */
514 if (buffer_out != NULL) {
516 GST_DEBUG ("buffer out detected, creating the sink pad");
517 /* get the sink caps */
521 fail_unless (gst_caps_is_fixed (caps_out));
522 temp = gst_caps_to_string (caps_out);
524 GST_DEBUG ("sink caps requested by buffer out: '%s'", temp);
528 /* get the sink pad */
529 sink_pad = gst_pad_new ("sink", GST_PAD_SINK);
530 fail_unless (GST_IS_PAD (sink_pad));
531 /* configure the sink pad */
532 gst_pad_set_chain_function (sink_pad, gst_check_chain_func);
533 gst_pad_set_active (sink_pad, TRUE);
535 gst_pad_set_element_private (sink_pad, caps_out);
536 gst_pad_set_event_function (sink_pad, buffer_event_function);
538 /* get the peer pad */
539 pad_peer = gst_element_get_static_pad (element, "src");
540 fail_unless (gst_pad_link (pad_peer, sink_pad) == GST_PAD_LINK_OK,
541 "Could not link sink and %s source pads", GST_ELEMENT_NAME (element));
542 gst_object_unref (pad_peer);
544 fail_unless (gst_element_set_state (element,
545 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
546 "could not set to playing");
547 /* push all the buffers in the buffer_in list */
548 fail_unless (g_list_length (buffer_in) > 0, "the buffer_in list is empty");
549 while (buffer_in != NULL) {
550 GstBuffer *next_buffer = GST_BUFFER (buffer_in->data);
552 fail_unless (GST_IS_BUFFER (next_buffer),
553 "data in buffer_in should be a buffer");
554 /* remove the buffer from the list */
555 buffer_in = g_list_remove (buffer_in, next_buffer);
556 if (buffer_in == NULL) {
557 fail_unless (gst_pad_push (src_pad, next_buffer) == last_flow_return,
558 "we expect something else from the last buffer");
560 fail_unless (gst_pad_push (src_pad, next_buffer) == GST_FLOW_OK,
561 "Failed to push buffer in");
564 fail_unless (gst_element_set_state (element,
565 GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
566 /* check that there is a buffer out */
567 fail_unless_equals_int (g_list_length (buffers), g_list_length (buffer_out));
568 while (buffers != NULL) {
569 GstBuffer *new = GST_BUFFER (buffers->data);
570 GstBuffer *orig = GST_BUFFER (buffer_out->data);
571 GstMapInfo newinfo, originfo;
573 gst_buffer_map (new, &newinfo, GST_MAP_READ);
574 gst_buffer_map (orig, &originfo, GST_MAP_READ);
576 GST_LOG ("orig buffer: size %" G_GSIZE_FORMAT, originfo.size);
577 GST_LOG ("new buffer: size %" G_GSIZE_FORMAT, newinfo.size);
578 GST_MEMDUMP ("orig buffer", originfo.data, originfo.size);
579 GST_MEMDUMP ("new buffer", newinfo.data, newinfo.size);
581 /* remove the buffers */
582 buffers = g_list_remove (buffers, new);
583 buffer_out = g_list_remove (buffer_out, orig);
585 fail_unless (originfo.size == newinfo.size,
586 "size of the buffers are not the same");
587 fail_unless (memcmp (originfo.data, newinfo.data, newinfo.size) == 0,
588 "data is not the same");
590 gst_check_caps_equal (GST_BUFFER_CAPS (orig), GST_BUFFER_CAPS (new));
593 gst_buffer_unmap (orig, &originfo);
594 gst_buffer_unmap (new, &newinfo);
596 gst_buffer_unref (new);
597 gst_buffer_unref (orig);
599 /* teardown the element and pads */
600 gst_pad_set_active (src_pad, FALSE);
601 gst_check_teardown_src_pad (element);
602 gst_pad_set_active (sink_pad, FALSE);
603 gst_check_teardown_sink_pad (element);
604 gst_check_teardown_element (element);
608 * gst_check_element_push_buffer:
609 * @element_name: name of the element that needs to be created
610 * @buffer_in: push this buffer to the element
611 * @buffer_out: compare the result with this buffer
613 * Create an @element with the factory with the name and push the
614 * @buffer_in to this element. The element should create one buffer
615 * and this will be compared with @buffer_out. We only check the caps
616 * and the data of the buffers. This function unrefs the buffers.
619 gst_check_element_push_buffer (const gchar * element_name,
620 GstBuffer * buffer_in, GstCaps * caps_in, GstBuffer * buffer_out,
626 in = g_list_append (in, buffer_in);
627 out = g_list_append (out, buffer_out);
629 gst_check_element_push_buffer_list (element_name, in, caps_in, out, caps_out,
634 gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes)
636 if (have_abi_sizes) {
640 for (i = 0; list[i].name; i++) {
641 if (list[i].size != list[i].abi_size) {
643 g_print ("sizeof(%s) is %d, expected %d\n",
644 list[i].name, list[i].size, list[i].abi_size);
647 fail_unless (ok, "failed ABI check");
651 if ((fn = g_getenv ("GST_ABI"))) {
656 s = g_string_new ("\nGstCheckABIStruct list[] = {\n");
657 for (i = 0; list[i].name; i++) {
658 g_string_append_printf (s, " {\"%s\", sizeof (%s), %d},\n",
659 list[i].name, list[i].name, list[i].size);
661 g_string_append (s, " {NULL, 0, 0}\n");
662 g_string_append (s, "};\n");
663 if (!g_file_set_contents (fn, s->str, s->len, &err)) {
664 g_print ("%s", s->str);
665 g_printerr ("\nFailed to write ABI information: %s\n", err->message);
667 g_print ("\nWrote ABI information to '%s'.\n", fn);
669 g_string_free (s, TRUE);
671 g_print ("No structure size list was generated for this architecture.\n");
672 g_print ("Run with GST_ABI environment variable set to output header.\n");
678 gst_check_run_suite (Suite * suite, const gchar * name, const gchar * fname)
681 gchar *xmlfilename = NULL;
684 sr = srunner_create (suite);
686 if (g_getenv ("GST_CHECK_XML")) {
687 /* how lucky we are to have __FILE__ end in .c */
688 xmlfilename = g_strdup_printf ("%sheck.xml", fname);
690 srunner_set_xml (sr, xmlfilename);
693 srunner_run_all (sr, CK_NORMAL);
694 nf = srunner_ntests_failed (sr);
695 g_free (xmlfilename);
701 _gst_check_run_test_func (const gchar * func_name)
703 const gchar *gst_checks;
704 gboolean res = FALSE;
707 gst_checks = g_getenv ("GST_CHECKS");
709 /* no filter specified => run all checks */
710 if (gst_checks == NULL || *gst_checks == '\0')
713 /* only run specified functions */
714 funcs = g_strsplit (gst_checks, ",", -1);
715 for (f = funcs; f != NULL && *f != NULL; ++f) {
716 if (g_pattern_match_simple (*f, func_name)) {
726 * gst_check_setup_events_with_stream_id:
727 * @srcpad: The src #GstPad to push on
728 * @element: The #GstElement use to create the stream id
729 * @caps: (allow-none): #GstCaps in case caps event must be sent
730 * @format: The #GstFormat of the default segment to send
731 * @stream_id: A unique identifier for the stream
733 * Push stream-start, caps and segment event, which concist of the minimum
734 * required events to allow streaming. Caps is optional to allow raw src
738 gst_check_setup_events_with_stream_id (GstPad * srcpad, GstElement * element,
739 GstCaps * caps, GstFormat format, const gchar * stream_id)
743 gst_segment_init (&segment, format);
745 fail_unless (gst_pad_push_event (srcpad,
746 gst_event_new_stream_start (stream_id)));
748 fail_unless (gst_pad_push_event (srcpad, gst_event_new_caps (caps)));
749 fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&segment)));
753 * gst_check_setup_events:
754 * @srcpad: The src #GstPad to push on
755 * @element: The #GstElement use to create the stream id
756 * @caps: (allow-none): #GstCaps in case caps event must be sent
757 * @format: The #GstFormat of the default segment to send
759 * Push stream-start, caps and segment event, which concist of the minimum
760 * required events to allow streaming. Caps is optional to allow raw src
761 * testing. If @element has more than one src or sink pad, use
762 * gst_check_setup_events_with_stream_id() instead.
765 gst_check_setup_events (GstPad * srcpad, GstElement * element,
766 GstCaps * caps, GstFormat format)
770 stream_id = gst_pad_create_stream_id (srcpad, element, NULL);
771 gst_check_setup_events_with_stream_id (srcpad, element, caps, format,