GetDumpPath function.

This commit is contained in:
Vlad Firoiu 2017-02-25 01:02:20 -08:00
parent 8c24387509
commit 9155af5103
1 changed files with 28 additions and 24 deletions

View File

@ -95,20 +95,13 @@ 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;
if (s_dump_path.empty())
{
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);
std::string s_dump_path = File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump" +
std::to_string(s_file_index) + "." + format;
// Ask to delete file
if (File::Exists(s_dump_path))
@ -121,10 +114,21 @@ bool AVIDump::CreateVideoFile()
else
{
// 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)