#include "config.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_IO_H
#include <io.h>
#endif
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bprint.h"
#include "common.h"
#include "internal.h"
#include "log.h"
#include "thread.h"
static AVMutex mutex = …;
#define LINE_SZ …
#if HAVE_VALGRIND_VALGRIND_H && CONFIG_VALGRIND_BACKTRACE
#include <valgrind/valgrind.h>
#define BACKTRACE_LOGLEVEL …
#endif
static int av_log_level = …;
static int flags;
#define NB_LEVELS …
#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
#include <windows.h>
static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
[AV_LOG_PANIC /8] = 12,
[AV_LOG_FATAL /8] = 12,
[AV_LOG_ERROR /8] = 12,
[AV_LOG_WARNING/8] = 14,
[AV_LOG_INFO /8] = 7,
[AV_LOG_VERBOSE/8] = 10,
[AV_LOG_DEBUG /8] = 10,
[AV_LOG_TRACE /8] = 8,
[16+AV_CLASS_CATEGORY_NA ] = 7,
[16+AV_CLASS_CATEGORY_INPUT ] = 13,
[16+AV_CLASS_CATEGORY_OUTPUT ] = 5,
[16+AV_CLASS_CATEGORY_MUXER ] = 13,
[16+AV_CLASS_CATEGORY_DEMUXER ] = 5,
[16+AV_CLASS_CATEGORY_ENCODER ] = 11,
[16+AV_CLASS_CATEGORY_DECODER ] = 3,
[16+AV_CLASS_CATEGORY_FILTER ] = 10,
[16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 9,
[16+AV_CLASS_CATEGORY_SWSCALER ] = 7,
[16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 7,
[16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 13,
[16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 5,
[16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 13,
[16+AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT ] = 5,
[16+AV_CLASS_CATEGORY_DEVICE_OUTPUT ] = 13,
[16+AV_CLASS_CATEGORY_DEVICE_INPUT ] = 5,
};
static int16_t background, attr_orig;
static HANDLE con;
#else
static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = …;
#endif
static int use_color = …;
#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
static void win_console_puts(const char *str)
{
const uint8_t *q = str;
uint16_t line[LINE_SZ];
while (*q) {
uint16_t *buf = line;
DWORD nb_chars = 0;
DWORD written;
while (*q && nb_chars < LINE_SZ - 1) {
uint32_t ch;
uint16_t tmp;
GET_UTF8(ch, *q ? *q++ : 0, ch = 0xfffd; goto continue_on_invalid;)
continue_on_invalid:
PUT_UTF16(ch, tmp, *buf++ = tmp; nb_chars++;)
}
WriteConsoleW(con, line, nb_chars, &written, NULL);
}
}
#endif
static void check_color_terminal(void)
{ … }
static void ansi_fputs(int level, int tint, const char *str, int local_use_color)
{ … }
static void colored_fputs(int level, int tint, const char *str)
{ … }
const char *av_default_item_name(void *ptr)
{ … }
AVClassCategory av_default_get_category(void *ptr)
{ … }
static void sanitize(uint8_t *line){ … }
static int get_category(void *ptr){ … }
static const char *get_level_str(int level)
{ … }
static const char *item_name(void *obj, const AVClass *cls)
{ … }
static void format_line(void *avcl, int level, const char *fmt, va_list vl,
AVBPrint part[4], int *print_prefix, int type[2])
{ … }
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
char *line, int line_size, int *print_prefix)
{ … }
int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
char *line, int line_size, int *print_prefix)
{ … }
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
{ … }
static void (*av_log_callback)(void*, int, const char*, va_list) = …;
#if !defined(CHROMIUM_NO_LOGGING)
void av_log(void* avcl, int level, const char *fmt, ...)
{ … }
#endif
#if !defined(CHROMIUM_NO_LOGGING)
void av_log_once(void* avcl, int initial_level, int subsequent_level, int *state, const char *fmt, ...)
{ … }
#endif
#if !defined(CHROMIUM_NO_LOGGING)
void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
{ … }
#endif
int av_log_get_level(void)
{ … }
void av_log_set_level(int level)
{ … }
void av_log_set_flags(int arg)
{ … }
int av_log_get_flags(void)
{ … }
void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
{ … }
#if !defined(CHROMIUM_NO_LOGGING)
static void missing_feature_sample(int sample, void *avc, const char *msg,
va_list argument_list)
{ … }
void avpriv_request_sample(void *avc, const char *msg, ...)
{ … }
void avpriv_report_missing_feature(void *avc, const char *msg, ...)
{ … }
#endif