]> git.sesse.net Git - vlc/blobdiff - modules/codec/ffmpeg/video.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / codec / ffmpeg / video.c
index 9b737c781bc7dc766a8abb32c70b1388d820f0d1..8c3b3a8f17fb42d886f5ff871b722debd771d7cf 100644 (file)
@@ -56,6 +56,8 @@ struct decoder_sys_t
 
     /* for frame skipping algo */
     int b_hurry_up;
+    enum AVDiscard i_skip_frame;
+    enum AVDiscard i_skip_idct;
 
     /* how many decoded frames are late */
     int     i_late_frames;
@@ -294,6 +296,7 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
             p_sys->p_context->skip_frame = AVDISCARD_NONE;
             break;
     }
+    p_sys->i_skip_frame = p_sys->p_context->skip_frame;
 
     var_Create( p_dec, "ffmpeg-skip-idct",  VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
     var_Get( p_dec, "ffmpeg-skip-idct", &val );
@@ -318,6 +321,7 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
             p_sys->p_context->skip_idct = AVDISCARD_NONE;
             break;
     }
+    p_sys->i_skip_idct = p_sys->p_context->skip_idct;
 
     /* ***** ffmpeg direct rendering ***** */
     p_sys->b_direct_rendering = 0;
@@ -456,7 +460,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
         p_block->i_pts = p_block->i_dts = 0;
     }
 
-    /* TODO implement it in a better way */
     /* A good idea could be to decode all I pictures and see for the other */
     if( !p_dec->b_pace_control &&
         p_sys->b_hurry_up &&
@@ -465,13 +468,12 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
         b_drawpicture = 0;
         if( p_sys->i_late_frames < 8 )
         {
-            p_sys->p_context->skip_frame = AVDISCARD_BIDIR;
+            p_sys->p_context->skip_frame = AVDISCARD_NONKEY;
         }
         else
         {
             /* picture too late, won't decode
              * but break picture until a new I, and for mpeg4 ...*/
-            p_sys->p_context->skip_frame = AVDISCARD_NONKEY;
             p_sys->i_late_frames--; /* needed else it will never be decrease */
             block_Release( p_block );
             p_sys->i_buffer = 0;
@@ -481,7 +483,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
     else
     {
         if( p_sys->b_hurry_up )
-            p_sys->p_context->skip_frame = AVDISCARD_DEFAULT;
+            p_sys->p_context->skip_frame = p_sys->i_skip_frame;
         if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
             b_drawpicture = 1;
         else
@@ -491,7 +493,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
     if( p_sys->p_context->width <= 0 || p_sys->p_context->height <= 0 )
     {
         if( p_sys->b_hurry_up )
-            p_sys->p_context->skip_frame = AVDISCARD_ALL;
+            p_sys->p_context->skip_frame = p_sys->i_skip_frame;
         b_null_size = VLC_TRUE;
     }
 
@@ -539,7 +541,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
             /* Reparse it to not drop the I frame */
             b_null_size = VLC_FALSE;
             if( p_sys->b_hurry_up )
-                p_sys->p_context->skip_frame = AVDISCARD_DEFAULT;
+                p_sys->p_context->skip_frame = p_sys->i_skip_frame;
             i_used = avcodec_decode_video( p_sys->p_context, p_sys->p_ff_pic,
                                            &b_gotpicture,
                                            (uint8_t*)p_sys->p_buffer, p_sys->i_buffer );