Commit 1d1d8b8d authored by Rafaël Carré's avatar Rafaël Carré

avcommon: add an helper to parse private options

parent f5bc59c5
......@@ -26,6 +26,8 @@
#endif
#include <vlc_avcodec.h>
#include <vlc_configuration.h>
#include <vlc_variables.h>
#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
# include <libavformat/avformat.h>
......@@ -53,3 +55,28 @@ static inline void vlc_init_avcodec(void)
vlc_avcodec_unlock();
}
#endif
#ifdef HAVE_LIBAVUTIL_AVUTIL_H
# include <libavutil/avutil.h>
# if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 51, 7, 0 )
# include <libavutil/dict.h>
#define AV_OPTIONS_TEXT "FFmpeg advanced options."
#define AV_OPTIONS_LONGTEXT "FFmpeg advanced options, in the form {opt=val,opt2=val2} ."
static inline AVDictionary *vlc_av_get_options(const char *psz_opts)
{
AVDictionary *options = NULL;
config_chain_t *cfg;
config_ChainParseOptions(&cfg, psz_opts);
while (cfg) {
config_chain_t *next = cfg->p_next;
av_dict_set(&options, cfg->psz_name, cfg->psz_value,
AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
free(cfg);
cfg = next;
}
return options;
}
# endif
#endif
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