gst/mpegaudioparse/gstmpegaudioparse.*: Queue segment event and push it after we know the caps on the pad or else an ...

Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event), (gst_mp3parse_emit_frame):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Queue segment event and push it after we know the caps on the pad or
else an autoplugger might not have plugged the element yet and the
segment is lost.
This commit is contained in:
Wim Taymans 2007-08-16 11:52:57 +00:00
parent 681dbdf9a3
commit 5b39e551b1
3 changed files with 24 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2007-08-16 Wim Taymans <wim.taymans@gmail.com>
* gst/mpegaudioparse/gstmpegaudioparse.c:
(gst_mp3parse_sink_event), (gst_mp3parse_emit_frame):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Queue segment event and push it after we know the caps on the pad or
else an autoplugger might not have plugged the element yet and the
segment is lost.
2007-08-16 Stefan Kost <ensonic@users.sf.net>
* gst/iec958/ac3iec.c:

View file

@ -324,6 +324,7 @@ gst_mp3parse_sink_event (GstPad * pad, GstEvent * event)
{
gboolean res;
GstMPEGAudioParse *mp3parse;
GstEvent **eventp;
mp3parse = GST_MP3PARSE (gst_pad_get_parent (pad));
@ -437,12 +438,18 @@ gst_mp3parse_sink_event (GstPad * pad, GstEvent * event)
gst_segment_set_newsegment_full (&mp3parse->segment, update, rate,
applied_rate, format, start, stop, pos);
res = gst_pad_push_event (mp3parse->srcpad, event);
/* save the segment for later, right before we push a new buffer so that
* the caps are fixed and the next linked element can receive the segment. */
eventp = &mp3parse->pending_segment;
gst_event_replace (eventp, event);
res = TRUE;
break;
}
case GST_EVENT_FLUSH_STOP:
/* Clear our adapter and set up for a new position */
gst_adapter_clear (mp3parse->adapter);
eventp = &mp3parse->pending_segment;
gst_event_replace (eventp, NULL);
res = gst_pad_push_event (mp3parse->srcpad, event);
break;
default:
@ -607,6 +614,10 @@ gst_mp3parse_emit_frame (GstMPEGAudioParse * mp3parse, guint size)
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
GST_BUFFER_OFFSET (outbuf));
mp3parse->segment.last_stop = GST_BUFFER_TIMESTAMP (outbuf);
/* push any pending segment now */
if (mp3parse->pending_segment)
gst_pad_push_event (mp3parse->srcpad, mp3parse->pending_segment);
mp3parse->pending_segment = NULL;
ret = gst_pad_push (mp3parse->srcpad, outbuf);
}
if (ret == GST_FLOW_UNEXPECTED

View file

@ -108,6 +108,9 @@ struct _GstMPEGAudioParse {
GMutex *pending_accurate_seeks_lock;
GSList *pending_accurate_seeks;
gboolean exact_position;
/* pending segment */
GstEvent *pending_segment;
};
struct _GstMPEGAudioParseClass {