aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-06-24 07:58:16 +0200
committerReinhard Tartler <siretart@tauware.de>2011-07-03 19:49:53 +0200
commitb263e94f774fa612c8329ddd95b35fdf5dac86d5 (patch)
treed0fa50086b5e2e883ee70e43ccc5c553633cc47f
parent9da3063e1cadf0bb4b910e4d9bcd9f859f2bbec6 (diff)
downloadffmpeg-b263e94f774fa612c8329ddd95b35fdf5dac86d5.tar.gz
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@khirnov.net> (cherry picked from commit 4f731c4429e1fe66a5c92ff15feb63253a36d8fb) Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r--libavformat/utils.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 29390b818d..0e6b00195b 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: