Make AssFixStylesFilter usable statically

Trivially speeds up ProcFrame as constructing export filters isn't free
due to that it has to look up the translatable strings.
This commit is contained in:
Thomas Goyne 2014-07-14 08:40:13 -07:00
parent 97c59e2630
commit 771525ae6f
3 changed files with 4 additions and 3 deletions

View File

@ -65,7 +65,7 @@ std::shared_ptr<VideoFrame> AsyncVideoProvider::ProcFrame(int frame_number, doub
single_frame = SUBS_FILE_ALREADY_LOADED;
}
else {
AssFixStylesFilter().ProcessSubs(subs.get(), nullptr);
AssFixStylesFilter::ProcessSubs(subs.get());
single_frame = frame_number;
subs_provider->LoadSubtitles(subs.get(), time);
}

View File

@ -47,7 +47,7 @@ AssFixStylesFilter::AssFixStylesFilter()
{
}
void AssFixStylesFilter::ProcessSubs(AssFile *subs, wxWindow *) {
void AssFixStylesFilter::ProcessSubs(AssFile *subs) {
auto styles = subs->GetStyles();
for (auto& str : styles) boost::to_lower(str);
sort(begin(styles), end(styles));

View File

@ -38,6 +38,7 @@
/// @brief Fixes styles by replacing any style that isn't available on file with Default
class AssFixStylesFilter final : public AssExportFilter {
public:
void ProcessSubs(AssFile *subs, wxWindow *) override;
static void ProcessSubs(AssFile *subs);
void ProcessSubs(AssFile *subs, wxWindow *) override { ProcessSubs(subs); }
AssFixStylesFilter();
};