*/
#include <gst/check/gstcheck.h>
+#include <gst/audio/audio.h>
gboolean have_eos = FALSE;
GstPad *mysrcpad, *mysinkpad;
#define ECHO_CAPS_STRING \
- "audio/x-raw-float, " \
+ "audio/x-raw, " \
"channels = (int) 2, " \
"rate = (int) 100000, " \
- "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, 2 ], "
"rate = (int) [ 1, MAX ], "
- "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, 2 ], "
"rate = (int) [ 1, MAX ], "
- "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }")
- );
+ "format = (string) { "
+ GST_AUDIO_NE(F32) ", "
+ GST_AUDIO_NE(F64) " }"));
static GstElement *
setup_echo (void)
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gdouble in[] = { 1.0, -1.0, 0.0, 0.5, -0.5, 0.0 };
- gdouble *res;
+ gdouble res[6];
echo = setup_echo ();
g_object_set (G_OBJECT (echo), "delay", (GstClockTime) 1, "intensity", 0.0,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- inbuffer = gst_buffer_new_and_alloc (sizeof (in));
- memcpy (GST_BUFFER_DATA (inbuffer), in, sizeof (in));
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, sizeof (in)) == 0);
caps = gst_caps_from_string (ECHO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
+
+ inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, sizeof (in));
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, sizeof (in)) == 0);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ fail_unless (gst_buffer_extract (outbuffer, 0, res, sizeof (res)) == sizeof (res));
GST_INFO
("expected %+lf %+lf %+lf %+lf %+lf %+lf real %+lf %+lf %+lf %+lf %+lf %+lf",
in[0], in[1], in[2], in[3], in[4], in[5], res[0], res[1], res[2], res[3],
res[4], res[5]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), in, sizeof (in)) == 0);
+ fail_unless (gst_buffer_memcmp (outbuffer, 0, in, sizeof (in)) == 0);
/* cleanup */
cleanup_echo (echo);
GstCaps *caps;
gdouble in[] = { 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, };
gdouble out[] = { 1.0, -1.0, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0 };
- gdouble *res;
+ gdouble res[10];
echo = setup_echo ();
g_object_set (G_OBJECT (echo), "delay", (GstClockTime) 20000, "intensity",
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- inbuffer = gst_buffer_new_and_alloc (sizeof (in));
- memcpy (GST_BUFFER_DATA (inbuffer), in, sizeof (in));
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, sizeof (in)) == 0);
caps = gst_caps_from_string (ECHO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
+
+ inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, sizeof (in));
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, sizeof (in)) == 0);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ fail_unless (gst_buffer_extract (outbuffer, 0, res, sizeof (res)) == sizeof (res));
GST_INFO
("expected %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf real %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf",
out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8],
out[9], res[0], res[1], res[2], res[3], res[4], res[5], res[6], res[7],
res[8], res[9]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, sizeof (out)) == 0);
+ fail_unless (gst_buffer_memcmp (outbuffer, 0, out, sizeof (out)) == 0);
/* cleanup */
cleanup_echo (echo);
GstCaps *caps;
gdouble in[] = { 1.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, };
gdouble out[] = { 1.0, -1.0, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 1.0, -1.0 };
- gdouble *res;
+ gdouble res[10];
echo = setup_echo ();
g_object_set (G_OBJECT (echo), "delay", (GstClockTime) 20000, "intensity",
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
- inbuffer = gst_buffer_new_and_alloc (sizeof (in));
- memcpy (GST_BUFFER_DATA (inbuffer), in, sizeof (in));
- fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, sizeof (in)) == 0);
caps = gst_caps_from_string (ECHO_CAPS_STRING);
- gst_buffer_set_caps (inbuffer, caps);
+ fail_unless (gst_pad_set_caps (mysrcpad, caps));
gst_caps_unref (caps);
+
+ inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, sizeof (in));
+ fail_unless (gst_buffer_memcmp (inbuffer, 0, in, sizeof (in)) == 0);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
- res = (gdouble *) GST_BUFFER_DATA (outbuffer);
+ fail_unless (gst_buffer_extract (outbuffer, 0, res, sizeof (res)) == sizeof (res));
GST_INFO
("expected %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf real %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf %+lf",
out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7], out[8],
out[9], res[0], res[1], res[2], res[3], res[4], res[5], res[6], res[7],
res[8], res[9]);
- fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, sizeof (out)) == 0);
+ fail_unless (gst_buffer_memcmp (outbuffer, 0, out, sizeof (out)) == 0);
/* cleanup */
cleanup_echo (echo);