decoder/ffmpeg: query supported demuxers at runtime

This commit is contained in:
Max Kellermann 2023-03-12 09:18:03 +01:00
parent 78a9c17bc6
commit 3c798b4907
2 changed files with 18 additions and 27 deletions

1
NEWS
View File

@ -19,6 +19,7 @@ ver 0.24 (not yet released)
- curl: fix busy loop after connection failed - curl: fix busy loop after connection failed
* decoder * decoder
- ffmpeg: require FFmpeg 4.0 or later - ffmpeg: require FFmpeg 4.0 or later
- ffmpeg: query supported demuxers at runtime
- gme: require GME 0.6 or later - gme: require GME 0.6 or later
- hybrid_dsd: remove - hybrid_dsd: remove
- opus: implement bitrate calculation - opus: implement bitrate calculation

View File

@ -26,6 +26,7 @@
#include "tag/MixRampParser.hxx" #include "tag/MixRampParser.hxx"
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "pcm/CheckAudioFormat.hxx" #include "pcm/CheckAudioFormat.hxx"
#include "util/IterableSplitString.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -690,33 +691,22 @@ ffmpeg_protocols() noexcept
return protocols; return protocols;
} }
/** static std::set<std::string, std::less<>>
* A list of extensions found for the formats supported by ffmpeg. ffmpeg_suffixes() noexcept
* This list is current as of 02-23-09; To find out if there are more {
* supported formats, check the ffmpeg changelog since this date for std::set<std::string, std::less<>> suffixes;
* more formats.
*/ void *demuxer_opaque = nullptr;
static const char *const ffmpeg_suffixes[] = { while (const auto input_format = av_demuxer_iterate(&demuxer_opaque)) {
"16sv", "3g2", "3gp", "4xm", "8svx", if (input_format->extensions != nullptr) {
"aa3", "aac", "ac3", "adx", "afc", "aif", for (const auto i : IterableSplitString(input_format->extensions, ','))
"aifc", "aiff", "al", "alaw", "amr", "anim", "apc", "ape", "asf", suffixes.emplace(i);
"atrac", "au", "aud", "avi", "avm2", "avs", "bap", "bfi", "c93", "cak", } else
"cin", "cmv", "cpk", "daud", "dct", "divx", "dts", "dv", "dvd", "dxa", suffixes.emplace(input_format->name);
"eac3", "film", "flac", "flc", "fli", "fll", "flx", "flv", "g726", }
"gsm", "gxf", "iss", "m1v", "m2v", "m2t", "m2ts",
"m4a", "m4b", "m4v", return suffixes;
"mad", }
"mj2", "mjpeg", "mjpg", "mka", "mkv", "mlp", "mm", "mmf", "mov", "mp+",
"mp1", "mp2", "mp3", "mp4", "mpc", "mpeg", "mpg", "mpga", "mpp", "mpu",
"mve", "mvi", "mxf", "nc", "nsv", "nut", "nuv", "oga", "ogm", "ogv",
"ogx", "oma", "ogg", "omg", "opus", "psp", "pva", "qcp", "qt", "r3d", "ra",
"ram", "rl2", "rm", "rmvb", "roq", "rpl", "rvc", "shn", "smk", "snd",
"sol", "son", "spx", "str", "swf", "tak", "tgi", "tgq", "tgv", "thp", "ts",
"tsp", "tta", "xa", "xvid", "uv", "uv2", "vb", "vid", "vob", "voc",
"vp6", "vmd", "wav", "webm", "wma", "wmv", "wsaud", "wsvga", "wv",
"wve",
nullptr
};
static const char *const ffmpeg_mime_types[] = { static const char *const ffmpeg_mime_types[] = {
"application/flv", "application/flv",