mirror of https://github.com/odrling/Aegisub
Allowed using detached subtitles providers on avisynth video provider, and changed the advanced video options in the options dialog to reload the video (so you can immediately see the changes)
Originally committed to SVN as r1032.
This commit is contained in:
parent
5d3442f567
commit
716539b54a
|
@ -57,6 +57,7 @@
|
||||||
#include "subtitles_provider.h"
|
#include "subtitles_provider.h"
|
||||||
#include "audio_box.h"
|
#include "audio_box.h"
|
||||||
#include "audio_display.h"
|
#include "audio_display.h"
|
||||||
|
#include "video_context.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -319,7 +320,7 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
||||||
wxSizer *videoSizer1 = new wxStaticBoxSizer(wxVERTICAL,videoPage,_("Options"));
|
wxSizer *videoSizer1 = new wxStaticBoxSizer(wxVERTICAL,videoPage,_("Options"));
|
||||||
wxSizer *videoSizer2 = new wxStaticBoxSizer(wxVERTICAL,videoPage,_("Advanced - EXPERT USERS ONLY"));
|
wxSizer *videoSizer2 = new wxStaticBoxSizer(wxVERTICAL,videoPage,_("Advanced - EXPERT USERS ONLY"));
|
||||||
wxFlexGridSizer *videoSizer3 = new wxFlexGridSizer(5,2,5,5);
|
wxFlexGridSizer *videoSizer3 = new wxFlexGridSizer(5,2,5,5);
|
||||||
wxFlexGridSizer *videoSizer4 = new wxFlexGridSizer(4,2,5,5);
|
wxFlexGridSizer *videoSizer4 = new wxFlexGridSizer(5,2,5,5);
|
||||||
wxControl *control;
|
wxControl *control;
|
||||||
|
|
||||||
// First sizer
|
// First sizer
|
||||||
|
@ -379,6 +380,9 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
||||||
Bind(control,_T("Allow Ancient Avisynth"));
|
Bind(control,_T("Allow Ancient Avisynth"));
|
||||||
videoSizer4->Add(control,1,wxEXPAND);
|
videoSizer4->Add(control,1,wxEXPAND);
|
||||||
videoSizer4->AddGrowableCol(1,1);
|
videoSizer4->AddGrowableCol(1,1);
|
||||||
|
control = new wxCheckBox(videoPage,-1,_("Avisynth renders its own subs"));
|
||||||
|
Bind(control,_T("Avisynth render own subs"));
|
||||||
|
videoSizer4->Add(control,1,wxEXPAND);
|
||||||
|
|
||||||
// Sizers
|
// Sizers
|
||||||
videoSizer1->Add(videoSizer3,1,wxEXPAND | wxALL,5);
|
videoSizer1->Add(videoSizer3,1,wxEXPAND | wxALL,5);
|
||||||
|
@ -694,6 +698,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
||||||
bool mustRestart = false;
|
bool mustRestart = false;
|
||||||
bool editBox = false;
|
bool editBox = false;
|
||||||
bool grid = false;
|
bool grid = false;
|
||||||
|
bool videoRestart = false;
|
||||||
bool video = false;
|
bool video = false;
|
||||||
bool audio = false;
|
bool audio = false;
|
||||||
|
|
||||||
|
@ -767,6 +772,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
||||||
if (type == MOD_EDIT_BOX) editBox = true;
|
if (type == MOD_EDIT_BOX) editBox = true;
|
||||||
if (type == MOD_GRID) grid = true;
|
if (type == MOD_GRID) grid = true;
|
||||||
if (type == MOD_VIDEO) video = true;
|
if (type == MOD_VIDEO) video = true;
|
||||||
|
if (type == MOD_VIDEO_RELOAD) videoRestart = true;
|
||||||
if (type == MOD_AUDIO) audio = true;
|
if (type == MOD_AUDIO) audio = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -802,7 +808,10 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video
|
// Video
|
||||||
if (video) {
|
if (videoRestart) {
|
||||||
|
VideoContext::Get()->Reload();
|
||||||
|
}
|
||||||
|
else if (video) {
|
||||||
FrameMain *frame = (FrameMain*) GetParent();
|
FrameMain *frame = (FrameMain*) GetParent();
|
||||||
frame->videoBox->videoSlider->Refresh();
|
frame->videoBox->videoSlider->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetBool(_T("Show keyframes on video slider"),true);
|
SetBool(_T("Show keyframes on video slider"),true);
|
||||||
|
|
||||||
// Dummy video defaults
|
// Dummy video defaults
|
||||||
|
SetModificationType(MOD_AUTOMATIC);
|
||||||
SetInt(_T("Video Dummy Last Width"), 640);
|
SetInt(_T("Video Dummy Last Width"), 640);
|
||||||
SetInt(_T("Video Dummy Last Height"), 480);
|
SetInt(_T("Video Dummy Last Height"), 480);
|
||||||
SetColour(_T("Video Dummy Last Colour"), wxColour(47, 163, 254));
|
SetColour(_T("Video Dummy Last Colour"), wxColour(47, 163, 254));
|
||||||
|
@ -151,14 +152,20 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetModificationType(MOD_RESTART);
|
SetModificationType(MOD_RESTART);
|
||||||
SetBool(_T("Threaded Video"),false);
|
SetBool(_T("Threaded Video"),false);
|
||||||
SetInt(_T("Avisynth MemoryMax"),64);
|
SetInt(_T("Avisynth MemoryMax"),64);
|
||||||
SetText(_T("Avisynth Subs Renderer"),_T("vsfilter"));
|
SetModificationType(MOD_VIDEO_RELOAD);
|
||||||
SetModificationType(MOD_AUTOMATIC);
|
|
||||||
SetBool(_T("Allow Ancient Avisynth"),false);
|
|
||||||
SetText(_T("Video Provider"),_T("Avisynth"));
|
SetText(_T("Video Provider"),_T("Avisynth"));
|
||||||
SetText(_T("Subtitles Provider"),_T("csri"));
|
SetBool(_T("Allow Ancient Avisynth"),false);
|
||||||
|
SetText(_T("Avisynth subs renderer"),_T("vsfilter"));
|
||||||
|
SetBool(_T("Avisynth render own subs"),true);
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
SetText(_T("Subtitles Provider"),_T("csri/vsfilter"));
|
||||||
|
#else
|
||||||
|
SetText(_T("Subtitles Provider"),_T("csri/asa"));
|
||||||
|
#endif
|
||||||
SetBool(_T("Video Use Pixel Shaders"),false);
|
SetBool(_T("Video Use Pixel Shaders"),false);
|
||||||
|
|
||||||
// Audio Options
|
// Audio Options
|
||||||
|
SetModificationType(MOD_AUTOMATIC);
|
||||||
SetBool(_T("Audio Next Line on Commit"),true);
|
SetBool(_T("Audio Next Line on Commit"),true);
|
||||||
SetBool(_T("Audio Autofocus"),false);
|
SetBool(_T("Audio Autofocus"),false);
|
||||||
SetBool(_T("Audio Wheel Default To Zoom"),false);
|
SetBool(_T("Audio Wheel Default To Zoom"),false);
|
||||||
|
|
|
@ -53,6 +53,7 @@ enum ModType {
|
||||||
MOD_EDIT_BOX,
|
MOD_EDIT_BOX,
|
||||||
MOD_GRID,
|
MOD_GRID,
|
||||||
MOD_VIDEO,
|
MOD_VIDEO,
|
||||||
|
MOD_VIDEO_RELOAD,
|
||||||
MOD_AUDIO
|
MOD_AUDIO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
virtual ~SubtitlesProvider();
|
virtual ~SubtitlesProvider();
|
||||||
|
|
||||||
virtual bool CanRaster() { return false; }
|
virtual bool CanRaster() { return false; }
|
||||||
|
virtual bool LockedToVideo() { return false; }
|
||||||
|
|
||||||
virtual void LoadSubtitles(AssFile *subs)=0;
|
virtual void LoadSubtitles(AssFile *subs)=0;
|
||||||
virtual void DrawSubtitles(AegiVideoFrame &dst,double time) {}
|
virtual void DrawSubtitles(AegiVideoFrame &dst,double time) {}
|
||||||
|
|
|
@ -188,10 +188,26 @@ void VideoContext::Reset() {
|
||||||
tempFrame.Clear();
|
tempFrame.Clear();
|
||||||
|
|
||||||
// Remove provider
|
// Remove provider
|
||||||
if (provider && subsProvider && provider->GetAsSubtitlesProvider() != subsProvider) delete subsProvider;
|
if (provider) {
|
||||||
|
if (subsProvider && !subsProvider->LockedToVideo()) delete subsProvider;
|
||||||
|
delete provider;
|
||||||
|
provider = NULL;
|
||||||
|
}
|
||||||
|
else delete subsProvider;
|
||||||
subsProvider = NULL;
|
subsProvider = NULL;
|
||||||
delete provider;
|
}
|
||||||
provider = NULL;
|
|
||||||
|
|
||||||
|
////////////////
|
||||||
|
// Reload video
|
||||||
|
void VideoContext::Reload() {
|
||||||
|
if (IsLoaded()) {
|
||||||
|
wxString name = videoName;
|
||||||
|
int n = frame_n;
|
||||||
|
SetVideo(_T(""));
|
||||||
|
SetVideo(name);
|
||||||
|
JumpToFrame(n);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ public:
|
||||||
|
|
||||||
void SetVideo(const wxString &filename);
|
void SetVideo(const wxString &filename);
|
||||||
void Reset();
|
void Reset();
|
||||||
|
void Reload();
|
||||||
|
|
||||||
void JumpToFrame(int n);
|
void JumpToFrame(int n);
|
||||||
void JumpToTime(int ms,bool exact=false);
|
void JumpToTime(int ms,bool exact=false);
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
|
|
||||||
SubtitlesProvider *GetAsSubtitlesProvider();
|
SubtitlesProvider *GetAsSubtitlesProvider();
|
||||||
void LoadSubtitles(AssFile *subs);
|
void LoadSubtitles(AssFile *subs);
|
||||||
|
bool LockedToVideo() { return true; }
|
||||||
|
|
||||||
const AegiVideoFrame DoGetFrame(int n);
|
const AegiVideoFrame DoGetFrame(int n);
|
||||||
void GetFloatFrame(float* Buffer, int n);
|
void GetFloatFrame(float* Buffer, int n);
|
||||||
|
@ -412,7 +413,8 @@ PClip AvisynthVideoProvider::ApplySubtitles(wxString _filename, PClip videosourc
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Get as subtitles provider
|
// Get as subtitles provider
|
||||||
SubtitlesProvider *AvisynthVideoProvider::GetAsSubtitlesProvider() {
|
SubtitlesProvider *AvisynthVideoProvider::GetAsSubtitlesProvider() {
|
||||||
return this;
|
if (Options.AsBool(_T("Avisynth render own subs"))) return this;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue