mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-01-31 01:25:18 +01:00
Update ffmpeg to 7.1.2
This commit is contained in:
2
3rdparty/ffmpeg
vendored
2
3rdparty/ffmpeg
vendored
Submodule 3rdparty/ffmpeg updated: ec6367d3ba...ce81114ed9
@@ -347,9 +347,22 @@ namespace utils
|
||||
{
|
||||
if (!codec) return false;
|
||||
|
||||
for (const AVSampleFormat* p = codec->sample_fmts; p && *p != AV_SAMPLE_FMT_NONE; p++)
|
||||
const void* sample_formats = nullptr;
|
||||
int num = 0;
|
||||
|
||||
if (const int err = avcodec_get_supported_config(nullptr, codec, AVCodecConfig::AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, &sample_formats, &num))
|
||||
{
|
||||
if (*p == sample_fmt)
|
||||
media_log.error("check_sample_fmt: avcodec_get_supported_config error: %d='%s'", err, av_error_to_string(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sample_formats)
|
||||
return true; // All supported
|
||||
|
||||
int i = 0;
|
||||
for (const AVSampleFormat* fmt = static_cast<const AVSampleFormat*>(sample_formats); fmt && *fmt != AV_SAMPLE_FMT_NONE && i < num; fmt++, i++)
|
||||
{
|
||||
if (*fmt == sample_fmt)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -360,18 +373,33 @@ namespace utils
|
||||
// just pick the highest supported samplerate
|
||||
static int select_sample_rate(const AVCodec* codec)
|
||||
{
|
||||
if (!codec || !codec->supported_samplerates)
|
||||
return 48000;
|
||||
constexpr int default_sample_rate = 48000;
|
||||
|
||||
int best_samplerate = 0;
|
||||
for (const int* samplerate = codec->supported_samplerates; samplerate && *samplerate != 0; samplerate++)
|
||||
if (!codec)
|
||||
return default_sample_rate;
|
||||
|
||||
const void* sample_rates = nullptr;
|
||||
int num = 0;
|
||||
|
||||
if (const int err = avcodec_get_supported_config(nullptr, codec, AVCodecConfig::AV_CODEC_CONFIG_SAMPLE_RATE, 0, &sample_rates, &num))
|
||||
{
|
||||
if (!best_samplerate || abs(48000 - *samplerate) < abs(48000 - best_samplerate))
|
||||
media_log.error("select_sample_rate: avcodec_get_supported_config error: %d='%s'", err, av_error_to_string(err));
|
||||
return default_sample_rate;
|
||||
}
|
||||
|
||||
if (!sample_rates)
|
||||
return default_sample_rate;
|
||||
|
||||
int i = 0;
|
||||
int best_sample_rate = 0;
|
||||
for (const int* sample_rate = static_cast<const int*>(sample_rates); sample_rate && *sample_rate != 0 && i < num; sample_rate++, i++)
|
||||
{
|
||||
best_samplerate = *samplerate;
|
||||
if (!best_sample_rate || abs(default_sample_rate - *sample_rate) < abs(default_sample_rate - best_sample_rate))
|
||||
{
|
||||
best_sample_rate = *sample_rate;
|
||||
}
|
||||
}
|
||||
return best_samplerate;
|
||||
return best_sample_rate;
|
||||
}
|
||||
|
||||
AVChannelLayout get_preferred_channel_layout(int channels)
|
||||
@@ -397,12 +425,25 @@ namespace utils
|
||||
{
|
||||
if (!codec) return nullptr;
|
||||
|
||||
const void* ch_layouts = nullptr;
|
||||
int num = 0;
|
||||
|
||||
if (const int err = avcodec_get_supported_config(nullptr, codec, AVCodecConfig::AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0, &ch_layouts, &num))
|
||||
{
|
||||
media_log.error("select_channel_layout: avcodec_get_supported_config error: %d='%s'", err, av_error_to_string(err));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!ch_layouts)
|
||||
return nullptr;
|
||||
|
||||
const AVChannelLayout preferred_ch_layout = get_preferred_channel_layout(channels);
|
||||
const AVChannelLayout* found_ch_layout = nullptr;
|
||||
|
||||
for (const AVChannelLayout* ch_layout = codec->ch_layouts;
|
||||
ch_layout && memcmp(ch_layout, &empty_ch_layout, sizeof(AVChannelLayout)) != 0;
|
||||
ch_layout++)
|
||||
int i = 0;
|
||||
for (const AVChannelLayout* ch_layout = static_cast<const AVChannelLayout*>(ch_layouts);
|
||||
i < num && ch_layout && memcmp(ch_layout, &empty_ch_layout, sizeof(AVChannelLayout)) != 0;
|
||||
ch_layout++, i++)
|
||||
{
|
||||
media_log.notice("select_channel_layout: listing channel layout '%s' with %d channels", channel_layout_name(*ch_layout), ch_layout->nb_channels);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user