2 * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
3 * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * SECTION:element-speexdec
23 * @see_also: speexenc, oggdemux
25 * This element decodes a Speex stream to raw integer audio.
26 * <ulink url="http://www.speex.org/">Speex</ulink> is a royalty-free
27 * audio codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
31 * <title>Example pipelines</title>
33 * gst-launch -v filesrc location=speex.ogg ! oggdemux ! speexdec ! audioconvert ! audioresample ! alsasink
34 * ]| Decode an Ogg/Speex file. To create an Ogg/Speex file refer to the
35 * documentation of speexenc.
38 * Last reviewed on 2006-04-05 (0.10.2)
45 #include "gstspeexdec.h"
47 #include <gst/tag/tag.h>
49 GST_DEBUG_CATEGORY_STATIC (speexdec_debug);
50 #define GST_CAT_DEFAULT speexdec_debug
52 static const GstElementDetails speex_dec_details =
53 GST_ELEMENT_DETAILS ("Speex audio decoder",
54 "Codec/Decoder/Audio",
55 "decode speex streams to audio",
56 "Wim Taymans <wim@fluendo.com>");
58 #define DEFAULT_ENH TRUE
66 static GstStaticPadTemplate speex_dec_src_factory =
67 GST_STATIC_PAD_TEMPLATE ("src",
70 GST_STATIC_CAPS ("audio/x-raw-int, "
71 "rate = (int) [ 6000, 48000 ], "
72 "channels = (int) [ 1, 2 ], "
73 "endianness = (int) BYTE_ORDER, "
74 "signed = (boolean) true, " "width = (int) 16, " "depth = (int) 16")
77 static GstStaticPadTemplate speex_dec_sink_factory =
78 GST_STATIC_PAD_TEMPLATE ("sink",
81 GST_STATIC_CAPS ("audio/x-speex")
84 GST_BOILERPLATE (GstSpeexDec, gst_speex_dec, GstElement, GST_TYPE_ELEMENT);
86 static gboolean speex_dec_sink_event (GstPad * pad, GstEvent * event);
87 static GstFlowReturn speex_dec_chain (GstPad * pad, GstBuffer * buf);
88 static GstStateChangeReturn speex_dec_change_state (GstElement * element,
89 GstStateChange transition);
91 static gboolean speex_dec_src_event (GstPad * pad, GstEvent * event);
92 static gboolean speex_dec_src_query (GstPad * pad, GstQuery * query);
93 static gboolean speex_dec_sink_query (GstPad * pad, GstQuery * query);
94 static const GstQueryType *speex_get_src_query_types (GstPad * pad);
95 static const GstQueryType *speex_get_sink_query_types (GstPad * pad);
96 static gboolean speex_dec_convert (GstPad * pad,
97 GstFormat src_format, gint64 src_value,
98 GstFormat * dest_format, gint64 * dest_value);
100 static void gst_speex_dec_get_property (GObject * object, guint prop_id,
101 GValue * value, GParamSpec * pspec);
102 static void gst_speex_dec_set_property (GObject * object, guint prop_id,
103 const GValue * value, GParamSpec * pspec);
105 static GstFlowReturn speex_dec_chain_parse_data (GstSpeexDec * dec,
106 GstBuffer * buf, GstClockTime timestamp, GstClockTime duration);
109 gst_speex_dec_base_init (gpointer g_class)
111 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
113 gst_element_class_add_pad_template (element_class,
114 gst_static_pad_template_get (&speex_dec_src_factory));
115 gst_element_class_add_pad_template (element_class,
116 gst_static_pad_template_get (&speex_dec_sink_factory));
117 gst_element_class_set_details (element_class, &speex_dec_details);
121 gst_speex_dec_class_init (GstSpeexDecClass * klass)
123 GObjectClass *gobject_class;
124 GstElementClass *gstelement_class;
126 gobject_class = (GObjectClass *) klass;
127 gstelement_class = (GstElementClass *) klass;
129 gobject_class->set_property = gst_speex_dec_set_property;
130 gobject_class->get_property = gst_speex_dec_get_property;
132 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ENH,
133 g_param_spec_boolean ("enh", "Enh", "Enable perceptual enhancement",
134 DEFAULT_ENH, G_PARAM_READWRITE));
136 gstelement_class->change_state = GST_DEBUG_FUNCPTR (speex_dec_change_state);
138 GST_DEBUG_CATEGORY_INIT (speexdec_debug, "speexdec", 0,
139 "speex decoding element");
143 gst_speex_dec_reset (GstSpeexDec * dec)
145 gst_segment_init (&dec->segment, GST_FORMAT_UNDEFINED);
146 dec->granulepos = -1;
149 dec->frame_duration = 0;
151 dec->header = NULL; /* FIXME: free ?! */
153 speex_decoder_destroy (dec->state);
159 gst_speex_dec_init (GstSpeexDec * dec, GstSpeexDecClass * g_class)
162 gst_pad_new_from_static_template (&speex_dec_sink_factory, "sink");
163 gst_pad_set_chain_function (dec->sinkpad,
164 GST_DEBUG_FUNCPTR (speex_dec_chain));
165 gst_pad_set_event_function (dec->sinkpad,
166 GST_DEBUG_FUNCPTR (speex_dec_sink_event));
167 gst_pad_set_query_type_function (dec->sinkpad,
168 GST_DEBUG_FUNCPTR (speex_get_sink_query_types));
169 gst_pad_set_query_function (dec->sinkpad,
170 GST_DEBUG_FUNCPTR (speex_dec_sink_query));
171 gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
174 gst_pad_new_from_static_template (&speex_dec_src_factory, "src");
175 gst_pad_use_fixed_caps (dec->srcpad);
176 gst_pad_set_event_function (dec->srcpad,
177 GST_DEBUG_FUNCPTR (speex_dec_src_event));
178 gst_pad_set_query_type_function (dec->srcpad,
179 GST_DEBUG_FUNCPTR (speex_get_src_query_types));
180 gst_pad_set_query_function (dec->srcpad,
181 GST_DEBUG_FUNCPTR (speex_dec_src_query));
182 gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
184 dec->enh = DEFAULT_ENH;
186 gst_speex_dec_reset (dec);
190 speex_dec_convert (GstPad * pad,
191 GstFormat src_format, gint64 src_value,
192 GstFormat * dest_format, gint64 * dest_value)
198 dec = GST_SPEEX_DEC (gst_pad_get_parent (pad));
200 if (dec->packetno < 1) {
205 if (src_format == *dest_format) {
206 *dest_value = src_value;
211 if (pad == dec->sinkpad &&
212 (src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES)) {
217 switch (src_format) {
218 case GST_FORMAT_TIME:
219 switch (*dest_format) {
220 case GST_FORMAT_BYTES:
221 scale = sizeof (float) * dec->header->nb_channels;
222 case GST_FORMAT_DEFAULT:
224 gst_util_uint64_scale_int (scale * src_value, dec->header->rate,
232 case GST_FORMAT_DEFAULT:
233 switch (*dest_format) {
234 case GST_FORMAT_BYTES:
235 *dest_value = src_value * sizeof (float) * dec->header->nb_channels;
237 case GST_FORMAT_TIME:
239 gst_util_uint64_scale_int (src_value, GST_SECOND,
247 case GST_FORMAT_BYTES:
248 switch (*dest_format) {
249 case GST_FORMAT_DEFAULT:
250 *dest_value = src_value / (sizeof (float) * dec->header->nb_channels);
252 case GST_FORMAT_TIME:
253 *dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
254 dec->header->rate * sizeof (float) * dec->header->nb_channels);
267 gst_object_unref (dec);
271 static const GstQueryType *
272 speex_get_sink_query_types (GstPad * pad)
274 static const GstQueryType speex_dec_sink_query_types[] = {
279 return speex_dec_sink_query_types;
283 speex_dec_sink_query (GstPad * pad, GstQuery * query)
288 dec = GST_SPEEX_DEC (gst_pad_get_parent (pad));
290 switch (GST_QUERY_TYPE (query)) {
291 case GST_QUERY_CONVERT:
293 GstFormat src_fmt, dest_fmt;
294 gint64 src_val, dest_val;
296 gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
297 res = speex_dec_convert (pad, src_fmt, src_val, &dest_fmt, &dest_val);
299 gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
304 res = gst_pad_query_default (pad, query);
308 gst_object_unref (dec);
312 static const GstQueryType *
313 speex_get_src_query_types (GstPad * pad)
315 static const GstQueryType speex_dec_src_query_types[] = {
321 return speex_dec_src_query_types;
325 speex_dec_src_query (GstPad * pad, GstQuery * query)
328 gboolean res = FALSE;
330 dec = GST_SPEEX_DEC (gst_pad_get_parent (pad));
332 switch (GST_QUERY_TYPE (query)) {
333 case GST_QUERY_POSITION:{
338 gst_query_parse_position (query, &format, NULL);
340 GST_PAD_STREAM_LOCK (dec->sinkpad);
341 segment = dec->segment;
342 GST_PAD_STREAM_UNLOCK (dec->sinkpad);
344 if (segment.format != GST_FORMAT_TIME) {
345 GST_DEBUG_OBJECT (dec, "segment not initialised yet");
349 if ((res = speex_dec_convert (dec->srcpad, GST_FORMAT_TIME,
350 segment.last_stop, &format, &cur))) {
351 gst_query_set_position (query, format, cur);
355 case GST_QUERY_DURATION:{
356 GstFormat format = GST_FORMAT_TIME;
359 /* get duration from demuxer */
360 if (!gst_pad_query_peer_duration (dec->sinkpad, &format, &dur))
363 gst_query_parse_duration (query, &format, NULL);
365 /* and convert it into the requested format */
366 if ((res = speex_dec_convert (dec->srcpad, GST_FORMAT_TIME,
367 dur, &format, &dur))) {
368 gst_query_set_duration (query, format, dur);
373 res = gst_pad_query_default (pad, query);
377 gst_object_unref (dec);
382 speex_dec_src_event (GstPad * pad, GstEvent * event)
384 gboolean res = FALSE;
385 GstSpeexDec *dec = GST_SPEEX_DEC (gst_pad_get_parent (pad));
387 GST_LOG_OBJECT (dec, "handling %s event", GST_EVENT_TYPE_NAME (event));
389 switch (GST_EVENT_TYPE (event)) {
390 case GST_EVENT_SEEK:{
391 GstFormat format, tformat;
395 GstSeekType cur_type, stop_type;
399 gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
402 /* we have to ask our peer to seek to time here as we know
403 * nothing about how to generate a granulepos from the src
404 * formats or anything.
406 * First bring the requested format to time
408 tformat = GST_FORMAT_TIME;
409 if (!(res = speex_dec_convert (pad, format, cur, &tformat, &tcur)))
411 if (!(res = speex_dec_convert (pad, format, stop, &tformat, &tstop)))
414 /* then seek with time on the peer */
415 real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
416 flags, cur_type, tcur, stop_type, tstop);
418 GST_LOG_OBJECT (dec, "seek to %" GST_TIME_FORMAT, GST_TIME_ARGS (tcur));
420 res = gst_pad_push_event (dec->sinkpad, real_seek);
421 gst_event_unref (event);
425 res = gst_pad_event_default (pad, event);
429 gst_object_unref (dec);
434 speex_dec_sink_event (GstPad * pad, GstEvent * event)
437 gboolean ret = FALSE;
439 dec = GST_SPEEX_DEC (gst_pad_get_parent (pad));
441 GST_LOG_OBJECT (dec, "handling %s event", GST_EVENT_TYPE_NAME (event));
443 switch (GST_EVENT_TYPE (event)) {
444 case GST_EVENT_NEWSEGMENT:{
447 gint64 start, stop, time;
450 gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
451 &start, &stop, &time);
453 if (format != GST_FORMAT_TIME)
454 goto newseg_wrong_format;
457 goto newseg_wrong_rate;
460 /* time progressed without data, see if we can fill the gap with
461 * some concealment data */
462 if (dec->segment.last_stop < start) {
463 GstClockTime duration;
465 duration = start - dec->segment.last_stop;
466 speex_dec_chain_parse_data (dec, NULL, dec->segment.last_stop,
471 /* now configure the values */
472 gst_segment_set_newsegment_full (&dec->segment, update,
473 rate, arate, GST_FORMAT_TIME, start, stop, time);
475 dec->granulepos = -1;
477 GST_DEBUG_OBJECT (dec, "segment now: cur = %" GST_TIME_FORMAT " [%"
478 GST_TIME_FORMAT " - %" GST_TIME_FORMAT "]",
479 GST_TIME_ARGS (dec->segment.last_stop),
480 GST_TIME_ARGS (dec->segment.start),
481 GST_TIME_ARGS (dec->segment.stop));
483 ret = gst_pad_push_event (dec->srcpad, event);
487 ret = gst_pad_event_default (pad, event);
491 gst_object_unref (dec);
497 GST_DEBUG_OBJECT (dec, "received non TIME newsegment");
498 gst_object_unref (dec);
503 GST_DEBUG_OBJECT (dec, "negative rates not supported yet");
504 gst_object_unref (dec);
510 speex_dec_chain_parse_header (GstSpeexDec * dec, GstBuffer * buf)
515 dec->header = speex_packet_to_header ((char *) GST_BUFFER_DATA (buf),
516 GST_BUFFER_SIZE (buf));
521 if (dec->header->mode >= SPEEX_NB_MODES || dec->header->mode < 0)
524 dec->mode = (SpeexMode *) speex_mode_list[dec->header->mode];
526 /* initialize the decoder */
527 dec->state = speex_decoder_init (dec->mode);
531 speex_decoder_ctl (dec->state, SPEEX_SET_ENH, &dec->enh);
532 speex_decoder_ctl (dec->state, SPEEX_GET_FRAME_SIZE, &dec->frame_size);
534 if (dec->header->nb_channels != 1) {
535 dec->callback.callback_id = SPEEX_INBAND_STEREO;
536 dec->callback.func = speex_std_stereo_request_handler;
537 dec->callback.data = &dec->stereo;
538 speex_decoder_ctl (dec->state, SPEEX_SET_HANDLER, &dec->callback);
541 speex_decoder_ctl (dec->state, SPEEX_SET_SAMPLING_RATE, &dec->header->rate);
543 dec->frame_duration = gst_util_uint64_scale_int (dec->frame_size,
544 GST_SECOND, dec->header->rate);
546 speex_bits_init (&dec->bits);
549 caps = gst_caps_new_simple ("audio/x-raw-int",
550 "rate", G_TYPE_INT, dec->header->rate,
551 "channels", G_TYPE_INT, dec->header->nb_channels,
552 "signed", G_TYPE_BOOLEAN, TRUE,
553 "endianness", G_TYPE_INT, G_BYTE_ORDER,
554 "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL);
556 if (!gst_pad_set_caps (dec->srcpad, caps))
559 gst_caps_unref (caps);
565 GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
566 (NULL), ("couldn't read header"));
567 return GST_FLOW_ERROR;
571 GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
573 ("Mode number %d does not (yet/any longer) exist in this version",
575 return GST_FLOW_ERROR;
579 GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
580 (NULL), ("couldn't initialize decoder"));
581 return GST_FLOW_ERROR;
585 GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
586 (NULL), ("couldn't negotiate format"));
587 gst_caps_unref (caps);
588 return GST_FLOW_NOT_NEGOTIATED;
593 speex_dec_chain_parse_comments (GstSpeexDec * dec, GstBuffer * buf)
596 gchar *ver, *encoder = NULL;
598 list = gst_tag_list_from_vorbiscomment_buffer (buf, NULL, 0, &encoder);
601 GST_WARNING_OBJECT (dec, "couldn't decode comments");
602 list = gst_tag_list_new ();
606 gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
607 GST_TAG_ENCODER, encoder, NULL);
610 gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
611 GST_TAG_AUDIO_CODEC, "Speex", NULL);
613 ver = g_strndup (dec->header->speex_version, SPEEX_HEADER_VERSION_LENGTH);
616 if (ver != NULL && *ver != '\0') {
617 gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
618 GST_TAG_ENCODER_VERSION, ver, NULL);
621 if (dec->header->bitrate > 0) {
622 gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
623 GST_TAG_BITRATE, (guint) dec->header->bitrate, NULL);
626 GST_INFO_OBJECT (dec, "tags: %" GST_PTR_FORMAT, list);
628 gst_element_found_tags_for_pad (GST_ELEMENT (dec), dec->srcpad, list);
637 speex_dec_chain_parse_data (GstSpeexDec * dec, GstBuffer * buf,
638 GstClockTime timestamp, GstClockTime duration)
640 GstFlowReturn res = GST_FLOW_OK;
646 if (timestamp != -1) {
647 dec->segment.last_stop = timestamp;
648 dec->granulepos = -1;
652 data = GST_BUFFER_DATA (buf);
653 size = GST_BUFFER_SIZE (buf);
655 /* send data to the bitstream */
656 speex_bits_read_from (&dec->bits, (char *) data, size);
658 fpp = dec->header->frames_per_packet;
661 GST_DEBUG_OBJECT (dec, "received buffer of size %u, fpp %d", size, fpp);
663 if (!GST_BUFFER_TIMESTAMP_IS_VALID (buf)
664 && GST_BUFFER_OFFSET_END_IS_VALID (buf)) {
665 dec->granulepos = GST_BUFFER_OFFSET_END (buf);
666 GST_DEBUG_OBJECT (dec,
667 "Taking granulepos from upstream: %" G_GUINT64_FORMAT,
673 /* concealment data, pass NULL as the bits parameters */
674 GST_DEBUG_OBJECT (dec, "creating concealment data");
675 fpp = dec->header->frames_per_packet;
680 /* now decode each frame */
681 for (i = 0; i < fpp; i++) {
686 GST_LOG_OBJECT (dec, "decoding frame %d/%d", i, fpp);
688 res = gst_pad_alloc_buffer_and_set_caps (dec->srcpad,
689 GST_BUFFER_OFFSET_NONE, dec->frame_size * dec->header->nb_channels * 2,
690 GST_PAD_CAPS (dec->srcpad), &outbuf);
692 if (res != GST_FLOW_OK) {
693 GST_DEBUG_OBJECT (dec, "buf alloc flow: %s", gst_flow_get_name (res));
697 out_data = (gint16 *) GST_BUFFER_DATA (outbuf);
699 ret = speex_decode_int (dec->state, bits, out_data);
701 /* uh? end of stream */
702 GST_WARNING_OBJECT (dec, "Unexpected end of stream found");
703 gst_buffer_unref (outbuf);
706 } else if (ret == -2) {
707 GST_WARNING_OBJECT (dec, "Decoding error: corrupted stream?");
708 gst_buffer_unref (outbuf);
713 if (bits && speex_bits_remaining (bits) < 0) {
714 GST_WARNING_OBJECT (dec, "Decoding overflow: corrupted stream?");
715 gst_buffer_unref (outbuf);
719 if (dec->header->nb_channels == 2)
720 speex_decode_stereo_int (out_data, dec->frame_size, &dec->stereo);
722 if (dec->granulepos == -1) {
723 if (dec->segment.format != GST_FORMAT_TIME) {
724 GST_WARNING_OBJECT (dec, "segment not initialized or not TIME format");
725 dec->granulepos = dec->frame_size;
727 dec->granulepos = gst_util_uint64_scale_int (dec->segment.last_stop,
728 dec->header->rate, GST_SECOND) + dec->frame_size;
730 GST_DEBUG_OBJECT (dec, "granulepos=%" G_GINT64_FORMAT, dec->granulepos);
733 if (timestamp == -1) {
734 timestamp = gst_util_uint64_scale_int (dec->granulepos - dec->frame_size,
735 GST_SECOND, dec->header->rate);
738 GST_BUFFER_OFFSET (outbuf) = dec->granulepos - dec->frame_size;
739 GST_BUFFER_OFFSET_END (outbuf) = dec->granulepos;
740 GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
741 GST_BUFFER_DURATION (outbuf) = dec->frame_duration;
743 dec->granulepos += dec->frame_size;
744 dec->segment.last_stop += dec->frame_duration;
746 GST_LOG_OBJECT (dec, "pushing buffer with ts=%" GST_TIME_FORMAT ", dur=%"
747 GST_TIME_FORMAT, GST_TIME_ARGS (timestamp),
748 GST_TIME_ARGS (dec->frame_duration));
750 res = gst_pad_push (dec->srcpad, outbuf);
752 if (res != GST_FLOW_OK) {
753 GST_DEBUG_OBJECT (dec, "flow: %s", gst_flow_get_name (res));
763 speex_dec_chain (GstPad * pad, GstBuffer * buf)
768 dec = GST_SPEEX_DEC (gst_pad_get_parent (pad));
770 switch (dec->packetno) {
772 res = speex_dec_chain_parse_header (dec, buf);
775 res = speex_dec_chain_parse_comments (dec, buf);
779 speex_dec_chain_parse_data (dec, buf, GST_BUFFER_TIMESTAMP (buf),
780 GST_BUFFER_DURATION (buf));
786 gst_buffer_unref (buf);
787 gst_object_unref (dec);
793 gst_speex_dec_get_property (GObject * object, guint prop_id,
794 GValue * value, GParamSpec * pspec)
796 GstSpeexDec *speexdec;
798 speexdec = GST_SPEEX_DEC (object);
802 g_value_set_boolean (value, speexdec->enh);
805 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
811 gst_speex_dec_set_property (GObject * object, guint prop_id,
812 const GValue * value, GParamSpec * pspec)
814 GstSpeexDec *speexdec;
816 speexdec = GST_SPEEX_DEC (object);
820 speexdec->enh = g_value_get_boolean (value);
823 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
829 static GstStateChangeReturn
830 speex_dec_change_state (GstElement * element, GstStateChange transition)
832 GstStateChangeReturn ret;
833 GstSpeexDec *dec = GST_SPEEX_DEC (element);
835 switch (transition) {
836 case GST_STATE_CHANGE_NULL_TO_READY:
837 case GST_STATE_CHANGE_READY_TO_PAUSED:
838 case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
843 ret = parent_class->change_state (element, transition);
844 if (ret != GST_STATE_CHANGE_SUCCESS)
847 switch (transition) {
848 case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
850 case GST_STATE_CHANGE_PAUSED_TO_READY:
851 gst_speex_dec_reset (dec);
853 case GST_STATE_CHANGE_READY_TO_NULL: