mirror of https://github.com/odrling/Aegisub
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:
parent
ab1993467a
commit
93477952c0
|
@ -126,15 +126,8 @@ bool QuickTimeVideoProvider::CanOpen(const Handle& dataref, const OSType dataref
|
||||||
void QuickTimeVideoProvider::LoadVideo(const wxString _filename) {
|
void QuickTimeVideoProvider::LoadVideo(const wxString _filename) {
|
||||||
Close();
|
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;
|
OSType in_dataref_type;
|
||||||
qt_err = QTNewDataReferenceFromFullPathCFString(qt_filename, kQTNativeDefaultPathStyle, 0,
|
wxStringToDataRef(_filename, &in_dataref, &in_dataref_type);
|
||||||
&in_dataref, &in_dataref_type);
|
|
||||||
QTCheckError(qt_err, wxString(_T("Failed to convert filename to data reference")));
|
|
||||||
|
|
||||||
// verify that file is openable
|
// verify that file is openable
|
||||||
if (!CanOpen(in_dataref, in_dataref_type))
|
if (!CanOpen(in_dataref, in_dataref_type))
|
||||||
|
@ -294,13 +287,6 @@ const AegiVideoFrame QuickTimeVideoProvider::GetFrame(int n) {
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Utility functions
|
// 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() {
|
int QuickTimeVideoProvider::GetWidth() {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,6 @@ private:
|
||||||
std::vector<int> IndexFile();
|
std::vector<int> IndexFile();
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
void QTCheckError(OSErr err, wxString errmsg);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QuickTimeVideoProvider(wxString filename);
|
QuickTimeVideoProvider(wxString filename);
|
||||||
~QuickTimeVideoProvider();
|
~QuickTimeVideoProvider();
|
||||||
|
|
Loading…
Reference in New Issue