Merge pull request #8128 from altimumdelta/FrameDumpUpgradePrep1

Code: Rename AVIDump to FrameDump
This commit is contained in:
Connor McLaughlin
2019-06-30 21:13:19 +10:00
committed by GitHub
8 changed files with 53 additions and 52 deletions

View File

@ -48,7 +48,6 @@
#include "Core/Host.h"
#include "Core/Movie.h"
#include "VideoCommon/AVIDump.h"
#include "VideoCommon/AbstractFramebuffer.h"
#include "VideoCommon/AbstractStagingTexture.h"
#include "VideoCommon/AbstractTexture.h"
@ -57,6 +56,7 @@
#include "VideoCommon/CPMemory.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/FPSCounter.h"
#include "VideoCommon/FrameDump.h"
#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/ImageWrite.h"
#include "VideoCommon/NetPlayChatUI.h"
@ -1390,7 +1390,7 @@ void Renderer::DumpCurrentFrame(const AbstractTexture* src_texture,
copy_rect = src_texture->GetRect();
}
// Index 0 was just sent to AVI dump. Swap with the second texture.
// Index 0 was just sent to FFMPEG dump. Swap with the second texture.
if (m_frame_dump_readback_textures[0])
std::swap(m_frame_dump_readback_textures[0], m_frame_dump_readback_textures[1]);
@ -1399,7 +1399,7 @@ void Renderer::DumpCurrentFrame(const AbstractTexture* src_texture,
m_frame_dump_readback_textures[0]->CopyFromTexture(src_texture, copy_rect, 0, 0,
m_frame_dump_readback_textures[0]->GetRect());
m_last_frame_state = AVIDump::FetchState(ticks);
m_last_frame_state = FrameDump::FetchState(ticks);
m_last_frame_exported = true;
}
@ -1493,7 +1493,8 @@ void Renderer::ShutdownFrameDumping()
tex.reset();
}
void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, const AVIDump::Frame& state)
void Renderer::DumpFrameData(const u8* data, int w, int h, int stride,
const FrameDump::Frame& state)
{
m_frame_dump_config = FrameDumpConfig{data, w, h, stride, state};
@ -1522,16 +1523,16 @@ void Renderer::FinishFrameData()
void Renderer::RunFrameDumps()
{
Common::SetCurrentThreadName("FrameDumping");
bool dump_to_avi = !g_ActiveConfig.bDumpFramesAsImages;
bool dump_to_ffmpeg = !g_ActiveConfig.bDumpFramesAsImages;
bool frame_dump_started = false;
// If Dolphin was compiled without libav, we only support dumping to images.
// If Dolphin was compiled without ffmpeg, we only support dumping to images.
#if !defined(HAVE_FFMPEG)
if (dump_to_avi)
if (dump_to_ffmpeg)
{
WARN_LOG(VIDEO, "AVI frame dump requested, but Dolphin was compiled without libav. "
"Frame dump will be saved as images instead.");
dump_to_avi = false;
WARN_LOG(VIDEO, "FrameDump: Dolphin was not compiled with FFmpeg, using fallback option. "
"Frames will be saved as PNG images instead.");
dump_to_ffmpeg = false;
}
#endif
@ -1561,8 +1562,8 @@ void Renderer::RunFrameDumps()
{
if (!frame_dump_started)
{
if (dump_to_avi)
frame_dump_started = StartFrameDumpToAVI(config);
if (dump_to_ffmpeg)
frame_dump_started = StartFrameDumpToFFMPEG(config);
else
frame_dump_started = StartFrameDumpToImage(config);
@ -1574,8 +1575,8 @@ void Renderer::RunFrameDumps()
// If we failed to start frame dumping, don't write a frame.
if (frame_dump_started)
{
if (dump_to_avi)
DumpFrameToAVI(config);
if (dump_to_ffmpeg)
DumpFrameToFFMPEG(config);
else
DumpFrameToImage(config);
}
@ -1587,40 +1588,40 @@ void Renderer::RunFrameDumps()
if (frame_dump_started)
{
// No additional cleanup is needed when dumping to images.
if (dump_to_avi)
StopFrameDumpToAVI();
if (dump_to_ffmpeg)
StopFrameDumpToFFMPEG();
}
}
#if defined(HAVE_FFMPEG)
bool Renderer::StartFrameDumpToAVI(const FrameDumpConfig& config)
bool Renderer::StartFrameDumpToFFMPEG(const FrameDumpConfig& config)
{
return AVIDump::Start(config.width, config.height);
return FrameDump::Start(config.width, config.height);
}
void Renderer::DumpFrameToAVI(const FrameDumpConfig& config)
void Renderer::DumpFrameToFFMPEG(const FrameDumpConfig& config)
{
AVIDump::AddFrame(config.data, config.width, config.height, config.stride, config.state);
FrameDump::AddFrame(config.data, config.width, config.height, config.stride, config.state);
}
void Renderer::StopFrameDumpToAVI()
void Renderer::StopFrameDumpToFFMPEG()
{
AVIDump::Stop();
FrameDump::Stop();
}
#else
bool Renderer::StartFrameDumpToAVI(const FrameDumpConfig& config)
bool Renderer::StartFrameDumpToFFMPEG(const FrameDumpConfig& config)
{
return false;
}
void Renderer::DumpFrameToAVI(const FrameDumpConfig& config)
void Renderer::DumpFrameToFFMPEG(const FrameDumpConfig& config)
{
}
void Renderer::StopFrameDumpToAVI()
void Renderer::StopFrameDumpToFFMPEG()
{
}