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:
Rodrigo Braz Monteiro 2007-04-08 19:27:46 +00:00
parent 5d3442f567
commit 716539b54a
7 changed files with 47 additions and 10 deletions

View file

@ -57,6 +57,7 @@
#include "subtitles_provider.h"
#include "audio_box.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 *videoSizer2 = new wxStaticBoxSizer(wxVERTICAL,videoPage,_("Advanced - EXPERT USERS ONLY"));
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;
// First sizer
@ -379,6 +380,9 @@ DialogOptions::DialogOptions(wxWindow *parent)
Bind(control,_T("Allow Ancient Avisynth"));
videoSizer4->Add(control,1,wxEXPAND);
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
videoSizer1->Add(videoSizer3,1,wxEXPAND | wxALL,5);
@ -694,6 +698,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
bool mustRestart = false;
bool editBox = false;
bool grid = false;
bool videoRestart = false;
bool video = false;
bool audio = false;
@ -767,6 +772,7 @@ void DialogOptions::WriteToOptions(bool justApply) {
if (type == MOD_EDIT_BOX) editBox = true;
if (type == MOD_GRID) grid = true;
if (type == MOD_VIDEO) video = true;
if (type == MOD_VIDEO_RELOAD) videoRestart = true;
if (type == MOD_AUDIO) audio = true;
}
}
@ -802,7 +808,10 @@ void DialogOptions::WriteToOptions(bool justApply) {
}
// Video
if (video) {
if (videoRestart) {
VideoContext::Get()->Reload();
}
else if (video) {
FrameMain *frame = (FrameMain*) GetParent();
frame->videoBox->videoSlider->Refresh();
}

View file

@ -140,6 +140,7 @@ void OptionsManager::LoadDefaults() {
SetBool(_T("Show keyframes on video slider"),true);
// Dummy video defaults
SetModificationType(MOD_AUTOMATIC);
SetInt(_T("Video Dummy Last Width"), 640);
SetInt(_T("Video Dummy Last Height"), 480);
SetColour(_T("Video Dummy Last Colour"), wxColour(47, 163, 254));
@ -151,14 +152,20 @@ 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);
SetModificationType(MOD_VIDEO_RELOAD);
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);
// Audio Options
SetModificationType(MOD_AUTOMATIC);
SetBool(_T("Audio Next Line on Commit"),true);
SetBool(_T("Audio Autofocus"),false);
SetBool(_T("Audio Wheel Default To Zoom"),false);

View file

@ -53,6 +53,7 @@ enum ModType {
MOD_EDIT_BOX,
MOD_GRID,
MOD_VIDEO,
MOD_VIDEO_RELOAD,
MOD_AUDIO
};

View file

@ -56,6 +56,7 @@ public:
virtual ~SubtitlesProvider();
virtual bool CanRaster() { return false; }
virtual bool LockedToVideo() { return false; }
virtual void LoadSubtitles(AssFile *subs)=0;
virtual void DrawSubtitles(AegiVideoFrame &dst,double time) {}

View file

@ -188,10 +188,26 @@ void VideoContext::Reset() {
tempFrame.Clear();
// 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;
delete provider;
provider = NULL;
}
////////////////
// Reload video
void VideoContext::Reload() {
if (IsLoaded()) {
wxString name = videoName;
int n = frame_n;
SetVideo(_T(""));
SetVideo(name);
JumpToFrame(n);
}
}

View file

@ -160,6 +160,7 @@ public:
void SetVideo(const wxString &filename);
void Reset();
void Reload();
void JumpToFrame(int n);
void JumpToTime(int ms,bool exact=false);

View file

@ -83,6 +83,7 @@ public:
SubtitlesProvider *GetAsSubtitlesProvider();
void LoadSubtitles(AssFile *subs);
bool LockedToVideo() { return true; }
const AegiVideoFrame DoGetFrame(int n);
void GetFloatFrame(float* Buffer, int n);
@ -412,7 +413,8 @@ PClip AvisynthVideoProvider::ApplySubtitles(wxString _filename, PClip videosourc
/////////////////////////////
// Get as subtitles provider
SubtitlesProvider *AvisynthVideoProvider::GetAsSubtitlesProvider() {
return this;
if (Options.AsBool(_T("Avisynth render own subs"))) return this;
return NULL;
}