forked from mia/Aegisub
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:
parent
97c59e2630
commit
771525ae6f
3 changed files with 4 additions and 3 deletions
|
@ -65,7 +65,7 @@ std::shared_ptr<VideoFrame> AsyncVideoProvider::ProcFrame(int frame_number, doub
|
||||||
single_frame = SUBS_FILE_ALREADY_LOADED;
|
single_frame = SUBS_FILE_ALREADY_LOADED;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AssFixStylesFilter().ProcessSubs(subs.get(), nullptr);
|
AssFixStylesFilter::ProcessSubs(subs.get());
|
||||||
single_frame = frame_number;
|
single_frame = frame_number;
|
||||||
subs_provider->LoadSubtitles(subs.get(), time);
|
subs_provider->LoadSubtitles(subs.get(), time);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ AssFixStylesFilter::AssFixStylesFilter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssFixStylesFilter::ProcessSubs(AssFile *subs, wxWindow *) {
|
void AssFixStylesFilter::ProcessSubs(AssFile *subs) {
|
||||||
auto styles = subs->GetStyles();
|
auto styles = subs->GetStyles();
|
||||||
for (auto& str : styles) boost::to_lower(str);
|
for (auto& str : styles) boost::to_lower(str);
|
||||||
sort(begin(styles), end(styles));
|
sort(begin(styles), end(styles));
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
/// @brief Fixes styles by replacing any style that isn't available on file with Default
|
/// @brief Fixes styles by replacing any style that isn't available on file with Default
|
||||||
class AssFixStylesFilter final : public AssExportFilter {
|
class AssFixStylesFilter final : public AssExportFilter {
|
||||||
public:
|
public:
|
||||||
void ProcessSubs(AssFile *subs, wxWindow *) override;
|
static void ProcessSubs(AssFile *subs);
|
||||||
|
void ProcessSubs(AssFile *subs, wxWindow *) override { ProcessSubs(subs); }
|
||||||
AssFixStylesFilter();
|
AssFixStylesFilter();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue