From f217d32de8480fca79585666fe4ce4dd299f61f4 Mon Sep 17 00:00:00 2001 From: Edward Wang Date: Sat, 12 Oct 2013 11:33:12 -0400 Subject: [PATCH] avcodec: fix discrepancy between documentation and code Fix to actually conform to the range specified in doc. First introduced in 9d20efb Signed-off-by: Jean-Baptiste Kempf --- modules/codec/avcodec/video.c | 56 +++++++++++-------------------------------- 1 file changed, 14 insertions(+), 42 deletions(-) diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index 720459a1e2..5ac682f0b7 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -247,50 +247,22 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, /* ***** libavcodec frame skipping ***** */ p_sys->b_hurry_up = var_CreateGetBool( p_dec, "avcodec-hurry-up" ); - switch( var_CreateGetInteger( p_dec, "avcodec-skip-frame" ) ) - { - case -1: - p_sys->p_context->skip_frame = AVDISCARD_NONE; - break; - case 0: - p_sys->p_context->skip_frame = AVDISCARD_DEFAULT; - break; - case 1: - p_sys->p_context->skip_frame = AVDISCARD_NONREF; - break; - case 2: - p_sys->p_context->skip_frame = AVDISCARD_NONKEY; - break; - case 3: - p_sys->p_context->skip_frame = AVDISCARD_ALL; - break; - default: - p_sys->p_context->skip_frame = AVDISCARD_NONE; - break; - } + i_val = var_CreateGetInteger( p_dec, "avcodec-skip-frame" ); + if( i_val >= 4 ) p_sys->p_context->skip_frame = AVDISCARD_ALL; + else if( i_val == 3 ) p_sys->p_context->skip_frame = AVDISCARD_NONKEY; + else if( i_val == 2 ) p_sys->p_context->skip_frame = AVDISCARD_BIDIR; + else if( i_val == 1 ) p_sys->p_context->skip_frame = AVDISCARD_NONREF; + else if( i_val == -1 ) p_sys->p_context->skip_frame = AVDISCARD_NONE; + else p_sys->p_context->skip_frame = AVDISCARD_DEFAULT; p_sys->i_skip_frame = p_sys->p_context->skip_frame; - switch( var_CreateGetInteger( p_dec, "avcodec-skip-idct" ) ) - { - case -1: - p_sys->p_context->skip_idct = AVDISCARD_NONE; - break; - case 0: - p_sys->p_context->skip_idct = AVDISCARD_DEFAULT; - break; - case 1: - p_sys->p_context->skip_idct = AVDISCARD_NONREF; - break; - case 2: - p_sys->p_context->skip_idct = AVDISCARD_NONKEY; - break; - case 3: - p_sys->p_context->skip_idct = AVDISCARD_ALL; - break; - default: - p_sys->p_context->skip_idct = AVDISCARD_NONE; - break; - } + i_val = var_CreateGetInteger( p_dec, "avcodec-skip-idct" ); + if( i_val >= 4 ) p_sys->p_context->skip_idct = AVDISCARD_ALL; + else if( i_val == 3 ) p_sys->p_context->skip_idct = AVDISCARD_NONKEY; + else if( i_val == 2 ) p_sys->p_context->skip_idct = AVDISCARD_BIDIR; + else if( i_val == 1 ) p_sys->p_context->skip_idct = AVDISCARD_NONREF; + else if( i_val == -1 ) p_sys->p_context->skip_idct = AVDISCARD_NONE; + else p_sys->p_context->skip_idct = AVDISCARD_DEFAULT; p_sys->i_skip_idct = p_sys->p_context->skip_idct; /* ***** libavcodec direct rendering ***** */ -- 2.11.4.GIT