Commit 08d8b810 authored by Wim Taymans's avatar Wim Taymans
Browse files

tests: fix some unit tests

Remove unit test for GstIndex.
Make some other unit tests compile
parent 27ee8931
......@@ -99,7 +99,6 @@ endif
check_PROGRAMS = \
generic/index \
generic/states \
elements/aacparse \
elements/ac3parse \
......@@ -217,14 +216,23 @@ elements_audiodynamic_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMIN
elements_audioecho_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_audioecho_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
elements_audioinvert_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_audioinvert_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
elements_audiopanorama_LDADD = \
$(GST_BASE_LIBS) $(GST_CONTROLLER_LIBS) \
$(LDADD)
$(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(GST_BASE_LIBS) \
$(GST_CONTROLLER_LIBS) $(LDADD)
elements_audiopanorama_CFLAGS = \
$(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) \
$(CFLAGS) $(AM_CFLAGS)
elements_audiowsincband_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_audiowsincband_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
elements_audiowsinclimit_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_audiowsinclimit_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD)
elements_cmmldec_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_cmmlenc_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
......
......@@ -88,15 +88,20 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad,
gpointer user_data)
{
if (!have_data) {
gdouble *data = (gdouble *) GST_BUFFER_DATA (buffer);
gsize size;
gdouble *data;
fail_unless (GST_BUFFER_SIZE (buffer) > 5 * sizeof (gdouble));
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
fail_unless (size > 5 * sizeof (gdouble));
fail_unless (data[0] == 0.0);
fail_unless (data[1] == 0.0);
fail_unless (data[2] == 0.0);
fail_unless (data[3] == 0.0);
fail_unless (data[4] == 0.0);
fail_unless (data[5] != 0.0);
gst_buffer_unmap (buffer, data, size);
have_data = TRUE;
}
}
......
......@@ -98,15 +98,20 @@ on_handoff (GstElement * object, GstBuffer * buffer, GstPad * pad,
gpointer user_data)
{
if (!have_data) {
gdouble *data = (gdouble *) GST_BUFFER_DATA (buffer);
gsize size;
gdouble *data;
fail_unless (GST_BUFFER_SIZE (buffer) > 5 * sizeof (gdouble));
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
fail_unless (size > 5 * sizeof (gdouble));
fail_unless (data[0] == 0.0);
fail_unless (data[1] == 0.0);
fail_unless (data[2] == 0.0);
fail_unless (data[3] == 0.0);
fail_unless (data[4] == 0.0);
fail_unless (data[5] != 0.0);
gst_buffer_unmap (buffer, data, size);
have_data = TRUE;
}
}
......
......@@ -25,6 +25,7 @@
#include <unistd.h>
#include <gst/audio/audio.h>
#include <gst/base/gstbasetransform.h>
#include <gst/check/gstcheck.h>
......@@ -102,10 +103,10 @@ GST_START_TEST (test_passthrough)
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
gst_buffer_fill (inbuffer, 0, in, 8);
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
caps = gst_caps_from_string (INVERT_CAPS_STRING);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -115,10 +116,12 @@ GST_START_TEST (test_passthrough)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
in[0], in[1], in[2], in[3], res[0], res[1], res[2], res[3]);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), in, 8) == 0);
gst_buffer_unmap (outbuffer, res, -1);
fail_unless (gst_buffer_memcmp (outbuffer, 0, in, 8) == 0);
/* cleanup */
cleanup_invert (invert);
......@@ -142,10 +145,10 @@ GST_START_TEST (test_zero)
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
gst_buffer_fill (inbuffer, 0, in, 8);
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
caps = gst_caps_from_string (INVERT_CAPS_STRING);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -155,10 +158,12 @@ GST_START_TEST (test_zero)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
gst_buffer_unmap (outbuffer, res, -1);
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
/* cleanup */
cleanup_invert (invert);
......@@ -182,10 +187,10 @@ GST_START_TEST (test_full_inverse)
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
gst_buffer_fill (inbuffer, 0, in, 8);
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
caps = gst_caps_from_string (INVERT_CAPS_STRING);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -195,10 +200,12 @@ GST_START_TEST (test_full_inverse)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
gst_buffer_unmap (outbuffer, res, -1);
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
/* cleanup */
cleanup_invert (invert);
......@@ -222,10 +229,10 @@ GST_START_TEST (test_25_inverse)
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
gst_buffer_fill (inbuffer, 0, in, 8);
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
caps = gst_caps_from_string (INVERT_CAPS_STRING);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -235,10 +242,12 @@ GST_START_TEST (test_25_inverse)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
out[0], out[1], out[2], out[3], res[0], res[1], res[2], res[3]);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
gst_buffer_unmap (outbuffer, res, -1);
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
/* cleanup */
cleanup_invert (invert);
......
......@@ -21,6 +21,7 @@
*/
#include <gst/gst.h>
#include <gst/audio/audio.h>
#include <gst/base/gstbasetransform.h>
#include <gst/check/gstcheck.h>
......@@ -32,34 +33,32 @@
GstPad *mysrcpad, *mysinkpad;
#define AUDIO_WSINC_BAND_CAPS_STRING_32 \
"audio/x-raw-float, " \
"channels = (int) 1, " \
"rate = (int) 44100, " \
"endianness = (int) BYTE_ORDER, " \
"width = (int) 32" \
"audio/x-raw, " \
"format = (string) " GST_AUDIO_NE (F32) ", " \
"channels = (int) 1, " \
"rate = (int) 44100"
#define AUDIO_WSINC_BAND_CAPS_STRING_64 \
"audio/x-raw-float, " \
"channels = (int) 1, " \
"rate = (int) 44100, " \
"endianness = (int) BYTE_ORDER, " \
"width = (int) 64" \
"audio/x-raw, " \
"format = (string) " GST_AUDIO_NE (F64) ", " \
"channels = (int) 1, " \
"rate = (int) 44100"
#define FORMATS "{ "GST_AUDIO_NE (F32)","GST_AUDIO_NE (F64)" }"
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-float, "
"channels = (int) 1, "
"rate = (int) 44100, "
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 } ")
GST_STATIC_CAPS ("audio/x-raw, "
"format = (string) " FORMATS ", "
"channels = (int) 1, " "rate = (int) 44100")
);
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-float, "
"channels = (int) 1, "
"rate = (int) 44100, "
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 } ")
GST_STATIC_CAPS ("audio/x-raw, "
"format = (string) " FORMATS ", "
"channels = (int) 1, " "rate = (int) 44100")
);
static GstElement *
......@@ -120,12 +119,14 @@ GST_START_TEST (test_32_bp_0hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -137,11 +138,13 @@ GST_START_TEST (test_32_bp_0hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gfloat);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -182,16 +185,17 @@ GST_START_TEST (test_32_bp_11025hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i += 4) {
in[i] = 0.0;
in[i + 1] = 1.0;
in[i + 2] = 0.0;
in[i + 3] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -203,11 +207,12 @@ GST_START_TEST (test_32_bp_11025hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gfloat);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -249,14 +254,15 @@ GST_START_TEST (test_32_bp_22050hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -268,11 +274,12 @@ GST_START_TEST (test_32_bp_22050hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gfloat);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -313,12 +320,13 @@ GST_START_TEST (test_32_br_0hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -330,11 +338,12 @@ GST_START_TEST (test_32_br_0hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gfloat);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -375,7 +384,7 @@ GST_START_TEST (test_32_br_11025hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i += 4) {
in[i] = 0.0;
......@@ -383,9 +392,10 @@ GST_START_TEST (test_32_br_11025hz)
in[i + 2] = 0.0;
in[i + 3] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -397,11 +407,12 @@ GST_START_TEST (test_32_br_11025hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gfloat);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -443,14 +454,15 @@ GST_START_TEST (test_32_br_22050hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -462,11 +474,12 @@ GST_START_TEST (test_32_br_22050hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gfloat);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -505,12 +518,13 @@ GST_START_TEST (test_32_small_buffer)
44100 / 4.0 + 44100 / 16.0, NULL);
inbuffer = gst_buffer_new_and_alloc (20 * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 20; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -561,12 +575,13 @@ GST_START_TEST (test_64_bp_0hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -578,11 +593,12 @@ GST_START_TEST (test_64_bp_0hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gdouble);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -623,16 +639,17 @@ GST_START_TEST (test_64_bp_11025hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i += 4) {
in[i] = 0.0;
in[i + 1] = 1.0;
in[i + 2] = 0.0;
in[i + 3] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -644,11 +661,12 @@ GST_START_TEST (test_64_bp_11025hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gdouble);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -690,14 +708,15 @@ GST_START_TEST (test_64_bp_22050hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -709,11 +728,12 @@ GST_START_TEST (test_64_bp_22050hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
buffer_length = GST_BUFFER_SIZE (outbuffer) / sizeof (gdouble);
res = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ);
buffer_length = size / sizeof (gfloat);
rms = 0.0;
for (i = 0; i < buffer_length; i++)
rms += res[i] * res[i];
......@@ -754,12 +774,13 @@ GST_START_TEST (test_64_br_0hz)
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 1024; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (AUDIO_WSINC_BAND_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
......@@ -771,11 +792,12 @@ GST_START_TEST (test_64_br_0hz)
for (node = buffers; node; node = node->next) {
gint buffer_length;
gsize size;
fail_if ((outbuffer = (GstBuffer *) node->data) == NULL);