mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-04 15:19:09 +00:00
VideoCommon: Limit maximum denominator for MPEG4
It happened to be under the limit normally, but now that the VBI rate can be changed, that's no longer the case.
This commit is contained in:
parent
832570c658
commit
c720211542
2 changed files with 13 additions and 4 deletions
|
@ -62,13 +62,13 @@ struct FrameDumpContext
|
|||
|
||||
namespace
|
||||
{
|
||||
AVRational GetTimeBaseForCurrentRefreshRate()
|
||||
AVRational GetTimeBaseForCurrentRefreshRate(s64 max_denominator)
|
||||
{
|
||||
auto& vi = Core::System::GetInstance().GetVideoInterface();
|
||||
int num;
|
||||
int den;
|
||||
av_reduce(&num, &den, int(vi.GetTargetRefreshRateDenominator()),
|
||||
int(vi.GetTargetRefreshRateNumerator()), std::numeric_limits<int>::max());
|
||||
int(vi.GetTargetRefreshRateNumerator()), max_denominator);
|
||||
return AVRational{num, den};
|
||||
}
|
||||
|
||||
|
@ -248,11 +248,16 @@ bool FFMpegFrameDump::CreateVideoFile()
|
|||
return false;
|
||||
}
|
||||
|
||||
m_max_denominator = std::numeric_limits<s64>::max();
|
||||
|
||||
// Force XVID FourCC for better compatibility when using H.263
|
||||
if (codec->id == AV_CODEC_ID_MPEG4)
|
||||
{
|
||||
m_context->codec->codec_tag = MKTAG('X', 'V', 'I', 'D');
|
||||
m_max_denominator = std::numeric_limits<unsigned short>::max();
|
||||
}
|
||||
|
||||
const auto time_base = GetTimeBaseForCurrentRefreshRate();
|
||||
const auto time_base = GetTimeBaseForCurrentRefreshRate(m_max_denominator);
|
||||
|
||||
INFO_LOG_FMT(FRAMEDUMP, "Creating video file: {} x {} @ {}/{} fps", m_context->width,
|
||||
m_context->height, time_base.den, time_base.num);
|
||||
|
@ -535,7 +540,7 @@ FrameState FFMpegFrameDump::FetchState(u64 ticks, int frame_number) const
|
|||
state.frame_number = frame_number;
|
||||
state.savestate_index = m_savestate_index;
|
||||
|
||||
const auto time_base = GetTimeBaseForCurrentRefreshRate();
|
||||
const auto time_base = GetTimeBaseForCurrentRefreshRate(m_max_denominator);
|
||||
state.refresh_rate_num = time_base.den;
|
||||
state.refresh_rate_den = time_base.num;
|
||||
return state;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue