mirror of https://github.com/odrling/Aegisub
Apply the export transform when sending subtitles to the provider on the video worker thread rather than the GUI thread
Originally committed to SVN as r4849.
This commit is contained in:
parent
c571f64f86
commit
3d85cacae0
|
@ -131,9 +131,9 @@ wxArrayString AssExporter::GetAllFilterNames() {
|
||||||
/// @param export_dialog
|
/// @param export_dialog
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
AssFile *AssExporter::ExportTransform(wxWindow *export_dialog) {
|
AssFile *AssExporter::ExportTransform(wxWindow *export_dialog,bool copy) {
|
||||||
// Copy
|
// Copy
|
||||||
AssFile *Subs = new AssFile(*OriginalSubs);
|
AssFile *Subs = copy ? new AssFile(*OriginalSubs) : OriginalSubs;
|
||||||
|
|
||||||
// Run filters
|
// Run filters
|
||||||
for (FilterList::iterator cur=Filters.begin();cur!=Filters.end();cur++) {
|
for (FilterList::iterator cur=Filters.begin();cur!=Filters.end();cur++) {
|
||||||
|
@ -151,7 +151,7 @@ AssFile *AssExporter::ExportTransform(wxWindow *export_dialog) {
|
||||||
/// @param export_dialog
|
/// @param export_dialog
|
||||||
///
|
///
|
||||||
void AssExporter::Export(wxString filename, wxString charset, wxWindow *export_dialog) {
|
void AssExporter::Export(wxString filename, wxString charset, wxWindow *export_dialog) {
|
||||||
std::auto_ptr<AssFile> Subs(ExportTransform(export_dialog));
|
std::auto_ptr<AssFile> Subs(ExportTransform(export_dialog,true));
|
||||||
Subs->Save(filename,false,false,charset);
|
Subs->Save(filename,false,false,charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
void AddAutoFilters();
|
void AddAutoFilters();
|
||||||
void DrawSettings(wxWindow *parent,wxSizer *AddTo);
|
void DrawSettings(wxWindow *parent,wxSizer *AddTo);
|
||||||
void Export(wxString file, wxString charset, wxWindow *export_dialog=NULL);
|
void Export(wxString file, wxString charset, wxWindow *export_dialog=NULL);
|
||||||
AssFile *ExportTransform(wxWindow *export_dialog=NULL);
|
AssFile *ExportTransform(wxWindow *export_dialog=NULL,bool copy=false);
|
||||||
wxSizer *GetSettingsSizer(wxString name);
|
wxSizer *GetSettingsSizer(wxString name);
|
||||||
|
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
|
|
@ -86,6 +86,10 @@ std::tr1::shared_ptr<AegiVideoFrame> ThreadedFrameSource::ProcFrame(int frameNum
|
||||||
// other lines will probably not be viewed before the file changes
|
// other lines will probably not be viewed before the file changes
|
||||||
// again), and if it's a different frame, export the entire file.
|
// again), and if it's a different frame, export the entire file.
|
||||||
if (singleFrame == -1) {
|
if (singleFrame == -1) {
|
||||||
|
AssExporter exporter(subs.get());
|
||||||
|
exporter.AddAutoFilters();
|
||||||
|
exporter.ExportTransform();
|
||||||
|
|
||||||
singleFrame = frameNum;
|
singleFrame = frameNum;
|
||||||
// Copying a nontrivially sized AssFile is fairly slow, so
|
// Copying a nontrivially sized AssFile is fairly slow, so
|
||||||
// instead muck around with its innards to just temporarily
|
// instead muck around with its innards to just temporarily
|
||||||
|
@ -173,14 +177,12 @@ ThreadedFrameSource::~ThreadedFrameSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadedFrameSource::LoadSubtitles(AssFile *subs) throw() {
|
void ThreadedFrameSource::LoadSubtitles(AssFile *subs) throw() {
|
||||||
AssExporter exporter(subs);
|
subs = new AssFile(*subs);
|
||||||
exporter.AddAutoFilters();
|
|
||||||
AssFile *exported = exporter.ExportTransform();
|
|
||||||
wxMutexLocker locker(jobMutex);
|
wxMutexLocker locker(jobMutex);
|
||||||
// Set nextSubs and let the worker thread move it to subs so that we don't
|
// Set nextSubs and let the worker thread move it to subs so that we don't
|
||||||
// have to lock fileMutex on the GUI thread, as that can be locked for
|
// have to lock fileMutex on the GUI thread, as that can be locked for
|
||||||
// extended periods of time with slow-rendering subtitles
|
// extended periods of time with slow-rendering subtitles
|
||||||
nextSubs.reset(exported);
|
nextSubs.reset(subs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadedFrameSource::RequestFrame(int frame, double time) throw() {
|
void ThreadedFrameSource::RequestFrame(int frame, double time) throw() {
|
||||||
|
|
Loading…
Reference in New Issue