From a017143695a98c99002d596efe0b6d55896179ba Mon Sep 17 00:00:00 2001 From: Edgard Lima Date: Fri, 20 Jan 2006 17:04:38 +0000 Subject: Fixed state transictions PLAYING->NULL->PLAYING. Original commit message from CVS: Fixed state transictions PLAYING->NULL->PLAYING. --- ext/ivorbis/vorbisfile.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'ext/ivorbis') diff --git a/ext/ivorbis/vorbisfile.c b/ext/ivorbis/vorbisfile.c index 2de32157..0268b8c3 100644 --- a/ext/ivorbis/vorbisfile.c +++ b/ext/ivorbis/vorbisfile.c @@ -145,6 +145,7 @@ static gboolean gst_ivorbisfile_sink_activate_pull (GstPad * sinkpad, gboolean active); static void gst_ivorbisfile_loop (GstPad * pad); +static GstFlowReturn gst_ivorbisfile_play (GstPad * pad); static GstElementClass *parent_class = NULL; @@ -288,6 +289,13 @@ gst_ivorbisfile_init (Ivorbisfile * ivorbisfile) ivorbisfile->adapter = NULL; + if (ivorbisfile->metadata) { + ivorbisfile->metadata = NULL; + } + if (ivorbisfile->streaminfo) { + ivorbisfile->streaminfo = NULL; + } + } @@ -621,15 +629,19 @@ gst_ivorbisfile_chain (GstPad * pad, GstBuffer * buffer) gst_adapter_push (ivorbisfile->adapter, buffer); - gst_ivorbisfile_loop (pad); - - return GST_FLOW_OK; + return gst_ivorbisfile_play (pad); } static void gst_ivorbisfile_loop (GstPad * pad) +{ + gst_ivorbisfile_play (pad); +} + +static GstFlowReturn +gst_ivorbisfile_play (GstPad * pad) { Ivorbisfile *ivorbisfile = GST_IVORBISFILE (gst_pad_get_parent (pad)); GstBuffer *outbuf; @@ -637,6 +649,7 @@ gst_ivorbisfile_loop (GstPad * pad) GstClockTime time; gint64 samples; gint link; + GstFlowReturn res = GST_FLOW_OK; if (ivorbisfile->eos) { goto done; @@ -803,7 +816,7 @@ gst_ivorbisfile_loop (GstPad * pad) ivorbisfile->total_bytes += GST_BUFFER_SIZE (outbuf); } - if (GST_FLOW_OK != gst_pad_push (ivorbisfile->srcpad, outbuf)) { + if (GST_FLOW_OK != (res = gst_pad_push (ivorbisfile->srcpad, outbuf))) { goto done; } @@ -814,6 +827,7 @@ gst_ivorbisfile_loop (GstPad * pad) done: gst_object_unref (ivorbisfile); + return res; } @@ -1309,8 +1323,14 @@ gst_ivorbisfile_change_state (GstElement * element, GstStateChange transition) ivorbisfile->offset = 0; ivorbisfile->seek_pending = 0; ivorbisfile->need_discont = FALSE; - ivorbisfile->metadata = NULL; - ivorbisfile->streaminfo = NULL; + if (ivorbisfile->metadata) { + gst_caps_unref (ivorbisfile->metadata); + ivorbisfile->metadata = NULL; + } + if (ivorbisfile->streaminfo) { + gst_caps_unref (ivorbisfile->streaminfo); + ivorbisfile->streaminfo = NULL; + } ivorbisfile->current_link = -1; ivorbisfile->rate = -1; -- cgit v1.2.1