ext/vorbis/vorbisenc.*: Set duration on encoded buffers. This allows oggmux's max_pag...
authorMichael Smith <msmith@xiph.org>
Fri, 11 Nov 2005 16:35:39 +0000 (16:35 +0000)
committerMichael Smith <msmith@xiph.org>
Fri, 11 Nov 2005 16:35:39 +0000 (16:35 +0000)
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
ext/vorbis/vorbisenc.c
ext/vorbis/vorbisenc.h

index fd881da..464f3b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
index 618c53f..1c56d02 100644 (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;
index a93cf93..b5149a4 100644 (file)
@@ -69,6 +69,7 @@ struct _GstVorbisEnc {
 
   guint64         samples_in;
   guint64         bytes_out;
+  GstClockTime     prev_ts;
 
   GstTagList *    tags;