Commit e9b57851 authored by Rémi Duraffort's avatar Rémi Duraffort

avcodec_video: cosmetics (use var_CreateGet whe applicable).

parent df6fda46
...@@ -190,7 +190,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -190,7 +190,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
AVCodec *p_codec, int i_codec_id, const char *psz_namecodec ) AVCodec *p_codec, int i_codec_id, const char *psz_namecodec )
{ {
decoder_sys_t *p_sys; decoder_sys_t *p_sys;
vlc_value_t val; int i_val;
/* Allocate the memory needed to store the decoder's structure */ /* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) ) ) == NULL ) if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) ) ) == NULL )
...@@ -218,37 +218,28 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -218,37 +218,28 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
config_GetInt( p_dec, "ffmpeg-error-resilience" ); config_GetInt( p_dec, "ffmpeg-error-resilience" );
#endif #endif
var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); if( var_CreateGetBool( p_dec, "grayscale" ) )
var_Get( p_dec, "grayscale", &val ); p_sys->p_context->flags |= CODEC_FLAG_GRAY;
if( val.b_bool ) p_sys->p_context->flags |= CODEC_FLAG_GRAY;
var_Create( p_dec, "ffmpeg-vismv", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); i_val = var_CreateGetInteger( p_dec, "ffmpeg-vismv" );
var_Get( p_dec, "ffmpeg-vismv", &val ); if( i_val ) p_sys->p_context->debug_mv = i_val;
if( val.i_int ) p_sys->p_context->debug_mv = val.i_int;
var_Create( p_dec, "ffmpeg-lowres", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); i_val = var_CreateGetInteger( p_dec, "ffmpeg-lowres" );
var_Get( p_dec, "ffmpeg-lowres", &val ); if( i_val > 0 && i_val <= 2 ) p_sys->p_context->lowres = i_val;
if( val.i_int > 0 && val.i_int <= 2 ) p_sys->p_context->lowres = val.i_int;
var_Create( p_dec, "ffmpeg-skiploopfilter", i_val = var_CreateGetInteger( p_dec, "ffmpeg-skiploopfilter" );
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); if( i_val >= 4 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL;
var_Get( p_dec, "ffmpeg-skiploopfilter", &val ); else if( i_val == 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY;
if( val.i_int > 0 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF; else if( i_val == 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR;
if( val.i_int > 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR; else if( i_val == 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF;
if( val.i_int > 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY;
if( val.i_int > 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL;
bool b_fast = var_CreateGetBool( p_dec, "ffmpeg-fast" ); if( var_CreateGetBool( p_dec, "ffmpeg-fast" ) )
if( b_fast ) p_sys->p_context->flags2 |= CODEC_FLAG2_FAST; p_sys->p_context->flags2 |= CODEC_FLAG2_FAST;
/* ***** ffmpeg frame skipping ***** */ /* ***** ffmpeg frame skipping ***** */
var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); p_sys->b_hurry_up = var_CreateGetBool( p_dec, "ffmpeg-hurry-up" );
var_Get( p_dec, "ffmpeg-hurry-up", &val );
p_sys->b_hurry_up = val.b_bool;
var_Create( p_dec, "ffmpeg-skip-frame", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); switch( var_CreateGetInteger( p_dec, "ffmpeg-skip-frame" ) )
var_Get( p_dec, "ffmpeg-skip-frame", &val );
switch( val.i_int )
{ {
case -1: case -1:
p_sys->p_context->skip_frame = AVDISCARD_NONE; p_sys->p_context->skip_frame = AVDISCARD_NONE;
...@@ -271,9 +262,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -271,9 +262,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
} }
p_sys->i_skip_frame = p_sys->p_context->skip_frame; p_sys->i_skip_frame = p_sys->p_context->skip_frame;
var_Create( p_dec, "ffmpeg-skip-idct", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); switch( var_CreateGetInteger( p_dec, "ffmpeg-skip-idct" ) )
var_Get( p_dec, "ffmpeg-skip-idct", &val );
switch( val.i_int )
{ {
case -1: case -1:
p_sys->p_context->skip_idct = AVDISCARD_NONE; p_sys->p_context->skip_idct = AVDISCARD_NONE;
...@@ -298,9 +287,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -298,9 +287,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
/* ***** ffmpeg direct rendering ***** */ /* ***** ffmpeg direct rendering ***** */
p_sys->b_direct_rendering = false; p_sys->b_direct_rendering = false;
var_Create( p_dec, "ffmpeg-dr", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); if( var_CreateGetBool( p_dec, "ffmpeg-dr" ) &&
var_Get( p_dec, "ffmpeg-dr", &val ); (p_sys->p_codec->capabilities & CODEC_CAP_DR1) &&
if( val.b_bool && (p_sys->p_codec->capabilities & CODEC_CAP_DR1) &&
/* Apparently direct rendering doesn't work with YUV422P */ /* Apparently direct rendering doesn't work with YUV422P */
p_sys->p_context->pix_fmt != PIX_FMT_YUV422P && p_sys->p_context->pix_fmt != PIX_FMT_YUV422P &&
/* H264 uses too many reference frames */ /* H264 uses too many reference frames */
......
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