bestsource: Clean index cache when necessary
This commit is contained in:
parent
e2fb3a7e43
commit
15f4da61d3
6 changed files with 24 additions and 1 deletions
|
@ -63,6 +63,7 @@ BSAudioProvider::BSAudioProvider(agi::fs::path const& filename, agi::BackgroundR
|
|||
LOG_D("bs") << "File cached and has exact samples.";
|
||||
}
|
||||
});
|
||||
BSCleanCache();
|
||||
properties = bs.GetAudioProperties();
|
||||
float_samples = properties.IsFloat;
|
||||
bytes_per_sample = properties.BytesPerSample;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "bestsource_common.h"
|
||||
|
||||
#include "options.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <libaegisub/fs.h>
|
||||
#include <libaegisub/path.h>
|
||||
|
@ -45,5 +46,11 @@ std::string GetBSCacheFile(agi::fs::path const& filename) {
|
|||
return result.string();
|
||||
}
|
||||
|
||||
void BSCleanCache() {
|
||||
CleanCache(config::path->Decode("?local/bsindex/"),
|
||||
"*.json",
|
||||
OPT_GET("Provider/BestSource/Cache/Size")->GetInt(),
|
||||
OPT_GET("Provider/BestSource/Cache/Files")->GetInt());
|
||||
}
|
||||
|
||||
#endif // WITH_BESTSOURCE
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022, arch1t3cht <arch1t3cht@gmail.com>>
|
||||
// Copyright (c) 2022, arch1t3cht <arch1t3cht@gmail.com>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -24,5 +24,6 @@
|
|||
#include <libaegisub/fs_fwd.h>
|
||||
|
||||
std::string GetBSCacheFile(agi::fs::path const& filename);
|
||||
void BSCleanCache();
|
||||
|
||||
#endif /* WITH_BESTSOURCE */
|
||||
|
|
|
@ -350,6 +350,12 @@
|
|||
"Index All Tracks" : true,
|
||||
"Log Level" : "quiet"
|
||||
},
|
||||
"BestSource" : {
|
||||
"Cache" : {
|
||||
"Files" : 100,
|
||||
"Size" : 42
|
||||
}
|
||||
},
|
||||
"Video" : {
|
||||
"Cache" : {
|
||||
"Size" : 32
|
||||
|
|
|
@ -350,6 +350,12 @@
|
|||
"Index All Tracks" : true,
|
||||
"Log Level" : "quiet"
|
||||
},
|
||||
"BestSource" : {
|
||||
"Cache" : {
|
||||
"Files" : 100,
|
||||
"Size" : 42
|
||||
}
|
||||
},
|
||||
"Video" : {
|
||||
"Cache" : {
|
||||
"Size" : 32
|
||||
|
|
|
@ -158,6 +158,8 @@ BSVideoProvider::BSVideoProvider(agi::fs::path const& filename, std::string cons
|
|||
}
|
||||
});
|
||||
|
||||
BSCleanCache();
|
||||
|
||||
// Decode the first frame to get the color space
|
||||
std::unique_ptr<BestVideoFrame> frame(bs.GetFrame(0));
|
||||
colorspace = colormatrix_description(frame->GetAVFrame());
|
||||
|
|
Loading…
Reference in a new issue