[vlc-commits] avcodec: fix discrepancy between documentation and code

Edward Wang git at videolan.org
Sat Oct 12 22:13:49 CEST 2013


vlc | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Oct 12 11:33:12 2013 -0400| [f217d32de8480fca79585666fe4ce4dd299f61f4] | committer: Jean-Baptiste Kempf

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 <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f217d32de8480fca79585666fe4ce4dd299f61f4
---

 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 720459a..5ac682f 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 ***** */



More information about the vlc-commits mailing list