diff options
| author | Vlad Firoiu <vladfi2@gmail.com> | 2017-02-25 01:02:20 -0800 |
|---|---|---|
| committer | Vlad Firoiu <vladfi2@gmail.com> | 2017-03-05 17:08:59 -0800 |
| commit | 9155af5103cb3f060376d7b6bdfa1e6cdcde6242 (patch) | |
| tree | 65574b03491de3dcd072ad6e35eb5fd1e8cd7cd3 /Source/Core/VideoCommon/AVIDump.cpp | |
| parent | 8c2438750958adbed7e99453077e27d359073096 (diff) | |
GetDumpPath function.
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) { |
