|
|
@ -92,40 +92,47 @@ static void sanitize(uint8_t *line){ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) |
|
|
|
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, |
|
|
|
|
|
|
|
char *line, int line_size, int *print_prefix) |
|
|
|
{ |
|
|
|
{ |
|
|
|
static int print_prefix = 1; |
|
|
|
|
|
|
|
static int count; |
|
|
|
|
|
|
|
static char prev[1024]; |
|
|
|
|
|
|
|
char line[1024]; |
|
|
|
|
|
|
|
static int is_atty; |
|
|
|
|
|
|
|
AVClass* avc = ptr ? *(AVClass **) ptr : NULL; |
|
|
|
AVClass* avc = ptr ? *(AVClass **) ptr : NULL; |
|
|
|
if (level > av_log_level) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
line[0] = 0; |
|
|
|
line[0] = 0; |
|
|
|
#undef fprintf |
|
|
|
if (*print_prefix && avc) { |
|
|
|
if (print_prefix && avc) { |
|
|
|
|
|
|
|
if (avc->parent_log_context_offset) { |
|
|
|
if (avc->parent_log_context_offset) { |
|
|
|
AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) + |
|
|
|
AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) + |
|
|
|
avc->parent_log_context_offset); |
|
|
|
avc->parent_log_context_offset); |
|
|
|
if (parent && *parent) { |
|
|
|
if (parent && *parent) { |
|
|
|
snprintf(line, sizeof(line), "[%s @ %p] ", |
|
|
|
snprintf(line, line_size, "[%s @ %p] ", |
|
|
|
(*parent)->item_name(parent), parent); |
|
|
|
(*parent)->item_name(parent), parent); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
snprintf(line + strlen(line), sizeof(line) - strlen(line), "[%s @ %p] ", |
|
|
|
snprintf(line + strlen(line), line_size - strlen(line), "[%s @ %p] ", |
|
|
|
avc->item_name(ptr), ptr); |
|
|
|
avc->item_name(ptr), ptr); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); |
|
|
|
vsnprintf(line + strlen(line), line_size - strlen(line), fmt, vl); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*print_prefix = strlen(line) && line[strlen(line) - 1] == '\n'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
static int print_prefix = 1; |
|
|
|
|
|
|
|
static int count; |
|
|
|
|
|
|
|
static char prev[1024]; |
|
|
|
|
|
|
|
char line[1024]; |
|
|
|
|
|
|
|
static int is_atty; |
|
|
|
|
|
|
|
|
|
|
|
print_prefix = strlen(line) && line[strlen(line) - 1] == '\n'; |
|
|
|
if (level > av_log_level) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
av_log_format_line(ptr, level, fmt, vl, line, sizeof(line), &print_prefix); |
|
|
|
|
|
|
|
|
|
|
|
#if HAVE_ISATTY |
|
|
|
#if HAVE_ISATTY |
|
|
|
if (!is_atty) |
|
|
|
if (!is_atty) |
|
|
|
is_atty = isatty(2) ? 1 : -1; |
|
|
|
is_atty = isatty(2) ? 1 : -1; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef fprintf |
|
|
|
if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ |
|
|
|
if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){ |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
if (is_atty == 1) |
|
|
|
if (is_atty == 1) |
|
|
|