Skip to content

Commit

Permalink
Filter ffmpeg logs by the av_log level
Browse files Browse the repository at this point in the history
This adds a check in the FFmpegInteropLogging to filter logs per the set av_log level.
  • Loading branch information
Peter Dunshee committed Apr 10, 2017
1 parent ac5d8b1 commit 6b645c0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions FFmpegInterop/Source/FFmpegInteropLogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ void FFmpegInteropLogging::SetLogProvider(ILogProvider^ logProvider)
s_pLogProvider = logProvider;
av_log_set_callback([](void*avcl, int level, const char *fmt, va_list vl)->void
{
if (s_pLogProvider != nullptr)
if (level <= av_log_get_level())
{
char pLine[1000];
int printPrefix = 1;
av_log_format_line(avcl, level, fmt, vl, pLine, sizeof(pLine), &printPrefix);
if (s_pLogProvider != nullptr)
{
char pLine[1000];
int printPrefix = 1;
av_log_format_line(avcl, level, fmt, vl, pLine, sizeof(pLine), &printPrefix);

wchar_t wLine[sizeof(pLine)];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pLine, -1, wLine, sizeof(pLine));
s_pLogProvider->Log((LogLevel)level, ref new String(wLine));
wchar_t wLine[sizeof(pLine)];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pLine, -1, wLine, sizeof(pLine));
s_pLogProvider->Log((LogLevel)level, ref new String(wLine));
}
}
});
}
Expand Down

0 comments on commit 6b645c0

Please sign in to comment.