ext/vorbis/vorbisenc.*: Set duration on encoded buffers. This allows oggmux's max_page_delay parameter to actually work.

Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_setup),
(gst_vorbisenc_buffer_from_packet):
* ext/vorbis/vorbisenc.h:
Set duration on encoded buffers. This allows oggmux's
max_page_delay parameter to actually work.
This commit is contained in:
Michael Smith 2005-11-11 16:35:39 +00:00
parent f407a3766e
commit 4427a67754
3 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2005-11-11 Michael Smith <msmith@fluendo.com>
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_setup),
(gst_vorbisenc_buffer_from_packet):
* ext/vorbis/vorbisenc.h:
Set duration on encoded buffers. This allows oggmux's
max_page_delay parameter to actually work.
2005-11-11 Tim-Philipp Müller <tim at centricular dot net>
* gst/ffmpegcolorspace/gstffmpegcodecmap.c:

View file

@ -772,6 +772,8 @@ gst_vorbisenc_setup (GstVorbisEnc * vorbisenc)
vorbis_analysis_init (&vorbisenc->vd, &vorbisenc->vi);
vorbis_block_init (&vorbisenc->vd, &vorbisenc->vb);
vorbisenc->prev_ts = 0;
vorbisenc->setup = TRUE;
return TRUE;
@ -808,6 +810,9 @@ gst_vorbisenc_buffer_from_packet (GstVorbisEnc * vorbisenc, ogg_packet * packet)
GST_BUFFER_TIMESTAMP (outbuf) =
vorbis_granule_time_copy (&vorbisenc->vd,
packet->granulepos) * GST_SECOND;
GST_BUFFER_DURATION (outbuf) =
GST_BUFFER_TIMESTAMP (outbuf) - vorbisenc->prev_ts;
vorbisenc->prev_ts = GST_BUFFER_TIMESTAMP (outbuf);
GST_DEBUG ("encoded buffer of %d bytes", GST_BUFFER_SIZE (outbuf));
return outbuf;

View file

@ -69,6 +69,7 @@ struct _GstVorbisEnc {
guint64 samples_in;
guint64 bytes_out;
GstClockTime prev_ts;
GstTagList * tags;