Aegisub now supports asa instead of vsfilter under avisynth
Originally committed to SVN as r792.
This commit is contained in:
parent
0901d0157e
commit
b1fb222591
3 changed files with 61 additions and 9 deletions
|
@ -135,6 +135,7 @@ void OptionsManager::LoadDefaults() {
|
|||
SetModificationType(MOD_RESTART);
|
||||
SetBool(_T("Threaded Video"),false);
|
||||
SetInt(_T("Avisynth MemoryMax"),64);
|
||||
SetText(_T("Avisynth Subs Renderer"),_T("vsfilter"));
|
||||
SetModificationType(MOD_AUTOMATIC);
|
||||
SetBool(_T("Allow Ancient Avisynth"),false);
|
||||
SetText(_T("Video Provider"),_T("Avisynth"));
|
||||
|
|
|
@ -64,9 +64,9 @@ AvisynthVideoProvider::AvisynthVideoProvider(wxString _filename, wxString _subfi
|
|||
subfilename = _subfilename;
|
||||
zoom = 1.0;
|
||||
|
||||
AVSTRACE(_T("AvisynthVideoProvider: Loading VSFilter"));
|
||||
LoadVSFilter();
|
||||
AVSTRACE(_T("AvisynthVideoProvider: VSFilter loaded"));
|
||||
AVSTRACE(_T("AvisynthVideoProvider: Loading Subtitles Renderer"));
|
||||
LoadRenderer();
|
||||
AVSTRACE(_T("AvisynthVideoProvider: Subtitles Renderer loaded"));
|
||||
|
||||
AVSTRACE(_T("AvisynthVideoProvider: Opening video"));
|
||||
RGB32Video = OpenVideo(_filename,mpeg2dec3_priority);
|
||||
|
@ -314,10 +314,11 @@ PClip AvisynthVideoProvider::ApplySubtitles(wxString _filename, PClip videosourc
|
|||
AVSValue args[2] = { videosource, temp };
|
||||
|
||||
try {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::ApplySutitles: Now invoking TextSub"));
|
||||
script = env->Invoke("TextSub", AVSValue(args,2));
|
||||
AVSTRACE(_T("AvisynthVideoProvider::ApplySutitles: TextSub invoked successfully"));
|
||||
} catch (AvisynthError &err) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::ApplySutitles: Now invoking ") + rendererCallString);
|
||||
script = env->Invoke(rendererCallString.mb_str(wxConvUTF8), AVSValue(args,2));
|
||||
AVSTRACE(_T("AvisynthVideoProvider::ApplySutitles: Invoked successfully"));
|
||||
}
|
||||
catch (AvisynthError &err) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::ApplySutitles: Avisynth error: ") + wxString(err.msg,wxConvLocal));
|
||||
throw _T("AviSynth error: ") + wxString(err.msg,wxConvLocal);
|
||||
}
|
||||
|
@ -471,6 +472,18 @@ void AvisynthVideoProvider::GetFloatFrame(float* Buffer, int n) {
|
|||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Load appropriate renderer
|
||||
void AvisynthVideoProvider::LoadRenderer() {
|
||||
// Get prefferred
|
||||
wxString prefferred = Options.AsText(_T("Avisynth subs renderer"));
|
||||
|
||||
// Load
|
||||
if (prefferred.Lower() == _T("asa")) LoadASA();
|
||||
else LoadVSFilter();
|
||||
}
|
||||
|
||||
|
||||
/////////////////
|
||||
// Load VSFilter
|
||||
void AvisynthVideoProvider::LoadVSFilter() {
|
||||
|
@ -478,12 +491,14 @@ void AvisynthVideoProvider::LoadVSFilter() {
|
|||
// Loading an avisynth plugin multiple times does almost nothing
|
||||
|
||||
wxFileName vsfilterPath(AegisubApp::folderName + _T("vsfilter.dll"));
|
||||
rendererCallString = _T("TextSub");
|
||||
|
||||
if (vsfilterPath.FileExists()) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: Invoking LoadPlugin"));
|
||||
env->Invoke("LoadPlugin",env->SaveString(vsfilterPath.GetFullPath().mb_str(wxConvLocal)));
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: Loaded"));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: VSFilter.dll not found in Aegisub dir, trying to locate registered DShow filter"));
|
||||
wxRegKey reg(_T("HKEY_CLASSES_ROOT\\CLSID\\{9852A670-F845-491B-9BE6-EBD841B8A613}\\InprocServer32"));
|
||||
if (reg.Exists()) {
|
||||
|
@ -500,8 +515,12 @@ void AvisynthVideoProvider::LoadVSFilter() {
|
|||
}
|
||||
|
||||
vsfilterPath = _T("vsfilter.dll");
|
||||
} else if (vsfilterPath.FileExists())
|
||||
}
|
||||
else if (vsfilterPath.FileExists()) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: Found on system path, loading"));
|
||||
env->Invoke("LoadPlugin",env->SaveString(vsfilterPath.GetFullPath().mb_str(wxConvLocal)));
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: Loaded"));
|
||||
}
|
||||
else if (!env->FunctionExists("TextSub")) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadVSFilter: Couldn't locate VSFilter"));
|
||||
throw _T("Couldn't locate VSFilter");
|
||||
|
@ -510,6 +529,35 @@ void AvisynthVideoProvider::LoadVSFilter() {
|
|||
}
|
||||
|
||||
|
||||
////////////
|
||||
// Load asa
|
||||
void AvisynthVideoProvider::LoadASA() {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Loading asa"));
|
||||
// Loading an avisynth plugin multiple times does almost nothing
|
||||
|
||||
wxFileName asaPath(AegisubApp::folderName + _T("asa.dll"));
|
||||
rendererCallString = _T("asa");
|
||||
|
||||
if (asaPath.FileExists()) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Invoking LoadPlugin"));
|
||||
env->Invoke("LoadPlugin",env->SaveString(asaPath.GetFullPath().mb_str(wxConvLocal)));
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Loaded"));
|
||||
}
|
||||
else {
|
||||
asaPath = _T("asa.dll");
|
||||
if (asaPath.FileExists()) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Invoking LoadPlugin"));
|
||||
env->Invoke("LoadPlugin",env->SaveString(asaPath.GetFullPath().mb_str(wxConvLocal)));
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Loaded"));
|
||||
}
|
||||
else if (!env->FunctionExists("asa")) {
|
||||
AVSTRACE(_T("AvisynthVideoProvider::LoadASA: Couldn't locate asa"));
|
||||
throw _T("Couldn't locate asa");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Override frame times
|
||||
void AvisynthVideoProvider::OverrideFrameTimeList(wxArrayInt list) {
|
||||
|
|
|
@ -63,6 +63,7 @@ private:
|
|||
VideoInfo vi;
|
||||
|
||||
wxString subfilename;
|
||||
wxString rendererCallString;
|
||||
|
||||
int last_fnum;
|
||||
int num_frames;
|
||||
|
@ -86,6 +87,8 @@ private:
|
|||
PClip ApplyDARZoom(double _zoom, double _dar, PClip videosource);
|
||||
wxBitmap GetFrame(int n, bool force);
|
||||
void LoadVSFilter();
|
||||
void LoadASA();
|
||||
void LoadRenderer();
|
||||
void AttachOverlay(SubtitleProvider::Overlay *_overlay) {}
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue