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:
Karl Blomster 2009-07-20 00:39:38 +00:00
parent 9e150d282d
commit 9ff3762eaf
14 changed files with 36 additions and 50 deletions

View File

@ -68,10 +68,10 @@ public:
// Use this to set any post-loading warnings, such as "being loaded with unreliable seeking"
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"; }
// 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; }
// For providers that are natively time-based (e.g. DirectShow)
@ -85,5 +85,5 @@ public:
class VideoProviderFactory {
public:
virtual ~VideoProviderFactory() {}
virtual VideoProvider *CreateProvider(Aegisub::String video,double fps=0.0)=0;
virtual VideoProvider *CreateProvider(Aegisub::String video)=0;
};

View File

@ -266,7 +266,7 @@ void VideoContext::SetVideo(const wxString &filename) {
#endif
// Choose a provider
provider = VideoProviderFactoryManager::GetProvider(filename, 0);
provider = VideoProviderFactoryManager::GetProvider(filename);
loaded = provider != NULL;
// Get subtitles provider

View File

@ -56,11 +56,11 @@
///////////////
// 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));
bool mpeg2dec3_priority = true;
RGB32Video = NULL;
fps = _fps;
fps = 0;
num_frames = 0;
last_fnum = -1;
byFrame = false;
@ -223,12 +223,7 @@ PClip AvisynthVideoProvider::OpenVideo(Aegisub::String _filename, bool mpeg2dec3
dss2 = false;
if (env->FunctionExists("dss2")) {
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Invoking DSS2"));
if (fps == 0.0) 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);
}
script = env->Invoke("DSS2", videoFilename);
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS2"));
dss2 = true;
decoderName = _T("DSS2");
@ -246,16 +241,9 @@ PClip AvisynthVideoProvider::OpenVideo(Aegisub::String _filename, bool mpeg2dec3
// Then try using DSS
if (env->FunctionExists("DirectShowSource")) {
if (fps == 0.0) {
const char *argnames[3] = { 0, "video", "audio" };
AVSValue args[3] = { videoFilename, true, false };
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);
}
const char *argnames[3] = { 0, "video", "audio" };
AVSValue args[3] = { videoFilename, true, false };
script = env->Invoke("DirectShowSource", AVSValue(args,3), argnames);
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS without audio"));
usedDirectShow = true;
decoderName = _T("DirectShowSource");

View File

@ -70,7 +70,7 @@ private:
PClip OpenVideo(Aegisub::String _filename, bool mpeg2dec3_priority = true);
public:
AvisynthVideoProvider(Aegisub::String _filename, double fps=0.0);
AvisynthVideoProvider(Aegisub::String _filename);
~AvisynthVideoProvider();
const AegiVideoFrame GetFrame(int n,int formatMask);
@ -98,7 +98,7 @@ public:
// Factory
class AvisynthVideoProviderFactory : public VideoProviderFactory {
public:
VideoProvider *CreateProvider(Aegisub::String video,double fps=0.0) { return new AvisynthVideoProvider(video,fps); }
VideoProvider *CreateProvider(Aegisub::String video) { return new AvisynthVideoProvider(video); }
};

View File

@ -65,8 +65,8 @@
///////////////
// Constructor
// Based on Haali's code for DirectShowSource2
DirectShowVideoProvider::DirectShowVideoProvider(Aegisub::String _filename, double _fps) {
fps = _fps;
DirectShowVideoProvider::DirectShowVideoProvider(Aegisub::String _filename) {
fps = 0;
m_registered = false;
m_hFrameReady = CreateEvent(NULL, FALSE, FALSE, NULL);
HRESULT hr = OpenVideo(_filename);

View File

@ -105,7 +105,7 @@ private:
DWORD m_rot_cookie;
public:
DirectShowVideoProvider(Aegisub::String _filename, double _fps=0.0);
DirectShowVideoProvider(Aegisub::String _filename);
~DirectShowVideoProvider();
void RefreshSubtitles();
@ -136,7 +136,7 @@ public:
// Factory
class DirectShowVideoProviderFactory : public VideoProviderFactory {
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

View File

@ -122,7 +122,7 @@ void DummyVideoProvider::Create(double _fps, int frames, int _width, int _height
///////////////////////
// Parsing constructor
DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename, double _fps)
DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename)
{
wxString filename = _filename.c_str();
wxString params;
@ -135,16 +135,14 @@ DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename, double _fps)
throw _T("Too few fields in dummy video parameter list");
}
double parsedfps;
double fps;
long _frames, _width, _height, red, green, blue;
bool pattern = false;
wxString field = t.GetNextToken();
if (!field.ToDouble(&parsedfps)) {
if (!field.ToDouble(&fps)) {
throw _T("Unable to parse fps field in dummy video parameter list");
}
if (_fps == 0.0)
_fps = parsedfps;
field = t.GetNextToken();
if (!field.ToLong(&_frames)) {
@ -181,7 +179,7 @@ DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename, double _fps)
pattern = true;
}
Create(_fps, _frames, _width, _height, wxColour(red, green, blue), pattern);
Create(fps, _frames, _width, _height, wxColour(red, green, blue), pattern);
}

View File

@ -60,7 +60,7 @@ private:
void Create(double fps, int frames, int _width, int _height, const wxColour &colour, bool pattern);
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();

View File

@ -54,7 +54,7 @@
///////////////
// Constructor
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, double fps) {
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename) {
COMInited = false;
#ifdef WIN32
HRESULT res;
@ -79,7 +79,7 @@ FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, d
// and here we go
try {
LoadVideo(filename, fps);
LoadVideo(filename);
} catch (...) {
Close();
throw;
@ -98,7 +98,7 @@ FFmpegSourceVideoProvider::~FFmpegSourceVideoProvider() {
///////////////
// 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
Close();

View File

@ -66,13 +66,13 @@ private:
bool COMInited;
void LoadVideo(Aegisub::String filename, double fps);
void LoadVideo(Aegisub::String filename);
void Close();
protected:
public:
FFmpegSourceVideoProvider(Aegisub::String filename, double fps);
FFmpegSourceVideoProvider(Aegisub::String filename);
~FFmpegSourceVideoProvider();
const AegiVideoFrame GetFrame(int n, int formatType);
@ -96,7 +96,7 @@ public:
// Factory
class FFmpegSourceVideoProviderFactory : public VideoProviderFactory {
public:
VideoProvider *CreateProvider(Aegisub::String video,double fps=0.0) { return new FFmpegSourceVideoProvider(video,fps); }
VideoProvider *CreateProvider(Aegisub::String video) { return new FFmpegSourceVideoProvider(video); }
};

View File

@ -58,18 +58,18 @@
////////////////
// Get provider
VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video,double fps) {
VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video) {
// First check special case of dummy video
if (video.StartsWith(_T("?dummy:"))) {
#if wxCHECK_VERSION(2,9,0)
return new DummyVideoProvider(video.wc_str(), fps);
return new DummyVideoProvider(video.wc_str());
#else
return new DummyVideoProvider(video.c_str(), fps);
return new DummyVideoProvider(video.c_str());
#endif
}
try {
VideoProvider *y4m_provider = new YUV4MPEGVideoProvider(video.c_str(), fps);
VideoProvider *y4m_provider = new YUV4MPEGVideoProvider(video.c_str());
if (y4m_provider)
y4m_provider = new VideoProviderCache(y4m_provider);
return y4m_provider;
@ -93,9 +93,9 @@ VideoProvider *VideoProviderFactoryManager::GetProvider(wxString video,double fp
try {
// Create provider
#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
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.c_str(),fps);
VideoProvider *provider = GetFactory(list[i])->CreateProvider(video.c_str());
#endif
if (provider) {
// Cache if necessary

View File

@ -50,6 +50,6 @@
class VideoProviderFactoryManager : public FactoryManager<VideoProviderFactory> {
public:
static void RegisterProviders();
static VideoProvider *GetProvider(wxString video,double fps=0.0);
static VideoProvider *GetProvider(wxString video);
static void ClearProviders();
};

View File

@ -47,7 +47,7 @@
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(Aegisub::String filename, double fps) {
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(Aegisub::String filename) {
sf = NULL;
w = 0;
h = 0;

View File

@ -118,7 +118,7 @@ private:
int IndexFile();
public:
YUV4MPEGVideoProvider(Aegisub::String filename, double fps);
YUV4MPEGVideoProvider(Aegisub::String filename);
~YUV4MPEGVideoProvider();
const AegiVideoFrame GetFrame(int n, int formatType);