[FFmpeg-cvslog] lavf: pass options from AVFormatContext to avio.

Anton Khirnov git at videolan.org
Mon Nov 14 00:43:08 CET 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Nov  5 12:30:21 2011 +0100| [32caa7b13cecca59213c73fa94dd683c2b003bfd] | committer: Anton Khirnov

lavf: pass options from AVFormatContext to avio.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32caa7b13cecca59213c73fa94dd683c2b003bfd
---

 libavformat/options.c |   17 ++++++++++++++---
 libavformat/utils.c   |    6 +++---
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/libavformat/options.c b/libavformat/options.c
index 23a7e65..66e01a4 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "avio_internal.h"
 #include "libavutil/opt.h"
 
 /**
@@ -40,6 +41,10 @@ static void *format_child_next(void *obj, void *prev)
         ((s->iformat && s->iformat->priv_class) ||
           s->oformat && s->oformat->priv_class))
         return s->priv_data;
+#if !FF_API_OLD_AVIO
+    if (s->pb && s->pb->av_class && prev != s->pb)
+        return s->pb;
+#endif
     return NULL;
 }
 
@@ -59,9 +64,15 @@ static const AVClass *format_child_class_next(const AVClass *prev)
     while (prev && (ofmt = av_oformat_next(ofmt)))
         if (ofmt->priv_class == prev)
             break;
-    while (ofmt = av_oformat_next(ofmt))
-        if (ofmt->priv_class)
-            return ofmt->priv_class;
+    if ((prev && ofmt) || (!prev))
+        while (ofmt = av_oformat_next(ofmt))
+            if (ofmt->priv_class)
+                return ofmt->priv_class;
+
+#if !FF_API_OLD_AVIO
+    if (prev != &ffio_url_class)
+        return &ffio_url_class;
+#endif
 
     return NULL;
 }
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 399b709..2dc7623 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -575,7 +575,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
 #endif
 
 /* open input file and probe the format if necessary */
-static int init_input(AVFormatContext *s, const char *filename)
+static int init_input(AVFormatContext *s, const char *filename, AVDictionary **options)
 {
     int ret;
     AVProbeData pd = {filename, NULL, 0};
@@ -594,7 +594,7 @@ static int init_input(AVFormatContext *s, const char *filename)
         return 0;
 
     if ((ret = avio_open2(&s->pb, filename, AVIO_FLAG_READ,
-                          &s->interrupt_callback, NULL)) < 0)
+                          &s->interrupt_callback, options)) < 0)
         return ret;
     if (s->iformat)
         return 0;
@@ -619,7 +619,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma
     if ((ret = av_opt_set_dict(s, &tmp)) < 0)
         goto fail;
 
-    if ((ret = init_input(s, filename)) < 0)
+    if ((ret = init_input(s, filename, &tmp)) < 0)
         goto fail;
 
     /* check filename in case an image number is expected */



More information about the ffmpeg-cvslog mailing list