#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
+#include <gst/audio/audio.h>
#include <gst/check/gstcheck.h>
#include <math.h>
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_audiochebband (void)
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.6);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.6);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.6);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
44100 / 4.0 - 1000, NULL);
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
- inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat));
- in = (gfloat *) GST_BUFFER_DATA (inbuffer);
+ inbuffer = gst_buffer_new_allocate (NULL, 1024 * sizeof (gfloat), 0);
+ 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.6);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms <= 0.1);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}
g_object_set (G_OBJECT (audiochebband), "upper-frequency",
44100 / 4.0 + 1000, NULL);
inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble));
- 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 (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);
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 < 1024; i++)
rms = sqrt (rms / 1024.0);
fail_unless (rms >= 0.9);
+ gst_buffer_unmap (outbuffer, res, -1);
+
/* cleanup */
cleanup_audiochebband (audiochebband);
}