From 5a00cae46fb77ec9a107797d5107f8db06a0dc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 16 May 2008 21:56:24 +0000 Subject: gst/interleave/: Add support for all raw audio formats and provide better negotiation if the caps are changing. Original commit message from CVS: * gst/interleave/Makefile.am: * gst/interleave/deinterleave.c: (deinterleave_24), (gst_deinterleave_finalize), (gst_deinterleave_base_init), (gst_deinterleave_class_init), (gst_deinterleave_init), (gst_deinterleave_add_new_pads), (gst_deinterleave_set_pads_caps), (gst_deinterleave_set_process_function), (gst_deinterleave_sink_setcaps), (__remove_channels), (__set_channels), (gst_deinterleave_getcaps), (gst_deinterleave_process), (gst_deinterleave_chain), (gst_deinterleave_sink_activate_push): * gst/interleave/deinterleave.h: Add support for all raw audio formats and provide better negotiation if the caps are changing. Don't allow changes of the channel positions and set the position of the corresponding channel on the src pad caps. General cleanup and smaller bugfixes. * tests/check/elements/deinterleave.c: (float_buffer_check_probe): Check the channel positions on the output buffer caps. --- tests/check/elements/deinterleave.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'tests/check') diff --git a/tests/check/elements/deinterleave.c b/tests/check/elements/deinterleave.c index 22ac0842..c22acaca 100644 --- a/tests/check/elements/deinterleave.c +++ b/tests/check/elements/deinterleave.c @@ -55,7 +55,7 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, " "width = (int) 32, " - "channels = (int) 2, " + "channels = (int) { 2, 3 }, " "rate = (int) {32000, 48000}, " "endianness = (int) BYTE_ORDER")); #define CAPS_32khz \ @@ -417,14 +417,30 @@ float_buffer_check_probe (GstPad * pad, GstBuffer * buf, gpointer userdata) gfloat *data; guint padnum, numpads; guint num, i; + GstCaps *caps; + GstStructure *s; + GstAudioChannelPosition *pos; + gint channels; fail_unless_equals_int (sscanf (GST_PAD_NAME (pad), "src%u", &padnum), 1); numpads = pads_created; + /* Check caps */ + caps = GST_BUFFER_CAPS (buf); + fail_unless (caps != NULL); + s = gst_caps_get_structure (caps, 0); + fail_unless (gst_structure_get_int (s, "channels", &channels)); + fail_unless_equals_int (channels, 1); + fail_unless (gst_structure_has_field (s, "channel-positions")); + pos = gst_audio_get_channel_positions (s); + fail_unless (pos != NULL && pos[0] == GST_AUDIO_CHANNEL_POSITION_NONE); + g_free (pos); + data = (gfloat *) GST_BUFFER_DATA (buf); num = GST_BUFFER_SIZE (buf) / sizeof (gfloat); + /* Check buffer content */ for (i = 0; i < num; ++i) { guint val, rest; -- cgit v1.2.1