mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Check log level from ffmpeg, use levels.
This commit is contained in:
parent
36fd5df53f
commit
8fb2cb5bf6
1 changed files with 22 additions and 4 deletions
|
@ -85,17 +85,35 @@ static int getPixelFormatBytes(int pspFormat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffmpeg_logger(void *, int, const char *format, va_list va_args) {
|
void ffmpeg_logger(void *, int level, const char *format, va_list va_args) {
|
||||||
|
// We're still called even if the level doesn't match.
|
||||||
|
if (level > av_log_get_level())
|
||||||
|
return;
|
||||||
|
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
vsprintf(tmp, format, va_args);
|
vsnprintf(tmp, sizeof(tmp), format, va_args);
|
||||||
|
tmp[sizeof(tmp) - 1] = '\0';
|
||||||
|
|
||||||
|
// Strip off any trailing newline.
|
||||||
|
size_t len = strlen(tmp);
|
||||||
|
if (tmp[len - 1] == '\n')
|
||||||
|
tmp[len - 1] = '\0';
|
||||||
|
|
||||||
|
// Let's color the log line appropriately.
|
||||||
|
if (level <= AV_LOG_PANIC) {
|
||||||
|
ERROR_LOG(ME, "%s", tmp);
|
||||||
|
} else if (level >= AV_LOG_VERBOSE) {
|
||||||
|
DEBUG_LOG(ME, "%s", tmp);
|
||||||
|
} else {
|
||||||
INFO_LOG(ME, "%s", tmp);
|
INFO_LOG(ME, "%s", tmp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool InitFFmpeg() {
|
bool InitFFmpeg() {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
av_log_set_level(AV_LOG_VERBOSE);
|
av_log_set_level(AV_LOG_VERBOSE);
|
||||||
#else
|
#else
|
||||||
av_log_set_level(AV_LOG_ERROR);
|
av_log_set_level(AV_LOG_WARNING);
|
||||||
#endif
|
#endif
|
||||||
av_log_set_callback(&ffmpeg_logger);
|
av_log_set_callback(&ffmpeg_logger);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue