2007-01-07 22:03:54 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
|
|
|
* 2007 Andy Wingo <wingo at pobox.com>
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
* 2008 Sebastian Dröge <slomo@circular-chaos.org>
|
2007-01-07 22:03:54 +00:00
|
|
|
*
|
2008-05-22 18:55:09 +00:00
|
|
|
* deinterleave.c: deinterleave samples
|
2007-01-07 22:03:54 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
/* TODO:
|
|
|
|
* - handle changes in number of channels
|
|
|
|
* - handle changes in channel positions
|
|
|
|
* - better capsnego by using a buffer alloc function
|
|
|
|
* and passing downstream caps changes upstream there
|
|
|
|
*/
|
|
|
|
|
2008-05-17 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-deinterleave
|
2008-06-13 11:59:23 +00:00
|
|
|
* @see_also: interleave
|
2008-05-17 19:39:53 +00:00
|
|
|
*
|
|
|
|
* Splits one interleaved multichannel audio stream into many mono audio streams.
|
2008-06-13 11:59:23 +00:00
|
|
|
*
|
2008-05-22 18:55:09 +00:00
|
|
|
* This element handles all raw audio formats and supports changing the input caps as long as
|
|
|
|
* all downstream elements can handle the new caps and the number of channels and the channel
|
|
|
|
* positions stay the same. This restriction will be removed in later versions by adding or
|
|
|
|
* removing some source pads as required.
|
2008-06-13 11:59:23 +00:00
|
|
|
*
|
2008-05-22 19:47:53 +00:00
|
|
|
* In most cases a queue and an audioconvert element should be added after each source pad
|
|
|
|
* before further processing of the audio data.
|
2008-06-13 11:59:23 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2008-05-17 19:39:53 +00:00
|
|
|
* <title>Example launch line</title>
|
2008-06-13 11:59:23 +00:00
|
|
|
* |[
|
2009-01-29 09:07:59 +00:00
|
|
|
* gst-launch filesrc location=/path/to/file.mp3 ! decodebin ! audioconvert ! "audio/x-raw-int,channels=2 ! deinterleave name=d d.src0 ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=channel1.ogg d.src1 ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=channel2.ogg
|
2008-06-13 11:59:23 +00:00
|
|
|
* ]| Decodes an MP3 file and encodes the left and right channel into separate
|
|
|
|
* Ogg Vorbis files.
|
|
|
|
* |[
|
2009-01-29 09:07:59 +00:00
|
|
|
* gst-launch filesrc location=file.mp3 ! decodebin ! audioconvert ! "audio/x-raw-int,channels=2" ! deinterleave name=d interleave name=i ! audioconvert ! wavenc ! filesink location=test.wav d.src0 ! queue ! audioconvert ! i.sink1 d.src1 ! queue ! audioconvert ! i.sink0
|
2008-06-13 11:59:23 +00:00
|
|
|
* ]| Decodes and deinterleaves a Stereo MP3 file into separate channels and
|
|
|
|
* then interleaves the channels again to a WAV file with the channel with the
|
|
|
|
* channels exchanged.
|
2008-05-17 19:39:53 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
#include <string.h>
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
#include "deinterleave.h"
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_deinterleave_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_deinterleave_debug
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) 1, "
|
|
|
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
|
|
|
|
"width = (int) { 8, 16, 24, 32 }, "
|
|
|
|
"depth = (int) [ 1, 32 ], "
|
|
|
|
"signed = (boolean) { true, false }; "
|
|
|
|
"audio/x-raw-float, "
|
2007-01-07 22:03:54 +00:00
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) 1, "
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
"endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, "
|
|
|
|
"width = (int) { 32, 64 }")
|
2007-01-07 22:03:54 +00:00
|
|
|
);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw-int, "
|
2007-01-07 22:03:54 +00:00
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
|
|
|
|
"width = (int) { 8, 16, 24, 32 }, "
|
|
|
|
"depth = (int) [ 1, 32 ], "
|
|
|
|
"signed = (boolean) { true, false }; "
|
|
|
|
"audio/x-raw-float, "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) [ 1, MAX ], "
|
|
|
|
"endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, "
|
|
|
|
"width = (int) { 32, 64 }")
|
2007-01-07 22:03:54 +00:00
|
|
|
);
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
#define MAKE_FUNC(type) \
|
|
|
|
static void deinterleave_##type (guint##type *out, guint##type *in, \
|
|
|
|
guint stride, guint nframes) \
|
|
|
|
{ \
|
|
|
|
gint i; \
|
|
|
|
\
|
|
|
|
for (i = 0; i < nframes; i++) { \
|
|
|
|
out[i] = *in; \
|
|
|
|
in += stride; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
MAKE_FUNC (8);
|
|
|
|
MAKE_FUNC (16);
|
|
|
|
MAKE_FUNC (32);
|
|
|
|
MAKE_FUNC (64);
|
|
|
|
|
|
|
|
static void
|
|
|
|
deinterleave_24 (guint8 * out, guint8 * in, guint stride, guint nframes)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < nframes; i++) {
|
|
|
|
memcpy (out, in, 3);
|
|
|
|
out += 3;
|
|
|
|
in += stride * 3;
|
|
|
|
}
|
|
|
|
}
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
GST_BOILERPLATE (GstDeinterleave, gst_deinterleave, GstElement,
|
|
|
|
GST_TYPE_ELEMENT);
|
|
|
|
|
2008-05-19 07:46:05 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_KEEP_POSITIONS
|
|
|
|
};
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static GstFlowReturn gst_deinterleave_chain (GstPad * pad, GstBuffer * buffer);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static gboolean gst_deinterleave_sink_setcaps (GstPad * pad, GstCaps * caps);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2008-05-22 18:55:09 +00:00
|
|
|
static GstCaps *gst_deinterleave_sink_getcaps (GstPad * pad);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static gboolean gst_deinterleave_sink_activate_push (GstPad * pad,
|
|
|
|
gboolean active);
|
2008-05-17 19:39:53 +00:00
|
|
|
static gboolean gst_deinterleave_sink_event (GstPad * pad, GstEvent * event);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
|
|
|
static gboolean gst_deinterleave_src_query (GstPad * pad, GstQuery * query);
|
|
|
|
|
2008-05-19 07:46:05 +00:00
|
|
|
static void gst_deinterleave_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_deinterleave_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
static void
|
|
|
|
gst_deinterleave_finalize (GObject * obj)
|
|
|
|
{
|
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (obj);
|
|
|
|
|
|
|
|
if (self->pos) {
|
|
|
|
g_free (self->pos);
|
|
|
|
self->pos = NULL;
|
|
|
|
}
|
|
|
|
|
2008-05-17 19:39:53 +00:00
|
|
|
if (self->pending_events) {
|
|
|
|
g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref, NULL);
|
|
|
|
g_list_free (self->pending_events);
|
|
|
|
self->pending_events = NULL;
|
|
|
|
}
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
|
|
|
}
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static void
|
|
|
|
gst_deinterleave_base_init (gpointer g_class)
|
|
|
|
{
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstElementClass *gstelement_class = (GstElementClass *) g_class;
|
|
|
|
|
|
|
|
gst_element_class_set_details_simple (gstelement_class, "Audio deinterleaver",
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
"Filter/Converter/Audio",
|
|
|
|
"Splits one interleaved multichannel audio stream into many mono audio streams",
|
2008-05-22 18:55:09 +00:00
|
|
|
"Andy Wingo <wingo at pobox.com>, "
|
|
|
|
"Iain <iain@prettypeople.org>, "
|
|
|
|
"Sebastian Dröge <slomo@circular-chaos.org>");
|
2007-01-07 22:03:54 +00:00
|
|
|
|
2011-11-28 12:58:44 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&sink_template);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&src_template);
|
2007-01-07 22:03:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_deinterleave_class_init (GstDeinterleaveClass * klass)
|
|
|
|
{
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_deinterleave_debug, "deinterleave", 0,
|
|
|
|
"deinterleave element");
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
|
|
|
|
gobject_class->finalize = gst_deinterleave_finalize;
|
2008-05-19 07:46:05 +00:00
|
|
|
gobject_class->set_property = gst_deinterleave_set_property;
|
|
|
|
gobject_class->get_property = gst_deinterleave_get_property;
|
|
|
|
|
2008-05-22 18:55:09 +00:00
|
|
|
/**
|
|
|
|
* GstDeinterleave:keep-positions
|
|
|
|
*
|
|
|
|
* Keep positions: When enable the caps on the output buffers will
|
|
|
|
* contain the original channel positions. This can be used to correctly
|
|
|
|
* interleave the output again later but can also lead to unwanted effects
|
|
|
|
* if the output should be handled as Mono.
|
|
|
|
*
|
|
|
|
*/
|
2008-05-19 07:46:05 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_KEEP_POSITIONS,
|
|
|
|
g_param_spec_boolean ("keep-positions", "Keep positions",
|
|
|
|
"Keep the original channel positions on the output buffers",
|
|
|
|
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2007-01-07 22:03:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_deinterleave_init (GstDeinterleave * self, GstDeinterleaveClass * klass)
|
|
|
|
{
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
self->channels = 0;
|
|
|
|
self->pos = NULL;
|
2008-05-19 07:46:05 +00:00
|
|
|
self->keep_positions = FALSE;
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
self->width = 0;
|
|
|
|
self->func = NULL;
|
2007-01-07 22:03:54 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
/* Add sink pad */
|
|
|
|
self->sink = gst_pad_new_from_static_template (&sink_template, "sink");
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_pad_set_chain_function (self->sink,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_deinterleave_chain));
|
|
|
|
gst_pad_set_setcaps_function (self->sink,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_deinterleave_sink_setcaps));
|
2008-05-22 18:55:09 +00:00
|
|
|
gst_pad_set_getcaps_function (self->sink,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_deinterleave_sink_getcaps));
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_pad_set_activatepush_function (self->sink,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_deinterleave_sink_activate_push));
|
2008-05-17 19:39:53 +00:00
|
|
|
gst_pad_set_event_function (self->sink,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_deinterleave_sink_event));
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (self), self->sink);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_deinterleave_add_new_pads (GstDeinterleave * self, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstPad *pad;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < self->channels; i++) {
|
|
|
|
gchar *name = g_strdup_printf ("src%d", i);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstCaps *srccaps;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstStructure *s;
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
pad = gst_pad_new_from_static_template (&src_template, name);
|
|
|
|
g_free (name);
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
|
|
|
|
/* Set channel position if we know it */
|
2008-05-19 07:46:05 +00:00
|
|
|
if (self->keep_positions) {
|
|
|
|
GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE };
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
srccaps = gst_caps_copy (caps);
|
|
|
|
s = gst_caps_get_structure (srccaps, 0);
|
2008-05-19 07:46:05 +00:00
|
|
|
if (self->pos)
|
|
|
|
gst_audio_set_channel_positions (s, &self->pos[i]);
|
|
|
|
else
|
|
|
|
gst_audio_set_channel_positions (s, pos);
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
} else {
|
|
|
|
srccaps = caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_pad_set_caps (pad, srccaps);
|
2007-01-13 19:12:32 +00:00
|
|
|
gst_pad_use_fixed_caps (pad);
|
2008-06-05 11:07:17 +00:00
|
|
|
gst_pad_set_query_function (pad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_deinterleave_src_query));
|
2007-03-22 22:14:29 +00:00
|
|
|
gst_pad_set_active (pad, TRUE);
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (self), pad);
|
2007-03-22 22:14:29 +00:00
|
|
|
self->srcpads = g_list_prepend (self->srcpads, gst_object_ref (pad));
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
|
2008-05-19 07:46:05 +00:00
|
|
|
if (self->keep_positions)
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
gst_caps_unref (srccaps);
|
2007-01-07 22:03:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_element_no_more_pads (GST_ELEMENT (self));
|
2007-03-22 22:14:29 +00:00
|
|
|
self->srcpads = g_list_reverse (self->srcpads);
|
2007-01-07 22:03:54 +00:00
|
|
|
}
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
static void
|
|
|
|
gst_deinterleave_set_pads_caps (GstDeinterleave * self, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GList *l;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstStructure *s;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (l = self->srcpads, i = 0; l; l = l->next, i++) {
|
|
|
|
GstPad *pad = GST_PAD (l->data);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstCaps *srccaps;
|
|
|
|
|
|
|
|
/* Set channel position if we know it */
|
2008-05-19 07:46:05 +00:00
|
|
|
if (self->keep_positions) {
|
|
|
|
GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE };
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
srccaps = gst_caps_copy (caps);
|
|
|
|
s = gst_caps_get_structure (srccaps, 0);
|
2008-05-19 07:46:05 +00:00
|
|
|
if (self->pos)
|
|
|
|
gst_audio_set_channel_positions (s, &self->pos[i]);
|
|
|
|
else
|
|
|
|
gst_audio_set_channel_positions (s, pos);
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
} else {
|
|
|
|
srccaps = caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_pad_set_caps (pad, srccaps);
|
|
|
|
|
2008-05-19 07:46:05 +00:00
|
|
|
if (self->keep_positions)
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
gst_caps_unref (srccaps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static void
|
|
|
|
gst_deinterleave_remove_pads (GstDeinterleave * self)
|
|
|
|
{
|
2007-03-22 22:14:29 +00:00
|
|
|
GList *l;
|
2007-01-07 22:03:54 +00:00
|
|
|
|
2007-03-22 22:14:29 +00:00
|
|
|
GST_INFO_OBJECT (self, "removing pads");
|
2007-01-07 22:03:54 +00:00
|
|
|
|
2007-03-22 22:14:29 +00:00
|
|
|
for (l = self->srcpads; l; l = l->next) {
|
|
|
|
GstPad *pad = GST_PAD (l->data);
|
2007-01-07 22:03:54 +00:00
|
|
|
|
2007-03-22 22:14:29 +00:00
|
|
|
gst_element_remove_pad (GST_ELEMENT_CAST (self), pad);
|
|
|
|
gst_object_unref (pad);
|
|
|
|
}
|
|
|
|
g_list_free (self->srcpads);
|
|
|
|
self->srcpads = NULL;
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
gst_pad_set_caps (self->sink, NULL);
|
|
|
|
gst_caps_replace (&self->sinkcaps, NULL);
|
|
|
|
}
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
static gboolean
|
|
|
|
gst_deinterleave_set_process_function (GstDeinterleave * self, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
if (!gst_structure_get_int (s, "width", &self->width))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
switch (self->width) {
|
|
|
|
case 8:
|
|
|
|
self->func = (GstDeinterleaveFunc) deinterleave_8;
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
self->func = (GstDeinterleaveFunc) deinterleave_16;
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
self->func = (GstDeinterleaveFunc) deinterleave_24;
|
|
|
|
break;
|
|
|
|
case 32:
|
|
|
|
self->func = (GstDeinterleaveFunc) deinterleave_32;
|
|
|
|
break;
|
|
|
|
case 64:
|
|
|
|
self->func = (GstDeinterleaveFunc) deinterleave_64;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static gboolean
|
|
|
|
gst_deinterleave_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstDeinterleave *self;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
GstCaps *srccaps;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
GstStructure *s;
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "got caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
if (self->sinkcaps && !gst_caps_is_equal (caps, self->sinkcaps)) {
|
2008-05-17 14:05:03 +00:00
|
|
|
gint new_channels, i;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstAudioChannelPosition *pos;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2008-05-17 14:05:03 +00:00
|
|
|
gboolean same_layout = TRUE;
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
/* We allow caps changes as long as the number of channels doesn't change
|
|
|
|
* and the channel positions stay the same. _getcaps() should've cared
|
|
|
|
* for this already but better be safe.
|
|
|
|
*/
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
if (!gst_structure_get_int (s, "channels", &new_channels) ||
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
new_channels != self->channels ||
|
|
|
|
!gst_deinterleave_set_process_function (self, caps))
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
goto cannot_change_caps;
|
|
|
|
|
2008-05-17 14:05:03 +00:00
|
|
|
/* Now check the channel positions. If we had no channel positions
|
|
|
|
* and get them or the other way around things have changed.
|
|
|
|
* If we had channel positions and get different ones things have
|
|
|
|
* changed too of course
|
|
|
|
*/
|
|
|
|
pos = gst_audio_get_channel_positions (s);
|
|
|
|
if ((pos && !self->pos) || (!pos && self->pos))
|
|
|
|
goto cannot_change_caps;
|
2007-01-07 22:03:54 +00:00
|
|
|
|
2008-05-17 14:05:03 +00:00
|
|
|
if (pos) {
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
for (i = 0; i < self->channels; i++) {
|
|
|
|
if (self->pos[i] != pos[i]) {
|
2008-05-17 14:05:03 +00:00
|
|
|
same_layout = FALSE;
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free (pos);
|
2008-05-17 14:05:03 +00:00
|
|
|
if (!same_layout)
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
goto cannot_change_caps;
|
|
|
|
}
|
2008-05-17 14:05:03 +00:00
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
} else {
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
s = gst_caps_get_structure (caps, 0);
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
if (!gst_structure_get_int (s, "channels", &self->channels))
|
|
|
|
goto no_channels;
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
|
|
|
|
if (!gst_deinterleave_set_process_function (self, caps))
|
|
|
|
goto unsupported_caps;
|
|
|
|
|
2008-05-17 14:05:03 +00:00
|
|
|
self->pos = gst_audio_get_channel_positions (s);
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_replace (&self->sinkcaps, caps);
|
|
|
|
|
|
|
|
/* Get srcpad caps */
|
|
|
|
srccaps = gst_caps_copy (caps);
|
|
|
|
s = gst_caps_get_structure (srccaps, 0);
|
|
|
|
gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL);
|
|
|
|
gst_structure_remove_field (s, "channel-positions");
|
|
|
|
|
|
|
|
/* If we already have pads, update the caps otherwise
|
|
|
|
* add new pads */
|
|
|
|
if (self->srcpads) {
|
|
|
|
gst_deinterleave_set_pads_caps (self, srccaps);
|
|
|
|
} else {
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_deinterleave_add_new_pads (self, srccaps);
|
|
|
|
}
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
gst_caps_unref (srccaps);
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_object_unref (self);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
cannot_change_caps:
|
2007-01-07 22:03:54 +00:00
|
|
|
{
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
GST_ERROR_OBJECT (self, "can't set new caps: %" GST_PTR_FORMAT, caps);
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_object_unref (self);
|
|
|
|
return FALSE;
|
|
|
|
}
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
unsupported_caps:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (self, "caps not supported: %" GST_PTR_FORMAT, caps);
|
|
|
|
gst_object_unref (self);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-01-07 22:03:54 +00:00
|
|
|
no_channels:
|
|
|
|
{
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
GST_ERROR_OBJECT (self, "invalid caps");
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_object_unref (self);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
static void
|
|
|
|
__remove_channels (GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
gint i, size;
|
|
|
|
|
|
|
|
size = gst_caps_get_size (caps);
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
s = gst_caps_get_structure (caps, i);
|
|
|
|
gst_structure_remove_field (s, "channel-positions");
|
|
|
|
gst_structure_remove_field (s, "channels");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
__set_channels (GstCaps * caps, gint channels)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
gint i, size;
|
|
|
|
|
|
|
|
size = gst_caps_get_size (caps);
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
s = gst_caps_get_structure (caps, i);
|
|
|
|
if (channels > 0)
|
|
|
|
gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
|
|
|
|
else
|
|
|
|
gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2008-05-22 18:55:09 +00:00
|
|
|
gst_deinterleave_sink_getcaps (GstPad * pad)
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
{
|
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstCaps *ret;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GList *l;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
/* Intersect all of our pad template caps with the peer caps of the pad
|
|
|
|
* to get all formats that are possible up- and downstream.
|
|
|
|
*
|
|
|
|
* For the pad for which the caps are requested we don't remove the channel
|
|
|
|
* informations as they must be in the returned caps and incompatibilities
|
|
|
|
* will be detected here already
|
|
|
|
*/
|
|
|
|
ret = gst_caps_new_any ();
|
|
|
|
for (l = GST_ELEMENT (self)->pads; l != NULL; l = l->next) {
|
|
|
|
GstPad *ourpad = GST_PAD (l->data);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2008-05-17 14:05:03 +00:00
|
|
|
GstCaps *peercaps = NULL, *ourcaps;
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
|
|
|
|
ourcaps = gst_caps_copy (gst_pad_get_pad_template_caps (ourpad));
|
|
|
|
|
|
|
|
if (pad == ourpad) {
|
|
|
|
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK)
|
|
|
|
__set_channels (ourcaps, self->channels);
|
|
|
|
else
|
|
|
|
__set_channels (ourcaps, 1);
|
|
|
|
} else {
|
|
|
|
__remove_channels (ourcaps);
|
2008-05-17 14:05:03 +00:00
|
|
|
/* Only ask for peer caps for other pads than pad
|
|
|
|
* as otherwise gst_pad_peer_get_caps() might call
|
|
|
|
* back into this function and deadlock
|
|
|
|
*/
|
|
|
|
peercaps = gst_pad_peer_get_caps (ourpad);
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the peer exists and has caps add them to the intersection,
|
|
|
|
* otherwise assume that the peer accepts everything */
|
|
|
|
if (peercaps) {
|
|
|
|
GstCaps *intersection;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstCaps *oldret = ret;
|
|
|
|
|
2008-05-17 14:05:03 +00:00
|
|
|
__remove_channels (peercaps);
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
intersection = gst_caps_intersect (peercaps, ourcaps);
|
|
|
|
|
|
|
|
ret = gst_caps_intersect (ret, intersection);
|
|
|
|
gst_caps_unref (intersection);
|
|
|
|
gst_caps_unref (peercaps);
|
|
|
|
gst_caps_unref (oldret);
|
|
|
|
} else {
|
|
|
|
GstCaps *oldret = ret;
|
|
|
|
|
|
|
|
ret = gst_caps_intersect (ret, ourcaps);
|
|
|
|
gst_caps_unref (oldret);
|
|
|
|
}
|
|
|
|
gst_caps_unref (ourcaps);
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
|
|
|
|
|
|
|
gst_object_unref (self);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (pad, "Intersected caps to %" GST_PTR_FORMAT, ret);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-05-17 19:39:53 +00:00
|
|
|
static gboolean
|
|
|
|
gst_deinterleave_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2008-05-17 19:39:53 +00:00
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
|
|
|
|
GST_DEBUG_PAD_NAME (pad));
|
|
|
|
|
|
|
|
/* Send FLUSH_STOP, FLUSH_START and EOS immediately, no matter if
|
|
|
|
* we have src pads already or not. Queue all other events and
|
|
|
|
* push them after we have src pads
|
|
|
|
*/
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
case GST_EVENT_FLUSH_START:
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
ret = gst_pad_event_default (pad, event);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (self->srcpads) {
|
|
|
|
ret = gst_pad_event_default (pad, event);
|
|
|
|
} else {
|
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
self->pending_events = g_list_append (self->pending_events, event);
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (self);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-06-05 11:07:17 +00:00
|
|
|
static gboolean
|
|
|
|
gst_deinterleave_src_query (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
res = gst_pad_query_default (pad, query);
|
|
|
|
|
|
|
|
if (res && GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
gint64 dur;
|
|
|
|
|
|
|
|
gst_query_parse_duration (query, &format, &dur);
|
|
|
|
|
|
|
|
/* Need to divide by the number of channels in byte format
|
|
|
|
* to get the correct value. All other formats should be fine
|
|
|
|
*/
|
|
|
|
if (format == GST_FORMAT_BYTES && dur != -1)
|
|
|
|
gst_query_set_duration (query, format, dur / self->channels);
|
|
|
|
} else if (res && GST_QUERY_TYPE (query) == GST_QUERY_POSITION) {
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
gint64 pos;
|
|
|
|
|
|
|
|
gst_query_parse_position (query, &format, &pos);
|
|
|
|
|
|
|
|
/* Need to divide by the number of channels in byte format
|
|
|
|
* to get the correct value. All other formats should be fine
|
|
|
|
*/
|
|
|
|
if (format == GST_FORMAT_BYTES && pos != -1)
|
|
|
|
gst_query_set_position (query, format, pos / self->channels);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (self);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2008-05-19 07:46:05 +00:00
|
|
|
static void
|
|
|
|
gst_deinterleave_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_KEEP_POSITIONS:
|
|
|
|
self->keep_positions = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_deinterleave_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_KEEP_POSITIONS:
|
|
|
|
g_value_set_boolean (value, self->keep_positions);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
|
|
|
|
{
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
guint channels = self->channels;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
guint pads_pushed = 0, buffers_allocated = 0;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
guint nframes = GST_BUFFER_SIZE (buf) / channels / (self->width / 8);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
guint bufsize = nframes * (self->width / 8);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
guint i;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
GList *srcs;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstBuffer **buffers_out = g_new0 (GstBuffer *, channels);
|
2008-06-05 11:07:17 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
guint8 *in, *out;
|
2007-01-07 22:03:54 +00:00
|
|
|
|
2008-05-17 19:39:53 +00:00
|
|
|
/* Send any pending events to all src pads */
|
|
|
|
GST_OBJECT_LOCK (self);
|
|
|
|
if (self->pending_events) {
|
|
|
|
GList *events;
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2008-05-17 19:39:53 +00:00
|
|
|
GstEvent *event;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (self, "Sending pending events to all src pads");
|
|
|
|
|
|
|
|
for (events = self->pending_events; events != NULL; events = events->next) {
|
|
|
|
event = GST_EVENT (events->data);
|
|
|
|
|
|
|
|
for (srcs = self->srcpads; srcs != NULL; srcs = srcs->next)
|
|
|
|
gst_pad_push_event (GST_PAD (srcs->data), gst_event_ref (event));
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (self->pending_events);
|
|
|
|
self->pending_events = NULL;
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (self);
|
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
/* Allocate buffers */
|
2007-03-22 22:14:29 +00:00
|
|
|
for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) {
|
2007-01-07 22:03:54 +00:00
|
|
|
GstPad *pad = (GstPad *) srcs->data;
|
|
|
|
|
|
|
|
buffers_out[i] = NULL;
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
ret =
|
|
|
|
gst_pad_alloc_buffer (pad, GST_BUFFER_OFFSET_NONE, bufsize,
|
|
|
|
GST_PAD_CAPS (pad), &buffers_out[i]);
|
2007-01-07 22:03:54 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
/* Make sure we got a correct buffer. The only other case we allow
|
|
|
|
* here is an unliked pad */
|
2007-01-07 22:03:54 +00:00
|
|
|
if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED)
|
|
|
|
goto alloc_buffer_failed;
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
else if (buffers_out[i] && GST_BUFFER_SIZE (buffers_out[i]) != bufsize)
|
2007-01-07 22:03:54 +00:00
|
|
|
goto alloc_buffer_bad_size;
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
else if (buffers_out[i] &&
|
|
|
|
!gst_caps_is_equal (GST_BUFFER_CAPS (buffers_out[i]),
|
|
|
|
GST_PAD_CAPS (pad)))
|
|
|
|
goto invalid_caps;
|
2007-01-13 19:12:32 +00:00
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
if (buffers_out[i]) {
|
2007-07-11 23:43:25 +00:00
|
|
|
gst_buffer_copy_metadata (buffers_out[i], buf,
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS);
|
|
|
|
buffers_allocated++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
/* Return NOT_LINKED if no pad was linked */
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
if (!buffers_allocated) {
|
2008-05-17 19:39:53 +00:00
|
|
|
GST_WARNING_OBJECT (self,
|
|
|
|
"Couldn't allocate any buffers because no pad was linked");
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
ret = GST_FLOW_NOT_LINKED;
|
|
|
|
goto done;
|
2007-01-07 22:03:54 +00:00
|
|
|
}
|
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
/* deinterleave */
|
2007-03-22 22:14:29 +00:00
|
|
|
for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) {
|
2007-01-07 22:03:54 +00:00
|
|
|
GstPad *pad = (GstPad *) srcs->data;
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
in = (guint8 *) GST_BUFFER_DATA (buf);
|
|
|
|
in += i * (self->width / 8);
|
2007-01-07 22:03:54 +00:00
|
|
|
if (buffers_out[i]) {
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
out = (guint8 *) GST_BUFFER_DATA (buffers_out[i]);
|
|
|
|
|
|
|
|
self->func (out, in, channels, nframes);
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
ret = gst_pad_push (pad, buffers_out[i]);
|
|
|
|
buffers_out[i] = NULL;
|
|
|
|
if (ret == GST_FLOW_OK)
|
|
|
|
pads_pushed++;
|
|
|
|
else if (ret == GST_FLOW_NOT_LINKED)
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
else
|
|
|
|
goto push_failed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
/* Return NOT_LINKED if no pad was linked */
|
2007-01-07 22:03:54 +00:00
|
|
|
if (!pads_pushed)
|
|
|
|
ret = GST_FLOW_NOT_LINKED;
|
|
|
|
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
done:
|
2007-03-22 22:14:29 +00:00
|
|
|
gst_buffer_unref (buf);
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
g_free (buffers_out);
|
2007-01-07 22:03:54 +00:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
alloc_buffer_failed:
|
|
|
|
{
|
2007-03-22 22:14:29 +00:00
|
|
|
GST_WARNING ("gst_pad_alloc_buffer() returned %s", gst_flow_get_name (ret));
|
2007-01-07 22:03:54 +00:00
|
|
|
goto clean_buffers;
|
|
|
|
|
|
|
|
}
|
|
|
|
alloc_buffer_bad_size:
|
|
|
|
{
|
|
|
|
GST_WARNING ("called alloc_buffer(), but didn't get requested bytes");
|
|
|
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
goto clean_buffers;
|
|
|
|
}
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
invalid_caps:
|
|
|
|
{
|
|
|
|
GST_WARNING ("called alloc_buffer(), but didn't get requested caps");
|
|
|
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
goto clean_buffers;
|
|
|
|
}
|
2007-01-07 22:03:54 +00:00
|
|
|
push_failed:
|
|
|
|
{
|
2007-03-22 22:14:29 +00:00
|
|
|
GST_DEBUG ("push() failed, flow = %s", gst_flow_get_name (ret));
|
2007-01-07 22:03:54 +00:00
|
|
|
goto clean_buffers;
|
|
|
|
}
|
|
|
|
clean_buffers:
|
|
|
|
{
|
2007-03-22 22:14:29 +00:00
|
|
|
for (i = 0; i < channels; i++) {
|
2007-01-07 22:03:54 +00:00
|
|
|
if (buffers_out[i])
|
|
|
|
gst_buffer_unref (buffers_out[i]);
|
2007-03-22 22:14:29 +00:00
|
|
|
}
|
|
|
|
gst_buffer_unref (buf);
|
gst/interleave/: Split definitions into separate header files for better documentation generation.
Original commit message from CVS:
* gst/interleave/Makefile.am:
* gst/interleave/deinterleave.h:
* gst/interleave/interleave.h:
* gst/interleave/plugin.h:
Split definitions into separate header files for better documentation
generation.
* gst/interleave/deinterleave.c: (gst_deinterleave_base_init),
(gst_deinterleave_class_init), (gst_deinterleave_sink_setcaps),
(gst_deinterleave_process):
Don't use alloca, allow caps changes as long as the number of channels
does not change, don't use g_warning, return NOT_NEGOTIATED as early
as possible and some other cleanup.
* gst/interleave/interleave.c: (gst_interleave_base_init),
(gst_interleave_class_init):
Do some random cleanup.
* tests/check/Makefile.am:
* tests/check/elements/deinterleave.c: (GST_START_TEST),
(deinterleave_chain_func), (deinterleave_pad_added),
(deinterleave_suite):
Add unit tests for the deinterleave element.
2008-05-14 07:32:44 +00:00
|
|
|
g_free (buffers_out);
|
2007-01-07 22:03:54 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_deinterleave_chain (GstPad * pad, GstBuffer * buffer)
|
|
|
|
{
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (GST_PAD_PARENT (pad));
|
2008-06-05 11:07:17 +00:00
|
|
|
|
2007-01-07 22:03:54 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED);
|
|
|
|
g_return_val_if_fail (self->width > 0, GST_FLOW_NOT_NEGOTIATED);
|
|
|
|
g_return_val_if_fail (self->channels > 0, GST_FLOW_NOT_NEGOTIATED);
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
ret = gst_deinterleave_process (self, buffer);
|
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK)
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "flow return: %s", gst_flow_get_name (ret));
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_deinterleave_sink_activate_push (GstPad * pad, gboolean active)
|
|
|
|
{
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
|
2007-01-07 22:03:54 +00:00
|
|
|
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
/* Reset everything when the pad is deactivated */
|
|
|
|
if (!active) {
|
2007-01-07 22:03:54 +00:00
|
|
|
gst_deinterleave_remove_pads (self);
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
if (self->pos) {
|
|
|
|
g_free (self->pos);
|
|
|
|
self->pos = NULL;
|
|
|
|
}
|
|
|
|
self->channels = 0;
|
|
|
|
self->width = 0;
|
|
|
|
self->func = NULL;
|
2008-05-17 19:39:53 +00:00
|
|
|
|
|
|
|
if (self->pending_events) {
|
|
|
|
g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref,
|
|
|
|
NULL);
|
|
|
|
g_list_free (self->pending_events);
|
|
|
|
self->pending_events = NULL;
|
|
|
|
}
|
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.
2008-05-16 21:56:24 +00:00
|
|
|
}
|
2007-01-07 22:03:54 +00:00
|
|
|
|
|
|
|
gst_object_unref (self);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|