ext/mad/gstmad.*: track discont on incomming buffers and set discont on outgoing buffers.

Original commit message from CVS:
* ext/mad/gstmad.c: (gst_mad_src_event), (gst_mad_chain),
(gst_mad_change_state):
* ext/mad/gstmad.h:
track discont on incomming buffers and set discont on outgoing
buffers.
Pass unknown events upstreams instead of dropping them.
This commit is contained in:
Wim Taymans 2008-10-08 13:59:57 +00:00
parent c9da8b4d0c
commit 26209707d9
4 changed files with 36 additions and 6 deletions

View file

@ -1,3 +1,12 @@
2008-10-08 Wim Taymans <wim.taymans@collabora.co.uk>
* ext/mad/gstmad.c: (gst_mad_src_event), (gst_mad_chain),
(gst_mad_change_state):
* ext/mad/gstmad.h:
track discont on incomming buffers and set discont on outgoing
buffers.
Pass unknown events upstreams instead of dropping them.
2008-09-28 Sebastian Dröge <sebastian.droege@collabora.co.uk>
Patch by: Sameer Naik <sameer dot subscriptions at damagehead dot com>

2
common

@ -1 +1 @@
Subproject commit 1ff63d8f92c36bf207434436f4ce75f2a4ea11a4
Subproject commit 46eefd2f8474ee748864c59635be87b5a29317d1

View file

@ -811,10 +811,10 @@ gst_mad_src_event (GstPad * pad, GstEvent * event)
mad = GST_MAD (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) {
/* the all-formats seek logic */
case GST_EVENT_SEEK:
/* the all-formats seek logic, ref the event, we need it later */
gst_event_ref (event);
if (!(res = gst_pad_event_default (pad, event))) {
if (!(res = gst_pad_push_event (mad->sinkpad, event))) {
#ifndef GST_DISABLE_INDEX
if (mad->index)
res = index_seek (mad, pad, event);
@ -822,14 +822,13 @@ gst_mad_src_event (GstPad * pad, GstEvent * event)
#endif
res = normal_seek (mad, pad, event);
}
gst_event_unref (event);
break;
default:
res = FALSE;
res = gst_pad_push_event (mad->sinkpad, event);
break;
}
gst_event_unref (event);
return res;
}
@ -1289,6 +1288,7 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
guint8 *data;
glong size, tempsize;
gboolean new_pts = FALSE;
gboolean discont;
GstClockTime timestamp;
GstFlowReturn result = GST_FLOW_OK;
@ -1300,6 +1300,9 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
GST_DEBUG ("mad restarted");
}
/* take discont flag */
discont = GST_BUFFER_IS_DISCONT (buffer);
timestamp = GST_BUFFER_TIMESTAMP (buffer);
GST_DEBUG ("mad in timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp));
@ -1335,6 +1338,10 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
gint tocopy;
guchar *mad_input_buffer; /* convenience pointer to tempbuffer */
if (mad->tempsize == 0 && discont) {
mad->discont = TRUE;
discont = FALSE;
}
tocopy =
MIN (MAD_BUFFER_MDLEN, MIN (size,
MAD_BUFFER_MDLEN * 3 - mad->tempsize));
@ -1626,6 +1633,7 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
GST_BUFFER_TIMESTAMP (outbuffer) = time_offset;
GST_BUFFER_DURATION (outbuffer) = time_duration;
GST_BUFFER_OFFSET (outbuffer) = mad->total_samples;
GST_BUFFER_OFFSET_END (outbuffer) = mad->total_samples + nsamples;
/* output sample(s) in 16-bit signed native-endian PCM */
if (mad->channels == 1) {
@ -1649,6 +1657,13 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
GST_BUFFER_OFFSET (outbuffer),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuffer)));
/* apply discont */
if (mad->discont) {
GST_BUFFER_FLAG_SET (outbuffer, GST_BUFFER_FLAG_DISCONT);
mad->discont = FALSE;
}
mad->segment.last_stop = GST_BUFFER_TIMESTAMP (outbuffer);
result = gst_pad_push (mad->srcpad, outbuffer);
if (result != GST_FLOW_OK) {
@ -1672,6 +1687,10 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer)
mad->bytes_consumed = 0;
}
tempsize = 0;
if (discont) {
mad->discont = TRUE;
discont = FALSE;
}
if (gst_mad_check_restart (mad)) {
goto end;
@ -1723,6 +1742,7 @@ gst_mad_change_state (GstElement * element, GstStateChange transition)
mad_frame_init (&mad->frame);
mad_synth_init (&mad->synth);
mad->tempsize = 0;
mad->discont = TRUE;
mad->total_samples = 0;
mad->rate = 0;
mad->channels = 0;

View file

@ -63,6 +63,7 @@ struct _GstMad
gboolean in_error; /* set when mad's in an error state */
gboolean restart;
gboolean discont;
guint64 segment_start;
GstSegment segment;
gboolean need_newsegment;