ext/musepack/gstmusepackdec.c: Some cleanups; pause task when push fails.

Original commit message from CVS:
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_base_init),
(gst_musepackdec_init), (gst_musepackdec_send_newsegment),
(gst_musepackdec_handle_seek_event),
(gst_musepackdec_get_src_query_types), (gst_musepackdec_src_query),
(gst_musepack_stream_init), (gst_musepackdec_sink_activate),
(gst_musepackdec_sink_activate_pull), (gst_musepackdec_loop),
(gst_musepackdec_change_state):
Some cleanups; pause task when push fails.
This commit is contained in:
Tim-Philipp Müller 2006-03-06 13:13:44 +00:00
parent c0a09d212b
commit 13cd0b0626
2 changed files with 116 additions and 212 deletions

View file

@ -1,3 +1,14 @@
2006-03-06 Tim-Philipp Müller <tim at centricular dot net>
* ext/musepack/gstmusepackdec.c: (gst_musepackdec_base_init),
(gst_musepackdec_init), (gst_musepackdec_send_newsegment),
(gst_musepackdec_handle_seek_event),
(gst_musepackdec_get_src_query_types), (gst_musepackdec_src_query),
(gst_musepack_stream_init), (gst_musepackdec_sink_activate),
(gst_musepackdec_sink_activate_pull), (gst_musepackdec_loop),
(gst_musepackdec_change_state):
Some cleanups; pause task when push fails.
2006-03-05 Tim-Philipp Müller <tim at centricular dot net> 2006-03-05 Tim-Philipp Müller <tim at centricular dot net>
* gst/qtdemux/qtdemux.c: (qtdemux_video_caps): * gst/qtdemux/qtdemux.c: (qtdemux_video_caps):

View file

@ -59,9 +59,6 @@ static void gst_musepackdec_dispose (GObject * obj);
static gboolean gst_musepackdec_src_event (GstPad * pad, GstEvent * event); static gboolean gst_musepackdec_src_event (GstPad * pad, GstEvent * event);
static const GstQueryType *gst_musepackdec_get_src_query_types (GstPad * pad); static const GstQueryType *gst_musepackdec_get_src_query_types (GstPad * pad);
static gboolean gst_musepackdec_src_query (GstPad * pad, GstQuery * query); static gboolean gst_musepackdec_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_musepackdec_src_convert (GstPad * pad,
GstFormat src_format, gint64 src_value, GstFormat * dest_format,
gint64 * dest_value);
static gboolean gst_musepackdec_sink_activate (GstPad * sinkpad); static gboolean gst_musepackdec_sink_activate (GstPad * sinkpad);
static gboolean static gboolean
gst_musepackdec_sink_activate_pull (GstPad * sinkpad, gboolean active); gst_musepackdec_sink_activate_pull (GstPad * sinkpad, gboolean active);
@ -70,9 +67,10 @@ static void gst_musepackdec_loop (GstPad * sinkpad);
static GstStateChangeReturn static GstStateChangeReturn
gst_musepackdec_change_state (GstElement * element, GstStateChange transition); gst_musepackdec_change_state (GstElement * element, GstStateChange transition);
GST_BOILERPLATE (GstMusepackDec, gst_musepackdec, GstElement, GST_TYPE_ELEMENT) GST_BOILERPLATE (GstMusepackDec, gst_musepackdec, GstElement, GST_TYPE_ELEMENT);
static void gst_musepackdec_base_init (gpointer klass) static void
gst_musepackdec_base_init (gpointer klass)
{ {
static GstElementDetails gst_musepackdec_details = static GstElementDetails gst_musepackdec_details =
GST_ELEMENT_DETAILS ("Musepack decoder", GST_ELEMENT_DETAILS ("Musepack decoder",
@ -104,10 +102,11 @@ static void
gst_musepackdec_init (GstMusepackDec * musepackdec, GstMusepackDecClass * klass) gst_musepackdec_init (GstMusepackDec * musepackdec, GstMusepackDecClass * klass)
{ {
musepackdec->offset = 0; musepackdec->offset = 0;
musepackdec->rate = 0;
musepackdec->bps = 0;
musepackdec->r = g_new (mpc_reader, 1); musepackdec->r = g_new (mpc_reader, 1);
musepackdec->d = g_new (mpc_decoder, 1); musepackdec->d = g_new (mpc_decoder, 1);
musepackdec->init = FALSE;
musepackdec->sinkpad = musepackdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sink_template), gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
@ -147,33 +146,23 @@ gst_musepackdec_dispose (GObject * obj)
} }
static void static void
gst_musepackdec_send_newsegment (GstMusepackDec * dec, gboolean update) gst_musepackdec_send_newsegment (GstMusepackDec * dec)
{ {
GstSegment *s = &dec->segment; GstSegment *s = &dec->segment;
GstFormat target_format = GST_FORMAT_TIME;
gint64 stop_time = GST_CLOCK_TIME_NONE; gint64 stop_time = GST_CLOCK_TIME_NONE;
gint64 start_time = 0; gint64 start_time = 0;
/* segment is in DEFAULT format, but we want to send a TIME newsegment */ start_time = gst_util_uint64_scale_int (s->start, GST_SECOND, dec->rate);
if (!gst_musepackdec_src_convert (dec->srcpad, GST_FORMAT_DEFAULT,
s->start, &target_format, &start_time)) {
GST_WARNING_OBJECT (dec, "failed to convert segment start %"
G_GINT64_FORMAT " to TIME", s->start);
return;
}
if (s->stop != -1 && !gst_musepackdec_src_convert (dec->srcpad, if (s->stop != -1)
GST_FORMAT_DEFAULT, s->stop, &target_format, &stop_time)) { stop_time = gst_util_uint64_scale_int (s->stop, GST_SECOND, dec->rate);
GST_WARNING_OBJECT (dec, "failed to convert segment stop to TIME");
return;
}
GST_DEBUG_OBJECT (dec, "sending newsegment from %" GST_TIME_FORMAT GST_DEBUG_OBJECT (dec, "sending newsegment from %" GST_TIME_FORMAT
" to %" GST_TIME_FORMAT, GST_TIME_ARGS (start_time), " to %" GST_TIME_FORMAT ", rate = %.1f", GST_TIME_ARGS (start_time),
GST_TIME_ARGS (stop_time)); GST_TIME_ARGS (stop_time), s->rate);
gst_pad_push_event (dec->srcpad, gst_pad_push_event (dec->srcpad,
gst_event_new_new_segment (update, s->rate, GST_FORMAT_TIME, gst_event_new_new_segment (FALSE, s->rate, GST_FORMAT_TIME,
start_time, stop_time, start_time)); start_time, stop_time, start_time));
} }
@ -184,11 +173,10 @@ gst_musepackdec_handle_seek_event (GstMusepackDec * dec, GstEvent * event)
GstSeekFlags flags; GstSeekFlags flags;
GstSegment segment; GstSegment segment;
GstFormat format; GstFormat format;
gboolean only_update;
gboolean seek_ok;
gboolean flush; gboolean flush;
gdouble rate; gdouble rate;
gint64 start, stop; gint64 start, stop;
gint samplerate;
gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start, gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
&stop_type, &stop); &stop_type, &stop);
@ -198,53 +186,32 @@ gst_musepackdec_handle_seek_event (GstMusepackDec * dec, GstEvent * event)
return FALSE; return FALSE;
} }
GST_OBJECT_LOCK (dec); samplerate = g_atomic_int_get (&dec->rate);
if (format == GST_FORMAT_TIME) { if (format == GST_FORMAT_TIME) {
format = GST_FORMAT_DEFAULT; if (start_type != GST_SEEK_TYPE_NONE)
if (start_type != GST_SEEK_TYPE_NONE && start = gst_util_uint64_scale_int (start, samplerate, GST_SECOND);
!gst_musepackdec_src_convert (dec->srcpad, GST_FORMAT_TIME, if (stop_type != GST_SEEK_TYPE_NONE)
start, &format, &start)) { stop = gst_util_uint64_scale_int (stop, samplerate, GST_SECOND);
GST_DEBUG_OBJECT (dec, "failed to convert start to to DEFAULT format");
goto failed;
}
if (stop_type != GST_SEEK_TYPE_NONE &&
!gst_musepackdec_src_convert (dec->srcpad, GST_FORMAT_TIME,
stop, &format, &stop)) {
GST_DEBUG_OBJECT (dec, "failed to convert stop to to DEFAULT format");
goto failed;
}
} }
flush = ((flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH); flush = ((flags & GST_SEEK_FLAG_FLUSH) == GST_SEEK_FLAG_FLUSH);
if (flush)
gst_pad_push_event (dec->srcpad, gst_event_new_flush_start ());
else
gst_pad_pause_task (dec->sinkpad); /* not _stop_task()? */
GST_PAD_STREAM_LOCK (dec->sinkpad);
/* operate on segment copy until we know the seek worked */ /* operate on segment copy until we know the seek worked */
segment = dec->segment; segment = dec->segment;
GST_OBJECT_UNLOCK (dec);
gst_segment_set_seek (&segment, rate, GST_FORMAT_DEFAULT, gst_segment_set_seek (&segment, rate, GST_FORMAT_DEFAULT,
flags, start_type, start, stop_type, stop, &only_update); flags, start_type, start, stop_type, stop, NULL);
if (flush) {
gst_pad_push_event (dec->srcpad, gst_event_new_flush_start ());
} else {
gst_pad_stop_task (dec->sinkpad);
}
gst_pad_push_event (dec->sinkpad, gst_event_new_flush_start ());
GST_PAD_STREAM_LOCK (dec->sinkpad);
gst_pad_push_event (dec->sinkpad, gst_event_new_flush_stop ()); gst_pad_push_event (dec->sinkpad, gst_event_new_flush_stop ());
GST_OBJECT_LOCK (dec);
#if 0
if (only_update) {
dec->segment = segment;
gst_musepackdec_send_newsegment (dec, TRUE);
goto done;
}
#endif
GST_DEBUG_OBJECT (dec, "segment: [%" G_GINT64_FORMAT "-%" G_GINT64_FORMAT GST_DEBUG_OBJECT (dec, "segment: [%" G_GINT64_FORMAT "-%" G_GINT64_FORMAT
"] = [%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "]", "] = [%" GST_TIME_FORMAT "-%" GST_TIME_FORMAT "]",
segment.start, segment.stop, segment.start, segment.stop,
@ -254,55 +221,37 @@ gst_musepackdec_handle_seek_event (GstMusepackDec * dec, GstEvent * event)
GST_DEBUG_OBJECT (dec, "performing seek to sample %" G_GINT64_FORMAT, GST_DEBUG_OBJECT (dec, "performing seek to sample %" G_GINT64_FORMAT,
segment.start); segment.start);
if (segment.start < 0 || segment.start >= segment.duration) {
GST_WARNING_OBJECT (dec, "seek out of bounds");
goto failed;
}
if (!mpc_decoder_seek_sample (dec->d, segment.start))
goto failed;
/* FIXME: support segment seeks */
if (flush) { if (flush) {
gst_pad_push_event (dec->srcpad, gst_event_new_flush_stop ()); gst_pad_push_event (dec->srcpad, gst_event_new_flush_stop ());
} }
if (segment.start < 0 || segment.start >= segment.duration) {
GST_WARNING_OBJECT (dec, "seek out of bounds");
GST_PAD_STREAM_UNLOCK (dec->sinkpad);
goto failed;
}
seek_ok = mpc_decoder_seek_sample (dec->d, segment.start);
if (!seek_ok) {
GST_PAD_STREAM_UNLOCK (dec->sinkpad);
goto failed;
}
/* FIXME: support segment seeks
if ((seek_flags & GST_SEEK_FLAG_SEGMENT) != 0) {
GST_DEBUG_OBJECT (dec, "posting SEGMENT_START message");
GST_OBJECT_UNLOCK (dec);
gst_element_post_message (GST_ELEMENT (dec),
gst_message_new_segment_start (GST_OBJECT (dec),
GST_FORMAT_DEFAULT, dec->segment.start));
GST_OBJECT_LOCK (dec);
}
*/
gst_segment_set_last_stop (&segment, GST_FORMAT_DEFAULT, segment.start); gst_segment_set_last_stop (&segment, GST_FORMAT_DEFAULT, segment.start);
dec->segment = segment; dec->segment = segment;
gst_musepackdec_send_newsegment (dec, FALSE); gst_musepackdec_send_newsegment (dec);
GST_DEBUG_OBJECT (dec, "seek successful"); GST_DEBUG_OBJECT (dec, "seek successful");
#if 0
done:
#endif
GST_PAD_STREAM_UNLOCK (dec->sinkpad);
gst_pad_start_task (dec->sinkpad, gst_pad_start_task (dec->sinkpad,
(GstTaskFunction) gst_musepackdec_loop, dec->sinkpad); (GstTaskFunction) gst_musepackdec_loop, dec->sinkpad);
GST_OBJECT_UNLOCK (dec); GST_PAD_STREAM_UNLOCK (dec->sinkpad);
return TRUE; return TRUE;
failed: failed:
{ {
GST_WARNING_OBJECT (dec, "seek failed"); GST_WARNING_OBJECT (dec, "seek failed");
GST_OBJECT_UNLOCK (dec); GST_PAD_STREAM_UNLOCK (dec->sinkpad);
return FALSE; return FALSE;
} }
} }
@ -336,7 +285,6 @@ gst_musepackdec_get_src_query_types (GstPad * pad)
static const GstQueryType query_types[] = { static const GstQueryType query_types[] = {
GST_QUERY_POSITION, GST_QUERY_POSITION,
GST_QUERY_DURATION, GST_QUERY_DURATION,
GST_QUERY_CONVERT,
(GstQueryType) 0 (GstQueryType) 0
}; };
@ -347,121 +295,60 @@ static gboolean
gst_musepackdec_src_query (GstPad * pad, GstQuery * query) gst_musepackdec_src_query (GstPad * pad, GstQuery * query)
{ {
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (gst_pad_get_parent (pad)); GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (gst_pad_get_parent (pad));
GstFormat format = GST_FORMAT_DEFAULT; GstFormat format;
GstFormat dest_format; gboolean res = FALSE;
gint64 value, dest_value; gint samplerate;
gboolean res = TRUE;
GST_OBJECT_LOCK (musepackdec); samplerate = g_atomic_int_get (&musepackdec->rate);
if (!musepackdec->init) { if (samplerate == 0)
res = FALSE;
goto done; goto done;
}
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION: case GST_QUERY_POSITION:{
gst_query_parse_position (query, &dest_format, NULL); gint64 cur, cur_off;
if (!gst_musepackdec_src_convert (pad, format,
musepackdec->segment.last_stop, &dest_format, &dest_value)) { gst_query_parse_position (query, &format, NULL);
res = FALSE;
GST_OBJECT_LOCK (musepackdec);
cur_off = musepackdec->segment.last_stop;
GST_OBJECT_UNLOCK (musepackdec);
if (format == GST_FORMAT_TIME) {
cur = gst_util_uint64_scale_int (cur_off, GST_SECOND, samplerate);
gst_query_set_position (query, GST_FORMAT_TIME, cur);
res = TRUE;
} else if (format == GST_FORMAT_DEFAULT) {
gst_query_set_position (query, GST_FORMAT_DEFAULT, cur_off);
res = TRUE;
} }
gst_query_set_position (query, dest_format, dest_value);
break; break;
case GST_QUERY_DURATION: }
gst_query_parse_duration (query, &dest_format, NULL); case GST_QUERY_DURATION:{
if (!gst_musepackdec_src_convert (pad, format, gint64 len, len_off;
musepackdec->segment.duration, &dest_format, &dest_value)) {
res = FALSE; gst_query_parse_duration (query, &format, NULL);
break;
GST_OBJECT_LOCK (musepackdec);
len_off = musepackdec->segment.duration;
GST_OBJECT_UNLOCK (musepackdec);
if (format == GST_FORMAT_TIME) {
len = gst_util_uint64_scale_int (len_off, GST_SECOND, samplerate);
gst_query_set_duration (query, GST_FORMAT_TIME, len);
res = TRUE;
} else if (format == GST_FORMAT_DEFAULT) {
gst_query_set_duration (query, GST_FORMAT_DEFAULT, len_off);
res = TRUE;
} }
gst_query_set_duration (query, dest_format, dest_value);
break;
case GST_QUERY_CONVERT:
gst_query_parse_convert (query, &format, &value, &dest_format,
&dest_value);
if (!gst_musepackdec_src_convert (pad, format, value, &dest_format,
&dest_value)) {
res = FALSE;
}
gst_query_set_convert (query, format, value, dest_format, dest_value);
break; break;
}
default: default:
res = gst_pad_query_default (pad, query); res = gst_pad_query_default (pad, query);
break; break;
} }
done: done:
GST_OBJECT_UNLOCK (musepackdec);
gst_object_unref (musepackdec);
return res;
}
static gboolean
gst_musepackdec_src_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
{
GstMusepackDec *musepackdec = GST_MUSEPACK_DEC (gst_pad_get_parent (pad));
gboolean res = TRUE;
if (!musepackdec->init) {
GST_DEBUG_OBJECT (musepackdec, "conversion failed: not initialiased yet");
gst_object_unref (musepackdec);
return FALSE;
}
switch (src_format) {
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_TIME:
*dest_value = gst_util_uint64_scale_int (src_value,
GST_SECOND, musepackdec->rate);
break;
case GST_FORMAT_BYTES:
*dest_value = src_value * musepackdec->bps;
break;
default:
res = FALSE;
break;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_value = gst_util_uint64_scale_int (src_value,
musepackdec->rate, GST_SECOND);
break;
case GST_FORMAT_BYTES:
*dest_value = gst_util_uint64_scale_int (src_value,
musepackdec->rate * musepackdec->bps, GST_SECOND);
break;
default:
res = FALSE;
break;
}
break;
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_value = src_value / musepackdec->bps;
break;
case GST_FORMAT_TIME:
*dest_value = gst_util_uint64_scale_int (src_value,
GST_SECOND, musepackdec->bps * musepackdec->rate);
break;
default:
res = FALSE;
break;
}
break;
default:
res = FALSE;
break;
}
gst_object_unref (musepackdec); gst_object_unref (musepackdec);
return res; return res;
} }
@ -503,8 +390,8 @@ gst_musepack_stream_init (GstMusepackDec * musepackdec)
return FALSE; return FALSE;
} }
musepackdec->bps = 4 * i.channels;; gst_atomic_int_set (&musepackdec->bps, 4 * i.channels);
musepackdec->rate = i.sample_freq; gst_atomic_int_set (&musepackdec->rate, i.sample_freq);
gst_segment_set_last_stop (&musepackdec->segment, GST_FORMAT_DEFAULT, 0); gst_segment_set_last_stop (&musepackdec->segment, GST_FORMAT_DEFAULT, 0);
gst_segment_set_duration (&musepackdec->segment, GST_FORMAT_DEFAULT, gst_segment_set_duration (&musepackdec->segment, GST_FORMAT_DEFAULT,
@ -552,18 +439,15 @@ gst_musepack_stream_init (GstMusepackDec * musepackdec)
static gboolean static gboolean
gst_musepackdec_sink_activate (GstPad * sinkpad) gst_musepackdec_sink_activate (GstPad * sinkpad)
{ {
if (!gst_pad_check_pull_range (sinkpad))
if (gst_pad_check_pull_range (sinkpad)) {
return gst_pad_activate_pull (sinkpad, TRUE);
} else {
return FALSE; return FALSE;
}
return gst_pad_activate_pull (sinkpad, TRUE);
} }
static gboolean static gboolean
gst_musepackdec_sink_activate_pull (GstPad * sinkpad, gboolean active) gst_musepackdec_sink_activate_pull (GstPad * sinkpad, gboolean active)
{ {
gboolean result; gboolean result;
if (active) { if (active) {
@ -583,19 +467,29 @@ gst_musepackdec_loop (GstPad * sinkpad)
GstFlowReturn flow; GstFlowReturn flow;
GstBuffer *out; GstBuffer *out;
guint32 update_acc, update_bits; guint32 update_acc, update_bits;
gint num_samples; gint num_samples, samplerate, bitspersample;
musepackdec = GST_MUSEPACK_DEC (GST_PAD_PARENT (sinkpad)); musepackdec = GST_MUSEPACK_DEC (GST_PAD_PARENT (sinkpad));
if (!musepackdec->init) { samplerate = g_atomic_int_get (&musepackdec->rate);
if (samplerate == 0) {
if (!gst_musepack_stream_init (musepackdec)) if (!gst_musepack_stream_init (musepackdec))
goto pause_task; goto pause_task;
musepackdec->init = TRUE; gst_musepackdec_send_newsegment (musepackdec);
gst_musepackdec_send_newsegment (musepackdec, FALSE); samplerate = g_atomic_int_get (&musepackdec->rate);
} }
out = gst_buffer_new_and_alloc (MPC_DECODER_BUFFER_LENGTH * 4); bitspersample = g_atomic_int_get (&musepackdec->bps);
flow = gst_pad_alloc_buffer_and_set_caps (musepackdec->srcpad, -1,
MPC_DECODER_BUFFER_LENGTH * 4, GST_PAD_CAPS (musepackdec->srcpad), &out);
if (flow != GST_FLOW_OK) {
GST_DEBUG_OBJECT (musepackdec, "Flow: %s", gst_flow_get_name (flow));
goto pause_task;
}
num_samples = mpc_decoder_decode (musepackdec->d, num_samples = mpc_decoder_decode (musepackdec->d,
(MPC_SAMPLE_FORMAT *) GST_BUFFER_DATA (out), &update_acc, &update_bits); (MPC_SAMPLE_FORMAT *) GST_BUFFER_DATA (out), &update_acc, &update_bits);
@ -610,16 +504,14 @@ gst_musepackdec_loop (GstPad * sinkpad)
goto pause_task; goto pause_task;
} }
GST_BUFFER_SIZE (out) = num_samples * musepackdec->bps; GST_BUFFER_SIZE (out) = num_samples * bitspersample;
GST_BUFFER_OFFSET (out) = musepackdec->segment.last_stop; GST_BUFFER_OFFSET (out) = musepackdec->segment.last_stop;
GST_BUFFER_TIMESTAMP (out) = GST_BUFFER_TIMESTAMP (out) =
gst_util_uint64_scale_int (musepackdec->segment.last_stop, gst_util_uint64_scale_int (musepackdec->segment.last_stop,
GST_SECOND, musepackdec->rate); GST_SECOND, samplerate);
GST_BUFFER_DURATION (out) = GST_BUFFER_DURATION (out) =
gst_util_uint64_scale_int (num_samples, GST_SECOND, musepackdec->rate); gst_util_uint64_scale_int (num_samples, GST_SECOND, samplerate);
gst_buffer_set_caps (out, GST_PAD_CAPS (musepackdec->srcpad));
musepackdec->segment.last_stop += num_samples; musepackdec->segment.last_stop += num_samples;
@ -627,7 +519,7 @@ gst_musepackdec_loop (GstPad * sinkpad)
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (out))); GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (out)));
flow = gst_pad_push (musepackdec->srcpad, out); flow = gst_pad_push (musepackdec->srcpad, out);
if (flow != GST_FLOW_OK && flow != GST_FLOW_NOT_LINKED) { if (flow != GST_FLOW_OK) {
GST_DEBUG_OBJECT (musepackdec, "Flow: %s", gst_flow_get_name (flow)); GST_DEBUG_OBJECT (musepackdec, "Flow: %s", gst_flow_get_name (flow));
goto pause_task; goto pause_task;
} }
@ -663,8 +555,9 @@ gst_musepackdec_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_segment_init (&musepackdec->segment, GST_FORMAT_UNDEFINED); gst_segment_init (&musepackdec->segment, GST_FORMAT_UNDEFINED);
musepackdec->init = FALSE;
musepackdec->offset = 0; musepackdec->offset = 0;
musepackdec->rate = 0;
musepackdec->bps = 0;
break; break;
default: default:
break; break;