From 4427a67754cb94bafbb4b2bd3db8431160a9dd5f Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 11 Nov 2005 16:35:39 +0000 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ ext/vorbis/vorbisenc.c | 5 +++++ ext/vorbis/vorbisenc.h | 1 + 3 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd881da3df..464f3b9587 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-11-11 Michael Smith + + * 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 * gst/ffmpegcolorspace/gstffmpegcodecmap.c: diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index 618c53f54c..1c56d024fd 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -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; diff --git a/ext/vorbis/vorbisenc.h b/ext/vorbis/vorbisenc.h index a93cf93002..b5149a4a04 100644 --- a/ext/vorbis/vorbisenc.h +++ b/ext/vorbis/vorbisenc.h @@ -69,6 +69,7 @@ struct _GstVorbisEnc { guint64 samples_in; guint64 bytes_out; + GstClockTime prev_ts; GstTagList * tags;