From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 3/5] fftools/ffmpeg_demux: move InputStream.guess_layout_max to stack
Date: Sat, 11 Feb 2023 08:44:10 +0100
Message-ID: <20230211074412.29495-3-anton@khirnov.net> (raw)
In-Reply-To: <20230211074412.29495-1-anton@khirnov.net>
It is only needed while processing the stream in add_input_streams(), no
reason to store it in the context.
---
fftools/ffmpeg.h | 1 -
fftools/ffmpeg_demux.c | 13 +++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 2d48a147b8..66dda45f70 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -388,7 +388,6 @@ typedef struct InputStream {
AVDictionary *decoder_opts;
AVRational framerate; /* framerate forced with -r */
int top_field_first;
- int guess_layout_max;
int autorotate;
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;
--
2.39.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-02-11 7:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-11 7:44 [FFmpeg-devel] [PATCH 1/5] fftools/ffmpeg_demux: add an AVClass to Demuxer/InputFile Anton Khirnov
2023-02-11 7:44 ` [FFmpeg-devel] [PATCH 2/5] fftools/ffmpeg_demux: add InputStream private data Anton Khirnov
2023-02-11 7:44 ` Anton Khirnov [this message]
2023-02-11 7:44 ` [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_demux: add an AVClass to DemuxStream/InputStream Anton Khirnov
2023-02-11 7:44 ` [FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg: move ts_scale to DemuxStream Anton Khirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230211074412.29495-3-anton@khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git