dolphin/Source/Core/VideoCommon/FrameDump.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
1.5 KiB
C
Raw Normal View History

// Copyright 2008 Dolphin Emulator Project
2015-05-18 01:08:10 +02:00
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
2020-10-21 16:37:16 +02:00
#include <ctime>
#include <memory>
#include "Common/CommonTypes.h"
2020-10-21 16:37:16 +02:00
struct FrameDumpContext;
class PointerWrap;
class FrameDump
{
2014-06-15 05:29:05 +02:00
public:
2020-10-21 16:37:16 +02:00
FrameDump();
~FrameDump();
// Holds relevant emulation state during a rendered frame for
// when it is later asynchronously written.
struct FrameState
{
u64 ticks = 0;
2020-10-21 16:37:16 +02:00
u32 savestate_index = 0;
int refresh_rate_num = 0;
int refresh_rate_den = 0;
};
struct FrameData
{
const u8* data;
int width;
int height;
int stride;
FrameState state;
};
2020-10-21 16:37:16 +02:00
bool Start(int w, int h);
void AddFrame(const FrameData&);
void Stop();
void DoState(PointerWrap&);
bool IsStarted() const;
FrameState FetchState(u64 ticks) const;
private:
bool IsFirstFrameInCurrentFile() const;
bool PrepareEncoding(int w, int h);
bool CreateVideoFile();
void CloseVideoFile();
void CheckForConfigChange(const FrameData&);
void ProcessPackets();
2017-05-22 21:27:10 +02:00
#if defined(HAVE_FFMPEG)
2020-10-21 16:37:16 +02:00
std::unique_ptr<FrameDumpContext> m_context;
#endif
2020-10-21 16:37:16 +02:00
// Used for FetchState:
u32 m_savestate_index = 0;
// Used for filename generation.
std::time_t m_start_time = {};
u32 m_file_index = 0;
};
2020-10-21 16:37:16 +02:00
#if !defined(HAVE_FFMPEG)
inline FrameDump::FrameDump() = default;
inline FrameDump::~FrameDump() = default;
inline FrameDump::FrameState FrameDump::FetchState(u64 ticks) const
{
return {};
}
#endif