mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
ext/amrwb/gstamrwbenc.*: Pass the discont flag from the input buffer on to the output buffer in the AMR encoder.
Original commit message from CVS: * ext/amrwb/gstamrwbenc.c: * ext/amrwb/gstamrwbenc.h: Pass the discont flag from the input buffer on to the output buffer in the AMR encoder.
This commit is contained in:
parent
ef8649e92e
commit
f92e6bd515
3 changed files with 29 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-10-09 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* ext/amrwb/gstamrwbenc.c:
|
||||
* ext/amrwb/gstamrwbenc.h:
|
||||
Pass the discont flag from the input buffer on to the output buffer in
|
||||
the AMR encoder.
|
||||
|
||||
2008-10-09 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||
|
||||
* gst/flv/gstflvparse.c: (gst_flv_parse_audio_negotiate),
|
||||
|
|
|
@ -279,6 +279,14 @@ gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer)
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* discontinuity clears adapter, FIXME, maybe we can set some
|
||||
* encoder flag to mask the discont. */
|
||||
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) {
|
||||
gst_adapter_clear (amrwbenc->adapter);
|
||||
amrwbenc->ts = 0;
|
||||
amrwbenc->discont = TRUE;
|
||||
}
|
||||
|
||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
|
||||
amrwbenc->ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
|
||||
|
@ -295,7 +303,13 @@ gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer)
|
|||
GST_BUFFER_DURATION (out) = GST_SECOND * L_FRAME16k /
|
||||
(amrwbenc->rate * amrwbenc->channels);
|
||||
GST_BUFFER_TIMESTAMP (out) = amrwbenc->ts;
|
||||
amrwbenc->ts += GST_BUFFER_DURATION (out);
|
||||
if (amrwbenc->ts != -1) {
|
||||
amrwbenc->ts += GST_BUFFER_DURATION (out);
|
||||
}
|
||||
if (amrwbenc->discont) {
|
||||
GST_BUFFER_FLAG_SET (out, GST_BUFFER_FLAG_DISCONT);
|
||||
amrwbenc->discont = FALSE;
|
||||
}
|
||||
gst_buffer_set_caps (out, gst_pad_get_caps (amrwbenc->srcpad));
|
||||
|
||||
data = (guint8 *) gst_adapter_peek (amrwbenc->adapter, buffer_size);
|
||||
|
@ -308,7 +322,9 @@ gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer)
|
|||
gst_adapter_flush (amrwbenc->adapter, buffer_size);
|
||||
GST_BUFFER_SIZE (out) = outsize;
|
||||
|
||||
ret = gst_pad_push (amrwbenc->srcpad, out);
|
||||
/* play */
|
||||
if ((ret = gst_pad_push (amrwbenc->srcpad, out)) != GST_FLOW_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -332,7 +348,10 @@ gst_amrwbenc_state_change (GstElement * element, GstStateChange transition)
|
|||
return GST_STATE_CHANGE_FAILURE;
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
amrwbenc->rate = 0;
|
||||
amrwbenc->channels = 0;
|
||||
amrwbenc->ts = 0;
|
||||
amrwbenc->discont = FALSE;
|
||||
gst_adapter_clear (amrwbenc->adapter);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -47,6 +47,7 @@ struct _GstAmrwbEnc {
|
|||
/* pads */
|
||||
GstPad *sinkpad, *srcpad;
|
||||
guint64 ts;
|
||||
gboolean discont;
|
||||
|
||||
GstAdapter *adapter;
|
||||
|
||||
|
|
Loading…
Reference in a new issue