Commit 967bc30b authored by François Cartegnie's avatar François Cartegnie 🤞

codec: avcodec: add corrupted frames output option

parent d9e604e4
......@@ -95,6 +95,7 @@ vlc_module_begin ()
add_obsolete_bool( "ffmpeg-dr" ) /* removed since 2.1.0 */
add_bool( "avcodec-dr", true, DR_TEXT, DR_TEXT, true )
add_bool( "avcodec-corrupted", false, CORRUPTED_TEXT, CORRUPTED_LONGTEXT, false )
add_obsolete_integer ( "ffmpeg-error-resilience" ) /* removed since 2.1.0 */
add_integer ( "avcodec-error-resilience", 1, ERROR_TEXT,
ERROR_LONGTEXT, true )
......
......@@ -56,6 +56,9 @@ void ffmpeg_CloseCodec( decoder_t *p_dec );
#define DR_TEXT N_("Direct rendering")
/* FIXME Does somebody who knows what it does, explain */
#define CORRUPTED_TEXT N_("Show corrupted frames")
#define CORRUPTED_LONGTEXT N_("Prefer visual artifacts instead of missing frames")
#define ERROR_TEXT N_("Error resilience")
#define ERROR_LONGTEXT N_( \
"libavcodec can do error resilience.\n" \
......
......@@ -58,6 +58,7 @@ struct decoder_sys_t
/* for frame skipping algo */
bool b_hurry_up;
bool b_show_corrupted;
bool b_from_preroll;
enum AVDiscard i_skip_frame;
......@@ -454,6 +455,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
/* ***** libavcodec frame skipping ***** */
p_sys->b_hurry_up = var_CreateGetBool( p_dec, "avcodec-hurry-up" );
p_sys->b_show_corrupted = var_CreateGetBool( p_dec, "avcodec-corrupted" );
i_val = var_CreateGetInteger( p_dec, "avcodec-skip-frame" );
if( i_val >= 4 ) p_context->skip_frame = AVDISCARD_ALL;
......@@ -951,7 +953,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
update_late_frame_count( p_dec, p_block, current_time, i_pts);
if( ( !p_sys->p_va && !frame->linesize[0] ) ||
( p_dec->b_frame_drop_allowed && (frame->flags & AV_FRAME_FLAG_CORRUPT) ) )
( p_dec->b_frame_drop_allowed && (frame->flags & AV_FRAME_FLAG_CORRUPT) &&
!p_sys->b_show_corrupted ) )
{
av_frame_free(&frame);
continue;
......
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