Factor a few things out of the QT video provider into a common QT class in preparation for eventually adding an audio provider sometime down the line.

Originally committed to SVN as r3225.
This commit is contained in:
Karl Blomster 2009-07-23 20:17:09 +00:00
parent ab1993467a
commit 93477952c0
2 changed files with 1 additions and 17 deletions

View file

@ -126,15 +126,8 @@ bool QuickTimeVideoProvider::CanOpen(const Handle& dataref, const OSType dataref
void QuickTimeVideoProvider::LoadVideo(const wxString _filename) {
Close();
// convert filename, first to a CFStringRef...
wxString wx_filename = wxFileName(_filename).GetShortPath();
CFStringRef qt_filename = CFStringCreateWithCString(NULL, wx_filename.utf8_str(), kCFStringEncodingUTF8);
// and then to a data reference
OSType in_dataref_type;
qt_err = QTNewDataReferenceFromFullPathCFString(qt_filename, kQTNativeDefaultPathStyle, 0,
&in_dataref, &in_dataref_type);
QTCheckError(qt_err, wxString(_T("Failed to convert filename to data reference")));
wxStringToDataRef(_filename, &in_dataref, &in_dataref_type);
// verify that file is openable
if (!CanOpen(in_dataref, in_dataref_type))
@ -294,13 +287,6 @@ const AegiVideoFrame QuickTimeVideoProvider::GetFrame(int n) {
///////////////
// Utility functions
void QuickTimeVideoProvider::QTCheckError(OSErr err, wxString errmsg) {
if (err != noErr)
throw errmsg;
/* CheckError(err, errmsg.c_str()); // I wonder if this actually works on Mac, and if so, what it does */
}
int QuickTimeVideoProvider::GetWidth() {
return w;
}

View file

@ -70,8 +70,6 @@ private:
std::vector<int> IndexFile();
void Close();
void QTCheckError(OSErr err, wxString errmsg);
public:
QuickTimeVideoProvider(wxString filename);
~QuickTimeVideoProvider();