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,channels=2 ! deinterleave name=d d.src_0 ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=channel1.ogg d.src_1 ! 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,channels=2" ! deinterleave name=d interleave name=i ! audioconvert ! wavenc ! filesink location=test.wav d.src_0 ! queue ! audioconvert ! i.sink_1 d.src_1 ! queue ! audioconvert ! i.sink_0
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, "
76 "format = (string) " GST_AUDIO_FORMATS_ALL ", "
77 "rate = (int) [ 1, MAX ], "
78 "channels = (int) 1, layout = (string) {non-interleaved, interleaved}"));
80 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
83 GST_STATIC_CAPS ("audio/x-raw, "
84 "format = (string) " GST_AUDIO_FORMATS_ALL ", "
85 "rate = (int) [ 1, MAX ], "
86 "channels = (int) [ 1, MAX ], layout = (string) interleaved"));
88 #define MAKE_FUNC(type) \
89 static void deinterleave_##type (guint##type *out, guint##type *in, \
90 guint stride, guint nframes) \
94 for (i = 0; i < nframes; i++) { \
106 deinterleave_24 (guint8 * out, guint8 * in, guint stride, guint nframes)
110 for (i = 0; i < nframes; i++) {
117 #define gst_deinterleave_parent_class parent_class
118 G_DEFINE_TYPE (GstDeinterleave, gst_deinterleave, GST_TYPE_ELEMENT);
126 static GstFlowReturn gst_deinterleave_chain (GstPad * pad, GstObject * parent,
129 static gboolean gst_deinterleave_sink_setcaps (GstDeinterleave * self,
132 static GstStateChangeReturn
133 gst_deinterleave_change_state (GstElement * element, GstStateChange transition);
135 static gboolean gst_deinterleave_sink_event (GstPad * pad, GstObject * parent,
138 static gboolean gst_deinterleave_src_query (GstPad * pad, GstObject * parent,
141 static void gst_deinterleave_set_property (GObject * object,
142 guint prop_id, const GValue * value, GParamSpec * pspec);
143 static void gst_deinterleave_get_property (GObject * object,
144 guint prop_id, GValue * value, GParamSpec * pspec);
148 gst_deinterleave_finalize (GObject * obj)
150 GstDeinterleave *self = GST_DEINTERLEAVE (obj);
152 if (self->pending_events) {
153 g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref, NULL);
154 g_list_free (self->pending_events);
155 self->pending_events = NULL;
158 G_OBJECT_CLASS (parent_class)->finalize (obj);
162 gst_deinterleave_class_init (GstDeinterleaveClass * klass)
164 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
165 GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
167 GST_DEBUG_CATEGORY_INIT (gst_deinterleave_debug, "deinterleave", 0,
168 "deinterleave element");
170 gst_element_class_set_details_simple (gstelement_class, "Audio deinterleaver",
171 "Filter/Converter/Audio",
172 "Splits one interleaved multichannel audio stream into many mono audio streams",
173 "Andy Wingo <wingo at pobox.com>, "
174 "Iain <iain@prettypeople.org>, "
175 "Sebastian Dröge <slomo@circular-chaos.org>");
177 gst_element_class_add_pad_template (gstelement_class,
178 gst_static_pad_template_get (&sink_template));
179 gst_element_class_add_pad_template (gstelement_class,
180 gst_static_pad_template_get (&src_template));
182 gstelement_class->change_state = gst_deinterleave_change_state;
184 gobject_class->finalize = gst_deinterleave_finalize;
185 gobject_class->set_property = gst_deinterleave_set_property;
186 gobject_class->get_property = gst_deinterleave_get_property;
189 * GstDeinterleave:keep-positions
191 * Keep positions: When enable the caps on the output buffers will
192 * contain the original channel positions. This can be used to correctly
193 * interleave the output again later but can also lead to unwanted effects
194 * if the output should be handled as Mono.
197 g_object_class_install_property (gobject_class, PROP_KEEP_POSITIONS,
198 g_param_spec_boolean ("keep-positions", "Keep positions",
199 "Keep the original channel positions on the output buffers",
200 FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
204 gst_deinterleave_init (GstDeinterleave * self)
206 self->keep_positions = FALSE;
208 gst_audio_info_init (&self->audio_info);
211 self->sink = gst_pad_new_from_static_template (&sink_template, "sink");
212 gst_pad_set_chain_function (self->sink,
213 GST_DEBUG_FUNCPTR (gst_deinterleave_chain));
214 gst_pad_set_event_function (self->sink,
215 GST_DEBUG_FUNCPTR (gst_deinterleave_sink_event));
216 gst_element_add_pad (GST_ELEMENT (self), self->sink);
220 gst_deinterleave_add_new_pads (GstDeinterleave * self, GstCaps * caps)
226 for (i = 0; i < GST_AUDIO_INFO_CHANNELS (&self->audio_info); i++) {
227 gchar *name = g_strdup_printf ("src_%u", i);
231 GstAudioFormat format = GST_AUDIO_INFO_FORMAT (&self->audio_info);
232 gint rate = GST_AUDIO_INFO_RATE (&self->audio_info);
233 GstAudioChannelPosition position = 0;
235 /* Set channel position if we know it */
236 if (self->keep_positions)
237 position = GST_AUDIO_INFO_POSITION (&self->audio_info, i);
239 gst_audio_info_init (&info);
240 gst_audio_info_set_format (&info, format, rate, 1, &position);
242 srccaps = gst_audio_info_to_caps (&info);
244 pad = gst_pad_new_from_static_template (&src_template, name);
247 gst_pad_use_fixed_caps (pad);
248 gst_pad_set_query_function (pad,
249 GST_DEBUG_FUNCPTR (gst_deinterleave_src_query));
250 gst_pad_set_active (pad, TRUE);
251 gst_pad_set_caps (pad, srccaps);
252 gst_element_add_pad (GST_ELEMENT (self), pad);
253 self->srcpads = g_list_prepend (self->srcpads, gst_object_ref (pad));
255 gst_caps_unref (srccaps);
258 gst_element_no_more_pads (GST_ELEMENT (self));
259 self->srcpads = g_list_reverse (self->srcpads);
263 gst_deinterleave_set_pads_caps (GstDeinterleave * self, GstCaps * caps)
268 for (l = self->srcpads, i = 0; l; l = l->next, i++) {
269 GstPad *pad = GST_PAD (l->data);
273 gst_audio_info_from_caps (&info, caps);
274 if (self->keep_positions)
275 GST_AUDIO_INFO_POSITION (&info, i) =
276 GST_AUDIO_INFO_POSITION (&self->audio_info, i);
278 srccaps = gst_audio_info_to_caps (&info);
280 gst_pad_set_caps (pad, srccaps);
281 gst_caps_unref (srccaps);
286 gst_deinterleave_remove_pads (GstDeinterleave * self)
290 GST_INFO_OBJECT (self, "removing pads");
292 for (l = self->srcpads; l; l = l->next) {
293 GstPad *pad = GST_PAD (l->data);
295 gst_element_remove_pad (GST_ELEMENT_CAST (self), pad);
296 gst_object_unref (pad);
298 g_list_free (self->srcpads);
299 self->srcpads = NULL;
301 gst_caps_replace (&self->sinkcaps, NULL);
305 gst_deinterleave_set_process_function (GstDeinterleave * self)
307 switch (GST_AUDIO_INFO_WIDTH (&self->audio_info)) {
309 self->func = (GstDeinterleaveFunc) deinterleave_8;
312 self->func = (GstDeinterleaveFunc) deinterleave_16;
315 self->func = (GstDeinterleaveFunc) deinterleave_24;
318 self->func = (GstDeinterleaveFunc) deinterleave_32;
321 self->func = (GstDeinterleaveFunc) deinterleave_64;
330 gst_deinterleave_sink_setcaps (GstDeinterleave * self, GstCaps * caps)
335 GST_DEBUG_OBJECT (self, "got caps: %" GST_PTR_FORMAT, caps);
337 if (!gst_audio_info_from_caps (&self->audio_info, caps))
340 if (!gst_deinterleave_set_process_function (self))
341 goto unsupported_caps;
343 if (self->sinkcaps && !gst_caps_is_equal (caps, self->sinkcaps)) {
345 gboolean same_layout = TRUE;
346 gboolean was_unpositioned;
347 gboolean is_unpositioned =
348 GST_AUDIO_INFO_IS_UNPOSITIONED (&self->audio_info);
349 gint new_channels = GST_AUDIO_INFO_CHANNELS (&self->audio_info);
351 GstAudioInfo old_info;
353 gst_audio_info_init (&old_info);
354 gst_audio_info_from_caps (&old_info, self->sinkcaps);
355 was_unpositioned = GST_AUDIO_INFO_IS_UNPOSITIONED (&old_info);
356 old_channels = GST_AUDIO_INFO_CHANNELS (&old_info);
358 /* We allow caps changes as long as the number of channels doesn't change
359 * and the channel positions stay the same. _getcaps() should've cared
360 * for this already but better be safe.
362 if (new_channels != old_channels ||
363 !gst_deinterleave_set_process_function (self))
364 goto cannot_change_caps;
366 /* Now check the channel positions. If we had no channel positions
367 * and get them or the other way around things have changed.
368 * If we had channel positions and get different ones things have
369 * changed too of course
371 if ((!was_unpositioned && is_unpositioned) || (was_unpositioned
372 && !is_unpositioned))
373 goto cannot_change_caps;
375 if (!is_unpositioned) {
376 if (GST_AUDIO_INFO_CHANNELS (&old_info) !=
377 GST_AUDIO_INFO_CHANNELS (&self->audio_info))
378 goto cannot_change_caps;
379 for (i = 0; i < GST_AUDIO_INFO_CHANNELS (&old_info); i++) {
380 if (self->audio_info.position[i] != old_info.position[i]) {
386 goto cannot_change_caps;
391 gst_caps_replace (&self->sinkcaps, caps);
393 /* Get srcpad caps */
394 srccaps = gst_caps_copy (caps);
395 s = gst_caps_get_structure (srccaps, 0);
396 gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL);
397 gst_structure_remove_field (s, "channel-mask");
399 /* If we already have pads, update the caps otherwise
402 gst_deinterleave_set_pads_caps (self, srccaps);
404 gst_deinterleave_add_new_pads (self, srccaps);
407 gst_caps_unref (srccaps);
413 GST_ERROR_OBJECT (self, "can't set new caps: %" GST_PTR_FORMAT, caps);
418 GST_ERROR_OBJECT (self, "caps not supported: %" GST_PTR_FORMAT, caps);
423 GST_ERROR_OBJECT (self, "invalid caps");
429 __remove_channels (GstCaps * caps)
435 size = gst_caps_get_size (caps);
436 for (i = 0; i < size; i++) {
437 s = gst_caps_get_structure (caps, i);
438 gst_structure_remove_field (s, "channel-mask");
439 gst_structure_remove_field (s, "channels");
444 __set_channels (GstCaps * caps, gint channels)
450 size = gst_caps_get_size (caps);
451 for (i = 0; i < size; i++) {
452 s = gst_caps_get_structure (caps, i);
454 gst_structure_set (s, "channels", G_TYPE_INT, channels, NULL);
456 gst_structure_set (s, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
461 gst_deinterleave_sink_getcaps (GstPad * pad, GstObject * parent,
464 GstDeinterleave *self = GST_DEINTERLEAVE (parent);
470 GST_OBJECT_LOCK (self);
471 /* Intersect all of our pad template caps with the peer caps of the pad
472 * to get all formats that are possible up- and downstream.
474 * For the pad for which the caps are requested we don't remove the channel
475 * informations as they must be in the returned caps and incompatibilities
476 * will be detected here already
478 ret = gst_caps_new_any ();
479 for (l = GST_ELEMENT (self)->pads; l != NULL; l = l->next) {
480 GstPad *ourpad = GST_PAD (l->data);
482 GstCaps *peercaps = NULL, *ourcaps;
484 ourcaps = gst_caps_copy (gst_pad_get_pad_template_caps (ourpad));
487 if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK)
488 __set_channels (ourcaps, GST_AUDIO_INFO_CHANNELS (&self->audio_info));
490 __set_channels (ourcaps, 1);
492 __remove_channels (ourcaps);
493 /* Only ask for peer caps for other pads than pad
494 * as otherwise gst_pad_peer_get_caps() might call
495 * back into this function and deadlock
497 peercaps = gst_pad_peer_query_caps (ourpad, NULL);
498 peercaps = gst_caps_make_writable (peercaps);
501 /* If the peer exists and has caps add them to the intersection,
502 * otherwise assume that the peer accepts everything */
504 GstCaps *intersection;
506 GstCaps *oldret = ret;
508 __remove_channels (peercaps);
510 intersection = gst_caps_intersect (peercaps, ourcaps);
512 ret = gst_caps_intersect (ret, intersection);
513 gst_caps_unref (intersection);
514 gst_caps_unref (peercaps);
515 gst_caps_unref (oldret);
517 GstCaps *oldret = ret;
519 ret = gst_caps_intersect (ret, ourcaps);
520 gst_caps_unref (oldret);
522 gst_caps_unref (ourcaps);
524 GST_OBJECT_UNLOCK (self);
526 GST_DEBUG_OBJECT (pad, "Intersected caps to %" GST_PTR_FORMAT, ret);
532 gst_deinterleave_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
534 GstDeinterleave *self = GST_DEINTERLEAVE (parent);
538 GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
539 GST_DEBUG_PAD_NAME (pad));
541 /* Send FLUSH_STOP, FLUSH_START and EOS immediately, no matter if
542 * we have src pads already or not. Queue all other events and
543 * push them after we have src pads
545 switch (GST_EVENT_TYPE (event)) {
546 case GST_EVENT_FLUSH_STOP:
547 case GST_EVENT_FLUSH_START:
549 ret = gst_pad_event_default (pad, parent, event);
555 gst_event_parse_caps (event, &caps);
556 ret = gst_deinterleave_sink_setcaps (self, caps);
557 gst_event_unref (event);
563 ret = gst_pad_event_default (pad, parent, event);
565 GST_OBJECT_LOCK (self);
566 self->pending_events = g_list_append (self->pending_events, event);
567 GST_OBJECT_UNLOCK (self);
577 gst_deinterleave_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
579 GstDeinterleave *self = GST_DEINTERLEAVE (parent);
583 res = gst_pad_query_default (pad, parent, query);
585 if (res && GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
590 gst_query_parse_duration (query, &format, &dur);
592 /* Need to divide by the number of channels in byte format
593 * to get the correct value. All other formats should be fine
595 if (format == GST_FORMAT_BYTES && dur != -1)
596 gst_query_set_duration (query, format,
597 dur / GST_AUDIO_INFO_CHANNELS (&self->audio_info));
598 } else if (res && GST_QUERY_TYPE (query) == GST_QUERY_POSITION) {
603 gst_query_parse_position (query, &format, &pos);
605 /* Need to divide by the number of channels in byte format
606 * to get the correct value. All other formats should be fine
608 if (format == GST_FORMAT_BYTES && pos != -1)
609 gst_query_set_position (query, format,
610 pos / GST_AUDIO_INFO_CHANNELS (&self->audio_info));
611 } else if (res && GST_QUERY_TYPE (query) == GST_QUERY_CAPS) {
612 GstCaps *filter, *caps;
614 gst_query_parse_caps (query, &filter);
615 caps = gst_deinterleave_sink_getcaps (pad, parent, filter);
616 gst_query_set_caps_result (query, caps);
617 gst_caps_unref (caps);
624 gst_deinterleave_set_property (GObject * object, guint prop_id,
625 const GValue * value, GParamSpec * pspec)
627 GstDeinterleave *self = GST_DEINTERLEAVE (object);
630 case PROP_KEEP_POSITIONS:
631 self->keep_positions = g_value_get_boolean (value);
634 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
640 gst_deinterleave_get_property (GObject * object, guint prop_id,
641 GValue * value, GParamSpec * pspec)
643 GstDeinterleave *self = GST_DEINTERLEAVE (object);
646 case PROP_KEEP_POSITIONS:
647 g_value_set_boolean (value, self->keep_positions);
650 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
656 gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
658 GstFlowReturn ret = GST_FLOW_OK;
660 guint channels = GST_AUDIO_INFO_CHANNELS (&self->audio_info);
662 guint pads_pushed = 0, buffers_allocated = 0;
665 gst_buffer_get_size (buf) / channels /
666 (GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
668 guint bufsize = nframes * (GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
674 GstBuffer **buffers_out = g_new0 (GstBuffer *, channels);
678 GstMapInfo read_info;
679 gst_buffer_map (buf, &read_info, GST_MAP_READ);
681 /* Send any pending events to all src pads */
682 GST_OBJECT_LOCK (self);
683 if (self->pending_events) {
688 GST_DEBUG_OBJECT (self, "Sending pending events to all src pads");
690 for (events = self->pending_events; events != NULL; events = events->next) {
691 event = GST_EVENT (events->data);
693 for (srcs = self->srcpads; srcs != NULL; srcs = srcs->next)
694 gst_pad_push_event (GST_PAD (srcs->data), gst_event_ref (event));
695 gst_event_unref (event);
698 g_list_free (self->pending_events);
699 self->pending_events = NULL;
701 GST_OBJECT_UNLOCK (self);
703 /* Allocate buffers */
704 for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) {
705 buffers_out[i] = gst_buffer_new_allocate (NULL, bufsize, 0);
707 /* Make sure we got a correct buffer. The only other case we allow
708 * here is an unliked pad */
710 goto alloc_buffer_failed;
711 else if (buffers_out[i] && gst_buffer_get_size (buffers_out[i]) != bufsize)
712 goto alloc_buffer_bad_size;
714 if (buffers_out[i]) {
715 gst_buffer_copy_into (buffers_out[i], buf, GST_BUFFER_COPY_METADATA, 0,
721 /* Return NOT_LINKED if no pad was linked */
722 if (!buffers_allocated) {
723 GST_WARNING_OBJECT (self,
724 "Couldn't allocate any buffers because no pad was linked");
725 ret = GST_FLOW_NOT_LINKED;
730 for (srcs = self->srcpads, i = 0; srcs; srcs = srcs->next, i++) {
731 GstPad *pad = (GstPad *) srcs->data;
732 GstMapInfo write_info;
735 in = (guint8 *) read_info.data;
736 in += i * (GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
737 if (buffers_out[i]) {
738 gst_buffer_map (buffers_out[i], &write_info, GST_MAP_WRITE);
740 out = (guint8 *) write_info.data;
742 self->func (out, in, channels, nframes);
744 gst_buffer_unmap (buffers_out[i], &write_info);
746 ret = gst_pad_push (pad, buffers_out[i]);
747 buffers_out[i] = NULL;
748 if (ret == GST_FLOW_OK)
750 else if (ret == GST_FLOW_NOT_LINKED)
757 /* Return NOT_LINKED if no pad was linked */
759 ret = GST_FLOW_NOT_LINKED;
762 gst_buffer_unmap (buf, &read_info);
763 gst_buffer_unref (buf);
764 g_free (buffers_out);
769 GST_WARNING ("gst_pad_alloc_buffer() returned %s", gst_flow_get_name (ret));
773 alloc_buffer_bad_size:
775 GST_WARNING ("called alloc_buffer(), but didn't get requested bytes");
776 ret = GST_FLOW_NOT_NEGOTIATED;
781 GST_DEBUG ("push() failed, flow = %s", gst_flow_get_name (ret));
786 gst_buffer_unmap (buf, &read_info);
787 for (i = 0; i < channels; i++) {
789 gst_buffer_unref (buffers_out[i]);
791 gst_buffer_unref (buf);
792 g_free (buffers_out);
798 gst_deinterleave_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
800 GstDeinterleave *self = GST_DEINTERLEAVE (parent);
804 g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED);
805 g_return_val_if_fail (GST_AUDIO_INFO_WIDTH (&self->audio_info) > 0,
806 GST_FLOW_NOT_NEGOTIATED);
807 g_return_val_if_fail (GST_AUDIO_INFO_CHANNELS (&self->audio_info) > 0,
808 GST_FLOW_NOT_NEGOTIATED);
810 ret = gst_deinterleave_process (self, buffer);
812 if (ret != GST_FLOW_OK)
813 GST_DEBUG_OBJECT (self, "flow return: %s", gst_flow_get_name (ret));
818 static GstStateChangeReturn
819 gst_deinterleave_change_state (GstElement * element, GstStateChange transition)
821 GstStateChangeReturn ret;
822 GstDeinterleave *self = GST_DEINTERLEAVE (element);
824 switch (transition) {
825 case GST_STATE_CHANGE_NULL_TO_READY:
827 case GST_STATE_CHANGE_READY_TO_PAUSED:
828 gst_deinterleave_remove_pads (self);
832 if (self->pending_events) {
833 g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref,
835 g_list_free (self->pending_events);
836 self->pending_events = NULL;
839 case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
845 ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
847 switch (transition) {
848 case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
850 case GST_STATE_CHANGE_PAUSED_TO_READY:
851 gst_deinterleave_remove_pads (self);
855 if (self->pending_events) {
856 g_list_foreach (self->pending_events, (GFunc) gst_mini_object_unref,
858 g_list_free (self->pending_events);
859 self->pending_events = NULL;
862 case GST_STATE_CHANGE_READY_TO_NULL: