summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorMark Nauwelaerts <manauw@skynet.be>2006-03-23 09:15:09 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-03-23 09:15:09 +0000
commit06e6b4ec676f4a0fdbb34aaab5c0c8689da60b1a (patch)
treeb84811b8708efaa12d2f38675ccc1434e2886e3c /ext
parenta00eb33ece263f0d7fca34dc67976eab7d623007 (diff)
downloadgst-plugins-bad-06e6b4ec676f4a0fdbb34aaab5c0c8689da60b1a.tar.gz
gst-plugins-bad-06e6b4ec676f4a0fdbb34aaab5c0c8689da60b1a.tar.bz2
gst-plugins-bad-06e6b4ec676f4a0fdbb34aaab5c0c8689da60b1a.zip
ext/xvid/gstxvidenc.c: Patch to mark outgoing encoded buffers as delta-units (or not).
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
Diffstat (limited to 'ext')
-rw-r--r--ext/xvid/gstxvidenc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c
index bc8c9424..d358f7a9 100644
--- a/ext/xvid/gstxvidenc.c
+++ b/ext/xvid/gstxvidenc.c
@@ -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);