Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / tests / check / elements / spectrum.c
1 /* GStreamer
2  *
3  * unit test for spectrum
4  *
5  * Copyright (C) <2007> Stefan Kost <ensonic@users.sf.net>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #include <unistd.h>
24
25 #include <gst/check/gstcheck.h>
26
27 gboolean have_eos = FALSE;
28
29 /* For ease of programming we use globals to keep refs for our floating
30  * src and sink pads we create; otherwise we always have to do get_pad,
31  * get_peer, and then remove references in every test function */
32 GstPad *mysrcpad, *mysinkpad;
33
34 #define SPECT_CAPS_TEMPLATE_STRING \
35     "audio/x-raw-int, "                                               \
36     " width = (int) 16, "                                             \
37     " depth = (int) 16, "                                             \
38     " signed = (boolean) true, "                                      \
39     " endianness = (int) BYTE_ORDER, "                                \
40     " rate = (int) [ 1, MAX ], "                                      \
41     " channels = (int) [ 1, MAX ]; "                                  \
42     "audio/x-raw-int, "                                               \
43     " width = (int) 32, "                                             \
44     " depth = (int) 32, "                                             \
45     " signed = (boolean) true, "                                      \
46     " endianness = (int) BYTE_ORDER, "                                \
47     " rate = (int) [ 1, MAX ], "                                      \
48     " channels = (int) [ 1, MAX ]; "                                  \
49     "audio/x-raw-float, "                                             \
50     " width = (int) { 32, 64 }, "                                     \
51     " endianness = (int) BYTE_ORDER, "                                \
52     " rate = (int) [ 1, MAX ], "                                      \
53     " channels = (int) [ 1, MAX ]"
54
55 #define SPECT_CAPS_STRING_S16 \
56   "audio/x-raw-int, " \
57     "rate = (int) 44100, " \
58     "channels = (int) 1, " \
59     "endianness = (int) BYTE_ORDER, " \
60     "width = (int) 16, " \
61     "depth = (int) 16, " \
62     "signed = (boolean) true"
63
64 #define SPECT_CAPS_STRING_S32 \
65   "audio/x-raw-int, " \
66     "rate = (int) 44100, " \
67     "channels = (int) 1, " \
68     "endianness = (int) BYTE_ORDER, " \
69     "width = (int) 32, " \
70     "depth = (int) 32, " \
71     "signed = (boolean) true"
72
73 #define SPECT_CAPS_STRING_F32 \
74     "audio/x-raw-float, "                                             \
75     " width = (int) 32, "                                             \
76     " endianness = (int) BYTE_ORDER, "                                \
77     " rate = (int) 44100, "                                           \
78     " channels = (int) 1"
79
80 #define SPECT_CAPS_STRING_F64 \
81     "audio/x-raw-float, "                                             \
82     " width = (int) 64, "                                             \
83     " endianness = (int) BYTE_ORDER, "                                \
84     " rate = (int) 44100, "                                           \
85     " channels = (int) 1"
86
87 #define SPECT_BANDS 256
88
89 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
90     GST_PAD_SINK,
91     GST_PAD_ALWAYS,
92     GST_STATIC_CAPS (SPECT_CAPS_TEMPLATE_STRING)
93     );
94 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
95     GST_PAD_SRC,
96     GST_PAD_ALWAYS,
97     GST_STATIC_CAPS (SPECT_CAPS_TEMPLATE_STRING)
98     );
99
100 /* takes over reference for outcaps */
101 static GstElement *
102 setup_spectrum (void)
103 {
104   GstElement *spectrum;
105
106   GST_DEBUG ("setup_spectrum");
107   spectrum = gst_check_setup_element ("spectrum");
108   mysrcpad = gst_check_setup_src_pad (spectrum, &srctemplate, NULL);
109   mysinkpad = gst_check_setup_sink_pad (spectrum, &sinktemplate, NULL);
110   gst_pad_set_active (mysrcpad, TRUE);
111   gst_pad_set_active (mysinkpad, TRUE);
112
113   return spectrum;
114 }
115
116 static void
117 cleanup_spectrum (GstElement * spectrum)
118 {
119   GST_DEBUG ("cleanup_spectrum");
120
121   gst_pad_set_active (mysrcpad, FALSE);
122   gst_pad_set_active (mysinkpad, FALSE);
123   gst_check_teardown_src_pad (spectrum);
124   gst_check_teardown_sink_pad (spectrum);
125   gst_check_teardown_element (spectrum);
126
127   g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
128   g_list_free (buffers);
129   buffers = NULL;
130 }
131
132
133 GST_START_TEST (test_int16)
134 {
135   GstElement *spectrum;
136   GstBuffer *inbuffer, *outbuffer;
137   GstBus *bus;
138   GstCaps *caps;
139   GstMessage *message;
140   const GstStructure *structure;
141   int i, j;
142   gint16 *data;
143   const GValue *list, *value;
144   GstClockTime endtime;
145   gfloat level;
146
147   spectrum = setup_spectrum ();
148   g_object_set (spectrum, "message", TRUE, "interval", GST_SECOND / 100,
149       "bands", SPECT_BANDS, "threshold", -80, NULL);
150
151   fail_unless (gst_element_set_state (spectrum,
152           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
153       "could not set to playing");
154
155   /* create a 1 sec buffer with an 11025 Hz sine wave */
156   inbuffer = gst_buffer_new_and_alloc (44100 * sizeof (gint16));
157   data = (gint16 *) GST_BUFFER_DATA (inbuffer);
158
159   for (j = 0; j < 44100; j += 4) {
160     *data = 0;
161     ++data;
162     *data = 32767;
163     ++data;
164     *data = 0;
165     ++data;
166     *data = -32767;
167     ++data;
168   }
169
170   caps = gst_caps_from_string (SPECT_CAPS_STRING_S16);
171   gst_buffer_set_caps (inbuffer, caps);
172   gst_caps_unref (caps);
173   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
174
175   /* create a bus to get the spectrum message on */
176   bus = gst_bus_new ();
177   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
178   gst_element_set_bus (spectrum, bus);
179   ASSERT_OBJECT_REFCOUNT (bus, "bus", 2);
180
181   /* pushing gives away my reference ... */
182   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
183   /* ... but it ends up being collected on the global buffer list */
184   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
185   fail_unless_equals_int (g_list_length (buffers), 1);
186   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
187   fail_unless (inbuffer == outbuffer);
188
189   message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, -1);
190   ASSERT_OBJECT_REFCOUNT (message, "message", 1);
191
192   fail_unless (message != NULL);
193   fail_unless (GST_MESSAGE_SRC (message) == GST_OBJECT (spectrum));
194   fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT);
195   structure = gst_message_get_structure (message);
196   fail_if (structure == NULL);
197   fail_unless_equals_string ((char *) gst_structure_get_name (structure),
198       "spectrum");
199   fail_unless (gst_structure_get_clock_time (structure, "endtime", &endtime));
200
201   list = gst_structure_get_value (structure, "magnitude");
202   for (i = 0; i < SPECT_BANDS; ++i) {
203     value = gst_value_list_get_value (list, i);
204     level = g_value_get_float (value);
205     GST_DEBUG ("band[%3d] is %.2f", i, level);
206     /* Only the bands in the middle should have a level above 60 */
207     fail_if ((i == SPECT_BANDS / 2 || i == SPECT_BANDS / 2 - 1)
208         && level < -20.0);
209     fail_if ((i != SPECT_BANDS / 2 && i != SPECT_BANDS / 2 - 1)
210         && level > -20.0);
211   }
212   fail_unless_equals_int (g_list_length (buffers), 1);
213   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
214   fail_unless (inbuffer == outbuffer);
215
216   /* clean up */
217   /* flush current messages,and future state change messages */
218   gst_bus_set_flushing (bus, TRUE);
219
220   /* message has a ref to the element */
221   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 2);
222   gst_message_unref (message);
223   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
224
225   gst_element_set_bus (spectrum, NULL);
226   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
227   gst_object_unref (bus);
228   fail_unless (gst_element_set_state (spectrum,
229           GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
230   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
231   cleanup_spectrum (spectrum);
232 }
233
234 GST_END_TEST;
235
236 GST_START_TEST (test_int32)
237 {
238   GstElement *spectrum;
239   GstBuffer *inbuffer, *outbuffer;
240   GstBus *bus;
241   GstCaps *caps;
242   GstMessage *message;
243   const GstStructure *structure;
244   int i, j;
245   gint32 *data;
246   const GValue *list, *value;
247   GstClockTime endtime;
248   gfloat level;
249
250   spectrum = setup_spectrum ();
251   g_object_set (spectrum, "message", TRUE, "interval", GST_SECOND / 100,
252       "bands", SPECT_BANDS, "threshold", -80, NULL);
253
254   fail_unless (gst_element_set_state (spectrum,
255           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
256       "could not set to playing");
257
258   /* create a 1 sec buffer with an 11025 Hz sine wave */
259   inbuffer = gst_buffer_new_and_alloc (44100 * sizeof (gint32));
260   data = (gint32 *) GST_BUFFER_DATA (inbuffer);
261   for (j = 0; j < 44100; j += 4) {
262     *data = 0;
263     ++data;
264     *data = 2147483647;
265     ++data;
266     *data = 0;
267     ++data;
268     *data = -2147483647;
269     ++data;
270   }
271   caps = gst_caps_from_string (SPECT_CAPS_STRING_S32);
272   gst_buffer_set_caps (inbuffer, caps);
273   gst_caps_unref (caps);
274   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
275
276   /* create a bus to get the spectrum message on */
277   bus = gst_bus_new ();
278   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
279   gst_element_set_bus (spectrum, bus);
280   ASSERT_OBJECT_REFCOUNT (bus, "bus", 2);
281
282   /* pushing gives away my reference ... */
283   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
284   /* ... but it ends up being collected on the global buffer list */
285   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
286   fail_unless_equals_int (g_list_length (buffers), 1);
287   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
288   fail_unless (inbuffer == outbuffer);
289
290   message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, -1);
291   ASSERT_OBJECT_REFCOUNT (message, "message", 1);
292
293   fail_unless (message != NULL);
294   fail_unless (GST_MESSAGE_SRC (message) == GST_OBJECT (spectrum));
295   fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT);
296   structure = gst_message_get_structure (message);
297   fail_if (structure == NULL);
298   fail_unless_equals_string ((char *) gst_structure_get_name (structure),
299       "spectrum");
300   fail_unless (gst_structure_get_clock_time (structure, "endtime", &endtime));
301
302   list = gst_structure_get_value (structure, "magnitude");
303   for (i = 0; i < SPECT_BANDS; ++i) {
304     value = gst_value_list_get_value (list, i);
305     level = g_value_get_float (value);
306     GST_DEBUG ("band[%3d] is %.2f", i, level);
307     /* Only the bands in the middle should have a level above 60 */
308     fail_if ((i == SPECT_BANDS / 2 || i == SPECT_BANDS / 2 - 1)
309         && level < -20.0);
310     fail_if ((i != SPECT_BANDS / 2 && i != SPECT_BANDS / 2 - 1)
311         && level > -20.0);
312   }
313   fail_unless_equals_int (g_list_length (buffers), 1);
314   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
315   fail_unless (inbuffer == outbuffer);
316
317   /* clean up */
318   /* flush current messages,and future state change messages */
319   gst_bus_set_flushing (bus, TRUE);
320
321   /* message has a ref to the element */
322   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 2);
323   gst_message_unref (message);
324   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
325
326   gst_element_set_bus (spectrum, NULL);
327   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
328   gst_object_unref (bus);
329   fail_unless (gst_element_set_state (spectrum,
330           GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
331   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
332   cleanup_spectrum (spectrum);
333 }
334
335 GST_END_TEST;
336
337 GST_START_TEST (test_float32)
338 {
339   GstElement *spectrum;
340   GstBuffer *inbuffer, *outbuffer;
341   GstBus *bus;
342   GstCaps *caps;
343   GstMessage *message;
344   const GstStructure *structure;
345   int i, j;
346   gfloat *data;
347   const GValue *list, *value;
348   GstClockTime endtime;
349   gfloat level;
350
351   spectrum = setup_spectrum ();
352   g_object_set (spectrum, "message", TRUE, "interval", GST_SECOND / 100,
353       "bands", SPECT_BANDS, "threshold", -80, NULL);
354
355   fail_unless (gst_element_set_state (spectrum,
356           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
357       "could not set to playing");
358
359   /* create a 1 sec buffer with an 11025 Hz sine wave */
360   inbuffer = gst_buffer_new_and_alloc (44100 * sizeof (gfloat));
361   data = (gfloat *) GST_BUFFER_DATA (inbuffer);
362   for (j = 0; j < 44100; j += 4) {
363     *data = 0.0;
364     ++data;
365     *data = 1.0;
366     ++data;
367     *data = 0.0;
368     ++data;
369     *data = -1.0;
370     ++data;
371   }
372   caps = gst_caps_from_string (SPECT_CAPS_STRING_F32);
373   gst_buffer_set_caps (inbuffer, caps);
374   gst_caps_unref (caps);
375   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
376
377   /* create a bus to get the spectrum message on */
378   bus = gst_bus_new ();
379   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
380   gst_element_set_bus (spectrum, bus);
381   ASSERT_OBJECT_REFCOUNT (bus, "bus", 2);
382
383   /* pushing gives away my reference ... */
384   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
385   /* ... but it ends up being collected on the global buffer list */
386   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
387   fail_unless_equals_int (g_list_length (buffers), 1);
388   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
389   fail_unless (inbuffer == outbuffer);
390
391   message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, -1);
392   ASSERT_OBJECT_REFCOUNT (message, "message", 1);
393
394   fail_unless (message != NULL);
395   fail_unless (GST_MESSAGE_SRC (message) == GST_OBJECT (spectrum));
396   fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT);
397   structure = gst_message_get_structure (message);
398   fail_if (structure == NULL);
399   fail_unless_equals_string ((char *) gst_structure_get_name (structure),
400       "spectrum");
401   fail_unless (gst_structure_get_clock_time (structure, "endtime", &endtime));
402
403   list = gst_structure_get_value (structure, "magnitude");
404   for (i = 0; i < SPECT_BANDS; ++i) {
405     value = gst_value_list_get_value (list, i);
406     level = g_value_get_float (value);
407     GST_DEBUG ("band[%3d] is %.2f", i, level);
408     /* Only the bands in the middle should have a level above 60 */
409     fail_if ((i == SPECT_BANDS / 2 || i == SPECT_BANDS / 2 - 1)
410         && level < -20.0);
411     fail_if ((i != SPECT_BANDS / 2 && i != SPECT_BANDS / 2 - 1)
412         && level > -20.0);
413   }
414   fail_unless_equals_int (g_list_length (buffers), 1);
415   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
416   fail_unless (inbuffer == outbuffer);
417
418   /* clean up */
419   /* flush current messages,and future state change messages */
420   gst_bus_set_flushing (bus, TRUE);
421
422   /* message has a ref to the element */
423   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 2);
424   gst_message_unref (message);
425   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
426
427   gst_element_set_bus (spectrum, NULL);
428   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
429   gst_object_unref (bus);
430   fail_unless (gst_element_set_state (spectrum,
431           GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
432   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
433   cleanup_spectrum (spectrum);
434 }
435
436 GST_END_TEST;
437
438 GST_START_TEST (test_float64)
439 {
440   GstElement *spectrum;
441   GstBuffer *inbuffer, *outbuffer;
442   GstBus *bus;
443   GstCaps *caps;
444   GstMessage *message;
445   const GstStructure *structure;
446   int i, j;
447   gdouble *data;
448   const GValue *list, *value;
449   GstClockTime endtime;
450   gfloat level;
451
452   spectrum = setup_spectrum ();
453   g_object_set (spectrum, "message", TRUE, "interval", GST_SECOND / 100,
454       "bands", SPECT_BANDS, "threshold", -80, NULL);
455
456   fail_unless (gst_element_set_state (spectrum,
457           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
458       "could not set to playing");
459
460   /* create a 1 sec buffer with an 11025 Hz sine wave */
461   inbuffer = gst_buffer_new_and_alloc (44100 * sizeof (gdouble));
462   data = (gdouble *) GST_BUFFER_DATA (inbuffer);
463   for (j = 0; j < 44100; j += 4) {
464     *data = 0.0;
465     ++data;
466     *data = 1.0;
467     ++data;
468     *data = 0.0;
469     ++data;
470     *data = -1.0;
471     ++data;
472   }
473   caps = gst_caps_from_string (SPECT_CAPS_STRING_F64);
474   gst_buffer_set_caps (inbuffer, caps);
475   gst_caps_unref (caps);
476   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
477
478   /* create a bus to get the spectrum message on */
479   bus = gst_bus_new ();
480   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
481   gst_element_set_bus (spectrum, bus);
482   ASSERT_OBJECT_REFCOUNT (bus, "bus", 2);
483
484   /* pushing gives away my reference ... */
485   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
486   /* ... but it ends up being collected on the global buffer list */
487   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
488   fail_unless_equals_int (g_list_length (buffers), 1);
489   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
490   fail_unless (inbuffer == outbuffer);
491
492   message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, -1);
493   ASSERT_OBJECT_REFCOUNT (message, "message", 1);
494
495   fail_unless (message != NULL);
496   fail_unless (GST_MESSAGE_SRC (message) == GST_OBJECT (spectrum));
497   fail_unless (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ELEMENT);
498   structure = gst_message_get_structure (message);
499   fail_if (structure == NULL);
500   fail_unless_equals_string ((char *) gst_structure_get_name (structure),
501       "spectrum");
502   fail_unless (gst_structure_get_clock_time (structure, "endtime", &endtime));
503
504   list = gst_structure_get_value (structure, "magnitude");
505   for (i = 0; i < SPECT_BANDS; ++i) {
506     value = gst_value_list_get_value (list, i);
507     level = g_value_get_float (value);
508     GST_DEBUG ("band[%3d] is %.2f", i, level);
509     /* Only the bands in the middle should have a level above 60 */
510     fail_if ((i == SPECT_BANDS / 2 || i == SPECT_BANDS / 2 - 1)
511         && level < -20.0);
512     fail_if ((i != SPECT_BANDS / 2 && i != SPECT_BANDS / 2 - 1)
513         && level > -20.0);
514   }
515   fail_unless_equals_int (g_list_length (buffers), 1);
516   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
517   fail_unless (inbuffer == outbuffer);
518
519   /* clean up */
520   /* flush current messages,and future state change messages */
521   gst_bus_set_flushing (bus, TRUE);
522
523   /* message has a ref to the element */
524   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 2);
525   gst_message_unref (message);
526   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
527
528   gst_element_set_bus (spectrum, NULL);
529   ASSERT_OBJECT_REFCOUNT (bus, "bus", 1);
530   gst_object_unref (bus);
531   fail_unless (gst_element_set_state (spectrum,
532           GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
533   ASSERT_OBJECT_REFCOUNT (spectrum, "spectrum", 1);
534   cleanup_spectrum (spectrum);
535 }
536
537 GST_END_TEST;
538
539
540 static Suite *
541 spectrum_suite (void)
542 {
543   Suite *s = suite_create ("spectrum");
544   TCase *tc_chain = tcase_create ("general");
545
546   suite_add_tcase (s, tc_chain);
547   tcase_add_test (tc_chain, test_int16);
548   tcase_add_test (tc_chain, test_int32);
549   tcase_add_test (tc_chain, test_float32);
550   tcase_add_test (tc_chain, test_float64);
551
552   return s;
553 }
554
555 int
556 main (int argc, char **argv)
557 {
558   int nf;
559
560   Suite *s = spectrum_suite ();
561   SRunner *sr = srunner_create (s);
562
563   gst_check_init (&argc, &argv);
564
565   srunner_run_all (sr, CK_NORMAL);
566   nf = srunner_ntests_failed (sr);
567   srunner_free (sr);
568
569   return nf;
570 }