Remove Aegisub::String class as it's causing problems in wx2.9. The original plan was to have it so external modules wouldn't have to depend on wx. We'll think of a different solution when the time comes. closes #940

Originally committed to SVN as r3220.
This commit is contained in:
Amar Takhar 2009-07-23 15:16:53 +00:00
parent e496c0487d
commit a0370f9004
21 changed files with 53 additions and 68 deletions

View file

@ -52,7 +52,7 @@
////////////// //////////////
// Constructor // Constructor
AvisynthAudioProvider::AvisynthAudioProvider(Aegisub::String _filename) { AvisynthAudioProvider::AvisynthAudioProvider(wxString _filename) {
filename = _filename.c_str(); filename = _filename.c_str();
try { try {

View file

@ -56,7 +56,7 @@ private:
void Unload(); void Unload();
public: public:
AvisynthAudioProvider(Aegisub::String _filename); AvisynthAudioProvider(wxString _filename);
~AvisynthAudioProvider(); ~AvisynthAudioProvider();
wxString GetFilename(); wxString GetFilename();
@ -73,7 +73,7 @@ public:
// Factory // Factory
class AvisynthAudioProviderFactory : public AudioProviderFactory { class AvisynthAudioProviderFactory : public AudioProviderFactory {
public: public:
AudioProvider *CreateProvider(Aegisub::String file) { return new AvisynthAudioProvider(file); } AudioProvider *CreateProvider(wxString file) { return new AvisynthAudioProvider(file); }
}; };
#endif #endif

View file

@ -50,7 +50,7 @@
/////////// ///////////
// Constructor // Constructor
FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(Aegisub::String filename) { FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(wxString filename) {
COMInited = false; COMInited = false;
#ifdef WIN32 #ifdef WIN32
HRESULT res; HRESULT res;
@ -78,7 +78,7 @@ FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(Aegisub::String filename) {
/////////// ///////////
// Load audio file // Load audio file
void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) { void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
// clean up // clean up
Close(); Close();

View file

@ -54,10 +54,10 @@ private:
bool COMInited; bool COMInited;
void Close(); void Close();
void LoadAudio(Aegisub::String filename); void LoadAudio(wxString filename);
public: public:
FFmpegSourceAudioProvider(Aegisub::String filename); FFmpegSourceAudioProvider(wxString filename);
virtual ~FFmpegSourceAudioProvider(); virtual ~FFmpegSourceAudioProvider();
// FFMS always delivers samples in machine endian // FFMS always delivers samples in machine endian
@ -72,7 +72,7 @@ public:
// Factory // Factory
class FFmpegSourceAudioProviderFactory : public AudioProviderFactory { class FFmpegSourceAudioProviderFactory : public AudioProviderFactory {
public: public:
AudioProvider *CreateProvider(Aegisub::String file) { return new FFmpegSourceAudioProvider(file); } AudioProvider *CreateProvider(wxString file) { return new FFmpegSourceAudioProvider(file); }
}; };
#endif /* WITH_FFMPEGSOURCE */ #endif /* WITH_FFMPEGSOURCE */

View file

@ -39,24 +39,9 @@
/////////////// ///////////////
// STL Headers // STL Headers
#include <vector>
#include <string>
#include <stdint.h> #include <stdint.h>
////////////////////////////////
// Define types used by Aegisub
namespace Aegisub {
// String type
typedef wxString String;
// String array
typedef std::vector<String> StringArray;
// Integer array
typedef std::vector<int> IntArray;
};
/////////////////// ///////////////////
// Aegisub headers // Aegisub headers
//#include "video_frame.h" //#include "video_frame.h"

View file

@ -85,5 +85,5 @@ public:
class AudioProviderFactory { class AudioProviderFactory {
public: public:
virtual ~AudioProviderFactory() {} virtual ~AudioProviderFactory() {}
virtual AudioProvider *CreateProvider(Aegisub::String filename)=0; virtual AudioProvider *CreateProvider(wxString filename)=0;
}; };

View file

@ -66,10 +66,10 @@ public:
virtual FrameRate GetTrueFrameRate()=0; // Returns magic VFR stuff virtual FrameRate GetTrueFrameRate()=0; // Returns magic VFR stuff
// 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 wxString 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 wxString GetDecoderName() { return L"Unknown"; }
// How many frames does this provider want Aegisub to cache? 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; }
@ -77,7 +77,7 @@ public:
// For "special" providers that don't deal well with VFR (i.e. Avisynth) // For "special" providers that don't deal well with VFR (i.e. Avisynth)
virtual bool NeedsVFRHack() { return false; }; // Returns true if provider needs special VFR treatment virtual bool NeedsVFRHack() { return false; }; // Returns true if provider needs special VFR treatment
virtual bool IsNativelyByFrames() { return true; }; virtual bool IsNativelyByFrames() { return true; };
virtual void OverrideFrameTimeList(Aegisub::IntArray list) {} // Override the list with the provided one, for VFR handling virtual void OverrideFrameTimeList(std::vector<int> list) {} // Override the list with the provided one, for VFR handling
}; };
@ -86,5 +86,5 @@ public:
class VideoProviderFactory { class VideoProviderFactory {
public: public:
virtual ~VideoProviderFactory() {} virtual ~VideoProviderFactory() {}
virtual VideoProvider *CreateProvider(Aegisub::String video)=0; virtual VideoProvider *CreateProvider(wxString video)=0;
}; };

View file

@ -410,7 +410,7 @@ int FrameRate::GetTimeAtFrame(int frame,bool start,bool exact) {
//////////////////////////////////////// ////////////////////////////////////////
// Get the current list of frames/times // Get the current list of frames/times
Aegisub::IntArray FrameRate::GetFrameTimeList() { std::vector<int> FrameRate::GetFrameTimeList() {
return Frame; return Frame;
} }

View file

@ -66,7 +66,7 @@ class FrameRate {
private: private:
double last_time; double last_time;
int last_frame; int last_frame;
Aegisub::IntArray Frame; std::vector<int> Frame;
// contains the assumed fps for v1 timecodes, average for v2 and actual fps for cfr // contains the assumed fps for v1 timecodes, average for v2 and actual fps for cfr
double AverageFrameRate; double AverageFrameRate;
@ -102,7 +102,7 @@ public:
ASS_FrameRateType GetFrameRateType() { return FrameRateType; }; ASS_FrameRateType GetFrameRateType() { return FrameRateType; };
wxString GetFilename() { return vfrFile; }; wxString GetFilename() { return vfrFile; };
Aegisub::IntArray GetFrameTimeList(); std::vector<int> GetFrameTimeList();
double GetCommonFPS(); double GetCommonFPS();
}; };

View file

@ -56,7 +56,7 @@
/////////////// ///////////////
// Constructor // Constructor
AvisynthVideoProvider::AvisynthVideoProvider(Aegisub::String _filename) { AvisynthVideoProvider::AvisynthVideoProvider(wxString _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;
@ -95,7 +95,7 @@ AvisynthVideoProvider::~AvisynthVideoProvider() {
///////////////////////////////////////// /////////////////////////////////////////
// Actually open the video into Avisynth // Actually open the video into Avisynth
PClip AvisynthVideoProvider::OpenVideo(Aegisub::String _filename, bool mpeg2dec3_priority) { PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priority) {
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening video")); AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening video"));
wxMutexLocker lock(AviSynthMutex); wxMutexLocker lock(AviSynthMutex);
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Got AVS mutex")); AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Got AVS mutex"));
@ -368,7 +368,7 @@ void AvisynthVideoProvider::OverrideFrameTimeList(wxArrayInt list) {
/////////////// ///////////////
// Get warning // Get warning
Aegisub::String AvisynthVideoProvider::GetWarning() { wxString AvisynthVideoProvider::GetWarning() {
if (usedDirectShow) return L"Warning! The file is being opened using Avisynth's DirectShowSource, which has unreliable seeking. Frame numbers might not match the real number. PROCEED AT YOUR OWN RISK!"; if (usedDirectShow) return L"Warning! The file is being opened using Avisynth's DirectShowSource, which has unreliable seeking. Frame numbers might not match the real number. PROCEED AT YOUR OWN RISK!";
else return L""; else return L"";
} }

View file

@ -50,8 +50,8 @@ private:
AegiVideoFrame iframe; AegiVideoFrame iframe;
bool usedDirectShow; bool usedDirectShow;
Aegisub::String rendererCallString; wxString rendererCallString;
Aegisub::String decoderName; wxString decoderName;
int num_frames; int num_frames;
int last_fnum; int last_fnum;
@ -67,10 +67,10 @@ private:
PClip RGB32Video; PClip RGB32Video;
PClip OpenVideo(Aegisub::String _filename, bool mpeg2dec3_priority = true); PClip OpenVideo(wxString _filename, bool mpeg2dec3_priority = true);
public: public:
AvisynthVideoProvider(Aegisub::String _filename); AvisynthVideoProvider(wxString _filename);
~AvisynthVideoProvider(); ~AvisynthVideoProvider();
const AegiVideoFrame GetFrame(int n); const AegiVideoFrame GetFrame(int n);
@ -90,8 +90,8 @@ public:
void OverrideFrameTimeList(wxArrayInt list); void OverrideFrameTimeList(wxArrayInt list);
bool IsNativelyByFrames() { return byFrame; } bool IsNativelyByFrames() { return byFrame; }
bool NeedsVFRHack() { return true; } bool NeedsVFRHack() { return true; }
Aegisub::String GetWarning(); wxString GetWarning();
Aegisub::String GetDecoderName() { return Aegisub::String(L"Avisynth/") + decoderName; } wxString GetDecoderName() { return wxString(L"Avisynth/") + decoderName; }
}; };
@ -99,7 +99,7 @@ public:
// Factory // Factory
class AvisynthVideoProviderFactory : public VideoProviderFactory { class AvisynthVideoProviderFactory : public VideoProviderFactory {
public: public:
VideoProvider *CreateProvider(Aegisub::String video) { return new AvisynthVideoProvider(video); } VideoProvider *CreateProvider(wxString video) { return new AvisynthVideoProvider(video); }
}; };

View file

@ -161,7 +161,7 @@ wxArrayInt VideoProviderCache::GetKeyFrames() {
FrameRate VideoProviderCache::GetTrueFrameRate() { FrameRate VideoProviderCache::GetTrueFrameRate() {
return master->GetTrueFrameRate(); return master->GetTrueFrameRate();
} }
void VideoProviderCache::OverrideFrameTimeList(Aegisub::IntArray list) { void VideoProviderCache::OverrideFrameTimeList(std::vector<int> list) {
master->OverrideFrameTimeList(list); master->OverrideFrameTimeList(list);
} }
bool VideoProviderCache::IsNativelyByFrames() { bool VideoProviderCache::IsNativelyByFrames() {
@ -170,9 +170,9 @@ bool VideoProviderCache::IsNativelyByFrames() {
bool VideoProviderCache::NeedsVFRHack() { bool VideoProviderCache::NeedsVFRHack() {
return master->NeedsVFRHack(); return master->NeedsVFRHack();
} }
Aegisub::String VideoProviderCache::GetWarning() { wxString VideoProviderCache::GetWarning() {
return master->GetWarning(); return master->GetWarning();
} }
Aegisub::String VideoProviderCache::GetDecoderName() { wxString VideoProviderCache::GetDecoderName() {
return master->GetDecoderName(); return master->GetDecoderName();
} }

View file

@ -87,9 +87,9 @@ public:
virtual bool IsVFR(); virtual bool IsVFR();
virtual wxArrayInt GetKeyFrames(); virtual wxArrayInt GetKeyFrames();
virtual FrameRate GetTrueFrameRate(); virtual FrameRate GetTrueFrameRate();
virtual void OverrideFrameTimeList(Aegisub::IntArray list); // Override the list with the provided one, for VFR handling virtual void OverrideFrameTimeList(std::vector<int> list); // Override the list with the provided one, for VFR handling
virtual bool IsNativelyByFrames(); virtual bool IsNativelyByFrames();
virtual bool NeedsVFRHack(); virtual bool NeedsVFRHack();
virtual Aegisub::String GetWarning(); virtual wxString GetWarning();
virtual Aegisub::String GetDecoderName(); virtual wxString GetDecoderName();
}; };

View file

@ -122,7 +122,7 @@ void DummyVideoProvider::Create(double _fps, int frames, int _width, int _height
/////////////////////// ///////////////////////
// Parsing constructor // Parsing constructor
DummyVideoProvider::DummyVideoProvider(Aegisub::String _filename) DummyVideoProvider::DummyVideoProvider(wxString _filename)
{ {
wxString filename = _filename.c_str(); wxString filename = _filename.c_str();
wxString params; wxString params;
@ -249,7 +249,7 @@ double DummyVideoProvider::GetFPS() {
//////////////////// ////////////////////
// Get decoder name // Get decoder name
Aegisub::String DummyVideoProvider::GetDecoderName() { wxString DummyVideoProvider::GetDecoderName() {
return L"Dummy Video Provider"; return L"Dummy Video Provider";
} }

View file

@ -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); DummyVideoProvider(wxString 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();
@ -79,7 +79,7 @@ public:
bool IsVFR() { return false; }; bool IsVFR() { return false; };
FrameRate GetTrueFrameRate() { return FrameRate(); }; FrameRate GetTrueFrameRate() { return FrameRate(); };
Aegisub::String GetDecoderName(); wxString GetDecoderName();
}; };
#endif #endif

View file

@ -54,7 +54,7 @@
/////////////// ///////////////
// Constructor // Constructor
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename) { FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(wxString filename) {
COMInited = false; COMInited = false;
#ifdef WIN32 #ifdef WIN32
HRESULT res; HRESULT res;
@ -96,7 +96,7 @@ FFmpegSourceVideoProvider::~FFmpegSourceVideoProvider() {
/////////////// ///////////////
// Open video // Open video
void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename) { void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
// make sure we don't have anything messy lying around // make sure we don't have anything messy lying around
Close(); Close();

View file

@ -64,13 +64,13 @@ private:
bool COMInited; bool COMInited;
void LoadVideo(Aegisub::String filename); void LoadVideo(wxString filename);
void Close(); void Close();
protected: protected:
public: public:
FFmpegSourceVideoProvider(Aegisub::String filename); FFmpegSourceVideoProvider(wxString filename);
~FFmpegSourceVideoProvider(); ~FFmpegSourceVideoProvider();
const AegiVideoFrame GetFrame(int n); const AegiVideoFrame GetFrame(int n);
@ -84,7 +84,7 @@ public:
wxArrayInt GetKeyFrames() { return KeyFramesList; }; wxArrayInt GetKeyFrames() { return KeyFramesList; };
bool IsVFR() { return true; }; bool IsVFR() { return true; };
FrameRate GetTrueFrameRate() { return Timecodes; }; FrameRate GetTrueFrameRate() { return Timecodes; };
Aegisub::String GetDecoderName() { return L"FFmpegSource"; } wxString GetDecoderName() { return L"FFmpegSource"; }
int GetDesiredCacheSize() { return 8; } int GetDesiredCacheSize() { return 8; }
}; };
@ -93,7 +93,7 @@ public:
// Factory // Factory
class FFmpegSourceVideoProviderFactory : public VideoProviderFactory { class FFmpegSourceVideoProviderFactory : public VideoProviderFactory {
public: public:
VideoProvider *CreateProvider(Aegisub::String video) { return new FFmpegSourceVideoProvider(video); } VideoProvider *CreateProvider(wxString video) { return new FFmpegSourceVideoProvider(video); }
}; };

View file

@ -40,7 +40,7 @@
#include "aegisub_endian.h" #include "aegisub_endian.h"
#include "video_provider_quicktime.h" #include "video_provider_quicktime.h"
QuickTimeVideoProvider::QuickTimeVideoProvider(Aegisub::String filename) { QuickTimeVideoProvider::QuickTimeVideoProvider(wxString filename) {
in_dataref = NULL; in_dataref = NULL;
movie = NULL; movie = NULL;
gw = NULL; gw = NULL;
@ -119,7 +119,7 @@ bool QuickTimeVideoProvider::CanOpen(const Handle& dataref, const OSType dataref
} }
void QuickTimeVideoProvider::LoadVideo(const Aegisub::String _filename) { void QuickTimeVideoProvider::LoadVideo(const wxString _filename) {
Close(); Close();
// convert filename, first to a CFStringRef... // convert filename, first to a CFStringRef...

View file

@ -89,14 +89,14 @@ private:
wxString errmsg; // aegisub error message wxString errmsg; // aegisub error message
bool CanOpen(const Handle& dataref, const OSType dataref_type); bool CanOpen(const Handle& dataref, const OSType dataref_type);
void LoadVideo(const Aegisub::String filename); void LoadVideo(const wxString filename);
std::vector<int> IndexFile(); std::vector<int> IndexFile();
void Close(); void Close();
void QTCheckError(OSErr err, wxString errmsg); void QTCheckError(OSErr err, wxString errmsg);
public: public:
QuickTimeVideoProvider(Aegisub::String filename); QuickTimeVideoProvider(wxString filename);
~QuickTimeVideoProvider(); ~QuickTimeVideoProvider();
const AegiVideoFrame GetFrame(int n); const AegiVideoFrame GetFrame(int n);
@ -110,7 +110,7 @@ public:
FrameRate GetTrueFrameRate(); FrameRate GetTrueFrameRate();
wxArrayInt GetKeyFrames(); wxArrayInt GetKeyFrames();
bool QuickTimeVideoProvider::AreKeyFramesLoaded(); bool QuickTimeVideoProvider::AreKeyFramesLoaded();
Aegisub::String GetDecoderName() { return L"QuickTime"; }; wxString GetDecoderName() { return L"QuickTime"; };
bool IsNativelyByFrames() { return true; }; bool IsNativelyByFrames() { return true; };
int GetDesiredCacheSize() { return 8; }; int GetDesiredCacheSize() { return 8; };
}; };
@ -118,7 +118,7 @@ public:
class QuickTimeVideoProviderFactory : public VideoProviderFactory { class QuickTimeVideoProviderFactory : public VideoProviderFactory {
public: public:
VideoProvider *CreateProvider(Aegisub::String video) { return new QuickTimeVideoProvider(video); } VideoProvider *CreateProvider(wxString video) { return new QuickTimeVideoProvider(video); }
}; };

View file

@ -47,7 +47,7 @@
YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(Aegisub::String filename) { YUV4MPEGVideoProvider::YUV4MPEGVideoProvider(wxString filename) {
sf = NULL; sf = NULL;
w = 0; w = 0;
h = 0; h = 0;
@ -82,7 +82,7 @@ YUV4MPEGVideoProvider::~YUV4MPEGVideoProvider() {
} }
void YUV4MPEGVideoProvider::LoadVideo(const Aegisub::String _filename) { void YUV4MPEGVideoProvider::LoadVideo(const wxString _filename) {
Close(); Close();
wxString filename = wxFileName(wxString(_filename.wc_str(), wxConvFile)).GetShortPath(); wxString filename = wxFileName(wxString(_filename.wc_str(), wxConvFile)).GetShortPath();

View file

@ -108,7 +108,7 @@ private:
wxString errmsg; wxString errmsg;
void LoadVideo(const Aegisub::String filename); void LoadVideo(const wxString filename);
void Close(); void Close();
void CheckFileFormat(); void CheckFileFormat();
@ -118,7 +118,7 @@ private:
int IndexFile(); int IndexFile();
public: public:
YUV4MPEGVideoProvider(Aegisub::String filename); YUV4MPEGVideoProvider(wxString filename);
~YUV4MPEGVideoProvider(); ~YUV4MPEGVideoProvider();
const AegiVideoFrame GetFrame(int n); const AegiVideoFrame GetFrame(int n);
@ -132,7 +132,7 @@ public:
wxArrayInt GetKeyFrames() { return wxArrayInt(); } wxArrayInt GetKeyFrames() { return wxArrayInt(); }
bool IsVFR() { return false; }; bool IsVFR() { return false; };
FrameRate GetTrueFrameRate() { return FrameRate(); } FrameRate GetTrueFrameRate() { return FrameRate(); }
Aegisub::String GetDecoderName() { return L"YUV4MPEG"; } wxString GetDecoderName() { return L"YUV4MPEG"; }
int GetDesiredCacheSize() { return 8; } int GetDesiredCacheSize() { return 8; }
}; };