mirror of https://github.com/odrling/Aegisub
FFmpegSource2: no more exceptions
Originally committed to SVN as r2375.
This commit is contained in:
parent
b013a92923
commit
6898afabac
|
@ -26,13 +26,9 @@ AvisynthVideoSource::AvisynthVideoSource(const char *SourceFile, int Track, Fram
|
|||
SWS = NULL;
|
||||
ConvertToFormat = PIX_FMT_NONE;
|
||||
|
||||
try {
|
||||
VS = FFMS_CreateVideoSource(SourceFile, Track, TrackIndices, PP, Threads, SeekMode, ErrorMsg, MsgSize);
|
||||
if (!VS)
|
||||
throw ErrorMsg;
|
||||
} catch (...) {
|
||||
Env->ThrowError(ErrorMsg);
|
||||
}
|
||||
|
||||
const VideoProperties VP = *FFMS_GetVideoProperties(VS);
|
||||
|
||||
|
@ -145,13 +141,9 @@ PVideoFrame AvisynthVideoSource::GetFrame(int n, IScriptEnvironment *Env) {
|
|||
AvisynthAudioSource::AvisynthAudioSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, IScriptEnvironment* Env, char *ErrorMsg, unsigned MsgSize) {
|
||||
memset(&VI, 0, sizeof(VI));
|
||||
|
||||
try {
|
||||
AS = FFMS_CreateAudioSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
||||
if (!AS)
|
||||
throw ErrorMsg;
|
||||
} catch (...) {
|
||||
Env->ThrowError(ErrorMsg);
|
||||
}
|
||||
|
||||
const AudioProperties AP = *FFMS_GetAudioProperties(AS);
|
||||
|
||||
|
|
|
@ -31,19 +31,27 @@ FFMS_API(void) FFMS_Init() {
|
|||
}
|
||||
|
||||
FFMS_API(VideoBase *) FFMS_CreateVideoSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, const char *PP, int Threads, int SeekMode, char *ErrorMsg, unsigned MsgSize) {
|
||||
try {
|
||||
switch (TrackIndices->Decoder) {
|
||||
case 0: return new FFVideoSource(SourceFile, Track, TrackIndices, PP, Threads, SeekMode, ErrorMsg, MsgSize);
|
||||
case 1: return new MatroskaVideoSource(SourceFile, Track, TrackIndices, PP, Threads, ErrorMsg, MsgSize);
|
||||
default: return NULL;
|
||||
}
|
||||
} catch (...) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FFMS_API(AudioBase *) FFMS_CreateAudioSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize) {
|
||||
try {
|
||||
switch (TrackIndices->Decoder) {
|
||||
//case 0: return new FFVideoSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
||||
case 1: return new MatroskaAudioSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
||||
default: return NULL;
|
||||
}
|
||||
} catch (...) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FFMS_API(void) FFMS_DestroyVideoSource(VideoBase *VB) {
|
||||
|
|
Loading…
Reference in New Issue