2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
4 * 2005 Wim Taymans <wim@fluendo.com>
5 * 2007 Andy Wingo <wingo at pobox.com>
6 * 2008 Sebastian Dröge <slomo@circular-chaos.org>
8 * deinterleave.c: deinterleave samples
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
20 * You should have received a copy of the GNU Library General Public
21 * License along with this library; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 02111-1307, USA.
27 * - handle changes in number of channels
28 * - handle changes in channel positions
29 * - better capsnego by using a buffer alloc function
30 * and passing downstream caps changes upstream there
34 * SECTION:element-deinterleave
35 * @see_also: interleave
37 * Splits one interleaved multichannel audio stream into many mono audio streams.
39 * This element handles all raw audio formats and supports changing the input caps as long as
40 * all downstream elements can handle the new caps and the number of channels and the channel
41 * positions stay the same. This restriction will be removed in later versions by adding or
42 * removing some source pads as required.
44 * In most cases a queue and an audioconvert element should be added after each source pad
45 * before further processing of the audio data.
48 * <title>Example launch line</title>
50 * 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
51 * ]| Decodes an MP3 file and encodes the left and right channel into separate
54 * 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
55 * ]| Decodes and deinterleaves a Stereo MP3 file into separate channels and
56 * then interleaves the channels again to a WAV file with the channel with the
67 #include "deinterleave.h"
69 GST_DEBUG_CATEGORY_STATIC (gst_deinterleave_debug);
70 #define GST_CAT_DEFAULT gst_deinterleave_debug
72 static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src_%u",
75 GST_STATIC_CAPS ("audio/x-raw-int, "
76 "rate = (int) [ 1, MAX ], "
77 "channels = (int) 1, "
78 "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
79 "width = (int) { 8, 16, 24, 32 }, "
80 "depth = (int) [ 1, 32 ], "
81 "signed = (boolean) { true, false }; "
83 "rate = (int) [ 1, MAX ], "
84 "channels = (int) 1, "
85 "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, "
86 "width = (int) { 32, 64 }")
89 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
92 GST_STATIC_CAPS ("audio/x-raw-int, "
93 "rate = (int) [ 1, MAX ], "
94 "channels = (int) [ 1, MAX ], "
95 "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "
96 "width = (int) { 8, 16, 24, 32 }, "
97 "depth = (int) [ 1, 32 ], "
98 "signed = (boolean) { true, false }; "
100 "rate = (int) [ 1, MAX ], "
101 "channels = (int) [ 1, MAX ], "
102 "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, "
103 "width = (int) { 32, 64 }")
106 #define MAKE_FUNC(type) \
107 static void deinterleave_##type (guint##type *out, guint##type *in, \
108 guint stride, guint nframes) \
112 for (i = 0; i < nframes; i++) { \
124 deinterleave_24 (guint8 * out, guint8 * in, guint stride, guint nframes)
128 for (i = 0; i < nframes; i++) {
135 GST_BOILERPLATE (GstDeinterleave, gst_deinterleave, GstElement,
144 static GstFlowReturn gst_deinterleave_chain (GstPad * pad, GstBuffer * buffer);
146 static gboolean gst_deinterleave_sink_setcaps (GstPad * pad, GstCaps * caps);
148 static GstCaps *gst_deinterleave_sink_getcaps (GstPad * pad);
150 static gboolean gst_deinterleave_sink_activate_push (GstPad * pad,
152 static gboolean gst_deinterleave_sink_event (GstPad * pad, GstEvent * event);
154 static gboolean gst_deinterleave_src_query (GstPad * pad, GstQuery * query);
156 static void gst_deinterleave_set_property (GObject * object,
157 guint prop_id, const GValue * value, GParamSpec * pspec);
158 static void gst_deinterleave_get_property (GObject * object,
159 guint prop_id, GValue * value, GParamSpec * pspec);
163 gst_deinterleave_finalize (GObject * obj)
165 GstDeinterleave *self = GST_DEINTERLEAVE (obj);
172 if (self->pending_events) {
173 g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref, NULL);
174 g_list_free (self->pending_events);
175 self->pending_events = NULL;
178 G_OBJECT_CLASS (parent_class)->finalize (obj);
182 gst_deinterleave_base_init (gpointer g_class)
184 GstElementClass *gstelement_class = (GstElementClass *) g_class;
186 gst_element_class_set_details_simple (gstelement_class, "Audio deinterleaver",
187 "Filter/Converter/Audio",
188 "Splits one interleaved multichannel audio stream into many mono audio streams",
189 "Andy Wingo <wingo at pobox.com>, "
190 "Iain <iain@prettypeople.org>, "
191 "Sebastian Dröge <slomo@circular-chaos.org>");
193 gst_element_class_add_pad_template (gstelement_class,
194 gst_static_pad_template_get (&sink_template));
195 gst_element_class_add_pad_template (gstelement_class,
196 gst_static_pad_template_get (&src_template));
200 gst_deinterleave_class_init (GstDeinterleaveClass * klass)
202 GObjectClass *gobject_class = (GObjectClass *) klass;
204 GST_DEBUG_CATEGORY_INIT (gst_deinterleave_debug, "deinterleave", 0,
205 "deinterleave element");
207 gobject_class->finalize = gst_deinterleave_finalize;
208 gobject_class->set_property = gst_deinterleave_set_property;
209 gobject_class->get_property = gst_deinterleave_get_property;
212 * GstDeinterleave:keep-positions
214 * Keep positions: When enable the caps on the output buffers will
215 * contain the original channel positions. This can be used to correctly
216 * interleave the output again later but can also lead to unwanted effects
217 * if the output should be handled as Mono.
220 g_object_class_install_property (gobject_class, PROP_KEEP_POSITIONS,
221 g_param_spec_boolean ("keep-positions", "Keep positions",
222 "Keep the original channel positions on the output buffers",
223 FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
227 gst_deinterleave_init (GstDeinterleave * self, GstDeinterleaveClass * klass)
231 self->keep_positions = FALSE;
236 self->sink = gst_pad_new_from_static_template (&sink_template, "sink");
237 gst_pad_set_chain_function (self->sink,
238 GST_DEBUG_FUNCPTR (gst_deinterleave_chain));
239 gst_pad_set_setcaps_function (self->sink,
240 GST_DEBUG_FUNCPTR (gst_deinterleave_sink_setcaps));
241 gst_pad_set_getcaps_function (self->sink,
242 GST_DEBUG_FUNCPTR (gst_deinterleave_sink_getcaps));
243 gst_pad_set_activatepush_function (self->sink,
244 GST_DEBUG_FUNCPTR (gst_deinterleave_sink_activate_push));
245 gst_pad_set_event_function (self->sink,
246 GST_DEBUG_FUNCPTR (gst_deinterleave_sink_event));
247 gst_element_add_pad (GST_ELEMENT (self), self->sink);
251 gst_deinterleave_add_new_pads (GstDeinterleave * self, GstCaps * caps)
257 for (i = 0; i < self->channels; i++) {
258 gchar *name = g_strdup_printf ("src_%u", i);
264 pad = gst_pad_new_from_static_template (&src_template, name);
267 /* Set channel position if we know it */
268 if (self->keep_positions) {
269 GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE };
271 srccaps = gst_caps_copy (caps);
272 s = gst_caps_get_structure (srccaps, 0);
274 gst_audio_set_channel_positions (s, &self->pos[i]);
276 gst_audio_set_channel_positions (s, pos);
281 gst_pad_set_caps (pad, srccaps);
282 gst_pad_use_fixed_caps (pad);
283 gst_pad_set_query_function (pad,
284 GST_DEBUG_FUNCPTR (gst_deinterleave_src_query));
285 gst_pad_set_active (pad, TRUE);
286 gst_element_add_pad (GST_ELEMENT (self), pad);
287 self->srcpads = g_list_prepend (self->srcpads, gst_object_ref (pad));
289 if (self->keep_positions)
290 gst_caps_unref (srccaps);
293 gst_element_no_more_pads (GST_ELEMENT (self));
294 self->srcpads = g_list_reverse (self->srcpads);
298 gst_deinterleave_set_pads_caps (GstDeinterleave * self, GstCaps * caps)
306 for (l = self->srcpads, i = 0; l; l = l->next, i++) {
307 GstPad *pad = GST_PAD (l->data);
311 /* Set channel position if we know it */
312 if (self->keep_positions) {
313 GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE };
315 srccaps = gst_caps_copy (caps);
316 s = gst_caps_get_structure (srccaps, 0);
318 gst_audio_set_channel_positions (s, &self->pos[i]);
320 gst_audio_set_channel_positions (s, pos);
325 gst_pad_set_caps (pad, srccaps);
327 if (self->keep_positions)
328 gst_caps_unref (srccaps);
333 gst_deinterleave_remove_pads (GstDeinterleave * self)
337 GST_INFO_OBJECT (self, "removing pads");
339 for (l = self->srcpads; l; l = l->next) {
340 GstPad *pad = GST_PAD (l->data);
342 gst_element_remove_pad (GST_ELEMENT_CAST (self), pad);
343 gst_object_unref (pad);
345 g_list_free (self->srcpads);
346 self->srcpads = NULL;
348 gst_pad_set_caps (self->sink, NULL);
349 gst_caps_replace (&self->sinkcaps, NULL);
353 gst_deinterleave_set_process_function (GstDeinterleave * self, GstCaps * caps)
357 s = gst_caps_get_structure (caps, 0);
358 if (!gst_structure_get_int (s, "width", &self->width))
361 switch (self->width) {
363 self->func = (GstDeinterleaveFunc) deinterleave_8;
366 self->func = (GstDeinterleaveFunc) deinterleave_16;
369 self->func = (GstDeinterleaveFunc) deinterleave_24;
372 self->func = (GstDeinterleaveFunc) deinterleave_32;
375 self->func = (GstDeinterleaveFunc) deinterleave_64;
384 gst_deinterleave_sink_setcaps (GstPad * pad, GstCaps * caps)
386 GstDeinterleave *self;
392 self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
394 GST_DEBUG_OBJECT (self, "got caps: %" GST_PTR_FORMAT, caps);
396 if (self->sinkcaps && !gst_caps_is_equal (caps, self->sinkcaps)) {
397 gint new_channels, i;
399 GstAudioChannelPosition *pos;
401 gboolean same_layout = TRUE;
403 s = gst_caps_get_structure (caps, 0);
405 /* We allow caps changes as long as the number of channels doesn't change
406 * and the channel positions stay the same. _getcaps() should've cared
407 * for this already but better be safe.
409 if (!gst_structure_get_int (s, "channels", &new_channels) ||
410 new_channels != self->channels ||
411 !gst_deinterleave_set_process_function (self, caps))
412 goto cannot_change_caps;
414 /* Now check the channel positions. If we had no channel positions
415 * and get them or the other way around things have changed.
416 * If we had channel positions and get different ones things have
417 * changed too of course
419 pos = gst_audio_get_channel_positions (s);
420 if ((pos && !self->pos) || (!pos && self->pos))
421 goto cannot_change_caps;
424 for (i = 0; i < self->channels; i++) {
425 if (self->pos[i] != pos[i]) {
432 goto cannot_change_caps;
436 s = gst_caps_get_structure (caps, 0);
438 if (!gst_structure_get_int (s, "channels", &self->channels))
441 if (!gst_deinterleave_set_process_function (self, caps))
442 goto unsupported_caps;
444 self->pos = gst_audio_get_channel_positions (s);
447 gst_caps_replace (&self->sinkcaps, caps);
449 /* Get srcpad caps */
450 srccaps = gst_caps_copy (caps);
451 s = gst_caps_get_structure (srccaps, 0);
452 gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL);
453 gst_structure_remove_field (s, "channel-positions");
455 /* If we already have pads, update the caps otherwise
458 gst_deinterleave_set_pads_caps (self, srccaps);
460 gst_deinterleave_add_new_pads (self, srccaps);
463 gst_caps_unref (srccaps);
464 gst_object_unref (self);
470 GST_ERROR_OBJECT (self, "can't set new caps: %" GST_PTR_FORMAT, caps);
471 gst_object_unref (self);
476 GST_ERROR_OBJECT (self, "caps not supported: %" GST_PTR_FORMAT, caps);
477 gst_object_unref (self);
482 GST_ERROR_OBJECT (self, "invalid caps");
483 gst_object_unref (self);
489 __remove_channels (GstCaps * caps)
495 size = gst_caps_get_size (caps);
496 for (i = 0; i < size; i++) {
497 s = gst_caps_get_structure (caps, i);
498 gst_structure_remove_field (s, "channel-positions");
499 gst_structure_remove_field (s, "channels");
504 __set_channels (GstCaps * caps, gint channels)
510 size = gst_caps_get_size (caps);
511 for (i = 0; i < size; i++) {
512 s = gst_caps_get_structure (caps, i);
514 gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
516 gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
521 gst_deinterleave_sink_getcaps (GstPad * pad)
523 GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
529 GST_OBJECT_LOCK (self);
530 /* Intersect all of our pad template caps with the peer caps of the pad
531 * to get all formats that are possible up- and downstream.
533 * For the pad for which the caps are requested we don't remove the channel
534 * informations as they must be in the returned caps and incompatibilities
535 * will be detected here already
537 ret = gst_caps_new_any ();
538 for (l = GST_ELEMENT (self)->pads; l != NULL; l = l->next) {
539 GstPad *ourpad = GST_PAD (l->data);
541 GstCaps *peercaps = NULL, *ourcaps;
543 ourcaps = gst_caps_copy (gst_pad_get_pad_template_caps (ourpad));
546 if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK)
547 __set_channels (ourcaps, self->channels);
549 __set_channels (ourcaps, 1);
551 __remove_channels (ourcaps);
552 /* Only ask for peer caps for other pads than pad
553 * as otherwise gst_pad_peer_get_caps() might call
554 * back into this function and deadlock
556 peercaps = gst_pad_peer_get_caps (ourpad);
559 /* If the peer exists and has caps add them to the intersection,
560 * otherwise assume that the peer accepts everything */
562 GstCaps *intersection;
564 GstCaps *oldret = ret;
566 __remove_channels (peercaps);
568 intersection = gst_caps_intersect (peercaps, ourcaps);
570 ret = gst_caps_intersect (ret, intersection);
571 gst_caps_unref (intersection);
572 gst_caps_unref (peercaps);
573 gst_caps_unref (oldret);
575 GstCaps *oldret = ret;
577 ret = gst_caps_intersect (ret, ourcaps);
578 gst_caps_unref (oldret);
580 gst_caps_unref (ourcaps);
582 GST_OBJECT_UNLOCK (self);
584 gst_object_unref (self);
586 GST_DEBUG_OBJECT (pad, "Intersected caps to %" GST_PTR_FORMAT, ret);
592 gst_deinterleave_sink_event (GstPad * pad, GstEvent * event)
594 GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
598 GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
599 GST_DEBUG_PAD_NAME (pad));
601 /* Send FLUSH_STOP, FLUSH_START and EOS immediately, no matter if
602 * we have src pads already or not. Queue all other events and
603 * push them after we have src pads
605 switch (GST_EVENT_TYPE (event)) {
606 case GST_EVENT_FLUSH_STOP:
607 case GST_EVENT_FLUSH_START:
609 ret = gst_pad_event_default (pad, event);
613 ret = gst_pad_event_default (pad, event);
615 GST_OBJECT_LOCK (self);
616 self->pending_events = g_list_append (self->pending_events, event);
617 GST_OBJECT_UNLOCK (self);
623 gst_object_unref (self);
629 gst_deinterleave_src_query (GstPad * pad, GstQuery * query)
631 GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
635 res = gst_pad_query_default (pad, query);
637 if (res && GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
642 gst_query_parse_duration (query, &format, &dur);
644 /* Need to divide by the number of channels in byte format
645 * to get the correct value. All other formats should be fine
647 if (format == GST_FORMAT_BYTES && dur != -1)
648 gst_query_set_duration (query, format, dur / self->channels);
649 } else if (res && GST_QUERY_TYPE (query) == GST_QUERY_POSITION) {
654 gst_query_parse_position (query, &format, &pos);
656 /* Need to divide by the number of channels in byte format
657 * to get the correct value. All other formats should be fine
659 if (format == GST_FORMAT_BYTES && pos != -1)
660 gst_query_set_position (query, format, pos / self->channels);
663 gst_object_unref (self);
668 gst_deinterleave_set_property (GObject * object, guint prop_id,
669 const GValue * value, GParamSpec * pspec)
671 GstDeinterleave *self = GST_DEINTERLEAVE (object);
674 case PROP_KEEP_POSITIONS:
675 self->keep_positions = g_value_get_boolean (value);
678 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
684 gst_deinterleave_get_property (GObject * object, guint prop_id,
685 GValue * value, GParamSpec * pspec)
687 GstDeinterleave *self = GST_DEINTERLEAVE (object);
690 case PROP_KEEP_POSITIONS:
691 g_value_set_boolean (value, self->keep_positions);
694 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
700 gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
702 GstFlowReturn ret = GST_FLOW_OK;
704 guint channels = self->channels;
706 guint pads_pushed = 0, buffers_allocated = 0;
708 guint nframes = GST_BUFFER_SIZE (buf) / channels / (self->width / 8);
710 guint bufsize = nframes * (self->width / 8);
716 GstBuffer **buffers_out = g_new0 (GstBuffer *, channels);
720 /* Send any pending events to all src pads */
721 GST_OBJECT_LOCK (self);
722 if (self->pending_events) {
727 GST_DEBUG_OBJECT (self, "Sending pending events to all src pads");
729 for (events = self->pending_events; events != NULL; events = events->next) {
730 event = GST_EVENT (events->data);
732 for (srcs = self->srcpads; srcs != NULL; srcs = srcs->next)
733 gst_pad_push_event (GST_PAD (srcs->data), gst_event_ref (event));
734 gst_event_unref (event);
737 g_list_free (self->pending_events);
738 self->pending_events = NULL;
740 GST_OBJECT_UNLOCK (self);
742 /* Allocate buffers */
743 for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) {
744 GstPad *pad = (GstPad *) srcs->data;
746 buffers_out[i] = NULL;
748 gst_pad_alloc_buffer (pad, GST_BUFFER_OFFSET_NONE, bufsize,
749 GST_PAD_CAPS (pad), &buffers_out[i]);
751 /* Make sure we got a correct buffer. The only other case we allow
752 * here is an unliked pad */
753 if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED)
754 goto alloc_buffer_failed;
755 else if (buffers_out[i] && GST_BUFFER_SIZE (buffers_out[i]) != bufsize)
756 goto alloc_buffer_bad_size;
757 else if (buffers_out[i] &&
758 !gst_caps_is_equal (GST_BUFFER_CAPS (buffers_out[i]),
762 if (buffers_out[i]) {
763 gst_buffer_copy_metadata (buffers_out[i], buf,
764 GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS);
769 /* Return NOT_LINKED if no pad was linked */
770 if (!buffers_allocated) {
771 GST_WARNING_OBJECT (self,
772 "Couldn't allocate any buffers because no pad was linked");
773 ret = GST_FLOW_NOT_LINKED;
778 for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) {
779 GstPad *pad = (GstPad *) srcs->data;
781 in = (guint8 *) GST_BUFFER_DATA (buf);
782 in += i * (self->width / 8);
783 if (buffers_out[i]) {
784 out = (guint8 *) GST_BUFFER_DATA (buffers_out[i]);
786 self->func (out, in, channels, nframes);
788 ret = gst_pad_push (pad, buffers_out[i]);
789 buffers_out[i] = NULL;
790 if (ret == GST_FLOW_OK)
792 else if (ret == GST_FLOW_NOT_LINKED)
799 /* Return NOT_LINKED if no pad was linked */
801 ret = GST_FLOW_NOT_LINKED;
804 gst_buffer_unref (buf);
805 g_free (buffers_out);
810 GST_WARNING ("gst_pad_alloc_buffer() returned %s", gst_flow_get_name (ret));
814 alloc_buffer_bad_size:
816 GST_WARNING ("called alloc_buffer(), but didn't get requested bytes");
817 ret = GST_FLOW_NOT_NEGOTIATED;
822 GST_WARNING ("called alloc_buffer(), but didn't get requested caps");
823 ret = GST_FLOW_NOT_NEGOTIATED;
828 GST_DEBUG ("push() failed, flow = %s", gst_flow_get_name (ret));
833 for (i = 0; i < channels; i++) {
835 gst_buffer_unref (buffers_out[i]);
837 gst_buffer_unref (buf);
838 g_free (buffers_out);
844 gst_deinterleave_chain (GstPad * pad, GstBuffer * buffer)
846 GstDeinterleave *self = GST_DEINTERLEAVE (GST_PAD_PARENT (pad));
850 g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED);
851 g_return_val_if_fail (self->width > 0, GST_FLOW_NOT_NEGOTIATED);
852 g_return_val_if_fail (self->channels > 0, GST_FLOW_NOT_NEGOTIATED);
854 ret = gst_deinterleave_process (self, buffer);
856 if (ret != GST_FLOW_OK)
857 GST_DEBUG_OBJECT (self, "flow return: %s", gst_flow_get_name (ret));
863 gst_deinterleave_sink_activate_push (GstPad * pad, gboolean active)
865 GstDeinterleave *self = GST_DEINTERLEAVE (gst_pad_get_parent (pad));
867 /* Reset everything when the pad is deactivated */
869 gst_deinterleave_remove_pads (self);
878 if (self->pending_events) {
879 g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref,
881 g_list_free (self->pending_events);
882 self->pending_events = NULL;
886 gst_object_unref (self);