gst/audiofx/audiopanorama.*: Add 'method' property and provide a simple (non-psychoacustic) processing method (#394859).

Original commit message from CVS:
Patch by: Sebastian Dröge <slomo circular-chaos org>
* gst/audiofx/audiopanorama.c:
(gst_audio_panorama_method_get_type),
(gst_audio_panorama_class_init), (gst_audio_panorama_init),
(gst_audio_panorama_set_process_function),
(gst_audio_panorama_set_property),
(gst_audio_panorama_get_property), (gst_audio_panorama_set_caps),
(gst_audio_panorama_transform_m2s_int_simple),
(gst_audio_panorama_transform_s2s_int_simple),
(gst_audio_panorama_transform_m2s_float_simple),
(gst_audio_panorama_transform_s2s_float_simple):
* gst/audiofx/audiopanorama.h:
Add 'method' property and provide a simple (non-psychoacustic)
processing method (#394859).
* tests/check/elements/audiopanorama.c: (GST_START_TEST),
(panorama_suite):
Tests for new method.
This commit is contained in:
Sebastian Dröge 2007-01-13 15:52:18 +00:00 committed by Tim-Philipp Müller
parent 3a4c011aa6
commit 22ebbb6912
4 changed files with 501 additions and 31 deletions

View file

@ -1,3 +1,25 @@
2007-01-13 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Sebastian Dröge <slomo circular-chaos org>
* gst/audiofx/audiopanorama.c:
(gst_audio_panorama_method_get_type),
(gst_audio_panorama_class_init), (gst_audio_panorama_init),
(gst_audio_panorama_set_process_function),
(gst_audio_panorama_set_property),
(gst_audio_panorama_get_property), (gst_audio_panorama_set_caps),
(gst_audio_panorama_transform_m2s_int_simple),
(gst_audio_panorama_transform_s2s_int_simple),
(gst_audio_panorama_transform_m2s_float_simple),
(gst_audio_panorama_transform_s2s_float_simple):
* gst/audiofx/audiopanorama.h:
Add 'method' property and provide a simple (non-psychoacustic)
processing method (#394859).
* tests/check/elements/audiopanorama.c: (GST_START_TEST),
(panorama_suite):
Tests for new method.
2007-01-11 Tim-Philipp Müller <tim at centricular dot net>
* gst/apetag/gsttagdemux.c: (gst_tag_demux_read_range):

View file

@ -1,6 +1,7 @@
/*
* GStreamer
* Copyright (C) 2006 Stefan Kost <ensonic@users.sf.net>
* Copyright (C) 2006 Sebastian Dröge <slomo@circular-chaos.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -23,13 +24,15 @@
* @short_description: audio stereo pan effect
*
* <refsect2>
* Stereo panorama effect with controllable pan position.
* Stereo panorama effect with controllable pan position. One can choose between the default psychoacoustic panning method,
* which keeps the same perceived loudness, and a simple panning method that just controls the volume on one channel.
* <title>Example launch line</title>
* <para>
* <programlisting>
* gst-launch audiotestsrc wave=saw ! audiopanorama panorama=-1.00 ! alsasink
* gst-launch filesrc location="melo1.ogg" ! oggdemux ! vorbisdec ! audioconvert ! audiopanorama panorama=-1.00 ! alsasink
* gst-launch audiotestsrc wave=saw ! audioconvert ! audiopanorama panorama=-1.00 ! audioconvert ! alsasink
* gst-launch audiotestsrc wave=saw ! audioconvert ! audiopanorama method=simple panorama=-0.50 ! audioconvert ! alsasink
* </programlisting>
* </para>
* </refsect2>
@ -64,9 +67,35 @@ enum
enum
{
PROP_0,
PROP_PANORAMA
PROP_PANORAMA,
PROP_METHOD
};
enum
{
METHOD_PSYCHOACOUSTIC,
METHOD_SIMPLE
};
#define GST_TYPE_AUDIO_PANORAMA_METHOD (gst_audio_panorama_method_get_type ())
static GType
gst_audio_panorama_method_get_type (void)
{
static GType gtype = 0;
if (gtype == 0) {
static const GEnumValue values[] = {
{METHOD_PSYCHOACOUSTIC, "Psychoacoustic Panning (default)",
"psychoacoustic"},
{METHOD_SIMPLE, "Simple Panning", "simple"},
{0, NULL, NULL}
};
gtype = g_enum_register_static ("GstAudioPanoramaMethod", values);
}
return gtype;
}
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
@ -122,6 +151,15 @@ static void gst_audio_panorama_transform_m2s_float (GstAudioPanorama * filter,
static void gst_audio_panorama_transform_s2s_float (GstAudioPanorama * filter,
gfloat * idata, gfloat * odata, guint num_samples);
static void gst_audio_panorama_transform_m2s_int_simple (GstAudioPanorama *
filter, gint16 * idata, gint16 * odata, guint num_samples);
static void gst_audio_panorama_transform_s2s_int_simple (GstAudioPanorama *
filter, gint16 * idata, gint16 * odata, guint num_samples);
static void gst_audio_panorama_transform_m2s_float_simple (GstAudioPanorama *
filter, gfloat * idata, gfloat * odata, guint num_samples);
static void gst_audio_panorama_transform_s2s_float_simple (GstAudioPanorama *
filter, gfloat * idata, gfloat * odata, guint num_samples);
static GstFlowReturn gst_audio_panorama_transform (GstBaseTransform * base,
GstBuffer * inbuf, GstBuffer * outbuf);
@ -152,6 +190,20 @@ gst_audio_panorama_class_init (GstAudioPanoramaClass * klass)
g_param_spec_float ("panorama", "Panorama",
"Position in stereo panorama (-1.0 left -> 1.0 right)", -1.0, 1.0,
0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
/**
* GstAudioPanorama:method
*
* Panning method: psychoacoustic mode keeps the same perceived loudness,
* while simple mode just controls the volume of one channel.
*
* Since: 0.10.6
**/
g_object_class_install_property (gobject_class, PROP_METHOD,
g_param_spec_enum ("method", "Panning method",
"Psychoacoustic mode keeps same perceived loudness, "
"simple mode just controls volume of one channel.",
GST_TYPE_AUDIO_PANORAMA_METHOD, METHOD_PSYCHOACOUSTIC,
G_PARAM_READWRITE));
GST_BASE_TRANSFORM_CLASS (klass)->get_unit_size =
GST_DEBUG_FUNCPTR (gst_audio_panorama_get_unit_size);
@ -168,7 +220,67 @@ gst_audio_panorama_init (GstAudioPanorama * filter,
GstAudioPanoramaClass * klass)
{
filter->panorama = 0;
filter->method = METHOD_PSYCHOACOUSTIC;
filter->width = 0;
filter->channels = 0;
filter->format_float = FALSE;
filter->process = NULL;
}
static gboolean
gst_audio_panorama_set_process_function (GstAudioPanorama * filter)
{
gboolean ret;
/* set processing function */
switch (filter->channels) {
case 1:
if (!filter->format_float) {
if (filter->method == METHOD_SIMPLE) {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_m2s_int_simple;
} else {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_m2s_int;
}
} else {
if (filter->method == METHOD_SIMPLE) {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_m2s_float_simple;
} else {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_m2s_float;
}
}
ret = TRUE;
break;
case 2:
if (!filter->format_float) {
if (filter->method == METHOD_SIMPLE) {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_s2s_int_simple;
} else {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_s2s_int;
}
} else {
if (filter->method == METHOD_SIMPLE) {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_s2s_float_simple;
} else {
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_s2s_float;
}
}
ret = TRUE;
break;
default:
ret = FALSE;
filter->process = NULL;
break;
}
return ret;
}
static void
@ -181,6 +293,10 @@ gst_audio_panorama_set_property (GObject * object, guint prop_id,
case PROP_PANORAMA:
filter->panorama = g_value_get_float (value);
break;
case PROP_METHOD:
filter->method = g_value_get_enum (value);
gst_audio_panorama_set_process_function (filter);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -197,6 +313,9 @@ gst_audio_panorama_get_property (GObject * object, guint prop_id,
case PROP_PANORAMA:
g_value_set_float (value, filter->panorama);
break;
case PROP_METHOD:
g_value_set_enum (value, filter->method);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -254,13 +373,13 @@ gst_audio_panorama_set_caps (GstBaseTransform * base, GstCaps * incaps,
GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base);
const GstStructure *structure;
gboolean ret;
gint channels, width;
gint width;
const gchar *fmt;
/*GST_INFO ("incaps are %" GST_PTR_FORMAT, incaps); */
structure = gst_caps_get_structure (incaps, 0);
ret = gst_structure_get_int (structure, "channels", &channels);
ret = gst_structure_get_int (structure, "channels", &filter->channels);
if (!ret)
goto no_channels;
@ -269,36 +388,19 @@ gst_audio_panorama_set_caps (GstBaseTransform * base, GstCaps * incaps,
goto no_width;
filter->width = width / 8;
fmt = gst_structure_get_name (structure);
if (!strcmp (fmt, "audio/x-raw-int"))
filter->format_float = FALSE;
else
filter->format_float = TRUE;
GST_DEBUG ("try to process %s input with %d channels", fmt, channels);
GST_DEBUG ("try to process %s input with %d channels", fmt, filter->channels);
ret = gst_audio_panorama_set_process_function (filter);
if (!ret)
GST_WARNING ("can't process input with %d channels", filter->channels);
/* set processing function */
switch (channels) {
case 1:
if (!strcmp (fmt, "audio/x-raw-int"))
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_m2s_int;
else
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_m2s_float;
ret = TRUE;
break;
case 2:
if (!strcmp (fmt, "audio/x-raw-int"))
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_s2s_int;
else
filter->process = (GstAudioPanoramaProcessFunc)
gst_audio_panorama_transform_s2s_float;
ret = TRUE;
break;
default:
filter->process = NULL;
ret = FALSE;
GST_WARNING ("can't process input with %d channels", channels);
}
return ret;
no_channels:
@ -309,6 +411,7 @@ no_width:
return ret;
}
/* psychoacoustic processing functions */
static void
gst_audio_panorama_transform_m2s_int (GstAudioPanorama * filter, gint16 * idata,
gint16 * odata, guint num_samples)
@ -437,6 +540,98 @@ gst_audio_panorama_transform_s2s_float (GstAudioPanorama * filter,
}
}
/* simple processing functions */
static void
gst_audio_panorama_transform_m2s_int_simple (GstAudioPanorama * filter,
gint16 * idata, gint16 * odata, guint num_samples)
{
guint i;
gdouble val;
glong lval, rval;
for (i = 0; i < num_samples; i++) {
val = (gdouble) * idata++;
if (filter->panorama > 0.0) {
lval = (glong) (val * (1.0 - filter->panorama));
rval = (glong) val;
} else {
lval = (glong) val;
rval = (glong) (val * (1.0 + filter->panorama));
}
*odata++ = (gint16) CLAMP (lval, G_MININT16, G_MAXINT16);
*odata++ = (gint16) CLAMP (rval, G_MININT16, G_MAXINT16);
}
}
static void
gst_audio_panorama_transform_s2s_int_simple (GstAudioPanorama * filter,
gint16 * idata, gint16 * odata, guint num_samples)
{
guint i;
glong lval, rval;
gdouble lival, rival;
for (i = 0; i < num_samples; i++) {
lival = (gdouble) * idata++;
rival = (gdouble) * idata++;
if (filter->panorama > 0.0) {
lval = (glong) (lival * (1.0 - filter->panorama));
rval = (glong) rival;
} else {
lval = (glong) lival;
rval = (glong) (rival * (1.0 + filter->panorama));
}
*odata++ = (gint16) CLAMP (lval, G_MININT16, G_MAXINT16);
*odata++ = (gint16) CLAMP (rval, G_MININT16, G_MAXINT16);
}
}
static void
gst_audio_panorama_transform_m2s_float_simple (GstAudioPanorama * filter,
gfloat * idata, gfloat * odata, guint num_samples)
{
guint i;
gfloat val;
for (i = 0; i < num_samples; i++) {
val = *idata++;
if (filter->panorama > 0.0) {
*odata++ = val * (1.0 - filter->panorama);
*odata++ = val;
} else {
*odata++ = val;
*odata++ = val * (1.0 + filter->panorama);
}
}
}
static void
gst_audio_panorama_transform_s2s_float_simple (GstAudioPanorama * filter,
gfloat * idata, gfloat * odata, guint num_samples)
{
guint i;
gfloat lival, rival;
for (i = 0; i < num_samples; i++) {
lival = *idata++;
rival = *idata++;
if (filter->panorama > 0.0) {
*odata++ = lival * (1.0 - filter->panorama);
*odata++ = rival;
} else {
*odata++ = lival;
*odata++ = rival * (1.0 + filter->panorama);
}
}
}
/* this function does the actual processing
*/
static GstFlowReturn

View file

@ -45,7 +45,10 @@ struct _GstAudioPanorama {
/* < private > */
GstAudioPanoramaProcessFunc process;
gint channels;
gboolean format_float;
gint width;
gint method;
};
struct _GstAudioPanoramaClass {

View file

@ -373,6 +373,250 @@ GST_START_TEST (test_stereo_right)
GST_END_TEST;
GST_START_TEST (test_mono_middle_simple)
{
GstElement *panorama;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gint16 in[2] = { 16384, -256 };
gint16 out[4] = { 16384, 16384, -256, -256 };
gint16 *res;
panorama = setup_panorama_m ();
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
fail_unless (gst_element_set_state (panorama,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"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);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being collected on the global buffer list */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5ld %+5ld %+5ld %+5ld real %+5ld %+5ld %+5ld %+5ld",
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);
/* cleanup */
cleanup_panorama (panorama);
}
GST_END_TEST;
GST_START_TEST (test_mono_left_simple)
{
GstElement *panorama;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gint16 in[2] = { 16384, -256 };
gint16 out[4] = { 16384, 0, -256, 0 };
gint16 *res;
panorama = setup_panorama_m ();
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
g_object_set (G_OBJECT (panorama), "panorama", -1.0, NULL);
fail_unless (gst_element_set_state (panorama,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"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);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... and puts a new buffer on the global list */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5ld %+5ld %+5ld %+5ld real %+5ld %+5ld %+5ld %+5ld",
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);
/* cleanup */
cleanup_panorama (panorama);
}
GST_END_TEST;
GST_START_TEST (test_mono_right_simple)
{
GstElement *panorama;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gint16 in[2] = { 16384, -256 };
gint16 out[4] = { 0, 16384, 0, -256 };
gint16 *res;
panorama = setup_panorama_m ();
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
g_object_set (G_OBJECT (panorama), "panorama", 1.0, NULL);
fail_unless (gst_element_set_state (panorama,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"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);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... and puts a new buffer on the global list */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5ld %+5ld %+5ld %+5ld real %+5ld %+5ld %+5ld %+5ld",
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);
/* cleanup */
cleanup_panorama (panorama);
}
GST_END_TEST;
GST_START_TEST (test_stereo_middle_simple)
{
GstElement *panorama;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gint16 in[4] = { 16384, -256, 8192, 128 };
gint16 *res;
panorama = setup_panorama_s ();
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
fail_unless (gst_element_set_state (panorama,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"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);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... so keep an extra one */
gst_buffer_ref (inbuffer);
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being collected on the global buffer list */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (inbuffer);
GST_INFO ("expected %+5ld %+5ld %+5ld %+5ld real %+5ld %+5ld %+5ld %+5ld",
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);
/* cleanup */
gst_buffer_unref (inbuffer);
cleanup_panorama (panorama);
}
GST_END_TEST;
GST_START_TEST (test_stereo_left_simple)
{
GstElement *panorama;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gint16 in[4] = { 16384, -256, 8192, 128 };
gint16 out[4] = { 16384, 0, 8192, 0 };
gint16 *res;
panorama = setup_panorama_s ();
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
g_object_set (G_OBJECT (panorama), "panorama", -1.0, NULL);
fail_unless (gst_element_set_state (panorama,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"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);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... and puts a new buffer on the global list */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5ld %+5ld %+5ld %+5ld real %+5ld %+5ld %+5ld %+5ld",
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);
/* cleanup */
cleanup_panorama (panorama);
}
GST_END_TEST;
GST_START_TEST (test_stereo_right_simple)
{
GstElement *panorama;
GstBuffer *inbuffer, *outbuffer;
GstCaps *caps;
gint16 in[4] = { 16384, -256, 8192, 128 };
gint16 out[4] = { 0, -256, 0, 128 };
gint16 *res;
panorama = setup_panorama_s ();
g_object_set (G_OBJECT (panorama), "method", 1, NULL);
g_object_set (G_OBJECT (panorama), "panorama", 1.0, NULL);
fail_unless (gst_element_set_state (panorama,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"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);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... and puts a new buffer on the global list */
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5ld %+5ld %+5ld %+5ld real %+5ld %+5ld %+5ld %+5ld",
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);
/* cleanup */
cleanup_panorama (panorama);
}
GST_END_TEST;
GST_START_TEST (test_wrong_caps)
{
GstElement *panorama;
@ -434,6 +678,12 @@ panorama_suite (void)
tcase_add_test (tc_chain, test_stereo_middle);
tcase_add_test (tc_chain, test_stereo_left);
tcase_add_test (tc_chain, test_stereo_right);
tcase_add_test (tc_chain, test_mono_middle_simple);
tcase_add_test (tc_chain, test_mono_left_simple);
tcase_add_test (tc_chain, test_mono_right_simple);
tcase_add_test (tc_chain, test_stereo_middle_simple);
tcase_add_test (tc_chain, test_stereo_left_simple);
tcase_add_test (tc_chain, test_stereo_right_simple);
tcase_add_test (tc_chain, test_wrong_caps);
return s;