diff --git a/aegisub/FFmpegSource2/ffavsfilters.cpp b/aegisub/FFmpegSource2/ffavsfilters.cpp index c510afedf..1c5d2955c 100644 --- a/aegisub/FFmpegSource2/ffavsfilters.cpp +++ b/aegisub/FFmpegSource2/ffavsfilters.cpp @@ -219,9 +219,13 @@ AVSValue __cdecl CreateSWScale(AVSValue Args, void* UserData, IScriptEnvironment return new SWScale(Args[0].AsClip(), Args[1].AsInt(0), Args[2].AsInt(0), Args[3].AsString("BICUBIC"), Args[4].AsString(""), Env); } -AVSValue __cdecl FFNoLog(AVSValue Args, void* UserData, IScriptEnvironment* Env) { - FFMS_NoLog(); - return 0; +AVSValue __cdecl FFGetLogLevel(AVSValue Args, void* UserData, IScriptEnvironment* Env) { + return FFMS_GetLogLevel(); +} + +AVSValue __cdecl FFSetLogLevel(AVSValue Args, void* UserData, IScriptEnvironment* Env) { + FFMS_SetLogLevel(Args[0].AsInt()); + return FFMS_GetLogLevel(); } extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* Env) { @@ -230,7 +234,8 @@ extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScri Env->AddFunction("FFAudioSource", "[source]s[track]i[cache]b[cachefile]s", CreateFFAudioSource, 0); Env->AddFunction("FFPP", "c[pp]s", CreateFFPP, 0); Env->AddFunction("SWScale", "c[width]i[height]i[resizer]s[colorspace]s", CreateSWScale, 0); - Env->AddFunction("FFNoLog", "", FFNoLog, 0); + Env->AddFunction("FFGetLogLevel", "", FFGetLogLevel, 0); + Env->AddFunction("FFSetLogLevel", "i", FFSetLogLevel, 0); return "FFmpegSource - The Second Coming"; } diff --git a/aegisub/FFmpegSource2/ffms.cpp b/aegisub/FFmpegSource2/ffms.cpp index 213a20133..0d6ee670b 100644 --- a/aegisub/FFmpegSource2/ffms.cpp +++ b/aegisub/FFmpegSource2/ffms.cpp @@ -57,12 +57,18 @@ FrameInfo::FrameInfo(int64_t SampleStart, int64_t FilePos, unsigned int FrameSiz FFMS_API(void) FFMS_Init() { static bool InitDone = false; - if (!InitDone) + if (!InitDone) { av_register_all(); + av_log_set_level(AV_LOG_QUIET); + } InitDone = true; } -FFMS_API(void) FFMS_NoLog() { +FFMS_API(int) FFMS_GetLogLevel() { + return av_log_get_level(); +} + +FFMS_API(void) FFMS_SetLogLevel(int Level) { av_log_set_level(AV_LOG_QUIET); } diff --git a/aegisub/FFmpegSource2/ffms.h b/aegisub/FFmpegSource2/ffms.h index 1a8773a91..335395c5c 100644 --- a/aegisub/FFmpegSource2/ffms.h +++ b/aegisub/FFmpegSource2/ffms.h @@ -46,6 +46,7 @@ class AudioBase; class FrameIndex; class FrameInfoVector; +typedef int (FFMS_CC *IndexCallback)(int State, int64_t Current, int64_t Total, void *Private); typedef int (FFMS_CC *IndexCallback)(int State, int64_t Current, int64_t Total, void *Private); enum FFMS_SeekMode { @@ -112,6 +113,7 @@ struct AudioProperties { int SampleRate; int Channels; int BitsPerSample; + int Delay; bool Float; int64_t NumSamples; }; @@ -119,7 +121,8 @@ struct AudioProperties { // Most functions return 0 on success // Functions without error message output can be assumed to never fail FFMS_API(void) FFMS_Init(); -FFMS_API(void) FFMS_NoLog(); +FFMS_API(int) FFMS_GetLogLevel(); +FFMS_API(void) FFMS_SetLogLevel(int Level); 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(AudioBase *) FFMS_CreateAudioSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize); FFMS_API(void) FFMS_DestroyVideoSource(VideoBase *VB); @@ -147,4 +150,5 @@ FFMS_API(FrameIndex *) FFMS_MakeIndex(const char *SourceFile, int IndexMask, int FFMS_API(FrameIndex *) FFMS_ReadIndex(const char *IndexFile, char *ErrorMsg, unsigned MsgSize); FFMS_API(int) FFMS_WriteIndex(const char *IndexFile, FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize); FFMS_API(int) FFMS_GetPixFmt(const char *Name); +//FFMS_API(int) FFMS_DefaultAudioName(const char *SourceFile, int Track, const AudioProperties *AP, char *FileName, unsigned FNSize); #endif diff --git a/aegisub/FFmpegSource2/ffms2.html b/aegisub/FFmpegSource2/ffms2.html index 84f71d8cf..acb768c8f 100644 --- a/aegisub/FFmpegSource2/ffms2.html +++ b/aegisub/FFmpegSource2/ffms2.html @@ -60,10 +60,13 @@ Opens files using ffmpeg and nothing else. May be frame accurate on good days. T Separate postprocessing which also seems to include a few simple deinterlacers

-FFNoLog()
- Disable all logging output from FFmpeg +FFSetLogLevel(int Level)
+ Sets the log FFmpeg logging level, defaults to quiet (-8) and the FFmpeg default is 16, all different values can be found in avutil/log.h

+FFGetLogLevel()
+ Returns the current level of logging as an int +

source: @@ -233,6 +236,11 @@ Note that --enable-w32threads is required for multithreaded decoding to work.

Changes