[vlc-commits] codec: avcodec: add corrupted frames output option
Francois Cartegnie
git at videolan.org
Fri May 12 20:37:55 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 12 20:34:22 2017 +0200| [967bc30bd8381f2814de0689fe58f5ff90194106] | committer: Francois Cartegnie
codec: avcodec: add corrupted frames output option
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=967bc30bd8381f2814de0689fe58f5ff90194106
---
modules/codec/avcodec/avcodec.c | 1 +
modules/codec/avcodec/avcodec.h | 3 +++
modules/codec/avcodec/video.c | 5 ++++-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index edfe10603a..05626aecbd 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -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 )
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index e9b3c1af4e..c38d6fe184 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -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" \
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 85e9bf7a04..a8c812e27d 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -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;
More information about the vlc-commits
mailing list