forked from mia/Aegisub
Check the error code when FFMS2 can't create an indexer
Creating an indexer can fail for reasons other than the file not existing. This check is still not completely correct, since FFMS2 uses the wrong error codes in a bunch of places.
This commit is contained in:
parent
eab11666a9
commit
a2c14e9c5f
2 changed files with 12 additions and 4 deletions
|
@ -72,8 +72,12 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
|
|||
wxString FileNameShort = wxFileName(filename).GetShortPath();
|
||||
|
||||
FFMS_Indexer *Indexer = FFMS_CreateIndexer(FileNameShort.utf8_str(), &ErrInfo);
|
||||
if (!Indexer)
|
||||
throw agi::FileNotFoundError(ErrInfo.Buffer);
|
||||
if (!Indexer) {
|
||||
if (ErrInfo.SubType == FFMS_ERROR_FILE_READ)
|
||||
throw agi::FileNotFoundError(ErrInfo.Buffer);
|
||||
else
|
||||
throw agi::AudioDataNotFoundError(ErrInfo.Buffer, 0);
|
||||
}
|
||||
|
||||
std::map<int,wxString> TrackList = GetTracksOfType(Indexer, FFMS_TYPE_AUDIO);
|
||||
if (TrackList.size() <= 0)
|
||||
|
|
|
@ -85,8 +85,12 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
|
|||
wxString FileNameShort = wxFileName(filename).GetShortPath();
|
||||
|
||||
FFMS_Indexer *Indexer = FFMS_CreateIndexer(FileNameShort.utf8_str(), &ErrInfo);
|
||||
if (!Indexer)
|
||||
throw agi::FileNotFoundError(ErrInfo.Buffer);
|
||||
if (!Indexer) {
|
||||
if (ErrInfo.SubType == FFMS_ERROR_FILE_READ)
|
||||
throw agi::FileNotFoundError(ErrInfo.Buffer);
|
||||
else
|
||||
throw VideoNotSupported(ErrInfo.Buffer);
|
||||
}
|
||||
|
||||
std::map<int,wxString> TrackList = GetTracksOfType(Indexer, FFMS_TYPE_VIDEO);
|
||||
if (TrackList.size() <= 0)
|
||||
|
|
Loading…
Reference in a new issue