changeset 36356:7bb6989c97b8

Add support for ffmpeg's demuxer-specific options.
author reimar
date Sat, 21 Sep 2013 15:43:45 +0000
parents 4593e5141d8e
children 7dca7d4d4e54
files libmpdemux/demux_lavf.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Sat Sep 21 00:03:09 2013 +0000
+++ b/libmpdemux/demux_lavf.c	Sat Sep 21 15:43:45 2013 +0000
@@ -508,6 +508,7 @@
 }
 
 static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
+    AVDictionary *opts;
     AVFormatContext *avfc;
     AVDictionaryEntry *t = NULL;
     lavf_priv_t *priv= demuxer->priv;
@@ -535,7 +536,7 @@
     }
 
     if(opt_avopt){
-        if(parse_avopts(avfc, opt_avopt) < 0){
+        if(av_dict_parse_string(&opts, opt_avopt, "=", ",", 0) < 0){
             mp_msg(MSGT_HEADER,MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", opt_avopt);
             return NULL;
         }
@@ -563,10 +564,17 @@
         avfc->pb = priv->pb;
     }
 
-    if(avformat_open_input(&avfc, mp_filename, priv->avif, NULL)<0){
+    if(avformat_open_input(&avfc, mp_filename, priv->avif, &opts)<0){
         mp_msg(MSGT_HEADER,MSGL_ERR,"LAVF_header: av_open_input_stream() failed\n");
         return NULL;
     }
+    if (av_dict_count(opts)) {
+        AVDictionaryEntry *e = NULL;
+        while ((e = av_dict_get(opts, "", e, AV_DICT_IGNORE_SUFFIX)))
+            mp_msg(MSGT_HEADER,MSGL_ERR,"Unknown option %s\n", e->key);
+        return 0;
+    }
+    av_dict_free(&opts);
 
     priv->avfc= avfc;