[FFmpeg-cvslog] lavf: restore old behavior for custom AVIOContex with an AVFMT_NOFILE format.

Anton Khirnov git at videolan.org
Sun Jul 3 03:20:23 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Jun 24 07:58:16 2011 +0200| [4f731c4429e1fe66a5c92ff15feb63253a36d8fb] | committer: Anton Khirnov

lavf: restore old behavior for custom AVIOContex with an AVFMT_NOFILE format.

av_open_input_stream used to allow this, even though it makes no sense.
Make it just print a warning instead of failing, thus restoring
compatibility.

Note that avformat_open_input() will still reject this combination.

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

 libavformat/utils.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 92debd5..de26a18 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -459,9 +459,14 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
         err = AVERROR(ENOMEM);
         goto fail;
     }
-    ic->pb = pb;
+    if (pb && fmt && fmt->flags & AVFMT_NOFILE)
+        av_log(ic, AV_LOG_WARNING, "Custom AVIOContext makes no sense and "
+                                   "will be ignored with AVFMT_NOFILE format.\n");
+    else
+        ic->pb = pb;
 
     err = avformat_open_input(&ic, filename, fmt, &opts);
+    ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set above
 
     *ic_ptr = ic;
 fail:



More information about the ffmpeg-cvslog mailing list