mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-09 18:45:40 +00:00
AVIDump: Drop frames which are delayed over a savestate.
This commit is contained in:
parent
be29090aae
commit
3c65c5f2c5
@ -46,6 +46,8 @@ static bool s_last_frame_is_valid = false;
|
|||||||
static bool s_start_dumping = false;
|
static bool s_start_dumping = false;
|
||||||
static u64 s_last_pts;
|
static u64 s_last_pts;
|
||||||
static int s_file_index = 0;
|
static int s_file_index = 0;
|
||||||
|
static int s_savestate_index = 0;
|
||||||
|
static int s_last_savestate_index = 0;
|
||||||
|
|
||||||
static void InitAVCodec()
|
static void InitAVCodec()
|
||||||
{
|
{
|
||||||
@ -168,6 +170,14 @@ static void PreparePacket(AVPacket* pkt)
|
|||||||
|
|
||||||
void AVIDump::AddFrame(const u8* data, int width, int height, int stride, const Frame& state)
|
void AVIDump::AddFrame(const u8* data, int width, int height, int stride, const Frame& state)
|
||||||
{
|
{
|
||||||
|
// Assume that the timing is valid, if the savestate id of the new frame
|
||||||
|
// doesn't match the last one.
|
||||||
|
if (state.savestate_index != s_last_savestate_index)
|
||||||
|
{
|
||||||
|
s_last_savestate_index = state.savestate_index;
|
||||||
|
s_last_frame_is_valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
CheckResolution(width, height);
|
CheckResolution(width, height);
|
||||||
s_src_frame->data[0] = const_cast<u8*>(data);
|
s_src_frame->data[0] = const_cast<u8*>(data);
|
||||||
s_src_frame->linesize[0] = stride;
|
s_src_frame->linesize[0] = stride;
|
||||||
@ -285,7 +295,7 @@ void AVIDump::CloseFile()
|
|||||||
|
|
||||||
void AVIDump::DoState()
|
void AVIDump::DoState()
|
||||||
{
|
{
|
||||||
s_last_frame_is_valid = false;
|
s_savestate_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVIDump::CheckResolution(int width, int height)
|
void AVIDump::CheckResolution(int width, int height)
|
||||||
@ -310,5 +320,6 @@ AVIDump::Frame AVIDump::FetchState(u64 ticks)
|
|||||||
state.ticks = ticks;
|
state.ticks = ticks;
|
||||||
state.first_frame = Movie::GetCurrentFrame() < 1;
|
state.first_frame = Movie::GetCurrentFrame() < 1;
|
||||||
state.ticks_per_second = SystemTimers::GetTicksPerSecond();
|
state.ticks_per_second = SystemTimers::GetTicksPerSecond();
|
||||||
|
state.savestate_index = s_savestate_index;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ public:
|
|||||||
u64 ticks = 0;
|
u64 ticks = 0;
|
||||||
u32 ticks_per_second = 0;
|
u32 ticks_per_second = 0;
|
||||||
bool first_frame = false;
|
bool first_frame = false;
|
||||||
|
int savestate_index = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool Start(int w, int h);
|
static bool Start(int w, int h);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user