From 9ff3762eafb2b2cdea805fbd56eb3562f644dd80 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Mon, 20 Jul 2009 00:39:38 +0000 Subject: [PATCH] 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. --- aegisub/src/include/aegisub/video_provider.h | 6 ++--- aegisub/src/video_context.cpp | 2 +- aegisub/src/video_provider_avs.cpp | 24 +++++--------------- aegisub/src/video_provider_avs.h | 4 ++-- aegisub/src/video_provider_dshow.cpp | 4 ++-- aegisub/src/video_provider_dshow.h | 4 ++-- aegisub/src/video_provider_dummy.cpp | 10 ++++---- aegisub/src/video_provider_dummy.h | 2 +- aegisub/src/video_provider_ffmpegsource.cpp | 6 ++--- aegisub/src/video_provider_ffmpegsource.h | 6 ++--- aegisub/src/video_provider_manager.cpp | 12 +++++----- aegisub/src/video_provider_manager.h | 2 +- aegisub/src/video_provider_yuv4mpeg.cpp | 2 +- aegisub/src/video_provider_yuv4mpeg.h | 2 +- 14 files changed, 36 insertions(+), 50 deletions(-) diff --git a/aegisub/src/include/aegisub/video_provider.h b/aegisub/src/include/aegisub/video_provider.h index 899e94160..5bd70c2ba 100644 --- a/aegisub/src/include/aegisub/video_provider.h +++ b/aegisub/src/include/aegisub/video_provider.h @@ -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; }; diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp index 409c23917..9c94c9859 100644 --- a/aegisub/src/video_context.cpp +++ b/aegisub/src/video_context.cpp @@ -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 diff --git a/aegisub/src/video_provider_avs.cpp b/aegisub/src/video_provider_avs.cpp index 93217c9fc..5b85b1ff2 100644 --- a/aegisub/src/video_provider_avs.cpp +++ b/aegisub/src/video_provider_avs.cpp @@ -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"); diff --git a/aegisub/src/video_provider_avs.h b/aegisub/src/video_provider_avs.h index 0ef4a6d0a..9f4c2085f 100644 --- a/aegisub/src/video_provider_avs.h +++ b/aegisub/src/video_provider_avs.h @@ -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); } }; diff --git a/aegisub/src/video_provider_dshow.cpp b/aegisub/src/video_provider_dshow.cpp index 1966f8da0..b5199e774 100644 --- a/aegisub/src/video_provider_dshow.cpp +++ b/aegisub/src/video_provider_dshow.cpp @@ -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); diff --git a/aegisub/src/video_provider_dshow.h b/aegisub/src/video_provider_dshow.h index 2cdd09c8f..536ab3f76 100644 --- a/aegisub/src/video_provider_dshow.h +++ b/aegisub/src/video_provider_dshow.h @@ -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 diff --git a/aegisub/src/video_provider_dummy.cpp b/aegisub/src/video_provider_dummy.cpp index ccfc7943d..70ff5a653 100644 --- a/aegisub/src/video_provider_dummy.cpp +++ b/aegisub/src/video_provider_dummy.cpp @@ -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); } diff --git a/aegisub/src/video_provider_dummy.h b/aegisub/src/video_provider_dummy.h index b1513261d..6958e956f 100644 --- a/aegisub/src/video_provider_dummy.h +++ b/aegisub/src/video_provider_dummy.h @@ -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(); diff --git a/aegisub/src/video_provider_ffmpegsource.cpp b/aegisub/src/video_provider_ffmpegsource.cpp index de3409837..072a6848e 100644 --- a/aegisub/src/video_provider_ffmpegsource.cpp +++ b/aegisub/src/video_provider_ffmpegsource.cpp @@ -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(); diff --git a/aegisub/src/video_provider_ffmpegsource.h b/aegisub/src/video_provider_ffmpegsource.h index d0a77ce8a..e04c5613f 100644 --- a/aegisub/src/video_provider_ffmpegsource.h +++ b/aegisub/src/video_provider_ffmpegsource.h @@ -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); } }; diff --git a/aegisub/src/video_provider_manager.cpp b/aegisub/src/video_provider_manager.cpp index f8ad13219..9362a7d2b 100644 --- a/aegisub/src/video_provider_manager.cpp +++ b/aegisub/src/video_provider_manager.cpp @@ -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 diff --git a/aegisub/src/video_provider_manager.h b/aegisub/src/video_provider_manager.h index d45c924e5..60676f50b 100644 --- a/aegisub/src/video_provider_manager.h +++ b/aegisub/src/video_provider_manager.h @@ -50,6 +50,6 @@ class VideoProviderFactoryManager : public FactoryManager { public: static void RegisterProviders(); - static VideoProvider *GetProvider(wxString video,double fps=0.0); + static VideoProvider *GetProvider(wxString video); static void ClearProviders(); }; diff --git a/aegisub/src/video_provider_yuv4mpeg.cpp b/aegisub/src/video_provider_yuv4mpeg.cpp index 339c6aeae..5407666e9 100644 --- a/aegisub/src/video_provider_yuv4mpeg.cpp +++ b/aegisub/src/video_provider_yuv4mpeg.cpp @@ -47,7 +47,7 @@ -YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(Aegisub::String filename, double fps) { +YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(Aegisub::String filename) { sf = NULL; w = 0; h = 0; diff --git a/aegisub/src/video_provider_yuv4mpeg.h b/aegisub/src/video_provider_yuv4mpeg.h index 91f61763b..0fea5c49e 100644 --- a/aegisub/src/video_provider_yuv4mpeg.h +++ b/aegisub/src/video_provider_yuv4mpeg.h @@ -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);