Removed the extremely deprecated fps parameter of the video provider constructors, since it hasn't been used by anything for years and was of questionable utility when it actually was used in the Elder Days.
Originally committed to SVN as r3178.
This commit is contained in:
parent
9e150d282d
commit
9ff3762eaf
14 changed files with 36 additions and 50 deletions
|
@ -68,10 +68,10 @@ public:
|
||||||
// Use this to set any post-loading warnings, such as "being loaded with unreliable seeking"
|
// Use this to set any post-loading warnings, such as "being loaded with unreliable seeking"
|
||||||
virtual Aegisub::String GetWarning() { return L""; }
|
virtual Aegisub::String GetWarning() { return L""; }
|
||||||
|
|
||||||
// Name of decoder, e.g. "Avisynth/FFMPegSource"
|
// Name of decoder, e.g. "Avisynth/FFMpegSource"
|
||||||
virtual Aegisub::String GetDecoderName() { return L"Unknown"; }
|
virtual Aegisub::String GetDecoderName() { return L"Unknown"; }
|
||||||
|
|
||||||
// How many frames does this provider wants that Aegisub caches? Set to 0 if it doesn't require caching.
|
// How many frames does this provider want Aegisub to cache? Set to 0 if it doesn't require caching.
|
||||||
virtual int GetDesiredCacheSize() { return 0; }
|
virtual int GetDesiredCacheSize() { return 0; }
|
||||||
|
|
||||||
// For providers that are natively time-based (e.g. DirectShow)
|
// For providers that are natively time-based (e.g. DirectShow)
|
||||||
|
@ -85,5 +85,5 @@ public:
|
||||||
class VideoProviderFactory {
|
class VideoProviderFactory {
|
||||||
public:
|
public:
|
||||||
virtual ~VideoProviderFactory() {}
|
virtual ~VideoProviderFactory() {}
|
||||||
virtual VideoProvider *CreateProvider(Aegisub::String video,double fps=0.0)=0;
|
virtual VideoProvider *CreateProvider(Aegisub::String video)=0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -266,7 +266,7 @@ void VideoContext::SetVideo(const wxString &filename) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Choose a provider
|
// Choose a provider
|
||||||
provider = VideoProviderFactoryManager::GetProvider(filename, 0);
|
provider = VideoProviderFactoryManager::GetProvider(filename);
|
||||||
loaded = provider != NULL;
|
loaded = provider != NULL;
|
||||||
|
|
||||||
// Get subtitles provider
|
// Get subtitles provider
|
||||||
|
|
|
@ -56,11 +56,11 @@
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
AvisynthVideoProvider::AvisynthVideoProvider(Aegisub::String _filename, double _fps) {
|
AvisynthVideoProvider::AvisynthVideoProvider(Aegisub::String _filename) {
|
||||||
AVSTRACE(wxString::Format(_T("AvisynthVideoProvider: Creating new AvisynthVideoProvider: \"%s\", \"%s\""), _filename, _subfilename));
|
AVSTRACE(wxString::Format(_T("AvisynthVideoProvider: Creating new AvisynthVideoProvider: \"%s\", \"%s\""), _filename, _subfilename));
|
||||||
bool mpeg2dec3_priority = true;
|
bool mpeg2dec3_priority = true;
|
||||||
RGB32Video = NULL;
|
RGB32Video = NULL;
|
||||||
fps = _fps;
|
fps = 0;
|
||||||
num_frames = 0;
|
num_frames = 0;
|
||||||
last_fnum = -1;
|
last_fnum = -1;
|
||||||
byFrame = false;
|
byFrame = false;
|
||||||
|
@ -223,12 +223,7 @@ PClip AvisynthVideoProvider::OpenVideo(Aegisub::String _filename, bool mpeg2dec3
|
||||||
dss2 = false;
|
dss2 = false;
|
||||||
if (env->FunctionExists("dss2")) {
|
if (env->FunctionExists("dss2")) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Invoking DSS2"));
|
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Invoking DSS2"));
|
||||||
if (fps == 0.0) script = env->Invoke("DSS2", videoFilename);
|
script = env->Invoke("DSS2", videoFilename);
|
||||||
else {
|
|
||||||
const char *argnames[2] = { 0, "fps" };
|
|
||||||
AVSValue args[2] = { videoFilename, fps };
|
|
||||||
script = env->Invoke("DSS2", AVSValue(args,2), argnames);
|
|
||||||
}
|
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS2"));
|
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS2"));
|
||||||
dss2 = true;
|
dss2 = true;
|
||||||
decoderName = _T("DSS2");
|
decoderName = _T("DSS2");
|
||||||
|
@ -246,16 +241,9 @@ PClip AvisynthVideoProvider::OpenVideo(Aegisub::String _filename, bool mpeg2dec3
|
||||||
|
|
||||||
// Then try using DSS
|
// Then try using DSS
|
||||||
if (env->FunctionExists("DirectShowSource")) {
|
if (env->FunctionExists("DirectShowSource")) {
|
||||||
if (fps == 0.0) {
|
|
||||||
const char *argnames[3] = { 0, "video", "audio" };
|
const char *argnames[3] = { 0, "video", "audio" };
|
||||||
AVSValue args[3] = { videoFilename, true, false };
|
AVSValue args[3] = { videoFilename, true, false };
|
||||||
script = env->Invoke("DirectShowSource", AVSValue(args,3), argnames);
|
script = env->Invoke("DirectShowSource", AVSValue(args,3), argnames);
|
||||||
}
|
|
||||||
else {
|
|
||||||
const char *argnames[4] = { 0, "video", "audio" , "fps" };
|
|
||||||
AVSValue args[4] = { videoFilename, true, false , fps };
|
|
||||||
script = env->Invoke("DirectShowSource", AVSValue(args,4), argnames);
|
|
||||||
}
|
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS without audio"));
|
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS without audio"));
|
||||||
usedDirectShow = true;
|
usedDirectShow = true;
|
||||||
decoderName = _T("DirectShowSource");
|
decoderName = _T("DirectShowSource");
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
PClip OpenVideo(Aegisub::String _filename, bool mpeg2dec3_priority = true);
|
PClip OpenVideo(Aegisub::String _filename, bool mpeg2dec3_priority = true);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AvisynthVideoProvider(Aegisub::String _filename, double fps=0.0);
|
AvisynthVideoProvider(Aegisub::String _filename);
|
||||||
~AvisynthVideoProvider();
|
~AvisynthVideoProvider();
|
||||||
|
|
||||||
const AegiVideoFrame GetFrame(int n,int formatMask);
|
const AegiVideoFrame GetFrame(int n,int formatMask);
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
// Factory
|
// Factory
|
||||||
class AvisynthVideoProviderFactory : public VideoProviderFactory {
|
class AvisynthVideoProviderFactory : public VideoProviderFactory {
|
||||||
public:
|
public:
|
||||||
VideoProvider *CreateProvider(Aegisub::String video,double fps=0.0) { return new AvisynthVideoProvider(video,fps); }
|
VideoProvider *CreateProvider(Aegisub::String video) { return new AvisynthVideoProvider(video); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
// Based on Haali's code for DirectShowSource2
|
// Based on Haali's code for DirectShowSource2
|
||||||
DirectShowVideoProvider::DirectShowVideoProvider(Aegisub::String _filename, double _fps) {
|
DirectShowVideoProvider::DirectShowVideoProvider(Aegisub::String _filename) {
|
||||||
fps = _fps;
|
fps = 0;
|
||||||
m_registered = false;
|
m_registered = false;
|
||||||
m_hFrameReady = CreateEvent(NULL, FALSE, FALSE, NULL);
|
m_hFrameReady = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
HRESULT hr = OpenVideo(_filename);
|
HRESULT hr = OpenVideo(_filename);
|
||||||
|
|
|
@ -105,7 +105,7 @@ private:
|
||||||
DWORD m_rot_cookie;
|
DWORD m_rot_cookie;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DirectShowVideoProvider(Aegisub::String _filename, double _fps=0.0);
|
DirectShowVideoProvider(Aegisub::String _filename);
|
||||||
~DirectShowVideoProvider();
|
~DirectShowVideoProvider();
|
||||||
|
|
||||||
void RefreshSubtitles();
|
void RefreshSubtitles();
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
// Factory
|
// Factory
|
||||||
class DirectShowVideoProviderFactory : public VideoProviderFactory {
|
class DirectShowVideoProviderFactory : public VideoProviderFactory {
|
||||||
public:
|
public:
|
||||||
VideoProvider *CreateProvider(Aegisub::String video,double fps=0.0) { return new DirectShowVideoProvider(video,fps); }
|
VideoProvider *CreateProvider(Aegisub::String video) { return new DirectShowVideoProvider(video); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -122,7 +122,7 @@ void DummyVideoProvider::Create(double _fps, int frames, int _width, int _height
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Parsing constructor
|
// Parsing constructor
|
||||||
DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename, double _fps)
|
DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename)
|
||||||
{
|
{
|
||||||
wxString filename = _filename.c_str();
|
wxString filename = _filename.c_str();
|
||||||
wxString params;
|
wxString params;
|
||||||
|
@ -135,16 +135,14 @@ DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename, double _fps)
|
||||||
throw _T("Too few fields in dummy video parameter list");
|
throw _T("Too few fields in dummy video parameter list");
|
||||||
}
|
}
|
||||||
|
|
||||||
double parsedfps;
|
double fps;
|
||||||
long _frames, _width, _height, red, green, blue;
|
long _frames, _width, _height, red, green, blue;
|
||||||
bool pattern = false;
|
bool pattern = false;
|
||||||
|
|
||||||
wxString field = t.GetNextToken();
|
wxString field = t.GetNextToken();
|
||||||
if (!field.ToDouble(&parsedfps)) {
|
if (!field.ToDouble(&fps)) {
|
||||||
throw _T("Unable to parse fps field in dummy video parameter list");
|
throw _T("Unable to parse fps field in dummy video parameter list");
|
||||||
}
|
}
|
||||||
if (_fps == 0.0)
|
|
||||||
_fps = parsedfps;
|
|
||||||
|
|
||||||
field = t.GetNextToken();
|
field = t.GetNextToken();
|
||||||
if (!field.ToLong(&_frames)) {
|
if (!field.ToLong(&_frames)) {
|
||||||
|
@ -181,7 +179,7 @@ DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename, double _fps)
|
||||||
pattern = true;
|
pattern = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Create(_fps, _frames, _width, _height, wxColour(red, green, blue), pattern);
|
Create(fps, _frames, _width, _height, wxColour(red, green, blue), pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
void Create(double fps, int frames, int _width, int _height, const wxColour &colour, bool pattern);
|
void Create(double fps, int frames, int _width, int _height, const wxColour &colour, bool pattern);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DummyVideoProvider(Aegisub::String filename, double fps);
|
DummyVideoProvider(Aegisub::String filename);
|
||||||
DummyVideoProvider(double fps, int frames, int _width, int _height, const wxColour &colour, bool pattern);
|
DummyVideoProvider(double fps, int frames, int _width, int _height, const wxColour &colour, bool pattern);
|
||||||
~DummyVideoProvider();
|
~DummyVideoProvider();
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, double fps) {
|
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename) {
|
||||||
COMInited = false;
|
COMInited = false;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
HRESULT res;
|
HRESULT res;
|
||||||
|
@ -79,7 +79,7 @@ FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, d
|
||||||
|
|
||||||
// and here we go
|
// and here we go
|
||||||
try {
|
try {
|
||||||
LoadVideo(filename, fps);
|
LoadVideo(filename);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
Close();
|
Close();
|
||||||
throw;
|
throw;
|
||||||
|
@ -98,7 +98,7 @@ FFmpegSourceVideoProvider::~FFmpegSourceVideoProvider() {
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Open video
|
// Open video
|
||||||
void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps) {
|
void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename) {
|
||||||
// make sure we don't have anything messy lying around
|
// make sure we don't have anything messy lying around
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
|
|
|
@ -66,13 +66,13 @@ private:
|
||||||
|
|
||||||
bool COMInited;
|
bool COMInited;
|
||||||
|
|
||||||
void LoadVideo(Aegisub::String filename, double fps);
|
void LoadVideo(Aegisub::String filename);
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FFmpegSourceVideoProvider(Aegisub::String filename, double fps);
|
FFmpegSourceVideoProvider(Aegisub::String filename);
|
||||||
~FFmpegSourceVideoProvider();
|
~FFmpegSourceVideoProvider();
|
||||||
|
|
||||||
const AegiVideoFrame GetFrame(int n, int formatType);
|
const AegiVideoFrame GetFrame(int n, int formatType);
|
||||||
|
@ -96,7 +96,7 @@ public:
|
||||||
// Factory
|
// Factory
|
||||||
class FFmpegSourceVideoProviderFactory : public VideoProviderFactory {
|
class FFmpegSourceVideoProviderFactory : public VideoProviderFactory {
|
||||||
public:
|
public:
|
||||||
VideoProvider *CreateProvider(Aegisub::String video,double fps=0.0) { return new FFmpegSourceVideoProvider(video,fps); }
|
VideoProvider *CreateProvider(Aegisub::String video) { return new FFmpegSourceVideoProvider(video); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,18 +58,18 @@
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// Get provider
|
// Get provider
|
||||||
VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video,double fps) {
|
VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) {
|
||||||
// First check special case of dummy video
|
// First check special case of dummy video
|
||||||
if (video.StartsWith(_T("?dummy:"))) {
|
if (video.StartsWith(_T("?dummy:"))) {
|
||||||
#if wxCHECK_VERSION(2,9,0)
|
#if wxCHECK_VERSION(2,9,0)
|
||||||
return new DummyVideoProvider(video.wc_str(), fps);
|
return new DummyVideoProvider(video.wc_str());
|
||||||
#else
|
#else
|
||||||
return new DummyVideoProvider(video.c_str(), fps);
|
return new DummyVideoProvider(video.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
VideoProvider *y4m_provider = new YUV4MPEGVideoProvider(video.c_str(), fps);
|
VideoProvider *y4m_provider = new YUV4MPEGVideoProvider(video.c_str());
|
||||||
if (y4m_provider)
|
if (y4m_provider)
|
||||||
y4m_provider = new VideoProviderCache(y4m_provider);
|
y4m_provider = new VideoProviderCache(y4m_provider);
|
||||||
return y4m_provider;
|
return y4m_provider;
|
||||||
|
@ -93,9 +93,9 @@ VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video,double fp
|
||||||
try {
|
try {
|
||||||
// Create provider
|
// Create provider
|
||||||
#if wxCHECK_VERSION(2,9,0)
|
#if wxCHECK_VERSION(2,9,0)
|
||||||
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.wc_str(),fps);
|
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.wc_str());
|
||||||
#else
|
#else
|
||||||
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.c_str(),fps);
|
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.c_str());
|
||||||
#endif
|
#endif
|
||||||
if (provider) {
|
if (provider) {
|
||||||
// Cache if necessary
|
// Cache if necessary
|
||||||
|
|
|
@ -50,6 +50,6 @@
|
||||||
class VideoProviderFactoryManager : public FactoryManager<VideoProviderFactory> {
|
class VideoProviderFactoryManager : public FactoryManager<VideoProviderFactory> {
|
||||||
public:
|
public:
|
||||||
static void RegisterProviders();
|
static void RegisterProviders();
|
||||||
static VideoProvider *GetProvider(wxString video,double fps=0.0);
|
static VideoProvider *GetProvider(wxString video);
|
||||||
static void ClearProviders();
|
static void ClearProviders();
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(Aegisub::String filename, double fps) {
|
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(Aegisub::String filename) {
|
||||||
sf = NULL;
|
sf = NULL;
|
||||||
w = 0;
|
w = 0;
|
||||||
h = 0;
|
h = 0;
|
||||||
|
|
|
@ -118,7 +118,7 @@ private:
|
||||||
int IndexFile();
|
int IndexFile();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
YUV4MPEGVideoProvider(Aegisub::String filename, double fps);
|
YUV4MPEGVideoProvider(Aegisub::String filename);
|
||||||
~YUV4MPEGVideoProvider();
|
~YUV4MPEGVideoProvider();
|
||||||
|
|
||||||
const AegiVideoFrame GetFrame(int n, int formatType);
|
const AegiVideoFrame GetFrame(int n, int formatType);
|
||||||
|
|
Loading…
Reference in a new issue