提交 9a9e457d 编写于 作者: M Michel Promonet

Allow to set av_log_set_level to reduce ffmpeg level below AV_LOG_ERROR

上级 c316dbe2
......@@ -850,6 +850,7 @@ static void ffmpeg_log_callback(void *ptr, int level, const char *fmt, va_list v
static bool skip_header = false;
static int prev_level = -1;
CV_UNUSED(ptr);
if (level>av_log_get_level()) return;
if (!skip_header || level != prev_level) printf("[OPENCV:FFMPEG:%02d] ", level);
vprintf(fmt, vargs);
size_t fmt_len = strlen(fmt);
......@@ -866,15 +867,21 @@ class InternalFFMpegRegister
static void initLogger_()
{
#ifndef NO_GETENV
#ifndef NO_GETENV
char* debug_option = getenv("OPENCV_FFMPEG_DEBUG");
if (debug_option != NULL)
char* level_option = getenv("OPENCV_FFMPEG_LOGLEVEL");
int level = AV_LOG_VERBOSE;
if (level_option != NULL)
{
level = atoi(level_option);
}
if ( (debug_option != NULL) || (level_option != NULL) )
{
av_log_set_level(AV_LOG_VERBOSE);
av_log_set_level(level);
av_log_set_callback(ffmpeg_log_callback);
}
else
#endif
#endif
{
av_log_set_level(AV_LOG_ERROR);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册