mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -06: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:
@ -62,13 +62,13 @@ struct FrameDumpContext
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
AVRational GetTimeBaseForCurrentRefreshRate()
|
AVRational GetTimeBaseForCurrentRefreshRate(s64 max_denominator)
|
||||||
{
|
{
|
||||||
auto& vi = Core::System::GetInstance().GetVideoInterface();
|
auto& vi = Core::System::GetInstance().GetVideoInterface();
|
||||||
int num;
|
int num;
|
||||||
int den;
|
int den;
|
||||||
av_reduce(&num, &den, int(vi.GetTargetRefreshRateDenominator()),
|
av_reduce(&num, &den, int(vi.GetTargetRefreshRateDenominator()),
|
||||||
int(vi.GetTargetRefreshRateNumerator()), std::numeric_limits<int>::max());
|
int(vi.GetTargetRefreshRateNumerator()), max_denominator);
|
||||||
return AVRational{num, den};
|
return AVRational{num, den};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,11 +248,16 @@ bool FFMpegFrameDump::CreateVideoFile()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_max_denominator = std::numeric_limits<s64>::max();
|
||||||
|
|
||||||
// Force XVID FourCC for better compatibility when using H.263
|
// Force XVID FourCC for better compatibility when using H.263
|
||||||
if (codec->id == AV_CODEC_ID_MPEG4)
|
if (codec->id == AV_CODEC_ID_MPEG4)
|
||||||
|
{
|
||||||
m_context->codec->codec_tag = MKTAG('X', 'V', 'I', 'D');
|
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,
|
INFO_LOG_FMT(FRAMEDUMP, "Creating video file: {} x {} @ {}/{} fps", m_context->width,
|
||||||
m_context->height, time_base.den, time_base.num);
|
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.frame_number = frame_number;
|
||||||
state.savestate_index = m_savestate_index;
|
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_num = time_base.den;
|
||||||
state.refresh_rate_den = time_base.num;
|
state.refresh_rate_den = time_base.num;
|
||||||
return state;
|
return state;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
@ -62,6 +63,9 @@ private:
|
|||||||
// Used for filename generation.
|
// Used for filename generation.
|
||||||
std::time_t m_start_time = {};
|
std::time_t m_start_time = {};
|
||||||
u32 m_file_index = 0;
|
u32 m_file_index = 0;
|
||||||
|
|
||||||
|
// Some codecs (like MPEG4) have a limit to this
|
||||||
|
int64_t m_max_denominator = std::numeric_limits<s64>::max();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(HAVE_FFMPEG)
|
#if !defined(HAVE_FFMPEG)
|
||||||
|
Reference in New Issue
Block a user