Commit 667c3a73 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

avcodec: vlc_av_get_options: Append to a potentially existing dict

parent 9a02992a
......@@ -159,7 +159,7 @@ int OpenAvio(vlc_object_t *object)
AVDictionary *options = NULL;
char *psz_opts = var_InheritString(access, "avio-options");
if (psz_opts) {
options = vlc_av_get_options(psz_opts);
vlc_av_get_options(psz_opts, &options);
free(psz_opts);
}
ret = avio_open2(&sys->context, url, AVIO_FLAG_READ, &cb, &options);
......@@ -239,7 +239,7 @@ int OutOpenAvio(vlc_object_t *object)
AVDictionary *options = NULL;
char *psz_opts = var_InheritString(access, "sout-avio-options");
if (psz_opts) {
options = vlc_av_get_options(psz_opts);
vlc_av_get_options(psz_opts, &options);
free(psz_opts);
}
ret = avio_open2(&sys->context, access->psz_path, AVIO_FLAG_WRITE,
......
......@@ -366,7 +366,7 @@ int ffmpeg_OpenCodec( decoder_t *p_dec )
int ret;
if (psz_opts) {
options = vlc_av_get_options(psz_opts);
vlc_av_get_options(psz_opts, &options);
free(psz_opts);
}
......
......@@ -45,20 +45,18 @@
#define AV_OPTIONS_TEXT "Advanced options"
#define AV_OPTIONS_LONGTEXT "Advanced options, in the form {opt=val,opt2=val2}."
static inline AVDictionary *vlc_av_get_options(const char *psz_opts)
static inline void vlc_av_get_options(const char *psz_opts, AVDictionary** pp_dict)
{
AVDictionary *options = NULL;
config_chain_t *cfg = NULL;
config_ChainParseOptions(&cfg, psz_opts);
while (cfg) {
config_chain_t *next = cfg->p_next;
av_dict_set(&options, cfg->psz_name, cfg->psz_value, 0);
av_dict_set(pp_dict, cfg->psz_name, cfg->psz_value, 0);
free(cfg->psz_name);
free(cfg->psz_value);
free(cfg);
cfg = next;
}
return options;
}
static inline void vlc_init_avutil(vlc_object_t *obj)
......
......@@ -915,7 +915,7 @@ int OpenEncoder( vlc_object_t *p_this )
char *psz_opts = var_InheritString(p_enc, ENC_CFG_PREFIX "options");
AVDictionary *options = NULL;
if (psz_opts) {
options = vlc_av_get_options(psz_opts);
vlc_av_get_options(psz_opts, &options);
free(psz_opts);
}
......
......@@ -90,7 +90,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
char *psz_opts = var_InheritString(dec, "avcodec-options");
AVDictionary *options = NULL;
if (psz_opts) {
options = vlc_av_get_options(psz_opts);
vlc_av_get_options(psz_opts, &options);
free(psz_opts);
}
......
......@@ -337,7 +337,7 @@ int OpenDemux( vlc_object_t *p_this )
for (unsigned i = 1; i < nb_streams; i++)
options[i] = NULL;
if (psz_opts) {
options[0] = vlc_av_get_options(psz_opts);
vlc_av_get_options(psz_opts, &options[0]);
for (unsigned i = 1; i < nb_streams; i++) {
av_dict_copy(&options[i], options[0], 0);
}
......
......@@ -404,7 +404,7 @@ static int Mux( sout_mux_t *p_mux )
char *psz_opts = var_GetNonEmptyString( p_mux, "sout-avformat-options" );
AVDictionary *options = NULL;
if (psz_opts) {
options = vlc_av_get_options(psz_opts);
vlc_av_get_options(psz_opts, &options);
free(psz_opts);
}
av_dict_set( &p_sys->oc->metadata, "encoding_tool", "VLC "VERSION, 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