ext/speex/gstspeexenc.c: fix a tag list assert follow gst-plugins-base/ext/ogg/README...
authorThomas Vander Stichele <thomas@apestaart.org>
Mon, 6 Mar 2006 00:10:29 +0000 (00:10 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Mon, 6 Mar 2006 00:10:29 +0000 (00:10 +0000)
Original commit message from CVS:
* ext/speex/gstspeexenc.c: (gst_speexenc_set_header_on_caps),
(gst_speexenc_chain):
fix a tag list assert
follow gst-plugins-base/ext/ogg/README; set OFFSET
and OFFSET_END.  Muxes correctly with gst-plugins-base
> 0.9.3

ChangeLog
ext/speex/gstspeexenc.c

index 3901003..641a91d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-03-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * ext/speex/gstspeexenc.c: (gst_speexenc_set_header_on_caps),
+       (gst_speexenc_chain):
+         fix a tag list assert
+         follow gst-plugins-base/ext/ogg/README; set OFFSET
+         and OFFSET_END.  Muxes correctly with gst-plugins-base
+         > 0.9.3
+
 2006-03-04  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/id3demux/Makefile.am:
index f3f680d..1987e4d 100644 (file)
@@ -830,7 +830,7 @@ gst_speexenc_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
 {
   caps = gst_caps_make_writable (caps);
   GstStructure *structure = gst_caps_get_structure (caps, 0);
-  GValue list = { 0 };
+  GValue array = { 0 };
   GValue value = { 0 };
 
   /* mark buffers */
@@ -838,17 +838,17 @@ gst_speexenc_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
   GST_BUFFER_FLAG_SET (buf2, GST_BUFFER_FLAG_IN_CAPS);
 
   /* put buffers in a fixed list */
-  g_value_init (&list, GST_TYPE_ARRAY);
+  g_value_init (&array, GST_TYPE_ARRAY);
   g_value_init (&value, GST_TYPE_BUFFER);
   gst_value_set_buffer (&value, buf1);
-  gst_value_list_append_value (&list, &value);
+  gst_value_array_append_value (&array, &value);
   g_value_unset (&value);
   g_value_init (&value, GST_TYPE_BUFFER);
   gst_value_set_buffer (&value, buf2);
-  gst_value_list_append_value (&list, &value);
-  gst_structure_set_value (structure, "streamheader", &list);
+  gst_value_array_append_value (&array, &value);
+  gst_structure_set_value (structure, "streamheader", &array);
   g_value_unset (&value);
-  g_value_unset (&list);
+  g_value_unset (&array);
 
   return caps;
 }
@@ -1013,9 +1013,12 @@ gst_speexenc_chain (GstPad * pad, GstBuffer * buf)
           (speexenc->frameno * frame_size -
           speexenc->lookahead) * GST_SECOND / speexenc->rate;
       GST_BUFFER_DURATION (outbuf) = frame_size * GST_SECOND / speexenc->rate;
-      GST_BUFFER_OFFSET (outbuf) = speexenc->bytes_out;
+      /* set gp time and granulepos; see gst-plugins-base/ext/ogg/README */
       GST_BUFFER_OFFSET_END (outbuf) =
-          speexenc->frameno * frame_size - speexenc->lookahead;
+          ((speexenc->frameno + 1) * frame_size - speexenc->lookahead);
+      GST_BUFFER_OFFSET (outbuf) =
+          gst_util_uint64_scale (GST_BUFFER_OFFSET_END (outbuf), GST_SECOND,
+          speexenc->rate);
 
       ret = gst_speexenc_push_buffer (speexenc, outbuf);