ext/theora/theoraenc.c: Fix bug where buffers were not marked as keyframes correctly.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 16 Aug 2004 10:19:39 +0000 (10:19 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 16 Aug 2004 10:19:39 +0000 (10:19 +0000)
Original commit message from CVS:
* ext/theora/theoraenc.c: (gst_border_mode_get_type),
(gst_theora_enc_class_init), (theora_enc_sink_link),
(theora_buffer_from_packet), (theora_enc_chain):
Fix bug where buffers were not marked as keyframes
correctly.

ChangeLog
ext/theora/theoraenc.c

index db93294..ef74156 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-08-16  Wim Taymans  <wim@fluendo.com>
+
+       * ext/theora/theoraenc.c: (gst_border_mode_get_type),
+       (gst_theora_enc_class_init), (theora_enc_sink_link),
+       (theora_buffer_from_packet), (theora_enc_chain):
+       Fix bug where buffers were not marked as keyframes
+       correctly.
+
 2004-08-15  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
 
        * ext/lame/gstlame.c: (gst_lame_vbrmode_get_type),
index ed353cd..3116ae7 100644 (file)
@@ -372,8 +372,12 @@ theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet,
 
   /* the second most significant bit of the first data byte is cleared
    * for keyframes */
-  if ((packet->packet[0] & 40) == 0) {
+  if ((packet->packet[0] & 0x40) == 0) {
     GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT);
+    GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_DELTA_UNIT);
+  } else {
+    GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_KEY_UNIT);
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DELTA_UNIT);
   }
 
   enc->packetno++;
@@ -463,17 +467,17 @@ theora_enc_chain (GstPad * pad, GstData * data)
   in_time = GST_BUFFER_TIMESTAMP (buf);
 
   /* no packets written yet, setup headers */
-  /* Theora streams begin with three headers; the initial header (with
-     most of the codec setup parameters) which is mandated by the Ogg
-     bitstream spec.  The second header holds any comment fields.  The
-     third header holds the bitstream codebook.  We merely need to
-     make the headers, then pass them to libtheora one at a time;
-     libtheora handles the additional Ogg bitstream constraints */
-
   if (enc->packetno == 0) {
     GstCaps *caps;
     GstBuffer *buf1, *buf2, *buf3;
 
+    /* Theora streams begin with three headers; the initial header (with
+       most of the codec setup parameters) which is mandated by the Ogg
+       bitstream spec.  The second header holds any comment fields.  The
+       third header holds the bitstream codebook.  We merely need to
+       make the headers, then pass them to libtheora one at a time;
+       libtheora handles the additional Ogg bitstream constraints */
+
     /* first packet will get its own page automatically */
     theora_encode_header (&enc->state, &op);
     buf1 = theora_buffer_from_packet (enc, &op, 0, 0);