5 * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
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.
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.
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.
25 #include <gst/base/gstbasetransform.h>
26 #include <gst/check/gstcheck.h>
27 #include <gst/controller/gstcontroller.h>
28 #include <gst/interfaces/streamvolume.h>
30 /* For ease of programming we use globals to keep refs for our floating
31 * src and sink pads we create; otherwise we always have to do get_pad,
32 * get_peer, and then remove references in every test function */
33 static GstPad *mysrcpad, *mysinkpad;
36 #define VOLUME_CAPS_TEMPLATE_STRING \
38 "channels = (int) [ 1, MAX ], " \
39 "rate = (int) [ 1, MAX ], " \
40 "endianness = (int) BYTE_ORDER, " \
41 "width = (int) { 8, 16, 24, 32 }, " \
42 "depth = (int) { 8, 16, 24, 32 }, " \
43 "signed = (bool) TRUE; " \
44 "audio/x-raw-float, " \
45 "channels = (int) [ 1, MAX ], " \
46 "rate = (int) [ 1, MAX ], " \
47 "endianness = (int) BYTE_ORDER, " \
48 "width = (int) { 32, 64 }" \
50 #define VOLUME_CAPS_STRING_S8 \
52 "channels = (int) 1, " \
53 "rate = (int) 44100, " \
54 "endianness = (int) BYTE_ORDER, " \
57 "signed = (bool) TRUE"
59 #define VOLUME_CAPS_STRING_S16 \
61 "channels = (int) 1, " \
62 "rate = (int) 44100, " \
63 "endianness = (int) BYTE_ORDER, " \
64 "width = (int) 16, " \
65 "depth = (int) 16, " \
66 "signed = (bool) TRUE"
68 #define VOLUME_CAPS_STRING_S24 \
70 "channels = (int) 1, " \
71 "rate = (int) 44100, " \
72 "endianness = (int) BYTE_ORDER, " \
73 "width = (int) 24, " \
74 "depth = (int) 24, " \
75 "signed = (bool) TRUE"
77 #define VOLUME_CAPS_STRING_S32 \
79 "channels = (int) 1, " \
80 "rate = (int) 44100, " \
81 "endianness = (int) BYTE_ORDER, " \
82 "width = (int) 32, " \
83 "depth = (int) 32, " \
84 "signed = (bool) TRUE"
86 #define VOLUME_CAPS_STRING_F32 \
87 "audio/x-raw-float, " \
88 "channels = (int) 1, " \
89 "rate = (int) 44100, " \
90 "endianness = (int) BYTE_ORDER, " \
93 #define VOLUME_CAPS_STRING_F64 \
94 "audio/x-raw-float, " \
95 "channels = (int) 1, " \
96 "rate = (int) 44100, " \
97 "endianness = (int) BYTE_ORDER, " \
100 #define VOLUME_WRONG_CAPS_STRING \
101 "audio/x-raw-int, " \
102 "channels = (int) 1, " \
103 "rate = (int) 44100, " \
104 "endianness = (int) BYTE_ORDER, " \
105 "width = (int) 16, " \
106 "depth = (int) 16, " \
107 "signed = (bool) FALSE"
110 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
113 GST_STATIC_CAPS (VOLUME_CAPS_TEMPLATE_STRING)
115 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
118 GST_STATIC_CAPS (VOLUME_CAPS_TEMPLATE_STRING)
126 GST_DEBUG ("setup_volume");
127 volume = gst_check_setup_element ("volume");
128 mysrcpad = gst_check_setup_src_pad (volume, &srctemplate, NULL);
129 mysinkpad = gst_check_setup_sink_pad (volume, &sinktemplate, NULL);
130 gst_pad_set_active (mysrcpad, TRUE);
131 gst_pad_set_active (mysinkpad, TRUE);
137 cleanup_volume (GstElement * volume)
139 GST_DEBUG ("cleanup_volume");
141 g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
142 g_list_free (buffers);
145 gst_pad_set_active (mysrcpad, FALSE);
146 gst_pad_set_active (mysinkpad, FALSE);
147 gst_check_teardown_src_pad (volume);
148 gst_check_teardown_sink_pad (volume);
149 gst_check_teardown_element (volume);
152 GST_START_TEST (test_get_set)
154 GstElement *volume = gst_element_factory_make ("volume", NULL);
157 fail_unless (volume != NULL);
158 g_object_get (G_OBJECT (volume), "volume", &val, NULL);
159 fail_unless (val == 1.0);
160 fail_unless (val == gst_stream_volume_get_volume (GST_STREAM_VOLUME (volume),
161 GST_STREAM_VOLUME_FORMAT_LINEAR));
163 g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
164 g_object_get (G_OBJECT (volume), "volume", &val, NULL);
165 fail_unless (val == 0.5);
166 fail_unless (val == gst_stream_volume_get_volume (GST_STREAM_VOLUME (volume),
167 GST_STREAM_VOLUME_FORMAT_LINEAR));
169 gst_stream_volume_set_volume (GST_STREAM_VOLUME (volume),
170 GST_STREAM_VOLUME_FORMAT_LINEAR, 1.0);
171 g_object_get (G_OBJECT (volume), "volume", &val, NULL);
172 fail_unless (val == 1.0);
173 fail_unless (val == gst_stream_volume_get_volume (GST_STREAM_VOLUME (volume),
174 GST_STREAM_VOLUME_FORMAT_LINEAR));
176 gst_object_unref (volume);
181 GST_START_TEST (test_unity_s8)
184 GstBuffer *inbuffer, *outbuffer;
186 gint8 in[2] = { 64, -16 };
190 volume = setup_volume ();
191 fail_unless (gst_element_set_state (volume,
192 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
193 "could not set to playing");
195 inbuffer = gst_buffer_new_and_alloc (2);
196 gst_buffer_fill (inbuffer, 0, in, 2);
197 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
198 gst_buffer_set_caps (inbuffer, caps);
199 gst_caps_unref (caps);
200 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
202 /* pushing gives away my reference ... */
203 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
204 /* ... but it ends up being collected on the global buffer list */
205 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
206 fail_unless_equals_int (g_list_length (buffers), 1);
207 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
208 fail_unless (inbuffer == outbuffer);
209 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
210 GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
211 fail_unless (memcmp (res, in, 2) == 0);
212 gst_buffer_unmap (outbuffer, res, size);
215 cleanup_volume (volume);
220 GST_START_TEST (test_half_s8)
224 GstBuffer *outbuffer;
226 gint8 in[2] = { 64, -16 };
227 gint8 out[2] = { 32, -8 };
231 volume = setup_volume ();
232 g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
233 fail_unless (gst_element_set_state (volume,
234 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
235 "could not set to playing");
237 inbuffer = gst_buffer_new_and_alloc (2);
238 gst_buffer_fill (inbuffer, 0, in, 2);
239 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
240 gst_buffer_set_caps (inbuffer, caps);
241 gst_caps_unref (caps);
242 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
243 /* FIXME: reffing the inbuffer should make the transformation not be
245 gst_buffer_ref (inbuffer);
248 /* pushing gives away my reference ... */
249 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
250 /* ... but it ends up being modified inplace and
251 * collected on the global buffer list */
252 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
253 fail_unless_equals_int (g_list_length (buffers), 1);
254 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
255 fail_unless (inbuffer == outbuffer);
256 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
257 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
259 fail_unless (memcmp (res, out, 2) == 0);
260 gst_buffer_unmap (outbuffer, res, size);
263 cleanup_volume (volume);
268 GST_START_TEST (test_double_s8)
272 GstBuffer *outbuffer;
274 gint8 in[2] = { 64, -16 };
275 gint8 out[2] = { 127, -32 }; /* notice the clamped sample */
279 volume = setup_volume ();
280 g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
281 fail_unless (gst_element_set_state (volume,
282 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
283 "could not set to playing");
285 inbuffer = gst_buffer_new_and_alloc (2);
286 gst_buffer_fill (inbuffer, 0, in, 2);
287 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
288 gst_buffer_set_caps (inbuffer, caps);
289 gst_caps_unref (caps);
290 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
291 /* FIXME: reffing the inbuffer should make the transformation not be
293 gst_buffer_ref (inbuffer);
296 /* pushing gives away my reference ... */
297 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
298 /* ... but it ends up being modified inplace and
299 * collected on the global buffer list */
300 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
301 fail_unless_equals_int (g_list_length (buffers), 1);
302 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
303 fail_unless (inbuffer == outbuffer);
304 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
305 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
307 fail_unless (memcmp (res, out, 2) == 0);
308 gst_buffer_unmap (outbuffer, res, size);
311 cleanup_volume (volume);
316 GST_START_TEST (test_ten_s8)
320 GstBuffer *outbuffer;
322 gint8 in[2] = { 64, -10 };
323 gint8 out[2] = { 127, -100 }; /* notice the clamped sample */
326 volume = setup_volume ();
327 g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
328 fail_unless (gst_element_set_state (volume,
329 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
330 "could not set to playing");
332 inbuffer = gst_buffer_new_and_alloc (2);
333 memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
334 fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
335 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
336 gst_buffer_set_caps (inbuffer, caps);
337 gst_caps_unref (caps);
338 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
339 /* FIXME: reffing the inbuffer should make the transformation not be
341 gst_buffer_ref (inbuffer);
344 /* pushing gives away my reference ... */
345 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
346 /* ... but it ends up being modified inplace and
347 * collected on the global buffer list */
348 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
349 fail_unless_equals_int (g_list_length (buffers), 1);
350 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
351 fail_unless (inbuffer == outbuffer);
352 res = (gint8 *) GST_BUFFER_DATA (outbuffer);
353 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
355 fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
358 cleanup_volume (volume);
363 GST_START_TEST (test_mute_s8)
367 GstBuffer *outbuffer;
369 gint8 in[2] = { 64, -16 };
370 gint8 out[2] = { 0, 0 };
374 volume = setup_volume ();
375 g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
376 fail_unless (gst_element_set_state (volume,
377 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
378 "could not set to playing");
380 inbuffer = gst_buffer_new_and_alloc (2);
381 gst_buffer_fill (inbuffer, 0, in, 2);
382 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
383 gst_buffer_set_caps (inbuffer, caps);
384 gst_caps_unref (caps);
385 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
386 /* FIXME: reffing the inbuffer should make the transformation not be
388 gst_buffer_ref (inbuffer);
391 /* pushing gives away my reference ... */
392 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
393 /* ... but it ends up being modified inplace and
394 * collected on the global buffer list */
395 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
396 fail_unless_equals_int (g_list_length (buffers), 1);
397 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
398 fail_unless (inbuffer == outbuffer);
399 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
400 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
402 fail_unless (memcmp (res, out, 2) == 0);
403 gst_buffer_unmap (outbuffer, res, size);
406 cleanup_volume (volume);
411 GST_START_TEST (test_unity_s16)
414 GstBuffer *inbuffer, *outbuffer;
416 gint16 in[2] = { 16384, -256 };
420 volume = setup_volume ();
421 fail_unless (gst_element_set_state (volume,
422 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
423 "could not set to playing");
425 inbuffer = gst_buffer_new_and_alloc (4);
426 gst_buffer_fill (inbuffer, 0, in, 4);
427 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
428 gst_buffer_set_caps (inbuffer, caps);
429 gst_caps_unref (caps);
430 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
432 /* pushing gives away my reference ... */
433 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
434 /* ... but it ends up being collected on the global buffer list */
435 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
436 fail_unless_equals_int (g_list_length (buffers), 1);
437 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
438 fail_unless (inbuffer == outbuffer);
439 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
440 GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
441 fail_unless (memcmp (res, in, 4) == 0);
442 gst_buffer_unmap (outbuffer, res, size);
445 cleanup_volume (volume);
450 GST_START_TEST (test_half_s16)
454 GstBuffer *outbuffer;
456 gint16 in[2] = { 16384, -256 };
457 gint16 out[2] = { 8192, -128 };
461 volume = setup_volume ();
462 g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
463 fail_unless (gst_element_set_state (volume,
464 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
465 "could not set to playing");
467 inbuffer = gst_buffer_new_and_alloc (4);
468 gst_buffer_fill (inbuffer, 0, in, 4);
469 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
470 gst_buffer_set_caps (inbuffer, caps);
471 gst_caps_unref (caps);
472 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
473 /* FIXME: reffing the inbuffer should make the transformation not be
475 gst_buffer_ref (inbuffer);
478 /* pushing gives away my reference ... */
479 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
480 /* ... but it ends up being modified inplace and
481 * collected on the global buffer list */
482 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
483 fail_unless_equals_int (g_list_length (buffers), 1);
484 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
485 fail_unless (inbuffer == outbuffer);
486 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
487 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
489 fail_unless (memcmp (res, out, 4) == 0);
490 gst_buffer_unmap (outbuffer, res, size);
493 cleanup_volume (volume);
498 GST_START_TEST (test_double_s16)
502 GstBuffer *outbuffer;
504 gint16 in[2] = { 16384, -256 };
505 gint16 out[2] = { 32767, -512 }; /* notice the clamped sample */
509 volume = setup_volume ();
510 g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
511 fail_unless (gst_element_set_state (volume,
512 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
513 "could not set to playing");
515 inbuffer = gst_buffer_new_and_alloc (4);
516 gst_buffer_fill (inbuffer, 0, in, 4);
517 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
518 gst_buffer_set_caps (inbuffer, caps);
519 gst_caps_unref (caps);
520 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
521 /* FIXME: reffing the inbuffer should make the transformation not be
523 gst_buffer_ref (inbuffer);
526 /* pushing gives away my reference ... */
527 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
528 /* ... but it ends up being modified inplace and
529 * collected on the global buffer list */
530 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
531 fail_unless_equals_int (g_list_length (buffers), 1);
532 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
533 fail_unless (inbuffer == outbuffer);
534 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
535 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
537 fail_unless (memcmp (res, out, 4) == 0);
538 gst_buffer_unmap (outbuffer, res, size);
541 cleanup_volume (volume);
546 GST_START_TEST (test_ten_s16)
550 GstBuffer *outbuffer;
552 gint16 in[2] = { 16384, -10 };
553 gint16 out[2] = { 32767, -100 }; /* notice the clamped sample */
556 volume = setup_volume ();
557 g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
558 fail_unless (gst_element_set_state (volume,
559 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
560 "could not set to playing");
562 inbuffer = gst_buffer_new_and_alloc (4);
563 memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
564 fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
565 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
566 gst_buffer_set_caps (inbuffer, caps);
567 gst_caps_unref (caps);
568 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
569 /* FIXME: reffing the inbuffer should make the transformation not be
571 gst_buffer_ref (inbuffer);
574 /* pushing gives away my reference ... */
575 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
576 /* ... but it ends up being modified inplace and
577 * collected on the global buffer list */
578 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
579 fail_unless_equals_int (g_list_length (buffers), 1);
580 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
581 fail_unless (inbuffer == outbuffer);
582 res = (gint16 *) GST_BUFFER_DATA (outbuffer);
583 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
585 fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
588 cleanup_volume (volume);
594 GST_START_TEST (test_mute_s16)
598 GstBuffer *outbuffer;
600 gint16 in[2] = { 16384, -256 };
601 gint16 out[2] = { 0, 0 };
605 volume = setup_volume ();
606 g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
607 fail_unless (gst_element_set_state (volume,
608 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
609 "could not set to playing");
611 inbuffer = gst_buffer_new_and_alloc (4);
612 gst_buffer_fill (inbuffer, 0, in, 4);
613 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
614 gst_buffer_set_caps (inbuffer, caps);
615 gst_caps_unref (caps);
616 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
617 /* FIXME: reffing the inbuffer should make the transformation not be
619 gst_buffer_ref (inbuffer);
622 /* pushing gives away my reference ... */
623 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
624 /* ... but it ends up being modified inplace and
625 * collected on the global buffer list */
626 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
627 fail_unless_equals_int (g_list_length (buffers), 1);
628 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
629 fail_unless (inbuffer == outbuffer);
630 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
631 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
633 fail_unless (memcmp (res, out, 4) == 0);
634 gst_buffer_unmap (outbuffer, res, size);
637 cleanup_volume (volume);
642 #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
643 #define get_unaligned_i24(_x) ( (((guint8*)_x)[0]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[2]) << 16) )
644 #define write_unaligned_u24(_x,samp) do { (((guint8*)_x)[0]) = samp & 0xFF; (((guint8*)_x)[1]) = (samp >> 8) & 0xFF; (((guint8*)_x)[2]) = (samp >> 16) & 0xFF; } while (0)
645 #else /* BIG ENDIAN */
646 #define get_unaligned_i24(_x) ( (((guint8*)_x)[2]) | ((((guint8*)_x)[1]) << 8) | ((((gint8*)_x)[0]) << 16) )
647 #define write_unaligned_u24(_x,samp) do { (((guint8*)_x)[0]) = (samp >> 16) & 0xFF; (((guint8*)_x)[1]) = (samp >> 8) & 0xFF; (((guint8*)_x)[2]) = samp & 0xFF; } while (0)
650 GST_START_TEST (test_unity_s24)
653 GstBuffer *inbuffer, *outbuffer;
655 gint32 in_32[2] = { 4194304, -4096 };
661 write_unaligned_u24 (in, in_32[0]);
662 write_unaligned_u24 (in + 3, in_32[1]);
664 volume = setup_volume ();
665 fail_unless (gst_element_set_state (volume,
666 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
667 "could not set to playing");
669 inbuffer = gst_buffer_new_and_alloc (6);
670 gst_buffer_fill (inbuffer, 0, in, 6);
671 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
672 gst_buffer_set_caps (inbuffer, caps);
673 gst_caps_unref (caps);
674 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
676 /* pushing gives away my reference ... */
677 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
678 /* ... but it ends up being collected on the global buffer list */
679 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
680 fail_unless_equals_int (g_list_length (buffers), 1);
681 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
682 fail_unless (inbuffer == outbuffer);
683 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
685 res_32[0] = get_unaligned_i24 (res);
686 res_32[1] = get_unaligned_i24 ((res + 3));
688 GST_INFO ("expected %+5d %+5d real %+5d %+5d", in_32[0], in_32[1], res_32[0],
690 fail_unless (memcmp (res, in, 6) == 0);
691 gst_buffer_unmap (outbuffer, res, size);
694 cleanup_volume (volume);
699 GST_START_TEST (test_half_s24)
703 GstBuffer *outbuffer;
705 gint32 in_32[2] = { 4194304, -4096 };
709 gint32 out_32[2] = { 2097152, -2048 };
712 write_unaligned_u24 (in, in_32[0]);
713 write_unaligned_u24 (in + 3, in_32[1]);
715 volume = setup_volume ();
716 g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
717 fail_unless (gst_element_set_state (volume,
718 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
719 "could not set to playing");
721 inbuffer = gst_buffer_new_and_alloc (6);
722 gst_buffer_fill (inbuffer, 0, in, 6);
723 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
724 gst_buffer_set_caps (inbuffer, caps);
725 gst_caps_unref (caps);
726 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
727 /* FIXME: reffing the inbuffer should make the transformation not be
729 gst_buffer_ref (inbuffer);
732 /* pushing gives away my reference ... */
733 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
734 /* ... but it ends up being modified inplace and
735 * collected on the global buffer list */
736 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
737 fail_unless_equals_int (g_list_length (buffers), 1);
738 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
739 fail_unless (inbuffer == outbuffer);
740 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
742 res_32[0] = get_unaligned_i24 (res);
743 res_32[1] = get_unaligned_i24 ((res + 3));
745 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
746 res_32[0], res_32[1]);
747 fail_unless (memcmp (res_32, out_32, 8) == 0);
748 gst_buffer_unmap (outbuffer, res, size);
751 cleanup_volume (volume);
756 GST_START_TEST (test_double_s24)
760 GstBuffer *outbuffer;
762 gint32 in_32[2] = { 4194304, -4096 };
766 gint32 out_32[2] = { 8388607, -8192 }; /* notice the clamped sample */
769 write_unaligned_u24 (in, in_32[0]);
770 write_unaligned_u24 (in + 3, in_32[1]);
772 volume = setup_volume ();
773 g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
774 fail_unless (gst_element_set_state (volume,
775 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
776 "could not set to playing");
778 inbuffer = gst_buffer_new_and_alloc (6);
779 gst_buffer_fill (inbuffer, 0, in, 6);
780 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
781 gst_buffer_set_caps (inbuffer, caps);
782 gst_caps_unref (caps);
783 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
784 /* FIXME: reffing the inbuffer should make the transformation not be
786 gst_buffer_ref (inbuffer);
789 /* pushing gives away my reference ... */
790 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
791 /* ... but it ends up being modified inplace and
792 * collected on the global buffer list */
793 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
794 fail_unless_equals_int (g_list_length (buffers), 1);
795 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
796 fail_unless (inbuffer == outbuffer);
797 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
799 res_32[0] = get_unaligned_i24 (res);
800 res_32[1] = get_unaligned_i24 ((res + 3));
802 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
803 res_32[0], res_32[1]);
804 fail_unless (memcmp (res_32, out_32, 8) == 0);
805 gst_buffer_unmap (outbuffer, res, size);
808 cleanup_volume (volume);
813 GST_START_TEST (test_ten_s24)
817 GstBuffer *outbuffer;
819 gint32 in_32[2] = { 4194304, -10 };
823 gint32 out_32[2] = { 8388607, -100 }; /* notice the clamped sample */
825 write_unaligned_u24 (in, in_32[0]);
826 write_unaligned_u24 (in + 3, in_32[1]);
828 volume = setup_volume ();
829 g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
830 fail_unless (gst_element_set_state (volume,
831 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
832 "could not set to playing");
834 inbuffer = gst_buffer_new_and_alloc (6);
835 memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
836 fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
837 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
838 gst_buffer_set_caps (inbuffer, caps);
839 gst_caps_unref (caps);
840 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
841 /* FIXME: reffing the inbuffer should make the transformation not be
843 gst_buffer_ref (inbuffer);
846 /* pushing gives away my reference ... */
847 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
848 /* ... but it ends up being modified inplace and
849 * collected on the global buffer list */
850 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
851 fail_unless_equals_int (g_list_length (buffers), 1);
852 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
853 fail_unless (inbuffer == outbuffer);
854 res = GST_BUFFER_DATA (outbuffer);
856 res_32[0] = get_unaligned_i24 (res);
857 res_32[1] = get_unaligned_i24 ((res + 3));
859 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
860 res_32[0], res_32[1]);
861 fail_unless (memcmp (res_32, out_32, 8) == 0);
864 cleanup_volume (volume);
869 GST_START_TEST (test_mute_s24)
873 GstBuffer *outbuffer;
875 gint32 in_32[2] = { 4194304, -4096 };
879 gint32 out_32[2] = { 0, 0 }; /* notice the clamped sample */
882 write_unaligned_u24 (in, in_32[0]);
883 write_unaligned_u24 (in + 3, in_32[1]);
885 volume = setup_volume ();
886 g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
887 fail_unless (gst_element_set_state (volume,
888 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
889 "could not set to playing");
891 inbuffer = gst_buffer_new_and_alloc (6);
892 gst_buffer_fill (inbuffer, 0, in, 6);
893 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
894 gst_buffer_set_caps (inbuffer, caps);
895 gst_caps_unref (caps);
896 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
897 /* FIXME: reffing the inbuffer should make the transformation not be
899 gst_buffer_ref (inbuffer);
902 /* pushing gives away my reference ... */
903 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
904 /* ... but it ends up being modified inplace and
905 * collected on the global buffer list */
906 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
907 fail_unless_equals_int (g_list_length (buffers), 1);
908 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
909 fail_unless (inbuffer == outbuffer);
911 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
913 res_32[0] = get_unaligned_i24 (res);
914 res_32[1] = get_unaligned_i24 ((res + 3));
916 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
917 res_32[0], res_32[1]);
918 fail_unless (memcmp (res_32, out_32, 8) == 0);
919 gst_buffer_unmap (outbuffer, res, size);
922 cleanup_volume (volume);
927 GST_START_TEST (test_unity_s32)
930 GstBuffer *inbuffer, *outbuffer;
932 gint32 in[2] = { 1073741824, -65536 };
936 volume = setup_volume ();
937 fail_unless (gst_element_set_state (volume,
938 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
939 "could not set to playing");
941 inbuffer = gst_buffer_new_and_alloc (8);
942 gst_buffer_fill (inbuffer, 0, in, 8);
943 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
944 gst_buffer_set_caps (inbuffer, caps);
945 gst_caps_unref (caps);
946 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
948 /* pushing gives away my reference ... */
949 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
950 /* ... but it ends up being collected on the global buffer list */
951 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
952 fail_unless_equals_int (g_list_length (buffers), 1);
953 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
954 fail_unless (inbuffer == outbuffer);
955 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
956 GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
957 fail_unless (memcmp (res, in, 8) == 0);
958 gst_buffer_unmap (outbuffer, res, size);
961 cleanup_volume (volume);
966 GST_START_TEST (test_half_s32)
970 GstBuffer *outbuffer;
972 gint32 in[2] = { 1073741824, -65536 };
973 gint32 out[2] = { 536870912, -32768 };
977 volume = setup_volume ();
978 g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
979 fail_unless (gst_element_set_state (volume,
980 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
981 "could not set to playing");
983 inbuffer = gst_buffer_new_and_alloc (8);
984 gst_buffer_fill (inbuffer, 0, in, 8);
985 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
986 gst_buffer_set_caps (inbuffer, caps);
987 gst_caps_unref (caps);
988 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
989 /* FIXME: reffing the inbuffer should make the transformation not be
991 gst_buffer_ref (inbuffer);
994 /* pushing gives away my reference ... */
995 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
996 /* ... but it ends up being modified inplace and
997 * collected on the global buffer list */
998 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
999 fail_unless_equals_int (g_list_length (buffers), 1);
1000 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1001 fail_unless (inbuffer == outbuffer);
1002 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1003 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
1005 fail_unless (memcmp (res, out, 8) == 0);
1006 gst_buffer_unmap (outbuffer, res, size);
1009 cleanup_volume (volume);
1014 GST_START_TEST (test_double_s32)
1017 GstBuffer *inbuffer;
1018 GstBuffer *outbuffer;
1020 gint32 in[2] = { 1073741824, -65536 };
1021 gint32 out[2] = { 2147483647, -131072 }; /* notice the clamped sample */
1025 volume = setup_volume ();
1026 g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
1027 fail_unless (gst_element_set_state (volume,
1028 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1029 "could not set to playing");
1031 inbuffer = gst_buffer_new_and_alloc (8);
1032 gst_buffer_fill (inbuffer, 0, in, 8);
1033 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
1034 gst_buffer_set_caps (inbuffer, caps);
1035 gst_caps_unref (caps);
1036 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1037 /* FIXME: reffing the inbuffer should make the transformation not be
1039 gst_buffer_ref (inbuffer);
1042 /* pushing gives away my reference ... */
1043 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1044 /* ... but it ends up being modified inplace and
1045 * collected on the global buffer list */
1046 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1047 fail_unless_equals_int (g_list_length (buffers), 1);
1048 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1049 fail_unless (inbuffer == outbuffer);
1050 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1051 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
1053 fail_unless (memcmp (res, out, 8) == 0);
1054 gst_buffer_unmap (outbuffer, res, size);
1057 cleanup_volume (volume);
1062 GST_START_TEST (test_ten_s32)
1065 GstBuffer *inbuffer;
1066 GstBuffer *outbuffer;
1068 gint32 in[2] = { 1073741824, -10 };
1069 gint32 out[2] = { 2147483647, -100 }; /* notice the clamped sample */
1072 volume = setup_volume ();
1073 g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
1074 fail_unless (gst_element_set_state (volume,
1075 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1076 "could not set to playing");
1078 inbuffer = gst_buffer_new_and_alloc (8);
1079 memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
1080 fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
1081 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
1082 gst_buffer_set_caps (inbuffer, caps);
1083 gst_caps_unref (caps);
1084 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1085 /* FIXME: reffing the inbuffer should make the transformation not be
1087 gst_buffer_ref (inbuffer);
1090 /* pushing gives away my reference ... */
1091 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1092 /* ... but it ends up being modified inplace and
1093 * collected on the global buffer list */
1094 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1095 fail_unless_equals_int (g_list_length (buffers), 1);
1096 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1097 fail_unless (inbuffer == outbuffer);
1098 res = (gint32 *) GST_BUFFER_DATA (outbuffer);
1099 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
1101 fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
1104 cleanup_volume (volume);
1109 GST_START_TEST (test_mute_s32)
1112 GstBuffer *inbuffer;
1113 GstBuffer *outbuffer;
1115 gint32 in[2] = { 1073741824, -65536 };
1116 gint32 out[2] = { 0, 0 };
1120 volume = setup_volume ();
1121 g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
1122 fail_unless (gst_element_set_state (volume,
1123 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1124 "could not set to playing");
1126 inbuffer = gst_buffer_new_and_alloc (8);
1127 gst_buffer_fill (inbuffer, 0, in, 8);
1128 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
1129 gst_buffer_set_caps (inbuffer, caps);
1130 gst_caps_unref (caps);
1131 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1132 /* FIXME: reffing the inbuffer should make the transformation not be
1134 gst_buffer_ref (inbuffer);
1137 /* pushing gives away my reference ... */
1138 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1139 /* ... but it ends up being modified inplace and
1140 * collected on the global buffer list */
1141 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1142 fail_unless_equals_int (g_list_length (buffers), 1);
1143 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1144 fail_unless (inbuffer == outbuffer);
1145 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1146 GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
1148 fail_unless (memcmp (res, out, 8) == 0);
1149 gst_buffer_unmap (outbuffer, res, size);
1152 cleanup_volume (volume);
1157 GST_START_TEST (test_unity_f32)
1160 GstBuffer *inbuffer, *outbuffer;
1162 gfloat in[2] = { 0.75, -0.25 };
1166 volume = setup_volume ();
1167 fail_unless (gst_element_set_state (volume,
1168 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1169 "could not set to playing");
1171 inbuffer = gst_buffer_new_and_alloc (8);
1172 gst_buffer_fill (inbuffer, 0, in, 8);
1173 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
1174 gst_buffer_set_caps (inbuffer, caps);
1175 gst_caps_unref (caps);
1176 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1178 /* pushing gives away my reference ... */
1179 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1180 /* ... but it ends up being collected on the global buffer list */
1181 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1182 fail_unless_equals_int (g_list_length (buffers), 1);
1183 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1184 fail_unless (inbuffer == outbuffer);
1185 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1186 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", in[0], in[1], res[0],
1188 fail_unless_equals_float (res[0], in[0]);
1189 fail_unless_equals_float (res[1], in[1]);
1192 cleanup_volume (volume);
1197 GST_START_TEST (test_half_f32)
1200 GstBuffer *inbuffer;
1201 GstBuffer *outbuffer;
1203 gfloat in[2] = { 0.75, -0.25 };
1204 gfloat out[2] = { 0.375, -0.125 };
1208 volume = setup_volume ();
1209 g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
1210 fail_unless (gst_element_set_state (volume,
1211 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1212 "could not set to playing");
1214 inbuffer = gst_buffer_new_and_alloc (8);
1215 gst_buffer_fill (inbuffer, 0, in, 8);
1216 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
1217 gst_buffer_set_caps (inbuffer, caps);
1218 gst_caps_unref (caps);
1219 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1220 /* FIXME: reffing the inbuffer should make the transformation not be
1222 gst_buffer_ref (inbuffer);
1225 /* pushing gives away my reference ... */
1226 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1227 /* ... but it ends up being modified inplace and
1228 * collected on the global buffer list */
1229 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1230 fail_unless_equals_int (g_list_length (buffers), 1);
1231 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1232 fail_unless (inbuffer == outbuffer);
1233 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1234 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1236 fail_unless_equals_float (res[0], out[0]);
1237 fail_unless_equals_float (res[1], out[1]);
1238 gst_buffer_unmap (outbuffer, res, size);
1241 cleanup_volume (volume);
1246 GST_START_TEST (test_double_f32)
1249 GstBuffer *inbuffer;
1250 GstBuffer *outbuffer;
1252 gfloat in[2] = { 0.75, -0.25 };
1253 gfloat out[2] = { 1.5, -0.5 }; /* nothing is clamped */
1257 volume = setup_volume ();
1258 g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
1259 fail_unless (gst_element_set_state (volume,
1260 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1261 "could not set to playing");
1263 inbuffer = gst_buffer_new_and_alloc (8);
1264 gst_buffer_fill (inbuffer, 0, in, 8);
1265 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
1266 gst_buffer_set_caps (inbuffer, caps);
1267 gst_caps_unref (caps);
1268 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1269 /* FIXME: reffing the inbuffer should make the transformation not be
1271 gst_buffer_ref (inbuffer);
1274 /* pushing gives away my reference ... */
1275 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1276 /* ... but it ends up being modified inplace and
1277 * collected on the global buffer list */
1278 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1279 fail_unless_equals_int (g_list_length (buffers), 1);
1280 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1281 fail_unless (inbuffer == outbuffer);
1282 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1283 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1285 fail_unless_equals_float (res[0], out[0]);
1286 fail_unless_equals_float (res[1], out[1]);
1287 gst_buffer_unmap (outbuffer, res, size);
1290 cleanup_volume (volume);
1295 GST_START_TEST (test_ten_f32)
1298 GstBuffer *inbuffer;
1299 GstBuffer *outbuffer;
1301 gfloat in[2] = { 0.75, -0.25 };
1302 gfloat out[2] = { 7.5, -2.5 }; /* nothing is clamped */
1305 volume = setup_volume ();
1306 g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
1307 fail_unless (gst_element_set_state (volume,
1308 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1309 "could not set to playing");
1311 inbuffer = gst_buffer_new_and_alloc (8);
1312 memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
1313 fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
1314 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
1315 gst_buffer_set_caps (inbuffer, caps);
1316 gst_caps_unref (caps);
1317 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1318 /* FIXME: reffing the inbuffer should make the transformation not be
1320 gst_buffer_ref (inbuffer);
1323 /* pushing gives away my reference ... */
1324 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1325 /* ... but it ends up being modified inplace and
1326 * collected on the global buffer list */
1327 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1328 fail_unless_equals_int (g_list_length (buffers), 1);
1329 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1330 fail_unless (inbuffer == outbuffer);
1331 res = (gfloat *) GST_BUFFER_DATA (outbuffer);
1332 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1334 fail_unless_equals_float (res[0], out[0]);
1335 fail_unless_equals_float (res[1], out[1]);
1338 cleanup_volume (volume);
1344 GST_START_TEST (test_mute_f32)
1347 GstBuffer *inbuffer;
1348 GstBuffer *outbuffer;
1350 gfloat in[2] = { 0.75, -0.25 };
1351 gfloat out[2] = { 0, 0 };
1355 volume = setup_volume ();
1356 g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
1357 fail_unless (gst_element_set_state (volume,
1358 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1359 "could not set to playing");
1361 inbuffer = gst_buffer_new_and_alloc (8);
1362 gst_buffer_fill (inbuffer, 0, in, 8);
1363 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
1364 gst_buffer_set_caps (inbuffer, caps);
1365 gst_caps_unref (caps);
1366 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1367 /* FIXME: reffing the inbuffer should make the transformation not be
1369 gst_buffer_ref (inbuffer);
1372 /* pushing gives away my reference ... */
1373 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1374 /* ... but it ends up being modified inplace and
1375 * collected on the global buffer list */
1376 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1377 fail_unless_equals_int (g_list_length (buffers), 1);
1378 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1379 fail_unless (inbuffer == outbuffer);
1380 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1381 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1383 fail_unless_equals_float (res[0], out[0]);
1384 fail_unless_equals_float (res[1], out[1]);
1385 gst_buffer_unmap (outbuffer, res, size);
1388 cleanup_volume (volume);
1393 GST_START_TEST (test_unity_f64)
1396 GstBuffer *inbuffer, *outbuffer;
1398 gdouble in[2] = { 0.75, -0.25 };
1402 volume = setup_volume ();
1403 fail_unless (gst_element_set_state (volume,
1404 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1405 "could not set to playing");
1407 inbuffer = gst_buffer_new_and_alloc (16);
1408 gst_buffer_fill (inbuffer, 0, in, 16);
1409 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
1410 gst_buffer_set_caps (inbuffer, caps);
1411 gst_caps_unref (caps);
1412 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1414 /* pushing gives away my reference ... */
1415 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1416 /* ... but it ends up being collected on the global buffer list */
1417 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1418 fail_unless_equals_int (g_list_length (buffers), 1);
1419 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1420 fail_unless (inbuffer == outbuffer);
1421 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1422 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", in[0], in[1], res[0],
1424 fail_unless_equals_float (res[0], in[0]);
1425 fail_unless_equals_float (res[1], in[1]);
1428 cleanup_volume (volume);
1433 GST_START_TEST (test_half_f64)
1436 GstBuffer *inbuffer;
1437 GstBuffer *outbuffer;
1439 gdouble in[2] = { 0.75, -0.25 };
1440 gdouble out[2] = { 0.375, -0.125 };
1444 volume = setup_volume ();
1445 g_object_set (G_OBJECT (volume), "volume", 0.5, NULL);
1446 fail_unless (gst_element_set_state (volume,
1447 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1448 "could not set to playing");
1450 inbuffer = gst_buffer_new_and_alloc (16);
1451 gst_buffer_fill (inbuffer, 0, in, 16);
1452 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
1453 gst_buffer_set_caps (inbuffer, caps);
1454 gst_caps_unref (caps);
1455 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1456 /* FIXME: reffing the inbuffer should make the transformation not be
1458 gst_buffer_ref (inbuffer);
1461 /* pushing gives away my reference ... */
1462 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1463 /* ... but it ends up being modified inplace and
1464 * collected on the global buffer list */
1465 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1466 fail_unless_equals_int (g_list_length (buffers), 1);
1467 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1468 fail_unless (inbuffer == outbuffer);
1469 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1470 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1472 fail_unless_equals_float (res[0], out[0]);
1473 fail_unless_equals_float (res[1], out[1]);
1474 gst_buffer_unmap (outbuffer, res, size);
1477 cleanup_volume (volume);
1482 GST_START_TEST (test_double_f64)
1485 GstBuffer *inbuffer;
1486 GstBuffer *outbuffer;
1488 gdouble in[2] = { 0.75, -0.25 };
1489 gdouble out[2] = { 1.5, -0.5 }; /* nothing is clamped */
1493 volume = setup_volume ();
1494 g_object_set (G_OBJECT (volume), "volume", 2.0, NULL);
1495 fail_unless (gst_element_set_state (volume,
1496 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1497 "could not set to playing");
1499 inbuffer = gst_buffer_new_and_alloc (16);
1500 gst_buffer_fill (inbuffer, 0, in, 16);
1501 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
1502 gst_buffer_set_caps (inbuffer, caps);
1503 gst_caps_unref (caps);
1504 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1505 /* FIXME: reffing the inbuffer should make the transformation not be
1507 gst_buffer_ref (inbuffer);
1510 /* pushing gives away my reference ... */
1511 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1512 /* ... but it ends up being modified inplace and
1513 * collected on the global buffer list */
1514 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1515 fail_unless_equals_int (g_list_length (buffers), 1);
1516 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1517 fail_unless (inbuffer == outbuffer);
1518 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1519 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1521 fail_unless_equals_float (res[0], out[0]);
1522 fail_unless_equals_float (res[1], out[1]);
1523 gst_buffer_unmap (outbuffer, res, size);
1526 cleanup_volume (volume);
1531 GST_START_TEST (test_ten_f64)
1534 GstBuffer *inbuffer;
1535 GstBuffer *outbuffer;
1537 gdouble in[2] = { 0.75, -0.25 };
1538 gdouble out[2] = { 7.5, -2.5 }; /* nothing is clamped */
1541 volume = setup_volume ();
1542 g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
1543 fail_unless (gst_element_set_state (volume,
1544 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1545 "could not set to playing");
1547 inbuffer = gst_buffer_new_and_alloc (16);
1548 memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
1549 fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
1550 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
1551 gst_buffer_set_caps (inbuffer, caps);
1552 gst_caps_unref (caps);
1553 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1554 /* FIXME: reffing the inbuffer should make the transformation not be
1556 gst_buffer_ref (inbuffer);
1559 /* pushing gives away my reference ... */
1560 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1561 /* ... but it ends up being modified inplace and
1562 * collected on the global buffer list */
1563 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1564 fail_unless_equals_int (g_list_length (buffers), 1);
1565 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1566 fail_unless (inbuffer == outbuffer);
1567 res = (gdouble *) GST_BUFFER_DATA (outbuffer);
1568 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1570 fail_unless_equals_float (res[0], out[0]);
1571 fail_unless_equals_float (res[1], out[1]);
1574 cleanup_volume (volume);
1580 GST_START_TEST (test_mute_f64)
1583 GstBuffer *inbuffer;
1584 GstBuffer *outbuffer;
1586 gdouble in[2] = { 0.75, -0.25 };
1587 gdouble out[2] = { 0, 0 };
1591 volume = setup_volume ();
1592 g_object_set (G_OBJECT (volume), "mute", TRUE, NULL);
1593 fail_unless (gst_element_set_state (volume,
1594 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1595 "could not set to playing");
1597 inbuffer = gst_buffer_new_and_alloc (16);
1598 gst_buffer_fill (inbuffer, 0, in, 16);
1599 caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
1600 gst_buffer_set_caps (inbuffer, caps);
1601 gst_caps_unref (caps);
1602 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1603 /* FIXME: reffing the inbuffer should make the transformation not be
1605 gst_buffer_ref (inbuffer);
1608 /* pushing gives away my reference ... */
1609 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1610 /* ... but it ends up being modified inplace and
1611 * collected on the global buffer list */
1612 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1613 fail_unless_equals_int (g_list_length (buffers), 1);
1614 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1615 fail_unless (inbuffer == outbuffer);
1616 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1617 GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
1619 fail_unless_equals_float (res[0], out[0]);
1620 fail_unless_equals_float (res[1], out[1]);
1621 gst_buffer_unmap (outbuffer, res, size);
1624 cleanup_volume (volume);
1629 GST_START_TEST (test_wrong_caps)
1632 GstBuffer *inbuffer;
1633 gint16 in[2] = { 16384, -256 };
1635 GstMessage *message;
1638 volume = setup_volume ();
1639 bus = gst_bus_new ();
1641 fail_unless (gst_element_set_state (volume,
1642 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1643 "could not set to playing");
1645 inbuffer = gst_buffer_new_and_alloc (4);
1646 gst_buffer_fill (inbuffer, 0, in, 4);
1647 caps = gst_caps_from_string (VOLUME_WRONG_CAPS_STRING);
1648 gst_buffer_set_caps (inbuffer, caps);
1649 gst_caps_unref (caps);
1650 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1651 gst_buffer_ref (inbuffer);
1653 /* set a bus here so we avoid getting state change messages */
1654 gst_element_set_bus (volume, bus);
1656 /* pushing gives an error because it can't negotiate with wrong caps */
1657 fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer),
1658 GST_FLOW_NOT_NEGOTIATED);
1659 /* ... and the buffer would have been lost if we didn't ref it ourselves */
1660 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1661 gst_buffer_unref (inbuffer);
1662 fail_unless_equals_int (g_list_length (buffers), 0);
1664 /* volume_set_caps should not have been called since basetransform caught
1665 * the negotiation problem */
1666 fail_if ((message = gst_bus_pop (bus)) != NULL);
1669 gst_element_set_bus (volume, NULL);
1670 gst_object_unref (GST_OBJECT (bus));
1671 cleanup_volume (volume);
1676 GST_START_TEST (test_passthrough)
1679 GstBuffer *inbuffer, *outbuffer;
1681 gint16 in[2] = { 16384, -256 };
1685 volume = setup_volume ();
1686 g_object_set (G_OBJECT (volume), "volume", 1.0, NULL);
1687 fail_unless (gst_element_set_state (volume,
1688 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1689 "could not set to playing");
1691 inbuffer = gst_buffer_new_and_alloc (4);
1692 gst_buffer_fill (inbuffer, 0, in, 4);
1693 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
1694 gst_buffer_set_caps (inbuffer, caps);
1695 gst_caps_unref (caps);
1696 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1698 /* pushing gives away my reference ... */
1699 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1700 /* ... but it ends up being collected on the global buffer list */
1701 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1702 fail_unless_equals_int (g_list_length (buffers), 1);
1703 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1704 fail_unless (inbuffer == outbuffer);
1705 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1706 GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
1707 fail_unless (memcmp (res, in, 4) == 0);
1708 gst_buffer_unmap (outbuffer, res, size);
1711 cleanup_volume (volume);
1716 GST_START_TEST (test_controller_usability)
1718 GstInterpolationControlSource *csource;
1721 GValue value = { 0, };
1723 /* note: the volume element should init the controller library for us */
1724 volume = setup_volume ();
1726 c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
1728 fail_unless (GST_IS_CONTROLLER (c));
1730 /* this shouldn't crash, whether this mode is implemented or not */
1731 csource = gst_interpolation_control_source_new ();
1732 gst_interpolation_control_source_set_interpolation_mode (csource,
1733 GST_INTERPOLATE_CUBIC);
1734 gst_controller_set_control_source (c, "volume", GST_CONTROL_SOURCE (csource));
1735 g_object_unref (csource);
1737 g_value_init (&value, G_TYPE_DOUBLE);
1738 g_value_set_double (&value, 0.0);
1739 gst_interpolation_control_source_set (csource, 0 * GST_SECOND, &value);
1740 g_value_set_double (&value, 1.0);
1741 gst_interpolation_control_source_set (csource, 5 * GST_SECOND, &value);
1742 g_value_set_double (&value, 0.0);
1743 gst_interpolation_control_source_set (csource, 10 * GST_SECOND, &value);
1744 g_value_unset (&value);
1748 cleanup_volume (volume);
1753 GST_START_TEST (test_controller_processing)
1755 GstInterpolationControlSource *csource;
1758 GstBuffer *inbuffer, *outbuffer;
1760 gint16 in[2] = { 16384, -256 };
1764 volume = setup_volume ();
1766 c = gst_controller_new (G_OBJECT (volume), "volume", NULL);
1768 fail_unless (GST_IS_CONTROLLER (c));
1770 csource = gst_interpolation_control_source_new ();
1771 gst_interpolation_control_source_set_interpolation_mode (csource,
1772 GST_INTERPOLATE_CUBIC);
1773 gst_controller_set_control_source (c, "volume", GST_CONTROL_SOURCE (csource));
1774 g_object_unref (csource);
1776 fail_unless (gst_element_set_state (volume,
1777 GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
1778 "could not set to playing");
1780 inbuffer = gst_buffer_new_and_alloc (4);
1781 gst_buffer_fill (inbuffer, 0, in, 4);
1782 caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
1783 gst_buffer_set_caps (inbuffer, caps);
1784 GST_BUFFER_TIMESTAMP (inbuffer) = 0;
1785 gst_caps_unref (caps);
1786 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1788 /* pushing gives away my reference ... */
1789 fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
1790 /* ... but it ends up being collected on the global buffer list */
1791 ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
1792 fail_unless_equals_int (g_list_length (buffers), 1);
1793 fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
1794 fail_unless (inbuffer == outbuffer);
1795 res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
1796 GST_INFO ("expected %+5d %+5d real %+5d %+5d", in[0], in[1], res[0], res[1]);
1797 fail_unless (memcmp (res, in, 4) == 0);
1798 gst_buffer_unmap (outbuffer, res, size);
1802 cleanup_volume (volume);
1810 Suite *s = suite_create ("volume");
1811 TCase *tc_chain = tcase_create ("general");
1813 suite_add_tcase (s, tc_chain);
1814 tcase_add_test (tc_chain, test_get_set);
1815 tcase_add_test (tc_chain, test_unity_s8);
1816 tcase_add_test (tc_chain, test_half_s8);
1817 tcase_add_test (tc_chain, test_double_s8);
1818 tcase_add_test (tc_chain, test_ten_s8);
1819 tcase_add_test (tc_chain, test_mute_s8);
1820 tcase_add_test (tc_chain, test_unity_s16);
1821 tcase_add_test (tc_chain, test_half_s16);
1822 tcase_add_test (tc_chain, test_double_s16);
1823 tcase_add_test (tc_chain, test_ten_s16);
1824 tcase_add_test (tc_chain, test_mute_s16);
1825 tcase_add_test (tc_chain, test_unity_s24);
1826 tcase_add_test (tc_chain, test_half_s24);
1827 tcase_add_test (tc_chain, test_double_s24);
1828 tcase_add_test (tc_chain, test_ten_s24);
1829 tcase_add_test (tc_chain, test_mute_s24);
1830 tcase_add_test (tc_chain, test_unity_s32);
1831 tcase_add_test (tc_chain, test_half_s32);
1832 tcase_add_test (tc_chain, test_double_s32);
1833 tcase_add_test (tc_chain, test_ten_s32);
1834 tcase_add_test (tc_chain, test_mute_s32);
1835 tcase_add_test (tc_chain, test_unity_f32);
1836 tcase_add_test (tc_chain, test_half_f32);
1837 tcase_add_test (tc_chain, test_double_f32);
1838 tcase_add_test (tc_chain, test_ten_f32);
1839 tcase_add_test (tc_chain, test_mute_f32);
1840 tcase_add_test (tc_chain, test_unity_f64);
1841 tcase_add_test (tc_chain, test_half_f64);
1842 tcase_add_test (tc_chain, test_double_f64);
1843 tcase_add_test (tc_chain, test_ten_f64);
1844 tcase_add_test (tc_chain, test_mute_f64);
1845 tcase_add_test (tc_chain, test_wrong_caps);
1846 tcase_add_test (tc_chain, test_passthrough);
1847 tcase_add_test (tc_chain, test_controller_usability);
1848 tcase_add_test (tc_chain, test_controller_processing);
1853 GST_CHECK_MAIN (volume)