[vlc-commits] avcommon: add an helper to parse private options

Rafaël Carré git at videolan.org
Tue Apr 17 14:36:14 CEST 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Apr 15 17:46:51 2012 -0400| [1d1d8b8d8a650347c086074acfa2f81bd9cc0608] | committer: Rafaël Carré

avcommon: add an helper to parse private options

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1d1d8b8d8a650347c086074acfa2f81bd9cc0608
---

 modules/codec/avcodec/avcommon.h |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h
index 29dca20..d65bd4d 100644
--- a/modules/codec/avcodec/avcommon.h
+++ b/modules/codec/avcodec/avcommon.h
@@ -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



More information about the vlc-commits mailing list