ext/xvid/gstxvidenc.c: Patch to mark outgoing encoded buffers as delta-units (or...
authorMark Nauwelaerts <manauw@skynet.be>
Thu, 23 Mar 2006 09:15:09 +0000 (09:15 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 23 Mar 2006 09:15:09 +0000 (09:15 +0000)
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet dot be>
* ext/xvid/gstxvidenc.c: (gst_xvidenc_init), (gst_xvidenc_setup),
(gst_xvidenc_chain):
Patch to mark outgoing encoded buffers as delta-units (or not).
Note that this patch also patches:
- the setting of fincr and fbase in xvid-encoder creation based on
caps framerate
- makes 0, rather than 2, the default max_b_frames, as the current
xvidenc does not seem "fully prepared" to handle b-frame
"effects", such as encoder returning 0 encoded bytes, etc.
Fixes #335585

ChangeLog
ext/xvid/gstxvidenc.c

index 6a7522d..b32b126 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2006-03-23  Wim Taymans  <wim@fluendo.com>
+
+       Patch by: Mark Nauwelaerts <manauw at skynet dot be>
+
+       * ext/xvid/gstxvidenc.c: (gst_xvidenc_init), (gst_xvidenc_setup),
+       (gst_xvidenc_chain):
+       Patch to mark outgoing encoded buffers as delta-units (or not).
+       Note that this patch also patches:
+       - the setting of fincr and fbase in xvid-encoder creation based on
+         caps framerate
+       - makes 0, rather than 2, the default max_b_frames, as the current
+         xvidenc does not seem "fully prepared" to handle b-frame 
+         "effects", such as encoder returning 0 encoded bytes, etc.
+       Fixes #335585
+
 2006-03-22  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/modplug/libmodplug/Makefile.am:
index bc8c942..d358f7a 100644 (file)
@@ -234,7 +234,7 @@ gst_xvidenc_init (GstXvidEnc * xvidenc)
   xvidenc->width = xvidenc->height = xvidenc->csp = xvidenc->stride = -1;
   xvidenc->profile = XVID_PROFILE_S_L0;
   xvidenc->bitrate = 512;
-  xvidenc->max_b_frames = 2;
+  xvidenc->max_b_frames = 0;
   xvidenc->max_key_interval = -1;       /* default - 2*fps */
   xvidenc->buffer_size = 512;
 
@@ -259,8 +259,9 @@ gst_xvidenc_setup (GstXvidEnc * xvidenc)
   xenc.max_bframes = xvidenc->max_b_frames;
   xenc.global = XVID_GLOBAL_PACKED;
 
-  xenc.fbase = 1000000;
-  xenc.fincr = (int) (xenc.fbase / xvidenc->fps_n / xvidenc->fps_d);    /* FIX? */
+  /* frame duration = fincr/fbase, is inverse of framerate */
+  xenc.fincr = xvidenc->fps_d;
+  xenc.fbase = xvidenc->fps_n;
   xenc.max_key_interval = (xvidenc->max_key_interval == -1) ?
       (2 * xenc.fbase / xenc.fincr) : xvidenc->max_key_interval;
   xenc.handle = NULL;
@@ -340,6 +341,10 @@ gst_xvidenc_chain (GstPad * pad, GstBuffer * buf)
 
   GST_BUFFER_SIZE (outbuf) = xstats.length;
 
+  /* mark whether key-frame = !delta-unit or not */
+  if (!(xframe.out_flags & XVID_KEYFRAME))
+    GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+
   /* go out, multiply! */
   gst_buffer_set_caps (outbuf, GST_PAD_CAPS (xvidenc->srcpad));
   ret = gst_pad_push (xvidenc->srcpad, outbuf);