From c5a6eb857ed603f7d2eaa4fa5b1849f3252b7847 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 9 Aug 2005 13:02:54 +0000 Subject: [PATCH] ext/mad/gstmad.c: It'd be nice if I could listen to my mp3 files, so send out an initial discont, as the sink apparen... Original commit message from CVS: * ext/mad/gstmad.c: (gst_mad_init), (gst_mad_chain): It'd be nice if I could listen to my mp3 files, so send out an initial discont, as the sink apparently wants. --- ChangeLog | 6 ++++++ ext/mad/gstmad.c | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ad1d40..4f005c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2005-08-09 Ronald S. Bultje + * ext/mad/gstmad.c: (gst_mad_init), (gst_mad_chain): + It'd be nice if I could listen to my mp3 files, so send out an + initial discont, as the sink apparently wants. + +2005-08-09 Ronald S. Bultje + * gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event), (gst_avi_demux_handle_seek): Fix seeking (or, well, fix threading issue where a variable was diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c index 22aca4e..4eebf03 100644 --- a/ext/mad/gstmad.c +++ b/ext/mad/gstmad.c @@ -360,7 +360,7 @@ gst_mad_init (GstMad * mad) mad->framecount = 0; mad->vbr_average = 0; mad->vbr_rate = 0; - mad->restart = FALSE; + mad->restart = TRUE; mad->segment_start = 0; mad->header.mode = -1; mad->header.emphasis = -1; @@ -1215,12 +1215,15 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) gboolean new_pts = FALSE; GstClockTime timestamp; GstFlowReturn result = GST_FLOW_OK; + gboolean do_send_discont = FALSE; mad = GST_MAD (GST_PAD_PARENT (pad)); /* restarts happen on discontinuities, ie. seek, flush, PAUSED to PLAYING */ - if (gst_mad_check_restart (mad)) + if (gst_mad_check_restart (mad)) { + do_send_discont = TRUE; GST_DEBUG ("mad restarted"); + } timestamp = GST_BUFFER_TIMESTAMP (buffer); GST_DEBUG ("mad in timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp)); @@ -1493,6 +1496,12 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) } } + if (do_send_discont) { + gst_pad_push_event (mad->srcpad, + gst_event_new_newsegment (1.0, GST_FORMAT_TIME, + GST_BUFFER_TIMESTAMP (outbuffer), GST_CLOCK_TIME_NONE, 0)); + do_send_discont = FALSE; + } result = gst_pad_push (mad->srcpad, outbuffer); if (result != GST_FLOW_OK) { goto end; -- 2.7.4