From ce35ed0209a01e43f67f16abcd898cf69df078f2 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 30 Apr 2009 01:42:59 +0300 Subject: vd_ffmpeg.c: Use FFmpeg-mt compatible code for codec delay This code to calculate codec delay should work with both with regular FFmpeg and FFmeg-mt. This MPlayer version is not completely compatible with current FFmpeg-mt though, since it has a build system change which matches upstream FFmpeg but hasn't been integrated in FFmpeg-mt yet (RUNTIME_CPUDETECT -> CONFIG_RUNTIME_CPUDETECT rename). --- libmpcodecs/vd_ffmpeg.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 708254304d..3ae46f56be 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -126,8 +126,14 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...){ case VDCTRL_RESYNC_STREAM: avcodec_flush_buffers(avctx); return CONTROL_TRUE; - case VDCTRL_QUERY_UNSEEN_FRAMES: - return avctx->has_b_frames + 10; + case VDCTRL_QUERY_UNSEEN_FRAMES:; + int delay = avctx->has_b_frames; +#ifdef FF_THREAD_FRAME + // FFmpeg-mt has extra delay when using frame threading + if (avctx->thread_type & FF_THREAD_FRAME) + delay += avctx->thread_count - 1; +#endif + return delay + 10; } return CONTROL_UNKNOWN; } -- cgit v1.2.3