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
/* Audio AAC encoder profile */
add_string( ENC_CFG_PREFIX "aac-profile", "low",
ENC_PROFILE_TEXT, ENC_PROFILE_LONGTEXT, true )
+
+ add_string( ENC_CFG_PREFIX "options", NULL, AV_OPTIONS_TEXT, AV_OPTIONS_LONGTEXT, true )
#endif /* ENABLE_SOUT */
#ifdef MERGE_FFMPEG
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();
- ret = avcodec_open2( p_sys->p_context, p_sys->p_codec, NULL /* options */ );
+ 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 );
#if (LIBAVCODEC_VERSION_MAJOR < 55)
"luma-elim-threshold", "chroma-elim-threshold",
#endif
- "aac-profile",
+ "aac-profile", "options",
NULL
};
p_context->thread_count = vlc_GetCPUCount();
int ret;
+ char *psz_opts = var_InheritString(p_enc, ENC_CFG_PREFIX "options");
+ AVDictionary *options = NULL;
+ if (psz_opts && *psz_opts)
+ options = vlc_av_get_options(psz_opts);
+ free(psz_opts);
+
vlc_avcodec_lock();
- ret = avcodec_open2( p_context, p_codec, NULL /* options */ );
+ ret = avcodec_open2( p_context, 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_enc, "Unknown option \"%s\"", t->key);
+ }
+
if( ret )
{
if( p_enc->fmt_in.i_cat != AUDIO_ES ||
msg_Err( p_enc, "cannot open encoder" );
dialog_Fatal( p_enc, _("Streaming / Transcoding failed"),
"%s", _("VLC could not open the encoder.") );
- free( p_sys );
- return VLC_EGENERIC;
+ av_dict_free(&options);
+ goto error;
}
if( p_context->channels > 2 )
{
msg_Err( p_enc, "MPEG audio doesn't support frequency=%d",
fmt->audio.i_rate );
- free( p_sys );
- return VLC_EGENERIC;
+ av_dict_free(&options);
+ goto error;
}
for ( i = 1; i < 14; i++ )
p_context->codec = NULL;
vlc_avcodec_lock();
- ret = avcodec_open2( p_context, p_codec, NULL /* options */ );
+ ret = avcodec_open2( p_context, p_codec, options ? &options : NULL );
vlc_avcodec_unlock();
if( ret )
{
dialog_Fatal( p_enc,
_("Streaming / Transcoding failed"),
"%s", _("VLC could not open the encoder.") );
- free( p_sys );
- return VLC_EGENERIC;
+ av_dict_free(&options);
+ goto error;
}
}
+ av_dict_free(&options);
+
if( i_codec_id == AV_CODEC_ID_FLAC )
{
p_enc->fmt_out.i_extra = 4 + 1 + 3 + p_context->extradata_size;
/* */
int ret;
+ char *psz_opts = var_InheritString(dec, "avcodec-options");
+ AVDictionary *options = NULL;
+ if (psz_opts && *psz_opts)
+ options = vlc_av_get_options(psz_opts);
+ free(psz_opts);
+
vlc_avcodec_lock();
- ret = avcodec_open2(context, codec, NULL /* options */);
+ ret = avcodec_open2(context, codec, options ? &options : NULL);
vlc_avcodec_unlock();
+
+ AVDictionaryEntry *t = NULL;
+ while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ msg_Err(dec, "Unknown option \"%s\"", t->key);
+ }
+ av_dict_free(&options);
+
if (ret < 0) {
msg_Err(dec, "cannot open codec (%s)", namecodec);
free(context->extradata);