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
/* 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;
......@@ -464,7 +468,9 @@ 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 =
(p_sys->i_skip_frame <= AVDISCARD_BIDIR) ?
AVDISCARD_BIDIR : p_sys->i_skip_frame;
}
else
{
......@@ -480,7 +486,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
......@@ -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->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;
}
......@@ -538,7 +544,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 );
......
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