Commit 637db918 authored by Rafaël Carré's avatar Rafaël Carré

Sanitize FFmpeg modules options

Obsolete "ffmpeg" prefix
Use "avformat" or "avcodec" prefix
avio has no options (yet)
switcher uses "sout-switcher" prefix
Use "sout-avformat" for muxer
parent 1d1d8b8d
...@@ -101,38 +101,52 @@ vlc_module_begin () ...@@ -101,38 +101,52 @@ vlc_module_begin ()
set_callbacks( OpenDecoder, CloseDecoder ) set_callbacks( OpenDecoder, CloseDecoder )
add_bool( "ffmpeg-dr", true, DR_TEXT, DR_TEXT, true ) add_obsolete_bool( "ffmpeg-dr" ) /* removed since 2.1.0 */
add_integer ( "ffmpeg-error-resilience", 1, ERROR_TEXT, add_bool( "avcodec-dr", true, DR_TEXT, DR_TEXT, true )
add_obsolete_integer ( "ffmpeg-error-resilience" ) /* removed since 2.1.0 */
add_integer ( "avcodec-error-resilience", 1, ERROR_TEXT,
ERROR_LONGTEXT, true ) ERROR_LONGTEXT, true )
add_integer ( "ffmpeg-workaround-bugs", 1, BUGS_TEXT, BUGS_LONGTEXT, add_obsolete_integer ( "ffmpeg-workaround-bugs" ) /* removed since 2.1.0 */
add_integer ( "avcodec-workaround-bugs", 1, BUGS_TEXT, BUGS_LONGTEXT,
false ) false )
add_bool( "ffmpeg-hurry-up", true, HURRYUP_TEXT, HURRYUP_LONGTEXT, add_obsolete_bool( "ffmpeg-hurry-up" ) /* removed since 2.1.0 */
add_bool( "avcodec-hurry-up", true, HURRYUP_TEXT, HURRYUP_LONGTEXT,
false ) false )
add_integer( "ffmpeg-skip-frame", 0, SKIP_FRAME_TEXT, add_obsolete_integer( "ffmpeg-skip-frame") /* removed since 2.1.0 */
add_integer( "avcodec-skip-frame", 0, SKIP_FRAME_TEXT,
SKIP_FRAME_LONGTEXT, true ) SKIP_FRAME_LONGTEXT, true )
change_integer_range( -1, 4 ) change_integer_range( -1, 4 )
add_integer( "ffmpeg-skip-idct", 0, SKIP_IDCT_TEXT, add_obsolete_integer( "ffmpeg-skip-idct" ) /* removed since 2.1.0 */
add_integer( "avcodec-skip-idct", 0, SKIP_IDCT_TEXT,
SKIP_IDCT_LONGTEXT, true ) SKIP_IDCT_LONGTEXT, true )
change_integer_range( -1, 4 ) change_integer_range( -1, 4 )
add_integer ( "ffmpeg-vismv", 0, VISMV_TEXT, VISMV_LONGTEXT, add_obsolete_integer ( "ffmpeg-vismv" ) /* removed since 2.1.0 */
add_integer ( "avcodec-vismv", 0, VISMV_TEXT, VISMV_LONGTEXT,
true ) true )
add_integer ( "ffmpeg-lowres", 0, LOWRES_TEXT, LOWRES_LONGTEXT, add_obsolete_integer ( "ffmpeg-lowres" ) /* removed since 2.1.0 */
add_integer ( "avcodec-lowres", 0, LOWRES_TEXT, LOWRES_LONGTEXT,
true ) true )
change_integer_range( 0, 2 ) change_integer_range( 0, 2 )
add_bool( "ffmpeg-fast", false, FAST_TEXT, FAST_LONGTEXT, false ) add_obsolete_bool( "ffmpeg-fast" ) /* removed since 2.1.0 */
add_integer ( "ffmpeg-skiploopfilter", 0, SKIPLOOPF_TEXT, add_bool( "avcodec-fast", false, FAST_TEXT, FAST_LONGTEXT, false )
add_obsolete_integer ( "ffmpeg-skiploopfilter" ) /* removed since 2.1.0 */
add_integer ( "avcodec-skiploopfilter", 0, SKIPLOOPF_TEXT,
SKIPLOOPF_LONGTEXT, false) SKIPLOOPF_LONGTEXT, false)
change_safe () change_safe ()
change_integer_list( nloopf_list, nloopf_list_text ) change_integer_list( nloopf_list, nloopf_list_text )
add_integer( "ffmpeg-debug", 0, DEBUG_TEXT, DEBUG_LONGTEXT, add_obsolete_integer( "ffmpeg-debug" ) /* removed since 2.1.0 */
add_integer( "avcodec-debug", 0, DEBUG_TEXT, DEBUG_LONGTEXT,
true ) true )
add_string( "ffmpeg-codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true ) add_obsolete_string( "ffmpeg-codec" ) /* removed since 2.1.0 */
add_string( "avcodec-codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true )
#if defined(HAVE_AVCODEC_VAAPI) || defined(HAVE_AVCODEC_DXVA2) #if defined(HAVE_AVCODEC_VAAPI) || defined(HAVE_AVCODEC_DXVA2)
add_bool( "ffmpeg-hw", false, HW_TEXT, HW_LONGTEXT, false ) add_obsolete_bool( "ffmpeg-hw" ) /* removed since 2.1.0 */
add_bool( "avcodec-hw", false, HW_TEXT, HW_LONGTEXT, false )
#endif #endif
#if defined(FF_THREAD_FRAME) #if defined(FF_THREAD_FRAME)
add_integer( "ffmpeg-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true ); add_obsolete_integer( "ffmpeg-threads" ) /* removed since 2.1.0 */
add_integer( "avcodec-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true );
#endif #endif
...@@ -145,6 +159,35 @@ vlc_module_begin () ...@@ -145,6 +159,35 @@ vlc_module_begin ()
set_capability( "encoder", 100 ) set_capability( "encoder", 100 )
set_callbacks( OpenEncoder, CloseEncoder ) set_callbacks( OpenEncoder, CloseEncoder )
/* removed in 2.1.0 */
add_obsolete_string( "sout-ffmpeg-codec" )
add_obsolete_string( "sout-ffmpeg-hq" )
add_obsolete_integer( "sout-ffmpeg-keyint" )
add_obsolete_integer( "sout-ffmpeg-bframes" )
add_obsolete_bool( "sout-ffmpeg-hurry-up" )
add_obsolete_bool( "sout-ffmpeg-interlace" )
add_obsolete_bool( "sout-ffmpeg-interlace-me" )
add_obsolete_integer( "sout-ffmpeg-vt" )
add_obsolete_bool( "sout-ffmpeg-pre-me" )
add_obsolete_integer( "sout-ffmpeg-rc-buffer-size" )
add_obsolete_float( "sout-ffmpeg-rc-buffer-aggressivity" )
add_obsolete_float( "sout-ffmpeg-i-quant-factor" )
add_obsolete_integer( "sout-ffmpeg-noise-reduction" )
add_obsolete_bool( "sout-ffmpeg-mpeg4-matrix" )
add_obsolete_integer( "sout-ffmpeg-qmin" )
add_obsolete_integer( "sout-ffmpeg-qmax" )
add_obsolete_bool( "sout-ffmpeg-trellis" )
add_obsolete_float( "sout-ffmpeg-qscale" )
add_obsolete_integer( "sout-ffmpeg-strict" )
add_obsolete_float( "sout-ffmpeg-lumi-masking" )
add_obsolete_float( "sout-ffmpeg-dark-masking" )
add_obsolete_float( "sout-ffmpeg-p-masking" )
add_obsolete_float( "sout-ffmpeg-border-masking" )
add_obsolete_integer( "sout-ffmpeg-luma-elim-threshold" )
add_obsolete_integer( "sout-ffmpeg-chroma-elim-threshold" )
add_obsolete_string( "sout-ffmpeg-aac-profile" )
add_string( ENC_CFG_PREFIX "codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true ) add_string( ENC_CFG_PREFIX "codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true )
add_string( ENC_CFG_PREFIX "hq", "simple", ENC_HQ_TEXT, add_string( ENC_CFG_PREFIX "hq", "simple", ENC_HQ_TEXT,
ENC_HQ_LONGTEXT, false ) ENC_HQ_LONGTEXT, false )
...@@ -240,7 +283,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -240,7 +283,7 @@ static int OpenDecoder( vlc_object_t *p_this )
vlc_init_avcodec(); vlc_init_avcodec();
/* *** ask ffmpeg for a decoder *** */ /* *** ask ffmpeg for a decoder *** */
char *psz_decoder = var_CreateGetString( p_this, "ffmpeg-codec" ); char *psz_decoder = var_CreateGetString( p_this, "avcodec-codec" );
if( psz_decoder && *psz_decoder ) if( psz_decoder && *psz_decoder )
{ {
p_codec = avcodec_find_decoder_by_name( psz_decoder ); p_codec = avcodec_find_decoder_by_name( psz_decoder );
...@@ -270,7 +313,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -270,7 +313,7 @@ static int OpenDecoder( vlc_object_t *p_this )
#endif #endif
if( !p_context ) if( !p_context )
return VLC_ENOMEM; return VLC_ENOMEM;
p_context->debug = var_InheritInteger( p_dec, "ffmpeg-debug" ); p_context->debug = var_InheritInteger( p_dec, "avcodec-debug" );
p_context->opaque = (void *)p_this; p_context->opaque = (void *)p_this;
/* Set CPU capabilities */ /* Set CPU capabilities */
......
...@@ -144,7 +144,7 @@ int ffmpeg_OpenCodec( decoder_t *p_dec ); ...@@ -144,7 +144,7 @@ int ffmpeg_OpenCodec( decoder_t *p_dec );
/* /*
* Encoder options * Encoder options
*/ */
#define ENC_CFG_PREFIX "sout-ffmpeg-" #define ENC_CFG_PREFIX "sout-avcodec-"
#define ENC_KEYINT_TEXT N_( "Ratio of key frames" ) #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
#define ENC_KEYINT_LONGTEXT N_( "Number of frames " \ #define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
......
...@@ -313,7 +313,7 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -313,7 +313,7 @@ int OpenEncoder( vlc_object_t *p_this )
#endif #endif
p_sys->p_context = p_context; p_sys->p_context = p_context;
p_sys->p_context->codec_id = p_sys->p_codec->id; p_sys->p_context->codec_id = p_sys->p_codec->id;
p_context->debug = var_InheritInteger( p_enc, "ffmpeg-debug" ); p_context->debug = var_InheritInteger( p_enc, "avcodec-debug" );
p_context->opaque = (void *)p_this; p_context->opaque = (void *)p_this;
/* Set CPU capabilities */ /* Set CPU capabilities */
......
...@@ -234,36 +234,36 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -234,36 +234,36 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
/* ***** Get configuration of ffmpeg plugin ***** */ /* ***** Get configuration of ffmpeg plugin ***** */
p_sys->p_context->workaround_bugs = p_sys->p_context->workaround_bugs =
var_InheritInteger( p_dec, "ffmpeg-workaround-bugs" ); var_InheritInteger( p_dec, "avcodec-workaround-bugs" );
#if LIBAVCODEC_VERSION_MAJOR < 54 #if LIBAVCODEC_VERSION_MAJOR < 54
p_sys->p_context->error_recognition = p_sys->p_context->error_recognition =
#else #else
p_sys->p_context->err_recognition = p_sys->p_context->err_recognition =
#endif #endif
var_InheritInteger( p_dec, "ffmpeg-error-resilience" ); var_InheritInteger( p_dec, "avcodec-error-resilience" );
if( var_CreateGetBool( p_dec, "grayscale" ) ) if( var_CreateGetBool( p_dec, "grayscale" ) )
p_sys->p_context->flags |= CODEC_FLAG_GRAY; p_sys->p_context->flags |= CODEC_FLAG_GRAY;
i_val = var_CreateGetInteger( p_dec, "ffmpeg-vismv" ); i_val = var_CreateGetInteger( p_dec, "avcodec-vismv" );
if( i_val ) p_sys->p_context->debug_mv = i_val; if( i_val ) p_sys->p_context->debug_mv = i_val;
i_val = var_CreateGetInteger( p_dec, "ffmpeg-lowres" ); i_val = var_CreateGetInteger( p_dec, "avcodec-lowres" );
if( i_val > 0 && i_val <= 2 ) p_sys->p_context->lowres = i_val; if( i_val > 0 && i_val <= 2 ) p_sys->p_context->lowres = i_val;
i_val = var_CreateGetInteger( p_dec, "ffmpeg-skiploopfilter" ); i_val = var_CreateGetInteger( p_dec, "avcodec-skiploopfilter" );
if( i_val >= 4 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL; if( i_val >= 4 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL;
else if( i_val == 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY; else if( i_val == 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY;
else if( i_val == 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR; else if( i_val == 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR;
else if( i_val == 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF; else if( i_val == 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF;
if( var_CreateGetBool( p_dec, "ffmpeg-fast" ) ) if( var_CreateGetBool( p_dec, "avcodec-fast" ) )
p_sys->p_context->flags2 |= CODEC_FLAG2_FAST; p_sys->p_context->flags2 |= CODEC_FLAG2_FAST;
/* ***** ffmpeg frame skipping ***** */ /* ***** ffmpeg frame skipping ***** */
p_sys->b_hurry_up = var_CreateGetBool( p_dec, "ffmpeg-hurry-up" ); p_sys->b_hurry_up = var_CreateGetBool( p_dec, "avcodec-hurry-up" );
switch( var_CreateGetInteger( p_dec, "ffmpeg-skip-frame" ) ) switch( var_CreateGetInteger( p_dec, "avcodec-skip-frame" ) )
{ {
case -1: case -1:
p_sys->p_context->skip_frame = AVDISCARD_NONE; p_sys->p_context->skip_frame = AVDISCARD_NONE;
...@@ -286,7 +286,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -286,7 +286,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;
switch( var_CreateGetInteger( p_dec, "ffmpeg-skip-idct" ) ) switch( var_CreateGetInteger( p_dec, "avcodec-skip-idct" ) )
{ {
case -1: case -1:
p_sys->p_context->skip_idct = AVDISCARD_NONE; p_sys->p_context->skip_idct = AVDISCARD_NONE;
...@@ -312,7 +312,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -312,7 +312,7 @@ 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;
p_sys->i_direct_rendering_used = -1; p_sys->i_direct_rendering_used = -1;
if( var_CreateGetBool( p_dec, "ffmpeg-dr" ) && if( var_CreateGetBool( p_dec, "avcodec-dr" ) &&
(p_sys->p_codec->capabilities & CODEC_CAP_DR1) && (p_sys->p_codec->capabilities & CODEC_CAP_DR1) &&
/* No idea why ... but this fixes flickering on some TSCC streams */ /* No idea why ... but this fixes flickering on some TSCC streams */
p_sys->i_codec_id != CODEC_ID_TSCC && p_sys->i_codec_id != CODEC_ID_CSCD && p_sys->i_codec_id != CODEC_ID_TSCC && p_sys->i_codec_id != CODEC_ID_CSCD &&
...@@ -349,7 +349,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -349,7 +349,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->opaque = p_dec; p_sys->p_context->opaque = p_dec;
#ifdef HAVE_AVCODEC_MT #ifdef HAVE_AVCODEC_MT
int i_thread_count = var_InheritInteger( p_dec, "ffmpeg-threads" ); int i_thread_count = var_InheritInteger( p_dec, "avcodec-threads" );
if( i_thread_count <= 0 ) if( i_thread_count <= 0 )
{ {
i_thread_count = vlc_GetCPUCount(); i_thread_count = vlc_GetCPUCount();
...@@ -365,7 +365,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -365,7 +365,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
#endif #endif
#ifdef HAVE_AVCODEC_VA #ifdef HAVE_AVCODEC_VA
const bool b_use_hw = var_CreateGetBool( p_dec, "ffmpeg-hw" ); const bool b_use_hw = var_CreateGetBool( p_dec, "avcodec-hw" );
if( b_use_hw && if( b_use_hw &&
(i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO || (i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO ||
i_codec_id == CODEC_ID_MPEG4 || i_codec_id == CODEC_ID_MPEG4 ||
......
...@@ -41,7 +41,8 @@ vlc_module_begin () ...@@ -41,7 +41,8 @@ vlc_module_begin ()
set_shortname( N_("Avformat") ) set_shortname( N_("Avformat") )
set_capability( "demux", 2 ) set_capability( "demux", 2 )
set_callbacks( OpenDemux, CloseDemux ) set_callbacks( OpenDemux, CloseDemux )
add_string( "ffmpeg-format", NULL, FORMAT_TEXT, FORMAT_LONGTEXT, true ) add_string( "avformat-format", NULL, FORMAT_TEXT, FORMAT_LONGTEXT, true )
add_obsolete_string("ffmpeg-format") /* removed since 2.1.0 */
#ifdef ENABLE_SOUT #ifdef ENABLE_SOUT
/* mux submodule */ /* mux submodule */
...@@ -49,8 +50,8 @@ vlc_module_begin () ...@@ -49,8 +50,8 @@ vlc_module_begin ()
add_shortcut( "ffmpeg", "avformat" ) add_shortcut( "ffmpeg", "avformat" )
set_description( N_("Avformat muxer" ) ) set_description( N_("Avformat muxer" ) )
set_capability( "sout mux", 2 ) set_capability( "sout mux", 2 )
add_string( "ffmpeg-mux", NULL, MUX_TEXT, add_string( "sout-avformat-mux", NULL, MUX_TEXT, MUX_LONGTEXT, true )
MUX_LONGTEXT, true ) add_obsolete_string("ffmpeg-mux") /* removed since 2.1.0 */
set_callbacks( OpenMux, CloseMux ) set_callbacks( OpenMux, CloseMux )
#endif #endif
#ifndef MERGE_FFMPEG #ifndef MERGE_FFMPEG
......
...@@ -140,7 +140,7 @@ int OpenDemux( vlc_object_t *p_this ) ...@@ -140,7 +140,7 @@ int OpenDemux( vlc_object_t *p_this )
vlc_init_avformat(); vlc_init_avformat();
char *psz_format = var_InheritString( p_this, "ffmpeg-format" ); char *psz_format = var_InheritString( p_this, "avformat-format" );
if( psz_format ) if( psz_format )
{ {
if( fmt = av_find_input_format(psz_format) ) if( fmt = av_find_input_format(psz_format) )
......
...@@ -94,10 +94,10 @@ int OpenMux( vlc_object_t *p_this ) ...@@ -94,10 +94,10 @@ int OpenMux( vlc_object_t *p_this )
vlc_init_avformat(); vlc_init_avformat();
config_ChainParse( p_mux, "ffmpeg-", ppsz_mux_options, p_mux->p_cfg ); config_ChainParse( p_mux, "sout-avformat-", ppsz_mux_options, p_mux->p_cfg );
/* Find the requested muxer */ /* Find the requested muxer */
psz_mux = var_GetNonEmptyString( p_mux, "ffmpeg-mux" ); psz_mux = var_GetNonEmptyString( p_mux, "sout-avformat-mux" );
if( psz_mux ) if( psz_mux )
{ {
#if( LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( 52, 45, 0 ) ) #if( LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( 52, 45, 0 ) )
......
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