Commit e7fd4ee1 authored by Gildas Bazin's avatar Gildas Bazin

* modules/codec/ffmpeg/*:

  + small fix for --ffmpeg-workaround-bugs.
  + new --ffmpeg-vismv option to visualize motion vectors.
parent 64600f1f
......@@ -83,12 +83,14 @@ vlc_module_begin();
set_callbacks( OpenDecoder, CloseDecoder );
add_bool( "ffmpeg-dr", 1, NULL, DR_TEXT, DR_TEXT, VLC_TRUE );
add_integer ( "ffmpeg-error-resilience", -1, NULL, ERROR_TEXT,
add_integer ( "ffmpeg-error-resilience", 1, NULL, ERROR_TEXT,
ERROR_LONGTEXT, VLC_TRUE );
add_integer ( "ffmpeg-workaround-bugs", 1, NULL, BUGS_TEXT, BUGS_LONGTEXT,
VLC_FALSE );
add_bool( "ffmpeg-hurry-up", 0, NULL, HURRYUP_TEXT, HURRYUP_LONGTEXT,
VLC_FALSE );
add_integer ( "ffmpeg-vismv", 0, NULL, VISMV_TEXT, VISMV_LONGTEXT,
VLC_TRUE );
#ifdef LIBAVCODEC_PP
add_integer( "ffmpeg-pp-q", 0, NULL, PP_Q_TEXT, PP_Q_LONGTEXT, VLC_FALSE );
......
......@@ -83,7 +83,7 @@ void E_(ClosePostproc)( decoder_t *, void * );
"ffmpeg can do error resilience.\n" \
"However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
"this can produce a lot of errors.\n" \
"Valid values range from -1 to 99 (-1 disables all errors resilience).")
"Valid values range from 0 to 4 (0 disables all errors resilience).")
#define BUGS_TEXT N_("Workaround bugs")
#define BUGS_LONGTEXT N_( \
......@@ -111,6 +111,12 @@ void E_(ClosePostproc)( decoder_t *, void * );
#define DEBUG_TEXT N_( "Debug mask" )
#define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
#define VISMV_TEXT N_( "Visualize motion vectors" )
#define VISMV_LONGTEXT N_( "Set motion vectors visualization mask.\n" \
"1 - visualize forward predicted MVs of P frames\n" \
"2 - visualize forward predicted MVs of B frames\n" \
"4 - visualize backward predicted MVs of B frames" )
#define LIBAVCODEC_PP_TEXT N_("ffmpeg post processing filter chains")
/* FIXME (cut/past from ffmpeg */
#define LIBAVCODEC_PP_LONGTEXT \
......
......@@ -197,8 +197,6 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
decoder_sys_t *p_sys;
vlc_value_t lockval;
vlc_value_t val;
int i_tmp;
var_Get( p_dec->p_libvlc, "avcodec", &lockval );
......@@ -222,16 +220,19 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->bits_per_sample = p_dec->fmt_in.video.i_bits_per_pixel;
/* ***** Get configuration of ffmpeg plugin ***** */
i_tmp = config_GetInt( p_dec, "ffmpeg-workaround-bugs" );
p_sys->p_context->workaround_bugs = __MAX( __MIN( i_tmp, 99 ), 0 );
i_tmp = config_GetInt( p_dec, "ffmpeg-error-resilience" );
p_sys->p_context->error_resilience = __MAX( __MIN( i_tmp, 99 ), -1 );
p_sys->p_context->workaround_bugs =
config_GetInt( p_dec, "ffmpeg-workaround-bugs" );
p_sys->p_context->error_resilience =
config_GetInt( p_dec, "ffmpeg-error-resilience" );
var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "grayscale", &val );
if( val.b_bool ) p_sys->p_context->flags |= CODEC_FLAG_GRAY;
var_Create( p_dec, "ffmpeg-vismv", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-vismv", &val );
if( val.i_int ) p_sys->p_context->debug_mv = val.i_int;
/* ***** ffmpeg frame skipping ***** */
var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-hurry-up", &val );
......@@ -245,7 +246,8 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
ffmpeg_PixFmtToChroma( p_sys->p_context->pix_fmt ) &&
/* Apparently direct rendering doesn't work with YUV422P */
p_sys->p_context->pix_fmt != PIX_FMT_YUV422P &&
p_sys->i_codec_id != CODEC_ID_H264 && /* H264 use too many reference frames */
/* H264 uses too many reference frames */
p_sys->i_codec_id != CODEC_ID_H264 &&
!(p_sys->p_context->width % 16) && !(p_sys->p_context->height % 16) )
{
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
......@@ -519,10 +521,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
/* Nothing to display */
if( !b_gotpicture )
{
if( i_used == 0 )
{
break;
}
if( i_used == 0 ) break;
continue;
}
......@@ -538,7 +537,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
p_sys->i_late_frames = 0;
}
if( !b_drawpicture || p_sys->p_ff_pic->linesize[0] == 0 )
if( !b_drawpicture || !p_sys->p_ff_pic->linesize[0] )
{
/* Do not display the picture */
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