From 06e6b4ec676f4a0fdbb34aaab5c0c8689da60b1a Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Thu, 23 Mar 2006 09:15:09 +0000 Subject: [PATCH] ext/xvid/gstxvidenc.c: Patch to mark outgoing encoded buffers as delta-units (or not). Original commit message from CVS: Patch by: Mark Nauwelaerts * 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 | 15 +++++++++++++++ ext/xvid/gstxvidenc.c | 11 ++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a7522d404..b32b126ffe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-03-23 Wim Taymans + + Patch by: Mark Nauwelaerts + + * 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 * gst/modplug/libmodplug/Makefile.am: diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c index bc8c94249d..d358f7a9a0 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);