diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-06-19 19:33:52 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-07-28 16:37:16 +0200 |
commit | 4f91782fcd37884b177c7507de878981a63ffaac (patch) | |
tree | e5950ba9cd87e3db3df36e9c4f7c851bd640cb1c /fftools/ffmpeg_opt.c | |
parent | 6353b2804237b1493bc0ac69a467859b85c44b3d (diff) | |
download | ffmpeg-4f91782fcd37884b177c7507de878981a63ffaac.tar.gz |
fftools/ffmpeg: move guess_input_channel_layout() to ffmpeg_opt.c
That is the only place where it is used. Also make it static.
Diffstat (limited to 'fftools/ffmpeg_opt.c')
-rw-r--r-- | fftools/ffmpeg_opt.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 29bc4fd97f..444392fd45 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -862,6 +862,25 @@ static const AVCodec *choose_decoder(OptionsContext *o, AVFormatContext *s, AVSt return avcodec_find_decoder(st->codecpar->codec_id); } +static int guess_input_channel_layout(InputStream *ist) +{ + 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) + return 0; + av_channel_layout_default(&dec->ch_layout, dec->ch_layout.nb_channels); + if (dec->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) + return 0; + av_channel_layout_describe(&dec->ch_layout, layout_name, sizeof(layout_name)); + av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " + "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name); + } + return 1; +} + /* Add all the streams from the given input file to the global * list of input streams. */ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) |