mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-20 22:05:06 +00:00
Update ffmpeg to 7.1.2
This commit is contained in:
parent
ad65878c0c
commit
ae6bdf84f1
2 changed files with 54 additions and 13 deletions
2
3rdparty/ffmpeg
vendored
2
3rdparty/ffmpeg
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit ec6367d3ba9d0d57b9d22d4b87da8144acaf428f
|
Subproject commit ce81114ed99e5510f6cd983f59a1eac9f33bb73c
|
||||||
|
|
@ -347,9 +347,22 @@ namespace utils
|
||||||
{
|
{
|
||||||
if (!codec) return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -360,18 +373,33 @@ namespace utils
|
||||||
// just pick the highest supported samplerate
|
// just pick the highest supported samplerate
|
||||||
static int select_sample_rate(const AVCodec* codec)
|
static int select_sample_rate(const AVCodec* codec)
|
||||||
{
|
{
|
||||||
if (!codec || !codec->supported_samplerates)
|
constexpr int default_sample_rate = 48000;
|
||||||
return 48000;
|
|
||||||
|
|
||||||
int best_samplerate = 0;
|
if (!codec)
|
||||||
for (const int* samplerate = codec->supported_samplerates; samplerate && *samplerate != 0; samplerate++)
|
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++)
|
||||||
|
{
|
||||||
|
if (!best_sample_rate || abs(default_sample_rate - *sample_rate) < abs(default_sample_rate - best_sample_rate))
|
||||||
{
|
{
|
||||||
best_samplerate = *samplerate;
|
best_sample_rate = *sample_rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return best_samplerate;
|
return best_sample_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVChannelLayout get_preferred_channel_layout(int channels)
|
AVChannelLayout get_preferred_channel_layout(int channels)
|
||||||
|
|
@ -397,12 +425,25 @@ namespace utils
|
||||||
{
|
{
|
||||||
if (!codec) return nullptr;
|
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 preferred_ch_layout = get_preferred_channel_layout(channels);
|
||||||
const AVChannelLayout* found_ch_layout = nullptr;
|
const AVChannelLayout* found_ch_layout = nullptr;
|
||||||
|
|
||||||
for (const AVChannelLayout* ch_layout = codec->ch_layouts;
|
int i = 0;
|
||||||
ch_layout && memcmp(ch_layout, &empty_ch_layout, sizeof(AVChannelLayout)) != 0;
|
for (const AVChannelLayout* ch_layout = static_cast<const AVChannelLayout*>(ch_layouts);
|
||||||
ch_layout++)
|
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);
|
media_log.notice("select_channel_layout: listing channel layout '%s' with %d channels", channel_layout_name(*ch_layout), ch_layout->nb_channels);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue