- copy offset from input buffer

Original commit message from CVS:
- copy offset from input buffer
This commit is contained in:
Wim Taymans 2003-05-29 12:41:42 +00:00
parent 6b8b864541
commit b27556d018

View file

@ -681,18 +681,24 @@ gst_lame_chain (GstPad *pad, GstBuffer *buf)
"encoded %d bytes of audio to %d bytes of mp3", "encoded %d bytes of audio to %d bytes of mp3",
GST_BUFFER_SIZE (buf), mp3_size); GST_BUFFER_SIZE (buf), mp3_size);
lame->last_ts = GST_BUFFER_TIMESTAMP (buf); if (lame->last_ts == GST_CLOCK_TIME_NONE) {
lame->last_ts = GST_BUFFER_TIMESTAMP (buf);
lame->last_offs = GST_BUFFER_OFFSET (buf);
}
gst_buffer_unref (buf); gst_buffer_unref (buf);
} }
if (mp3_size > 0) { if (mp3_size > 0) {
outbuf = gst_buffer_new (); outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = mp3_data; GST_BUFFER_DATA (outbuf) = mp3_data;
GST_BUFFER_SIZE (outbuf) = mp3_size; GST_BUFFER_SIZE (outbuf) = mp3_size;
GST_BUFFER_TIMESTAMP (outbuf) = lame->last_ts; GST_BUFFER_TIMESTAMP (outbuf) = lame->last_ts;
GST_BUFFER_OFFSET (outbuf) = lame->last_offs;
gst_pad_push (lame->srcpad,outbuf); gst_pad_push (lame->srcpad,outbuf);
lame->last_ts = GST_CLOCK_TIME_NONE;
} }
else { else {
g_free (mp3_data); g_free (mp3_data);
@ -784,7 +790,7 @@ gst_lame_change_state (GstElement *element)
switch (GST_STATE_TRANSITION (element)) { switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_READY_TO_PAUSED: case GST_STATE_READY_TO_PAUSED:
lame->last_ts = 0; lame->last_ts = GST_CLOCK_TIME_NONE;
break; break;
case GST_STATE_READY_TO_NULL: case GST_STATE_READY_TO_NULL:
if (lame->initialized) { if (lame->initialized) {