mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-03 16:09:39 +00:00
tests: audiopanorama: port to 0.11
This commit is contained in:
parent
7dba29cbd3
commit
f1c471b2b1
1 changed files with 95 additions and 117 deletions
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/base/gstbasetransform.h>
|
#include <gst/base/gstbasetransform.h>
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
|
@ -34,59 +35,47 @@ GstPad *mysrcpad, *mysinkpad;
|
||||||
|
|
||||||
|
|
||||||
#define PANORAMA_MONO_CAPS_STRING \
|
#define PANORAMA_MONO_CAPS_STRING \
|
||||||
"audio/x-raw-int, " \
|
"audio/x-raw, " \
|
||||||
"channels = (int) 1, " \
|
"channels = (int) 1, " \
|
||||||
"rate = (int) 44100, " \
|
"rate = (int) 44100, " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"format = (string) " GST_AUDIO_NE(S16)
|
||||||
"width = (int) 16, " \
|
|
||||||
"depth = (int) 16, " \
|
|
||||||
"signed = (bool) TRUE"
|
|
||||||
|
|
||||||
#define PANORAMA_STEREO_CAPS_STRING \
|
#define PANORAMA_STEREO_CAPS_STRING \
|
||||||
"audio/x-raw-int, " \
|
"audio/x-raw, " \
|
||||||
"channels = (int) 2, " \
|
"channels = (int) 2, " \
|
||||||
"rate = (int) 44100, " \
|
"rate = (int) 44100, " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"format = (string) " GST_AUDIO_NE(S16)
|
||||||
"width = (int) 16, " \
|
|
||||||
"depth = (int) 16, " \
|
|
||||||
"signed = (bool) TRUE"
|
|
||||||
|
|
||||||
#define PANORAMA_WRONG_CAPS_STRING \
|
#define PANORAMA_WRONG_CAPS_STRING \
|
||||||
"audio/x-raw-int, " \
|
"audio/x-raw, " \
|
||||||
"channels = (int) 5, " \
|
"channels = (int) 5, " \
|
||||||
"rate = (int) 44100, " \
|
"rate = (int) 44100, " \
|
||||||
"endianness = (int) BYTE_ORDER, " \
|
"format = (string) " GST_AUDIO_NE(U16)
|
||||||
"width = (int) 16, " \
|
|
||||||
"depth = (int) 16, " \
|
|
||||||
"signed = (bool) FALSE"
|
|
||||||
|
|
||||||
|
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"channels = (int) 2, "
|
"channels = (int) 2, "
|
||||||
"rate = (int) [ 1, MAX ], "
|
"rate = (int) [ 1, MAX ], "
|
||||||
"endianness = (int) BYTE_ORDER, "
|
"format = (string) " GST_AUDIO_NE(S16))
|
||||||
"width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE")
|
|
||||||
);
|
);
|
||||||
static GstStaticPadTemplate msrctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate msrctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"channels = (int) 1, "
|
"channels = (int) 1, "
|
||||||
"rate = (int) [ 1, MAX ], "
|
"rate = (int) [ 1, MAX ], "
|
||||||
"endianness = (int) BYTE_ORDER, "
|
"format = (string) " GST_AUDIO_NE(S16))
|
||||||
"width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE")
|
|
||||||
);
|
);
|
||||||
static GstStaticPadTemplate ssrctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate ssrctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"channels = (int) 2, "
|
"channels = (int) 2, "
|
||||||
"rate = (int) [ 1, MAX ], "
|
"rate = (int) [ 1, MAX ], "
|
||||||
"endianness = (int) BYTE_ORDER, "
|
"format = (string) " GST_AUDIO_NE(S16))
|
||||||
"width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstElement *
|
static GstElement *
|
||||||
|
@ -142,18 +131,18 @@ GST_START_TEST (test_mono_middle)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[2] = { 16384, -256 };
|
gint16 in[2] = { 16384, -256 };
|
||||||
gint16 out[4] = { 8192, 8192, -128, -128 };
|
gint16 out[4] = { 8192, 8192, -128, -128 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_m ();
|
panorama = setup_panorama_m ();
|
||||||
fail_unless (gst_element_set_state (panorama,
|
fail_unless (gst_element_set_state (panorama,
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (4);
|
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 4);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
/* pushing gives away my reference ... */
|
/* pushing gives away my reference ... */
|
||||||
|
@ -162,10 +151,10 @@ GST_START_TEST (test_mono_middle)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -180,7 +169,7 @@ GST_START_TEST (test_mono_left)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[2] = { 16384, -256 };
|
gint16 in[2] = { 16384, -256 };
|
||||||
gint16 out[4] = { 16384, 0, -256, 0 };
|
gint16 out[4] = { 16384, 0, -256, 0 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_m ();
|
panorama = setup_panorama_m ();
|
||||||
g_object_set (G_OBJECT (panorama), "panorama", -1.0, NULL);
|
g_object_set (G_OBJECT (panorama), "panorama", -1.0, NULL);
|
||||||
|
@ -188,12 +177,12 @@ GST_START_TEST (test_mono_left)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (4);
|
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
|
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 4);
|
||||||
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 4) == 0);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
/* pushing gives away my reference ... */
|
/* pushing gives away my reference ... */
|
||||||
|
@ -202,10 +191,10 @@ GST_START_TEST (test_mono_left)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -220,7 +209,7 @@ GST_START_TEST (test_mono_right)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[2] = { 16384, -256 };
|
gint16 in[2] = { 16384, -256 };
|
||||||
gint16 out[4] = { 0, 16384, 0, -256 };
|
gint16 out[4] = { 0, 16384, 0, -256 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_m ();
|
panorama = setup_panorama_m ();
|
||||||
g_object_set (G_OBJECT (panorama), "panorama", 1.0, NULL);
|
g_object_set (G_OBJECT (panorama), "panorama", 1.0, NULL);
|
||||||
|
@ -228,12 +217,12 @@ GST_START_TEST (test_mono_right)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (4);
|
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
|
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 4);
|
||||||
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 4) == 0);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
/* pushing gives away my reference ... */
|
/* pushing gives away my reference ... */
|
||||||
|
@ -242,10 +231,10 @@ GST_START_TEST (test_mono_right)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -259,35 +248,32 @@ GST_START_TEST (test_stereo_middle)
|
||||||
GstBuffer *inbuffer, *outbuffer;
|
GstBuffer *inbuffer, *outbuffer;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[4] = { 16384, -256, 8192, 128 };
|
gint16 in[4] = { 16384, -256, 8192, 128 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_s ();
|
panorama = setup_panorama_s ();
|
||||||
fail_unless (gst_element_set_state (panorama,
|
fail_unless (gst_element_set_state (panorama,
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (8);
|
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 8);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
/* pushing gives away my reference ... so keep an extra one */
|
/* pushing gives away my reference ... */
|
||||||
gst_buffer_ref (inbuffer);
|
|
||||||
|
|
||||||
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
||||||
/* ... but it ends up being collected on the global buffer list */
|
/* ... but it ends up being collected on the global buffer list */
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (inbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, in, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
gst_buffer_unref (inbuffer);
|
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +286,7 @@ GST_START_TEST (test_stereo_left)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[4] = { 16384, -256, 8192, 128 };
|
gint16 in[4] = { 16384, -256, 8192, 128 };
|
||||||
gint16 out[4] = { 16384 - 256, 0, 8192 + 128, 0 };
|
gint16 out[4] = { 16384 - 256, 0, 8192 + 128, 0 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_s ();
|
panorama = setup_panorama_s ();
|
||||||
g_object_set (G_OBJECT (panorama), "panorama", -1.0, NULL);
|
g_object_set (G_OBJECT (panorama), "panorama", -1.0, NULL);
|
||||||
|
@ -308,12 +294,12 @@ GST_START_TEST (test_stereo_left)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"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);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 8);
|
||||||
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
/* pushing gives away my reference ... */
|
/* pushing gives away my reference ... */
|
||||||
|
@ -322,10 +308,10 @@ GST_START_TEST (test_stereo_left)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -340,7 +326,7 @@ GST_START_TEST (test_stereo_right)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[4] = { 16384, -256, 8192, 128 };
|
gint16 in[4] = { 16384, -256, 8192, 128 };
|
||||||
gint16 out[4] = { 0, -256 + 16384, 0, 128 + 8192 };
|
gint16 out[4] = { 0, -256 + 16384, 0, 128 + 8192 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_s ();
|
panorama = setup_panorama_s ();
|
||||||
g_object_set (G_OBJECT (panorama), "panorama", 1.0, NULL);
|
g_object_set (G_OBJECT (panorama), "panorama", 1.0, NULL);
|
||||||
|
@ -348,12 +334,12 @@ GST_START_TEST (test_stereo_right)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"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);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 8);
|
||||||
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
/* pushing gives away my reference ... */
|
/* pushing gives away my reference ... */
|
||||||
|
@ -362,10 +348,10 @@ GST_START_TEST (test_stereo_right)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8));
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -380,7 +366,7 @@ GST_START_TEST (test_mono_middle_simple)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[2] = { 16384, -256 };
|
gint16 in[2] = { 16384, -256 };
|
||||||
gint16 out[4] = { 16384, 16384, -256, -256 };
|
gint16 out[4] = { 16384, 16384, -256, -256 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_m ();
|
panorama = setup_panorama_m ();
|
||||||
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
||||||
|
@ -388,10 +374,9 @@ GST_START_TEST (test_mono_middle_simple)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (4);
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 4);
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -401,10 +386,10 @@ GST_START_TEST (test_mono_middle_simple)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -419,7 +404,7 @@ GST_START_TEST (test_mono_left_simple)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[2] = { 16384, -256 };
|
gint16 in[2] = { 16384, -256 };
|
||||||
gint16 out[4] = { 16384, 0, -256, 0 };
|
gint16 out[4] = { 16384, 0, -256, 0 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_m ();
|
panorama = setup_panorama_m ();
|
||||||
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
||||||
|
@ -428,11 +413,10 @@ GST_START_TEST (test_mono_left_simple)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (4);
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 4);
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 4) == 0);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -442,10 +426,10 @@ GST_START_TEST (test_mono_left_simple)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -460,7 +444,7 @@ GST_START_TEST (test_mono_right_simple)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[2] = { 16384, -256 };
|
gint16 in[2] = { 16384, -256 };
|
||||||
gint16 out[4] = { 0, 16384, 0, -256 };
|
gint16 out[4] = { 0, 16384, 0, -256 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_m ();
|
panorama = setup_panorama_m ();
|
||||||
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
||||||
|
@ -469,11 +453,10 @@ GST_START_TEST (test_mono_right_simple)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (4);
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 4);
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 4) == 0);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_MONO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -483,10 +466,10 @@ GST_START_TEST (test_mono_right_simple)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -500,7 +483,7 @@ GST_START_TEST (test_stereo_middle_simple)
|
||||||
GstBuffer *inbuffer, *outbuffer;
|
GstBuffer *inbuffer, *outbuffer;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[4] = { 16384, -256, 8192, 128 };
|
gint16 in[4] = { 16384, -256, 8192, 128 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_s ();
|
panorama = setup_panorama_s ();
|
||||||
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
||||||
|
@ -508,28 +491,24 @@ GST_START_TEST (test_stereo_middle_simple)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (8);
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 8);
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
/* pushing gives away my reference ... so keep an extra one */
|
/* pushing gives away my reference ... */
|
||||||
gst_buffer_ref (inbuffer);
|
|
||||||
|
|
||||||
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
|
||||||
/* ... but it ends up being collected on the global buffer list */
|
/* ... but it ends up being collected on the global buffer list */
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (inbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, in, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
gst_buffer_unref (inbuffer);
|
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +521,7 @@ GST_START_TEST (test_stereo_left_simple)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[4] = { 16384, -256, 8192, 128 };
|
gint16 in[4] = { 16384, -256, 8192, 128 };
|
||||||
gint16 out[4] = { 16384, 0, 8192, 0 };
|
gint16 out[4] = { 16384, 0, 8192, 0 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_s ();
|
panorama = setup_panorama_s ();
|
||||||
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
||||||
|
@ -551,11 +530,10 @@ GST_START_TEST (test_stereo_left_simple)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (8);
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 8);
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -565,10 +543,10 @@ GST_START_TEST (test_stereo_left_simple)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -583,7 +561,7 @@ GST_START_TEST (test_stereo_right_simple)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint16 in[4] = { 16384, -256, 8192, 128 };
|
gint16 in[4] = { 16384, -256, 8192, 128 };
|
||||||
gint16 out[4] = { 0, -256, 0, 128 };
|
gint16 out[4] = { 0, -256, 0, 128 };
|
||||||
gint16 *res;
|
gint16 res[4];
|
||||||
|
|
||||||
panorama = setup_panorama_s ();
|
panorama = setup_panorama_s ();
|
||||||
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
|
||||||
|
@ -592,11 +570,10 @@ GST_START_TEST (test_stereo_right_simple)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (8);
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 8);
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
|
fail_unless (gst_buffer_memcmp (inbuffer, 0, in, 8) == 0);
|
||||||
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
caps = gst_caps_from_string (PANORAMA_STEREO_CAPS_STRING);
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
|
|
||||||
|
@ -606,10 +583,10 @@ GST_START_TEST (test_stereo_right_simple)
|
||||||
fail_unless_equals_int (g_list_length (buffers), 1);
|
fail_unless_equals_int (g_list_length (buffers), 1);
|
||||||
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
||||||
|
|
||||||
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
|
fail_unless (gst_buffer_extract (outbuffer, 0, res, 8) == 8);
|
||||||
GST_INFO ("expected %+5d %+5d %+5d %+5d real %+5d %+5d %+5d %+5d",
|
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]);
|
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);
|
fail_unless (gst_buffer_memcmp (outbuffer, 0, out, 8) == 0);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
cleanup_panorama (panorama);
|
cleanup_panorama (panorama);
|
||||||
|
@ -633,17 +610,18 @@ GST_START_TEST (test_wrong_caps)
|
||||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||||
"could not set to playing");
|
"could not set to playing");
|
||||||
|
|
||||||
inbuffer = gst_buffer_new_and_alloc (4);
|
inbuffer = gst_buffer_new_wrapped_full (in, NULL, 0, 4);
|
||||||
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
|
|
||||||
caps = gst_caps_from_string (PANORAMA_WRONG_CAPS_STRING);
|
|
||||||
gst_buffer_set_caps (inbuffer, caps);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||||
gst_buffer_ref (inbuffer);
|
gst_buffer_ref (inbuffer);
|
||||||
|
|
||||||
/* set a bus here so we avoid getting state change messages */
|
/* set a bus here so we avoid getting state change messages */
|
||||||
gst_element_set_bus (panorama, bus);
|
gst_element_set_bus (panorama, bus);
|
||||||
|
|
||||||
|
caps = gst_caps_from_string (PANORAMA_WRONG_CAPS_STRING);
|
||||||
|
/* this actually succeeds, because the caps event is sticky */
|
||||||
|
fail_unless (gst_pad_set_caps (mysrcpad, caps));
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
/* pushing gives an error because it can't negotiate with wrong caps */
|
/* pushing gives an error because it can't negotiate with wrong caps */
|
||||||
fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer),
|
fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer),
|
||||||
GST_FLOW_NOT_NEGOTIATED);
|
GST_FLOW_NOT_NEGOTIATED);
|
||||||
|
|
Loading…
Reference in a new issue