tests: audiocheblimit: port to 0.11

This commit is contained in:
René Stadler 2011-10-28 13:06:20 +02:00
parent 42f401a7eb
commit 8e0213a47a

View file

@ -21,6 +21,7 @@
*/
#include <gst/gst.h>
#include <gst/audio/audio.h>
#include <gst/base/gstbasetransform.h>
#include <gst/check/gstcheck.h>
@ -32,35 +33,35 @@
GstPad *mysrcpad, *mysinkpad;
#define BUFFER_CAPS_STRING_32 \
"audio/x-raw-float, " \
"audio/x-raw, " \
"channels = (int) 1, " \
"rate = (int) 44100, " \
"endianness = (int) BYTE_ORDER, " \
"width = (int) 32" \
"format = (string) " GST_AUDIO_NE(F32)
#define BUFFER_CAPS_STRING_64 \
"audio/x-raw-float, " \
"audio/x-raw, " \
"channels = (int) 1, " \
"rate = (int) 44100, " \
"endianness = (int) BYTE_ORDER, " \
"width = (int) 64" \
"format = (string) " 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, "
GST_STATIC_CAPS ("audio/x-raw, "
"channels = (int) 1, "
"rate = (int) 44100, "
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
);
"format = (string) { "
GST_AUDIO_NE(F32) ", "
GST_AUDIO_NE(F64) " }"));
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-float, "
GST_STATIC_CAPS ("audio/x-raw, "
"channels = (int) 1, "
"rate = (int) 44100, "
"endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
);
"format = (string) { "
GST_AUDIO_NE(F32) ", "
GST_AUDIO_NE(F64) " }"));
static GstElement *
setup_audiocheblimit (void)
@ -116,13 +117,14 @@ GST_START_TEST (test_type1_32_lp_0hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -132,7 +134,7 @@ GST_START_TEST (test_type1_32_lp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -140,6 +142,8 @@ GST_START_TEST (test_type1_32_lp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -169,15 +173,16 @@ GST_START_TEST (test_type1_32_lp_22050hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -187,7 +192,7 @@ GST_START_TEST (test_type1_32_lp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -195,6 +200,8 @@ GST_START_TEST (test_type1_32_lp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -224,13 +231,14 @@ GST_START_TEST (test_type1_32_hp_0hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -240,7 +248,7 @@ GST_START_TEST (test_type1_32_hp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -248,6 +256,8 @@ GST_START_TEST (test_type1_32_hp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -277,15 +287,16 @@ GST_START_TEST (test_type1_32_hp_22050hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -295,7 +306,7 @@ GST_START_TEST (test_type1_32_hp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -303,6 +314,8 @@ GST_START_TEST (test_type1_32_hp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -332,13 +345,14 @@ GST_START_TEST (test_type1_64_lp_0hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -348,7 +362,7 @@ GST_START_TEST (test_type1_64_lp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -356,6 +370,8 @@ GST_START_TEST (test_type1_64_lp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -385,15 +401,16 @@ GST_START_TEST (test_type1_64_lp_22050hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -403,7 +420,7 @@ GST_START_TEST (test_type1_64_lp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -411,6 +428,8 @@ GST_START_TEST (test_type1_64_lp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -440,13 +459,14 @@ GST_START_TEST (test_type1_64_hp_0hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -456,7 +476,7 @@ GST_START_TEST (test_type1_64_hp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -464,6 +484,8 @@ GST_START_TEST (test_type1_64_hp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -493,15 +515,16 @@ GST_START_TEST (test_type1_64_hp_22050hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -511,7 +534,7 @@ GST_START_TEST (test_type1_64_hp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -519,6 +542,8 @@ GST_START_TEST (test_type1_64_hp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -548,13 +573,14 @@ GST_START_TEST (test_type2_32_lp_0hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -564,7 +590,7 @@ GST_START_TEST (test_type2_32_lp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -572,6 +598,8 @@ GST_START_TEST (test_type2_32_lp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -601,15 +629,16 @@ GST_START_TEST (test_type2_32_lp_22050hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -619,7 +648,7 @@ GST_START_TEST (test_type2_32_lp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -627,6 +656,8 @@ GST_START_TEST (test_type2_32_lp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -656,13 +687,14 @@ GST_START_TEST (test_type2_32_hp_0hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -672,7 +704,7 @@ GST_START_TEST (test_type2_32_hp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -680,6 +712,8 @@ GST_START_TEST (test_type2_32_hp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -709,15 +743,16 @@ GST_START_TEST (test_type2_32_hp_22050hz)
"could not set to playing");
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat));
in = (gfloat *) GST_BUFFER_DATA (inbuffer);
inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), 0);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -727,7 +762,7 @@ GST_START_TEST (test_type2_32_hp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -735,6 +770,8 @@ GST_START_TEST (test_type2_32_hp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -765,12 +802,13 @@ GST_START_TEST (test_type2_64_lp_0hz)
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -780,7 +818,7 @@ GST_START_TEST (test_type2_64_lp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -788,6 +826,8 @@ GST_START_TEST (test_type2_64_lp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -818,14 +858,15 @@ GST_START_TEST (test_type2_64_lp_22050hz)
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -835,7 +876,7 @@ GST_START_TEST (test_type2_64_lp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -843,6 +884,8 @@ GST_START_TEST (test_type2_64_lp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -873,12 +916,13 @@ GST_START_TEST (test_type2_64_hp_0hz)
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i++)
in[i] = 1.0;
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -888,7 +932,7 @@ GST_START_TEST (test_type2_64_hp_0hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -896,6 +940,8 @@ GST_START_TEST (test_type2_64_hp_0hz)
rms = sqrt (rms / 128.0);
fail_unless (rms <= 0.1);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}
@ -926,14 +972,15 @@ GST_START_TEST (test_type2_64_hp_22050hz)
g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
in = (gdouble *) GST_BUFFER_DATA (inbuffer);
in = gst_buffer_map (inbuffer, NULL, NULL, GST_MAP_WRITE);
for (i = 0; i < 128; i += 2) {
in[i] = 1.0;
in[i + 1] = -1.0;
}
gst_buffer_unmap (inbuffer, in, -1);
caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
gst_buffer_set_caps (inbuffer, caps);
fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
@ -943,7 +990,7 @@ GST_START_TEST (test_type2_64_hp_22050hz)
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
res = gst_buffer_map (outbuffer, NULL, NULL, GST_MAP_READ);
rms = 0.0;
for (i = 0; i < 128; i++)
@ -951,6 +998,8 @@ GST_START_TEST (test_type2_64_hp_22050hz)
rms = sqrt (rms / 128.0);
fail_unless (rms >= 0.9);
gst_buffer_unmap (outbuffer, res, -1);
/* cleanup */
cleanup_audiocheblimit (audiocheblimit);
}