[MPlayer-dev-eng] [PATCH] make use of x264_encoder_delayed_frames
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Wed Sep 23 13:33:09 CEST 2009
Hello,
this gets rid of the giant hack to avoid lost last frames with libx264
and instead uses x264_encoder_delayed_frames.
I'd be happy if someone found the time to test it.
Index: configure
===================================================================
--- configure (revision 29701)
+++ configure (working copy)
@@ -7240,7 +7240,7 @@
cat > $TMPC << EOF
#include <inttypes.h>
#include <x264.h>
-#if X264_BUILD < 65
+#if X264_BUILD < 75
#error We do not support old versions of x264. Get the latest from SVN.
#endif
int main(void) { x264_encoder_open((void*)0); return 0; }
Index: libmpcodecs/ve_x264.c
===================================================================
--- libmpcodecs/ve_x264.c (revision 29701)
+++ libmpcodecs/ve_x264.c (working copy)
@@ -218,12 +218,10 @@
static int control(struct vf_instance_s* vf, int request, void *data)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
- int count = 256; // giant HACK, x264_encoder_encode may incorrectly return 0
- // when threads > 1 and delayed frames pending
switch(request){
case VFCTRL_FLUSH_FRAMES:
- while(encode_frame(vf, NULL) == 0 && --count);
- while(encode_frame(vf, NULL) > 0);
+ while (x264_encoder_delayed_frames(mod->x264) > 0)
+ encode_frame(vf, NULL);
return CONTROL_TRUE;
default:
return CONTROL_UNKNOWN;
More information about the MPlayer-dev-eng
mailing list