From 86a838237631bb0a6a8e35d81f3ebb825014558e Mon Sep 17 00:00:00 2001 From: Vlad Firoiu Date: Tue, 21 Feb 2017 02:43:49 -0800 Subject: [PATCH] Arbitrary dump formats. --- Source/Core/VideoCommon/AVIDump.cpp | 10 +++++++--- Source/Core/VideoCommon/VideoConfig.cpp | 1 + Source/Core/VideoCommon/VideoConfig.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index bcd594a0c0..4c08550449 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -98,7 +98,7 @@ bool AVIDump::CreateVideoFile() { AVCodec* codec = nullptr; - const char s_format[] = "avi"; + const std::string& s_format = g_Config.sDumpFormat; std::stringstream file_ss; file_ss << File::GetUserPath(D_DUMPFRAMES_IDX) @@ -122,8 +122,12 @@ bool AVIDump::CreateVideoFile() } } - AVOutputFormat* output_format = av_guess_format(s_format, filename.c_str(), nullptr); - if (!output_format) return false; + AVOutputFormat* output_format = av_guess_format(s_format.c_str(), filename.c_str(), nullptr); + if (!output_format) + { + WARN_LOG(VIDEO, "Invalid format %s", s_format.c_str()); + return false; + } avformat_alloc_output_context2(&s_format_context, output_format, nullptr, filename.c_str()); AVCodecID codec_id = diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 96f35a0640..359c2f64f0 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -75,6 +75,7 @@ void VideoConfig::Load(const std::string& ini_file) settings->Get("DumpFramesAsImages", &bDumpFramesAsImages, false); settings->Get("FreeLook", &bFreeLook, false); settings->Get("UseFFV1", &bUseFFV1, false); + settings->Get("DumpFormat", &sDumpFormat, "avi"); settings->Get("BitrateKbps", &iBitrateKbps, 2500); settings->Get("InternalResolutionFrameDumps", &bInternalResolutionFrameDumps, false); settings->Get("EnablePixelLighting", &bEnablePixelLighting, false); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index ce80525a86..6ee5cd9e2e 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -102,6 +102,7 @@ struct VideoConfig final bool bDumpEFBTarget; bool bDumpFramesAsImages; bool bUseFFV1; + std::string sDumpFormat; bool bInternalResolutionFrameDumps; bool bFreeLook; bool bBorderlessFullscreen;