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;
|
SWS = NULL;
|
||||||
ConvertToFormat = PIX_FMT_NONE;
|
ConvertToFormat = PIX_FMT_NONE;
|
||||||
|
|
||||||
try {
|
VS = FFMS_CreateVideoSource(SourceFile, Track, TrackIndices, PP, Threads, SeekMode, ErrorMsg, MsgSize);
|
||||||
VS = FFMS_CreateVideoSource(SourceFile, Track, TrackIndices, PP, Threads, SeekMode, ErrorMsg, MsgSize);
|
if (!VS)
|
||||||
if (!VS)
|
|
||||||
throw ErrorMsg;
|
|
||||||
} catch (...) {
|
|
||||||
Env->ThrowError(ErrorMsg);
|
Env->ThrowError(ErrorMsg);
|
||||||
}
|
|
||||||
|
|
||||||
const VideoProperties VP = *FFMS_GetVideoProperties(VS);
|
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) {
|
AvisynthAudioSource::AvisynthAudioSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, IScriptEnvironment* Env, char *ErrorMsg, unsigned MsgSize) {
|
||||||
memset(&VI, 0, sizeof(VI));
|
memset(&VI, 0, sizeof(VI));
|
||||||
|
|
||||||
try {
|
AS = FFMS_CreateAudioSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
||||||
AS = FFMS_CreateAudioSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
if (!AS)
|
||||||
if (!AS)
|
|
||||||
throw ErrorMsg;
|
|
||||||
} catch (...) {
|
|
||||||
Env->ThrowError(ErrorMsg);
|
Env->ThrowError(ErrorMsg);
|
||||||
}
|
|
||||||
|
|
||||||
const AudioProperties AP = *FFMS_GetAudioProperties(AS);
|
const AudioProperties AP = *FFMS_GetAudioProperties(AS);
|
||||||
|
|
||||||
|
|
|
@ -31,18 +31,26 @@ 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) {
|
FFMS_API(VideoBase *) FFMS_CreateVideoSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, const char *PP, int Threads, int SeekMode, char *ErrorMsg, unsigned MsgSize) {
|
||||||
switch (TrackIndices->Decoder) {
|
try {
|
||||||
case 0: return new FFVideoSource(SourceFile, Track, TrackIndices, PP, Threads, SeekMode, ErrorMsg, MsgSize);
|
switch (TrackIndices->Decoder) {
|
||||||
case 1: return new MatroskaVideoSource(SourceFile, Track, TrackIndices, PP, Threads, ErrorMsg, MsgSize);
|
case 0: return new FFVideoSource(SourceFile, Track, TrackIndices, PP, Threads, SeekMode, ErrorMsg, MsgSize);
|
||||||
default: return NULL;
|
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) {
|
FFMS_API(AudioBase *) FFMS_CreateAudioSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize) {
|
||||||
switch (TrackIndices->Decoder) {
|
try {
|
||||||
//case 0: return new FFVideoSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
switch (TrackIndices->Decoder) {
|
||||||
case 1: return new MatroskaAudioSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
//case 0: return new FFVideoSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
||||||
default: return NULL;
|
case 1: return new MatroskaAudioSource(SourceFile, Track, TrackIndices, ErrorMsg, MsgSize);
|
||||||
|
default: return NULL;
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue