#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 53, 34, 0 )
# error You must update libavcodec to a version >= 53.34.0
+#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 54, 25, 0 )
+# warning You should update libavcodec to a version >= 54.25.0
#endif
/*****************************************************************************
add_obsolete_integer( "ffmpeg-threads" ) /* removed since 2.1.0 */
add_integer( "avcodec-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true );
#endif
+ add_string( "avcodec-options", NULL, AV_OPTIONS_TEXT, AV_OPTIONS_LONGTEXT, true )
#ifdef ENABLE_SOUT
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", "rd", ENC_HQ_TEXT,
ENC_HQ_LONGTEXT, false )
change_string_list( enc_hq_list, enc_hq_list_text )
add_integer( ENC_CFG_PREFIX "keyint", 0, ENC_KEYINT_TEXT,
/* Audio AAC encoder profile */
add_string( ENC_CFG_PREFIX "aac-profile", "low",
ENC_PROFILE_TEXT, ENC_PROFILE_LONGTEXT, true )
-#endif /* ENABLE_SOUT */
- /* video filter submodule */
- add_submodule ()
- set_capability( "video filter2", 0 )
- set_callbacks( OpenDeinterlace, CloseDeinterlace )
- set_description( N_("FFmpeg deinterlace video filter") )
- add_shortcut( "ffmpeg-deinterlace" )
+ add_string( ENC_CFG_PREFIX "options", NULL, AV_OPTIONS_TEXT, AV_OPTIONS_LONGTEXT, true )
+#endif /* ENABLE_SOUT */
#ifdef MERGE_FFMPEG
add_submodule ()
}
/* *** get a p_context *** */
-#if LIBAVCODEC_VERSION_MAJOR >= 54
p_context = avcodec_alloc_context3(p_codec);
-#else
- p_context = avcodec_alloc_context();
-#endif
if( !p_context )
return VLC_ENOMEM;
p_context->debug = var_InheritInteger( p_dec, "avcodec-debug" );
switch( p_sys->i_cat )
{
- case AUDIO_ES:
- EndAudioDec ( p_dec );
- break;
case VIDEO_ES:
EndVideoDec ( p_dec );
break;
- case SPU_ES:
- EndSubtitleDec( p_dec );
- break;
}
if( p_sys->p_context )
if( p_sys->p_context->extradata_size <= 0 )
{
- if( p_sys->i_codec_id == CODEC_ID_VC1 ||
- p_sys->i_codec_id == CODEC_ID_VORBIS ||
- p_sys->i_codec_id == CODEC_ID_THEORA ||
- ( p_sys->i_codec_id == CODEC_ID_AAC &&
+ if( p_sys->i_codec_id == AV_CODEC_ID_VC1 ||
+ p_sys->i_codec_id == AV_CODEC_ID_VORBIS ||
+ p_sys->i_codec_id == AV_CODEC_ID_THEORA ||
+ ( p_sys->i_codec_id == AV_CODEC_ID_AAC &&
!p_dec->fmt_in.b_packetized ) )
{
msg_Warn( p_dec, "waiting for extra data for codec %s",
p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
- if( p_sys->i_codec_id == CODEC_ID_ADPCM_G726 &&
+ if( p_sys->i_codec_id == AV_CODEC_ID_ADPCM_G726 &&
p_sys->p_context->bit_rate > 0 &&
p_sys->p_context->sample_rate > 0)
p_sys->p_context->bits_per_coded_sample = p_sys->p_context->bit_rate /
p_sys->p_context->sample_rate;
}
int ret;
+ char *psz_opts = var_InheritString( p_dec, "avcodec-options" );
+ AVDictionary *options = NULL;
+ if (psz_opts && *psz_opts)
+ options = vlc_av_get_options(psz_opts);
+ free(psz_opts);
+
vlc_avcodec_lock();
-#if LIBAVCODEC_VERSION_MAJOR >= 54
- ret = avcodec_open2( p_sys->p_context, p_sys->p_codec, NULL /* options */ );
-#else
- ret = avcodec_open( p_sys->p_context, p_sys->p_codec );
-#endif
+ ret = avcodec_open2( p_sys->p_context, p_sys->p_codec, options ? &options : NULL );
vlc_avcodec_unlock();
+
+ AVDictionaryEntry *t = NULL;
+ while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ msg_Err( p_dec, "Unknown option \"%s\"", t->key );
+ }
+ av_dict_free(&options);
+
if( ret < 0 )
return VLC_EGENERIC;
msg_Dbg( p_dec, "avcodec codec (%s) started", p_sys->psz_namecodec );