aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_demux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-02-11 07:32:35 +0100
committerAnton Khirnov <anton@khirnov.net>2023-02-20 19:22:22 +0100
commitd9079f6700b022460e4492dc6f9e349741db0bdd (patch)
treee904501e98085751d177c05d4cfe7e3c7ec103ca /fftools/ffmpeg_demux.c
parent8a7554a57401ad41949fe355840cc053cb25274d (diff)
downloadffmpeg-d9079f6700b022460e4492dc6f9e349741db0bdd.tar.gz
fftools/ffmpeg_demux: move InputStream.guess_layout_max to stack
It is only needed while processing the stream in add_input_streams(), no reason to store it in the context.
Diffstat (limited to 'fftools/ffmpeg_demux.c')
-rw-r--r--fftools/ffmpeg_demux.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index b6b6b21271..ac0431233e 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -552,14 +552,14 @@ static const AVCodec *choose_decoder(const OptionsContext *o, AVFormatContext *s
}
}
-static int guess_input_channel_layout(InputStream *ist)
+static int guess_input_channel_layout(InputStream *ist, int guess_layout_max)
{
AVCodecContext *dec = ist->dec_ctx;
if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
char layout_name[256];
- if (dec->ch_layout.nb_channels > ist->guess_layout_max)
+ if (dec->ch_layout.nb_channels > guess_layout_max)
return 0;
av_channel_layout_default(&dec->ch_layout, dec->ch_layout.nb_channels);
if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
@@ -800,11 +800,12 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
ist->framerate_guessed = av_guess_frame_rate(ic, st, NULL);
break;
- case AVMEDIA_TYPE_AUDIO:
- ist->guess_layout_max = INT_MAX;
- MATCH_PER_STREAM_OPT(guess_layout_max, i, ist->guess_layout_max, ic, st);
- guess_input_channel_layout(ist);
+ case AVMEDIA_TYPE_AUDIO: {
+ int guess_layout_max = INT_MAX;
+ MATCH_PER_STREAM_OPT(guess_layout_max, i, guess_layout_max, ic, st);
+ guess_input_channel_layout(ist, guess_layout_max);
break;
+ }
case AVMEDIA_TYPE_DATA:
case AVMEDIA_TYPE_SUBTITLE: {
char *canvas_size = NULL;