Commit b3fe4787 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Honor --ffmpeg-skip-frame setting when used with --ffmpeg-hurry-up.

parent ab7ce0df
...@@ -56,6 +56,8 @@ struct decoder_sys_t ...@@ -56,6 +56,8 @@ struct decoder_sys_t
/* for frame skipping algo */ /* for frame skipping algo */
int b_hurry_up; int b_hurry_up;
enum AVDiscard i_skip_frame;
enum AVDiscard i_skip_idct;
/* how many decoded frames are late */ /* how many decoded frames are late */
int i_late_frames; int i_late_frames;
...@@ -294,6 +296,7 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -294,6 +296,7 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->skip_frame = AVDISCARD_NONE; p_sys->p_context->skip_frame = AVDISCARD_NONE;
break; 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_Create( p_dec, "ffmpeg-skip-idct", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-skip-idct", &val ); var_Get( p_dec, "ffmpeg-skip-idct", &val );
...@@ -318,6 +321,7 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -318,6 +321,7 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->skip_idct = AVDISCARD_NONE; p_sys->p_context->skip_idct = AVDISCARD_NONE;
break; break;
} }
p_sys->i_skip_idct = p_sys->p_context->skip_idct;
/* ***** ffmpeg direct rendering ***** */ /* ***** ffmpeg direct rendering ***** */
p_sys->b_direct_rendering = 0; p_sys->b_direct_rendering = 0;
...@@ -464,7 +468,9 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -464,7 +468,9 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
b_drawpicture = 0; b_drawpicture = 0;
if( p_sys->i_late_frames < 8 ) if( p_sys->i_late_frames < 8 )
{ {
p_sys->p_context->skip_frame = AVDISCARD_BIDIR; p_sys->p_context->skip_frame =
(p_sys->i_skip_frame <= AVDISCARD_BIDIR) ?
AVDISCARD_BIDIR : p_sys->i_skip_frame;
} }
else else
{ {
...@@ -480,7 +486,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -480,7 +486,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
else else
{ {
if( p_sys->b_hurry_up ) 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) ) if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
b_drawpicture = 1; b_drawpicture = 1;
else else
...@@ -490,7 +496,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -490,7 +496,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->p_context->width <= 0 || p_sys->p_context->height <= 0 )
{ {
if( p_sys->b_hurry_up ) 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; b_null_size = VLC_TRUE;
} }
...@@ -538,7 +544,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block ) ...@@ -538,7 +544,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
/* Reparse it to not drop the I frame */ /* Reparse it to not drop the I frame */
b_null_size = VLC_FALSE; b_null_size = VLC_FALSE;
if( p_sys->b_hurry_up ) 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, i_used = avcodec_decode_video( p_sys->p_context, p_sys->p_ff_pic,
&b_gotpicture, &b_gotpicture,
(uint8_t*)p_sys->p_buffer, p_sys->i_buffer ); (uint8_t*)p_sys->p_buffer, p_sys->i_buffer );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment