64
64
GST_STATIC_CAPS ("audio/x-vorbis")
67
GST_BOILERPLATE (GST_VORBIS_DEC_GLIB_TYPE_NAME, gst_vorbis_dec, GstElement,
67
GST_BOILERPLATE (GstVorbisDec, gst_vorbis_dec, GstAudioDecoder,
68
GST_TYPE_AUDIO_DECODER);
70
70
static void vorbis_dec_finalize (GObject * object);
71
static gboolean vorbis_dec_sink_event (GstPad * pad, GstEvent * event);
72
static GstFlowReturn vorbis_dec_chain (GstPad * pad, GstBuffer * buffer);
73
static GstFlowReturn vorbis_dec_chain_forward (GstVorbisDec * vd,
74
gboolean discont, GstBuffer * buffer);
75
static GstFlowReturn vorbis_dec_chain_reverse (GstVorbisDec * vd,
76
gboolean discont, GstBuffer * buf);
77
static GstStateChangeReturn vorbis_dec_change_state (GstElement * element,
78
GstStateChange transition);
80
static gboolean vorbis_dec_src_event (GstPad * pad, GstEvent * event);
81
static gboolean vorbis_dec_src_query (GstPad * pad, GstQuery * query);
82
static gboolean vorbis_dec_convert (GstPad * pad,
83
GstFormat src_format, gint64 src_value,
84
GstFormat * dest_format, gint64 * dest_value);
86
static gboolean vorbis_dec_sink_query (GstPad * pad, GstQuery * query);
72
static gboolean vorbis_dec_start (GstAudioDecoder * dec);
73
static gboolean vorbis_dec_stop (GstAudioDecoder * dec);
74
static GstFlowReturn vorbis_dec_handle_frame (GstAudioDecoder * dec,
76
static void vorbis_dec_flush (GstAudioDecoder * dec, gboolean hard);
89
79
gst_vorbis_dec_base_init (gpointer g_class)
91
81
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
92
GstPadTemplate *src_template, *sink_template;
94
src_template = gst_static_pad_template_get (&vorbis_dec_src_factory);
95
gst_element_class_add_pad_template (element_class, src_template);
97
sink_template = gst_static_pad_template_get (&vorbis_dec_sink_factory);
98
gst_element_class_add_pad_template (element_class, sink_template);
83
gst_element_class_add_static_pad_template (element_class,
84
&vorbis_dec_src_factory);
85
gst_element_class_add_static_pad_template (element_class,
86
&vorbis_dec_sink_factory);
100
88
gst_element_class_set_details_simple (element_class,
101
89
"Vorbis audio decoder", "Codec/Decoder/Audio",
107
95
gst_vorbis_dec_class_init (GstVorbisDecClass * klass)
109
97
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
110
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
98
GstAudioDecoderClass *base_class = GST_AUDIO_DECODER_CLASS (klass);
112
100
gobject_class->finalize = vorbis_dec_finalize;
114
gstelement_class->change_state = GST_DEBUG_FUNCPTR (vorbis_dec_change_state);
117
static const GstQueryType *
118
vorbis_get_query_types (GstPad * pad)
120
static const GstQueryType vorbis_dec_src_query_types[] = {
127
return vorbis_dec_src_query_types;
102
base_class->start = GST_DEBUG_FUNCPTR (vorbis_dec_start);
103
base_class->stop = GST_DEBUG_FUNCPTR (vorbis_dec_stop);
104
base_class->handle_frame = GST_DEBUG_FUNCPTR (vorbis_dec_handle_frame);
105
base_class->flush = GST_DEBUG_FUNCPTR (vorbis_dec_flush);
131
109
gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class)
133
dec->sinkpad = gst_pad_new_from_static_template (&vorbis_dec_sink_factory,
136
gst_pad_set_event_function (dec->sinkpad,
137
GST_DEBUG_FUNCPTR (vorbis_dec_sink_event));
138
gst_pad_set_chain_function (dec->sinkpad,
139
GST_DEBUG_FUNCPTR (vorbis_dec_chain));
140
gst_pad_set_query_function (dec->sinkpad,
141
GST_DEBUG_FUNCPTR (vorbis_dec_sink_query));
142
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
144
dec->srcpad = gst_pad_new_from_static_template (&vorbis_dec_src_factory,
147
gst_pad_set_event_function (dec->srcpad,
148
GST_DEBUG_FUNCPTR (vorbis_dec_src_event));
149
gst_pad_set_query_type_function (dec->srcpad,
150
GST_DEBUG_FUNCPTR (vorbis_get_query_types));
151
gst_pad_set_query_function (dec->srcpad,
152
GST_DEBUG_FUNCPTR (vorbis_dec_src_query));
153
gst_pad_use_fixed_caps (dec->srcpad);
154
gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
157
dec->pendingevents = NULL;
181
132
gst_vorbis_dec_reset (GstVorbisDec * dec)
183
dec->last_timestamp = GST_CLOCK_TIME_NONE;
185
dec->seqnum = gst_util_seqnum_next ();
186
gst_segment_init (&dec->segment, GST_FORMAT_TIME);
188
g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL);
189
g_list_free (dec->queued);
191
g_list_foreach (dec->gather, (GFunc) gst_mini_object_unref, NULL);
192
g_list_free (dec->gather);
194
g_list_foreach (dec->decode, (GFunc) gst_mini_object_unref, NULL);
195
g_list_free (dec->decode);
197
g_list_foreach (dec->pendingevents, (GFunc) gst_mini_object_unref, NULL);
198
g_list_free (dec->pendingevents);
199
dec->pendingevents = NULL;
201
134
if (dec->taglist)
202
135
gst_tag_list_free (dec->taglist);
203
136
dec->taglist = NULL;
208
vorbis_dec_convert (GstPad * pad,
209
GstFormat src_format, gint64 src_value,
210
GstFormat * dest_format, gint64 * dest_value)
216
if (src_format == *dest_format) {
217
*dest_value = src_value;
221
dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
223
if (!dec->initialized)
226
if (dec->sinkpad == pad &&
227
(src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES))
230
switch (src_format) {
231
case GST_FORMAT_TIME:
232
switch (*dest_format) {
233
case GST_FORMAT_BYTES:
234
scale = dec->width * dec->vi.channels;
235
case GST_FORMAT_DEFAULT:
237
scale * gst_util_uint64_scale_int (src_value, dec->vi.rate,
244
case GST_FORMAT_DEFAULT:
245
switch (*dest_format) {
246
case GST_FORMAT_BYTES:
247
*dest_value = src_value * dec->width * dec->vi.channels;
249
case GST_FORMAT_TIME:
251
gst_util_uint64_scale_int (src_value, GST_SECOND, dec->vi.rate);
257
case GST_FORMAT_BYTES:
258
switch (*dest_format) {
259
case GST_FORMAT_DEFAULT:
260
*dest_value = src_value / (dec->width * dec->vi.channels);
262
case GST_FORMAT_TIME:
263
*dest_value = gst_util_uint64_scale_int (src_value, GST_SECOND,
264
dec->vi.rate * dec->width * dec->vi.channels);
274
gst_object_unref (dec);
281
GST_DEBUG_OBJECT (dec, "no header packets received");
287
GST_DEBUG_OBJECT (dec, "formats unsupported");
294
vorbis_dec_src_query (GstPad * pad, GstQuery * query)
297
gboolean res = FALSE;
299
dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
300
if (G_UNLIKELY (dec == NULL))
303
switch (GST_QUERY_TYPE (query)) {
304
case GST_QUERY_POSITION:
310
gst_query_parse_position (query, &format, NULL);
312
/* we start from the last seen time */
313
time = dec->last_timestamp;
314
/* correct for the segment values */
315
time = gst_segment_to_stream_time (&dec->segment, GST_FORMAT_TIME, time);
318
"query %p: our time: %" GST_TIME_FORMAT, query, GST_TIME_ARGS (time));
320
/* and convert to the final format */
322
vorbis_dec_convert (pad, GST_FORMAT_TIME, time, &format, &value)))
325
gst_query_set_position (query, format, value);
328
"query %p: we return %" G_GINT64_FORMAT " (format %u)", query, value,
333
case GST_QUERY_DURATION:
335
res = gst_pad_peer_query (dec->sinkpad, query);
341
case GST_QUERY_CONVERT:
343
GstFormat src_fmt, dest_fmt;
344
gint64 src_val, dest_val;
346
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
348
vorbis_dec_convert (pad, src_fmt, src_val, &dest_fmt, &dest_val)))
350
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
354
res = gst_pad_query_default (pad, query);
358
gst_object_unref (dec);
365
GST_WARNING_OBJECT (dec, "error handling query");
371
vorbis_dec_sink_query (GstPad * pad, GstQuery * query)
376
dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
378
switch (GST_QUERY_TYPE (query)) {
379
case GST_QUERY_CONVERT:
381
GstFormat src_fmt, dest_fmt;
382
gint64 src_val, dest_val;
384
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
386
vorbis_dec_convert (pad, src_fmt, src_val, &dest_fmt, &dest_val)))
388
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
392
res = gst_pad_query_default (pad, query);
397
gst_object_unref (dec);
404
GST_DEBUG_OBJECT (dec, "error converting value");
140
vorbis_dec_start (GstAudioDecoder * dec)
142
GstVorbisDec *vd = GST_VORBIS_DEC (dec);
144
GST_DEBUG_OBJECT (dec, "start");
145
vorbis_info_init (&vd->vi);
146
vorbis_comment_init (&vd->vc);
147
vd->initialized = FALSE;
148
gst_vorbis_dec_reset (vd);
154
vorbis_dec_stop (GstAudioDecoder * dec)
156
GstVorbisDec *vd = GST_VORBIS_DEC (dec);
158
GST_DEBUG_OBJECT (dec, "stop");
159
vd->initialized = FALSE;
161
vorbis_block_clear (&vd->vb);
163
vorbis_dsp_clear (&vd->vd);
164
vorbis_comment_clear (&vd->vc);
165
vorbis_info_clear (&vd->vi);
166
gst_vorbis_dec_reset (vd);
410
173
vorbis_dec_src_event (GstPad * pad, GstEvent * event)
471
vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
473
gboolean ret = FALSE;
476
dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
478
GST_LOG_OBJECT (dec, "handling event");
479
switch (GST_EVENT_TYPE (event)) {
481
if (dec->segment.rate < 0.0)
482
vorbis_dec_chain_reverse (dec, TRUE, NULL);
483
ret = gst_pad_push_event (dec->srcpad, event);
485
case GST_EVENT_FLUSH_START:
486
ret = gst_pad_push_event (dec->srcpad, event);
488
case GST_EVENT_FLUSH_STOP:
489
/* here we must clean any state in the decoder */
490
#ifdef HAVE_VORBIS_SYNTHESIS_RESTART
491
vorbis_synthesis_restart (&dec->vd);
493
gst_vorbis_dec_reset (dec);
494
ret = gst_pad_push_event (dec->srcpad, event);
496
case GST_EVENT_NEWSEGMENT:
500
gint64 start, stop, time;
503
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
504
&start, &stop, &time);
506
/* we need time for now */
507
if (format != GST_FORMAT_TIME)
508
goto newseg_wrong_format;
510
GST_DEBUG_OBJECT (dec,
511
"newsegment: update %d, rate %g, arate %g, start %" GST_TIME_FORMAT
512
", stop %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT,
513
update, rate, arate, GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
514
GST_TIME_ARGS (time));
516
/* now configure the values */
517
gst_segment_set_newsegment_full (&dec->segment, update,
518
rate, arate, format, start, stop, time);
519
dec->seqnum = gst_event_get_seqnum (event);
521
if (dec->initialized)
523
ret = gst_pad_push_event (dec->srcpad, event);
525
/* store it to send once we're initialized */
526
dec->pendingevents = g_list_append (dec->pendingevents, event);
533
if (dec->initialized)
535
ret = gst_pad_push_event (dec->srcpad, event);
537
/* store it to send once we're initialized */
538
dec->pendingevents = g_list_append (dec->pendingevents, event);
544
ret = gst_pad_push_event (dec->srcpad, event);
548
gst_object_unref (dec);
555
GST_DEBUG_OBJECT (dec, "received non TIME newsegment");
560
230
static GstFlowReturn
561
231
vorbis_handle_identification_packet (GstVorbisDec * vd)
613
283
* for mono/stereo and avoid the depth switch in tremor case */
614
284
vd->copy_samples = get_copy_sample_func (vd->vi.channels, vd->width);
616
caps = gst_caps_copy (gst_pad_get_pad_template_caps (vd->srcpad));
617
gst_caps_set_simple (caps, "rate", G_TYPE_INT, vd->vi.rate,
618
"channels", G_TYPE_INT, vd->vi.channels,
619
"width", G_TYPE_INT, width, NULL);
287
gst_caps_copy (gst_pad_get_pad_template_caps
288
(GST_AUDIO_DECODER_SRC_PAD (vd)));
289
gst_caps_set_simple (caps, "rate", G_TYPE_INT, vd->vi.rate, "channels",
290
G_TYPE_INT, vd->vi.channels, "width", G_TYPE_INT, width, NULL);
622
293
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
805
470
static GstFlowReturn
806
vorbis_dec_push_forward (GstVorbisDec * dec, GstBuffer * buf)
471
vorbis_dec_handle_header_buffer (GstVorbisDec * vd, GstBuffer * buffer)
808
GstFlowReturn result;
811
if (!(buf = gst_audio_buffer_clip (buf, &dec->segment, dec->vi.rate,
812
dec->vi.channels * dec->width))) {
813
GST_LOG_OBJECT (dec, "clipped buffer");
818
GST_LOG_OBJECT (dec, "setting DISCONT");
819
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
820
dec->discont = FALSE;
823
GST_DEBUG_OBJECT (dec,
824
"pushing time %" GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT,
825
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
826
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
828
result = gst_pad_push (dec->srcpad, buf);
474
ogg_packet_wrapper packet_wrapper;
476
gst_ogg_packet_wrapper_from_buffer (&packet_wrapper, buffer);
477
packet = gst_ogg_packet_from_wrapper (&packet_wrapper);
479
return vorbis_handle_header_packet (vd, packet);
482
#define MIN_NUM_HEADERS 3
833
483
static GstFlowReturn
834
vorbis_dec_push_reverse (GstVorbisDec * dec, GstBuffer * buf)
484
vorbis_dec_handle_header_caps (GstVorbisDec * vd)
836
486
GstFlowReturn result = GST_FLOW_OK;
838
dec->queued = g_list_prepend (dec->queued, buf);
844
vorbis_do_timestamps (GstVorbisDec * vd, GstBuffer * buf, gboolean reverse,
845
GstClockTime timestamp, GstClockTime duration)
847
/* interpolate reverse */
848
if (vd->last_timestamp != -1 && duration != -1 && reverse)
849
vd->last_timestamp -= duration;
851
/* take buffer timestamp, use interpolated timestamp otherwise */
853
vd->last_timestamp = timestamp;
855
timestamp = vd->last_timestamp;
857
/* interpolate forwards */
858
if (vd->last_timestamp != -1 && duration != -1 && !reverse)
859
vd->last_timestamp += duration;
862
"keeping timestamp %" GST_TIME_FORMAT " ts %" GST_TIME_FORMAT " dur %"
863
GST_TIME_FORMAT, GST_TIME_ARGS (vd->last_timestamp),
864
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration));
867
GST_BUFFER_TIMESTAMP (buf) = timestamp;
868
GST_BUFFER_DURATION (buf) = duration;
488
GstStructure *s = NULL;
489
const GValue *array = NULL;
491
caps = GST_PAD_CAPS (GST_AUDIO_DECODER_SINK_PAD (vd));
493
s = gst_caps_get_structure (caps, 0);
495
array = gst_structure_get_value (s, "streamheader");
497
if (array && (gst_value_array_get_size (array) >= MIN_NUM_HEADERS)) {
498
const GValue *value = NULL;
499
GstBuffer *buf = NULL;
502
while (result == GST_FLOW_OK && i < gst_value_array_get_size (array)) {
503
value = gst_value_array_get_value (array, i);
504
buf = gst_value_get_buffer (value);
507
result = vorbis_dec_handle_header_buffer (vd, buf);
514
return (result != GST_FLOW_OK ? GST_FLOW_NOT_NEGOTIATED : GST_FLOW_OK);
519
GST_WARNING_OBJECT (vd, "streamheader array not found");
520
result = GST_FLOW_ERROR;
525
GST_WARNING_OBJECT (vd, "streamheader with null buffer received");
526
result = GST_FLOW_ERROR;
872
532
static GstFlowReturn
873
533
vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
874
534
GstClockTime timestamp, GstClockTime duration)
877
537
vorbis_sample_t *pcm;
879
539
vorbis_sample_t **pcm;
1058
717
GST_ELEMENT_ERROR (vd, STREAM, DECODE, (NULL), ("empty header received"));
1059
718
result = GST_FLOW_ERROR;
1067
* Buffer decoding order: 7 8 9 4 5 6 3 1 2 EOS
1068
* Discont flag: D D D D
1070
* - Each Discont marks a discont in the decoding order.
1072
* for vorbis, each buffer is a keyframe when we have the previous
1073
* buffer. This means that to decode buffer 7, we need buffer 6, which
1074
* arrives out of order.
1076
* we first gather buffers in the gather queue until we get a DISCONT. We
1077
* prepend each incomming buffer so that they are in reversed order.
1079
* gather queue: 9 8 7
1083
* When a DISCONT is received (buffer 4), we move the gather queue to the
1084
* decode queue. This is simply done be taking the head of the gather queue
1085
* and prepending it to the decode queue. This yields:
1088
* decode queue: 7 8 9
1091
* Then we decode each buffer in the decode queue in order and put the output
1092
* buffer in the output queue. The first buffer (7) will not produce any output
1093
* because it needs the previous buffer (6) which did not arrive yet. This
1097
* decode queue: 7 8 9
1100
* Then we remove the consumed buffers from the decode queue. Buffer 7 is not
1101
* completely consumed, we need to keep it around for when we receive buffer
1108
* Then we accumulate more buffers:
1110
* gather queue: 6 5 4
1114
* prepending to the decode queue on DISCONT yields:
1117
* decode queue: 4 5 6 7
1120
* after decoding and keeping buffer 4:
1124
* output queue: 7 6 5
1128
static GstFlowReturn
1129
vorbis_dec_flush_decode (GstVorbisDec * dec)
1131
GstFlowReturn res = GST_FLOW_OK;
1136
GST_DEBUG_OBJECT (dec, "flushing buffers to decoder");
1140
GstBuffer *buf = GST_BUFFER_CAST (walk->data);
1142
GST_DEBUG_OBJECT (dec, "decoding buffer %p, ts %" GST_TIME_FORMAT,
1143
buf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
1145
next = g_list_next (walk);
1147
/* decode buffer, prepend to output queue */
1148
res = vorbis_dec_decode_buffer (dec, buf);
1150
/* if we generated output, we can discard the buffer, else we
1151
* keep it in the queue */
1153
GST_DEBUG_OBJECT (dec, "decoded buffer to %p", dec->queued->data);
1154
dec->decode = g_list_delete_link (dec->decode, walk);
1155
gst_buffer_unref (buf);
1157
GST_DEBUG_OBJECT (dec, "buffer did not decode, keeping");
1161
while (dec->queued) {
1162
GstBuffer *buf = GST_BUFFER_CAST (dec->queued->data);
1163
GstClockTime timestamp, duration;
1165
timestamp = GST_BUFFER_TIMESTAMP (buf);
1166
duration = GST_BUFFER_DURATION (buf);
1168
vorbis_do_timestamps (dec, buf, TRUE, timestamp, duration);
1169
res = vorbis_dec_push_forward (dec, buf);
1171
dec->queued = g_list_delete_link (dec->queued, dec->queued);
1176
static GstFlowReturn
1177
vorbis_dec_chain_reverse (GstVorbisDec * vd, gboolean discont, GstBuffer * buf)
1179
GstFlowReturn result = GST_FLOW_OK;
1181
/* if we have a discont, move buffers to the decode list */
1182
if (G_UNLIKELY (discont)) {
1183
GST_DEBUG_OBJECT (vd, "received discont");
1184
while (vd->gather) {
1187
gbuf = GST_BUFFER_CAST (vd->gather->data);
1188
/* remove from the gather list */
1189
vd->gather = g_list_delete_link (vd->gather, vd->gather);
1190
/* copy to decode queue */
1191
vd->decode = g_list_prepend (vd->decode, gbuf);
1193
/* flush and decode the decode queue */
1194
result = vorbis_dec_flush_decode (vd);
1197
if (G_LIKELY (buf)) {
1198
GST_DEBUG_OBJECT (vd,
1199
"gathering buffer %p of size %u, time %" GST_TIME_FORMAT
1200
", dur %" GST_TIME_FORMAT, buf, GST_BUFFER_SIZE (buf),
1201
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
1202
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
1204
/* add buffer to gather queue */
1205
vd->gather = g_list_prepend (vd->gather, buf);
1211
static GstFlowReturn
1212
vorbis_dec_chain_forward (GstVorbisDec * vd, gboolean discont,
1215
GstFlowReturn result;
1217
result = vorbis_dec_decode_buffer (vd, buffer);
1219
gst_buffer_unref (buffer);
1224
static GstFlowReturn
1225
vorbis_dec_chain (GstPad * pad, GstBuffer * buffer)
1228
GstFlowReturn result = GST_FLOW_OK;
1231
vd = GST_VORBIS_DEC (gst_pad_get_parent (pad));
1233
discont = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT);
1235
/* resync on DISCONT */
1236
if (G_UNLIKELY (discont)) {
1237
GST_DEBUG_OBJECT (vd, "received DISCONT buffer");
1238
vd->last_timestamp = GST_CLOCK_TIME_NONE;
724
vorbis_dec_flush (GstAudioDecoder * dec, gboolean hard)
726
GstVorbisDec *vd = GST_VORBIS_DEC (dec);
1239
728
#ifdef HAVE_VORBIS_SYNTHESIS_RESTART
1240
vorbis_synthesis_restart (&vd->vd);
1245
if (vd->segment.rate >= 0.0)
1246
result = vorbis_dec_chain_forward (vd, discont, buffer);
1248
result = vorbis_dec_chain_reverse (vd, discont, buffer);
1250
gst_object_unref (vd);
1255
static GstStateChangeReturn
1256
vorbis_dec_change_state (GstElement * element, GstStateChange transition)
1258
GstVorbisDec *vd = GST_VORBIS_DEC (element);
1259
GstStateChangeReturn res;
1261
switch (transition) {
1262
case GST_STATE_CHANGE_NULL_TO_READY:
1264
case GST_STATE_CHANGE_READY_TO_PAUSED:
1265
vorbis_info_init (&vd->vi);
1266
vorbis_comment_init (&vd->vc);
1267
vd->initialized = FALSE;
1268
gst_vorbis_dec_reset (vd);
1270
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
1276
res = parent_class->change_state (element, transition);
1278
switch (transition) {
1279
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
1281
case GST_STATE_CHANGE_PAUSED_TO_READY:
1282
GST_DEBUG_OBJECT (vd, "PAUSED -> READY, clearing vorbis structures");
1283
vd->initialized = FALSE;
1286
vorbis_block_clear (&vd->vb);
1289
vorbis_dsp_clear (&vd->vd);
1290
vorbis_comment_clear (&vd->vc);
1291
vorbis_info_clear (&vd->vi);
1292
gst_vorbis_dec_reset (vd);
1294
case GST_STATE_CHANGE_READY_TO_NULL:
729
vorbis_synthesis_restart (&vd->vd);
733
gst_vorbis_dec_reset (vd);