Fix parsing of ffmpeg version

This commit is contained in:
Patrick Nicolas
2024-12-05 11:18:29 +01:00
parent 0e6aa7810d
commit b16e7e1c3d
+4 -2
View File
@@ -131,9 +131,11 @@ static constexpr auto ffmpeg_version()
for (auto & item: result) for (auto & item: result)
{ {
auto dot = version.find("."); auto dot = version.find(".");
auto number = version.substr(0, dot); auto number = version.substr(version.find_first_of("0123456789"), dot);
version = version.substr(dot + 1); version = version.substr(dot + 1);
std::from_chars(number.begin(), number.end(), item); auto res = std::from_chars(number.begin(), number.end(), item);
if (res.ec != std::errc{})
throw std::invalid_argument("Failed to parse FFMPEG_VERSION " FFMPEG_VERSION);
} }
return result; return result;
} }