Change the way ffms2 index cache files are named to use source filename (without path) + source file's size in bytes + source file modification time, instead of just source file path + size in bytes, in order to make reusing index cache files on other computers easier. Closes #1008.

Originally committed to SVN as r3582.
This commit is contained in:
Karl Blomster 2009-09-27 00:32:19 +00:00
parent ab269aac37
commit 6490c82e79

View file

@ -203,17 +203,20 @@ void FFmpegSourceProvider::SetLogLevel() {
/// @brief Generates an unique name for the ffms2 index file and prepares the cache folder if it doesn't exist
/// @param filename The name of the source file
/// @return Returns the generated filename.
wxString FFmpegSourceProvider::GetCacheFilename(const wxString& filename)
wxString FFmpegSourceProvider::GetCacheFilename(const wxString& _filename)
{
// Get the size of the file to be hashed
wxFileOffset len = 0;
{
wxFile file(filename,wxFile::read);
wxFile file(_filename,wxFile::read);
if (file.IsOpened()) len = file.Length();
}
wxFileName filename(_filename);
// Generate string to be hashed
wxString toHash = filename + wxString::Format(_T(":%i"),len);
wxString toHash = filename.GetFullName() + wxString::Format(_T(":%i"),len)
+ wxString::Format(_T(":%i"), filename.GetModificationTime().GetTicks());
// Get the MD5 digest of the string
const wchar_t *tmp = toHash.wc_str();