diff options
Diffstat (limited to 'Source/Core/VideoCommon/AVIDump.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/AVIDump.cpp | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/Source/Core/VideoCommon/AVIDump.cpp b/Source/Core/VideoCommon/AVIDump.cpp index 3d7459d054..d5616c4324 100644 --- a/Source/Core/VideoCommon/AVIDump.cpp +++ b/Source/Core/VideoCommon/AVIDump.cpp @@ -95,37 +95,41 @@ bool AVIDump::Start(int w, int h) return success; } -bool AVIDump::CreateVideoFile() +static std::string GetDumpPath(const std::string& format) { - const std::string& s_format = g_Config.sDumpFormat; + if (!g_Config.sDumpPath.empty()) + return g_Config.sDumpPath; - std::string s_dump_path = g_Config.sDumpPath; + std::string s_dump_path = File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump" + + std::to_string(s_file_index) + "." + format; - if (s_dump_path.empty()) + // Ask to delete file + if (File::Exists(s_dump_path)) { - std::stringstream file_ss; - file_ss << File::GetUserPath(D_DUMPFRAMES_IDX) - << "framedump" << s_file_index - << "." << s_format; - s_dump_path = file_ss.str(); - File::CreateFullPath(s_dump_path); - - // Ask to delete file - if (File::Exists(s_dump_path)) + if (SConfig::GetInstance().m_DumpFramesSilent || + AskYesNoT("Delete the existing file '%s'?", s_dump_path.c_str())) + { + File::Delete(s_dump_path); + } + else { - if (SConfig::GetInstance().m_DumpFramesSilent || - AskYesNoT("Delete the existing file '%s'?", s_dump_path.c_str())) - { - File::Delete(s_dump_path); - } - else - { - // Stop and cancel dumping the video - return false; - } + // Stop and cancel dumping the video + return ""; } } + return s_dump_path; +} + +bool AVIDump::CreateVideoFile() +{ + const std::string& s_format = g_Config.sDumpFormat; + + std::string s_dump_path = GetDumpPath(s_format); + + if (s_dump_path.empty()) + return false; + AVOutputFormat* output_format = av_guess_format(s_format.c_str(), s_dump_path.c_str(), nullptr); if (!output_format) { |
