aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/dump.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-02-03 02:57:52 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-02-07 10:22:18 +0100
commit569ad285a5c241e10a387fbfa13275e8fb90b979 (patch)
tree0cf9d935722176bfcf5e187dcd80b0e1a3c7a320 /libavformat/dump.c
parent76ef2b9337cf8d2cc7666b7bf8c5a870c373ade1 (diff)
downloadffmpeg-569ad285a5c241e10a387fbfa13275e8fb90b979.tar.gz
avformat/options: Only allocate AVCodecContext for demuxers
The muxer's AVCodecContext is currently used for exactly one thing: To store a time base in it that has been derived via heuristics in avformat_transfer_internal_stream_timing_info(); said time base can then be read back via av_stream_get_codec_timebase(). But one does not need a whole AVCodecContext for that, a simple AVRational is enough. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/dump.c')
-rw-r--r--libavformat/dump.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/dump.c b/libavformat/dump.c
index add38914f2..9d37179bb7 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -565,12 +565,14 @@ static void dump_stream_format(const AVFormatContext *ic, int i,
}
// Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
- avctx->properties = sti->avctx->properties;
- avctx->codec = sti->avctx->codec;
- avctx->qmin = sti->avctx->qmin;
- avctx->qmax = sti->avctx->qmax;
- avctx->coded_width = sti->avctx->coded_width;
- avctx->coded_height = sti->avctx->coded_height;
+ if (sti->avctx) {
+ avctx->properties = sti->avctx->properties;
+ avctx->codec = sti->avctx->codec;
+ avctx->qmin = sti->avctx->qmin;
+ avctx->qmax = sti->avctx->qmax;
+ avctx->coded_width = sti->avctx->coded_width;
+ avctx->coded_height = sti->avctx->coded_height;
+ }
if (separator)
av_opt_set(avctx, "dump_separator", separator, 0);