From 1a7ef3b39c38837b45f87ce8b673da5641289573 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 9 Jul 2011 13:50:16 +0300 Subject: [PATCH] vd_ffmpeg: fix "-lavdopts skipframe" support Support for -lavdopts skipframe had been broken since commit bc767c2a9 as framedrop logic now set the same field and thus overwrote the value set from the option. Change that code to set it to the original value instead of 0 when not dropping frames. --- libmpcodecs/vd_ffmpeg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 4f9f5a3e24..630d0c5e02 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -73,6 +73,7 @@ typedef struct { int b_count; AVRational last_sample_aspect_ratio; int lowres; + enum AVDiscard skip_frame; } vd_ffmpeg_ctx; #include "m_option.h" @@ -284,6 +285,9 @@ static int init(sh_video_t *sh){ } } + // Do this after the above avopt handling in case it changes values + ctx->skip_frame = avctx->skip_frame; + mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "libavcodec.size: %d x %d\n", avctx->width, avctx->height); switch (sh->format) { case mmioFOURCC('S','V','Q','3'): @@ -756,7 +760,7 @@ static struct mp_image *decode(struct sh_video *sh, void *data, int len, else if (flags & 1) avctx->skip_frame = AVDISCARD_NONREF; else - avctx->skip_frame = 0; + avctx->skip_frame = ctx->skip_frame; mp_msg(MSGT_DECVIDEO, MSGL_DBG3, "vd_ffmpeg data: %04x, %04x, %04x, %04x\n", ((int *)data)[0], ((int *)data)[1], ((int *)data)[2], ((int *)data)[3]);