FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
log.c
Go to the documentation of this file.
1 /*
2  * log functions
3  * Copyright (c) 2003 Michel Bardiaux
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * logging functions
25  */
26 
27 #include "config.h"
28 
29 #if HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
32 #if HAVE_IO_H
33 #include <io.h>
34 #endif
35 #include <inttypes.h>
36 #include <stdarg.h>
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <string.h>
40 #include "bprint.h"
41 #include "common.h"
42 #include "internal.h"
43 #include "log.h"
44 #include "thread.h"
45 #include "time.h"
46 #include "time_internal.h"
47 
49 
50 #define LINE_SZ 1024
51 
52 #if HAVE_VALGRIND_VALGRIND_H && CONFIG_VALGRIND_BACKTRACE
53 #include <valgrind/valgrind.h>
54 /* this is the log level at which valgrind will output a full backtrace */
55 #define BACKTRACE_LOGLEVEL AV_LOG_ERROR
56 #endif
57 
59 static int flags;
60 
61 #define NB_LEVELS 8
62 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
63 #include <windows.h>
64 static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
65  [AV_LOG_PANIC /8] = 12,
66  [AV_LOG_FATAL /8] = 12,
67  [AV_LOG_ERROR /8] = 12,
68  [AV_LOG_WARNING/8] = 14,
69  [AV_LOG_INFO /8] = 7,
70  [AV_LOG_VERBOSE/8] = 10,
71  [AV_LOG_DEBUG /8] = 10,
72  [AV_LOG_TRACE /8] = 8,
73  [16+AV_CLASS_CATEGORY_NA ] = 7,
74  [16+AV_CLASS_CATEGORY_INPUT ] = 13,
75  [16+AV_CLASS_CATEGORY_OUTPUT ] = 5,
76  [16+AV_CLASS_CATEGORY_MUXER ] = 13,
77  [16+AV_CLASS_CATEGORY_DEMUXER ] = 5,
78  [16+AV_CLASS_CATEGORY_ENCODER ] = 11,
79  [16+AV_CLASS_CATEGORY_DECODER ] = 3,
80  [16+AV_CLASS_CATEGORY_FILTER ] = 10,
91 };
92 
93 static int16_t background, attr_orig;
94 static HANDLE con;
95 #else
96 
97 static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
98  [AV_LOG_PANIC /8] = 52 << 16 | 196 << 8 | 0x41,
99  [AV_LOG_FATAL /8] = 208 << 8 | 0x41,
100  [AV_LOG_ERROR /8] = 196 << 8 | 0x11,
101  [AV_LOG_WARNING/8] = 226 << 8 | 0x03,
102  [AV_LOG_INFO /8] = 253 << 8 | 0x09,
103  [AV_LOG_VERBOSE/8] = 40 << 8 | 0x02,
104  [AV_LOG_DEBUG /8] = 34 << 8 | 0x02,
105  [AV_LOG_TRACE /8] = 34 << 8 | 0x07,
106  [16+AV_CLASS_CATEGORY_NA ] = 250 << 8 | 0x09,
107  [16+AV_CLASS_CATEGORY_INPUT ] = 219 << 8 | 0x15,
108  [16+AV_CLASS_CATEGORY_OUTPUT ] = 201 << 8 | 0x05,
109  [16+AV_CLASS_CATEGORY_MUXER ] = 213 << 8 | 0x15,
110  [16+AV_CLASS_CATEGORY_DEMUXER ] = 207 << 8 | 0x05,
111  [16+AV_CLASS_CATEGORY_ENCODER ] = 51 << 8 | 0x16,
112  [16+AV_CLASS_CATEGORY_DECODER ] = 39 << 8 | 0x06,
113  [16+AV_CLASS_CATEGORY_FILTER ] = 155 << 8 | 0x12,
114  [16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 192 << 8 | 0x14,
115  [16+AV_CLASS_CATEGORY_SWSCALER ] = 153 << 8 | 0x14,
116  [16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 147 << 8 | 0x14,
117  [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 213 << 8 | 0x15,
118  [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 207 << 8 | 0x05,
119  [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 213 << 8 | 0x15,
120  [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT ] = 207 << 8 | 0x05,
121  [16+AV_CLASS_CATEGORY_DEVICE_OUTPUT ] = 213 << 8 | 0x15,
122  [16+AV_CLASS_CATEGORY_DEVICE_INPUT ] = 207 << 8 | 0x05,
123 };
124 
125 #endif
126 static int use_color = -1;
127 
128 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
129 static void win_console_puts(const char *str)
130 {
131  const uint8_t *q = str;
132  uint16_t line[LINE_SZ];
133 
134  while (*q) {
135  uint16_t *buf = line;
136  DWORD nb_chars = 0;
137  DWORD written;
138 
139  while (*q && nb_chars < LINE_SZ - 1) {
140  uint32_t ch;
141  uint16_t tmp;
142 
143  GET_UTF8(ch, *q ? *q++ : 0, ch = 0xfffd; goto continue_on_invalid;)
144 continue_on_invalid:
145  PUT_UTF16(ch, tmp, *buf++ = tmp; nb_chars++;)
146  }
147 
148  WriteConsoleW(con, line, nb_chars, &written, NULL);
149  }
150 }
151 #endif
152 
153 static void check_color_terminal(void)
154 {
155  char *term = getenv("TERM");
156 
157 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
158  CONSOLE_SCREEN_BUFFER_INFO con_info;
159  DWORD dummy;
160  con = GetStdHandle(STD_ERROR_HANDLE);
161  if (con != INVALID_HANDLE_VALUE && !GetConsoleMode(con, &dummy))
162  con = INVALID_HANDLE_VALUE;
163  if (con != INVALID_HANDLE_VALUE) {
164  GetConsoleScreenBufferInfo(con, &con_info);
165  attr_orig = con_info.wAttributes;
166  background = attr_orig & 0xF0;
167  }
168 #endif
169 
170  if (getenv("AV_LOG_FORCE_NOCOLOR")) {
171  use_color = 0;
172  } else if (getenv("AV_LOG_FORCE_COLOR")) {
173  use_color = 1;
174  } else {
175 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
176  use_color = (con != INVALID_HANDLE_VALUE);
177 #elif HAVE_ISATTY
178  use_color = (term && isatty(2));
179 #else
180  use_color = 0;
181 #endif
182  }
183 
184  if (getenv("AV_LOG_FORCE_256COLOR") || term && strstr(term, "256color"))
185  use_color *= 256;
186 }
187 
188 static void ansi_fputs(int level, int tint, const char *str, int local_use_color)
189 {
190  if (local_use_color == 1) {
191  fprintf(stderr,
192  "\033[%"PRIu32";3%"PRIu32"m%s\033[0m",
193  (color[level] >> 4) & 15,
194  color[level] & 15,
195  str);
196  } else if (tint && use_color == 256) {
197  fprintf(stderr,
198  "\033[48;5;%"PRIu32"m\033[38;5;%dm%s\033[0m",
199  (color[level] >> 16) & 0xff,
200  tint,
201  str);
202  } else if (local_use_color == 256) {
203  fprintf(stderr,
204  "\033[48;5;%"PRIu32"m\033[38;5;%"PRIu32"m%s\033[0m",
205  (color[level] >> 16) & 0xff,
206  (color[level] >> 8) & 0xff,
207  str);
208  } else
209  fputs(str, stderr);
210 }
211 
212 static void colored_fputs(int level, int tint, const char *str)
213 {
214  int local_use_color;
215  if (!*str)
216  return;
217 
218  if (use_color < 0)
220 
221  if (level == AV_LOG_INFO/8) local_use_color = 0;
222  else local_use_color = use_color;
223 
224 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
225  if (con != INVALID_HANDLE_VALUE) {
226  if (local_use_color)
227  SetConsoleTextAttribute(con, background | color[level]);
228  win_console_puts(str);
229  if (local_use_color)
230  SetConsoleTextAttribute(con, attr_orig);
231  } else {
232  ansi_fputs(level, tint, str, local_use_color);
233  }
234 #else
235  ansi_fputs(level, tint, str, local_use_color);
236 #endif
237 
238 }
239 
240 const char *av_default_item_name(void *ptr)
241 {
242  return (*(AVClass **) ptr)->class_name;
243 }
244 
246 {
247  return (*(AVClass **) ptr)->category;
248 }
249 
250 static void sanitize(uint8_t *line){
251  while(*line){
252  if(*line < 0x08 || (*line > 0x0D && *line < 0x20))
253  *line='?';
254  line++;
255  }
256 }
257 
258 static int get_category(void *ptr){
259  AVClass *avc = *(AVClass **) ptr;
260  if( !avc
261  || (avc->version&0xFF)<100
262  || avc->version < (51 << 16 | 59 << 8)
263  || avc->category >= AV_CLASS_CATEGORY_NB) return AV_CLASS_CATEGORY_NA + 16;
264 
265  if(avc->get_category)
266  return avc->get_category(ptr) + 16;
267 
268  return avc->category + 16;
269 }
270 
271 static const char *get_level_str(int level)
272 {
273  switch (level) {
274  case AV_LOG_QUIET:
275  return "quiet";
276  case AV_LOG_DEBUG:
277  return "debug";
278  case AV_LOG_TRACE:
279  return "trace";
280  case AV_LOG_VERBOSE:
281  return "verbose";
282  case AV_LOG_INFO:
283  return "info";
284  case AV_LOG_WARNING:
285  return "warning";
286  case AV_LOG_ERROR:
287  return "error";
288  case AV_LOG_FATAL:
289  return "fatal";
290  case AV_LOG_PANIC:
291  return "panic";
292  default:
293  return "";
294  }
295 }
296 
297 static const char *item_name(void *obj, const AVClass *cls)
298 {
299  return (cls->item_name ? cls->item_name : av_default_item_name)(obj);
300 }
301 
302 static void format_date_now(AVBPrint* bp_time, int include_date)
303 {
304  struct tm *ptm, tmbuf;
305  const int64_t time_us = av_gettime();
306  const int64_t time_ms = time_us / 1000;
307  const time_t time_s = time_ms / 1000;
308  const int millisec = time_ms - (time_s * 1000);
309  ptm = localtime_r(&time_s, &tmbuf);
310  if (ptm) {
311  if (include_date)
312  av_bprint_strftime(bp_time, "%Y-%m-%d ", ptm);
313 
314  av_bprint_strftime(bp_time, "%H:%M:%S", ptm);
315  av_bprintf(bp_time, ".%03d ", millisec);
316  }
317 }
318 
319 static void format_line(void *avcl, int level, const char *fmt, va_list vl,
320  AVBPrint part[5], int *print_prefix, int type[2])
321 {
322  AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
326  av_bprint_init(part+3, 0, 65536);
328 
329  if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16;
330  if (*print_prefix && avc) {
331  if (avc->parent_log_context_offset) {
332  AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) +
334  if (parent && *parent) {
335  av_bprintf(part+0, "[%s @ %p] ",
336  item_name(parent, *parent), parent);
337  if(type) type[0] = get_category(parent);
338  }
339  }
340  av_bprintf(part+1, "[%s @ %p] ",
341  item_name(avcl, avc), avcl);
342  if(type) type[1] = get_category(avcl);
343  }
344 
345  if (*print_prefix && (level > AV_LOG_QUIET) && (flags & (AV_LOG_PRINT_TIME | AV_LOG_PRINT_DATETIME)))
347 
348  if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL))
349  av_bprintf(part+2, "[%s] ", get_level_str(level));
350 
351  av_vbprintf(part+3, fmt, vl);
352 
353  if(*part[0].str || *part[1].str || *part[2].str || *part[3].str) {
354  char lastc = part[3].len && part[3].len <= part[3].size ? part[3].str[part[3].len - 1] : 0;
355  *print_prefix = lastc == '\n' || lastc == '\r';
356  }
357 }
358 
359 void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
360  char *line, int line_size, int *print_prefix)
361 {
362  av_log_format_line2(ptr, level, fmt, vl, line, line_size, print_prefix);
363 }
364 
365 int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
366  char *line, int line_size, int *print_prefix)
367 {
368  AVBPrint part[5];
369  int ret;
370 
371  format_line(ptr, level, fmt, vl, part, print_prefix, NULL);
372  ret = snprintf(line, line_size, "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
373  av_bprint_finalize(part+3, NULL);
374  return ret;
375 }
376 
377 void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
378 {
379  static int print_prefix = 1;
380  static int count;
381  static char prev[LINE_SZ];
382  AVBPrint part[5];
383  char line[LINE_SZ];
384  static int is_atty;
385  int type[2];
386  unsigned tint = 0;
387 
388  if (level >= 0) {
389  tint = level & 0xff00;
390  level &= 0xff;
391  }
392 
393  if (level > av_log_level)
394  return;
396 
397  format_line(ptr, level, fmt, vl, part, &print_prefix, type);
398  snprintf(line, sizeof(line), "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
399 
400 #if HAVE_ISATTY
401  if (!is_atty)
402  is_atty = isatty(2) ? 1 : -1;
403 #endif
404 
405  if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev) &&
406  *line && line[strlen(line) - 1] != '\r'){
407  count++;
408  if (is_atty == 1)
409  fprintf(stderr, " Last message repeated %d times\r", count);
410  goto end;
411  }
412  if (count > 0) {
413  fprintf(stderr, " Last message repeated %d times\n", count);
414  count = 0;
415  }
416  strcpy(prev, line);
417 
418  sanitize(part[4].str);
419  colored_fputs(7, 0, part[4].str);
420  sanitize(part[0].str);
421  colored_fputs(type[0], 0, part[0].str);
422  sanitize(part[1].str);
423  colored_fputs(type[1], 0, part[1].str);
424  sanitize(part[2].str);
425  colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, part[2].str);
426  sanitize(part[3].str);
427  colored_fputs(av_clip(level >> 3, 0, NB_LEVELS - 1), tint >> 8, part[3].str);
428 
429 #if CONFIG_VALGRIND_BACKTRACE
430  if (level <= BACKTRACE_LOGLEVEL)
431  VALGRIND_PRINTF_BACKTRACE("%s", "");
432 #endif
433 end:
434  av_bprint_finalize(part+3, NULL);
436 }
437 
438 static void (*av_log_callback)(void*, int, const char*, va_list) =
440 
441 void av_log(void* avcl, int level, const char *fmt, ...)
442 {
443  va_list vl;
444  va_start(vl, fmt);
445  av_vlog(avcl, level, fmt, vl);
446  va_end(vl);
447 }
448 
449 void av_log_once(void* avcl, int initial_level, int subsequent_level, int *state, const char *fmt, ...)
450 {
451  va_list vl;
452  va_start(vl, fmt);
453  av_vlog(avcl, *state ? subsequent_level : initial_level, fmt, vl);
454  va_end(vl);
455  *state = 1;
456 }
457 
458 void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
459 {
460  AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
461  void (*log_callback)(void*, int, const char*, va_list) = av_log_callback;
462  if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) &&
464  level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset);
465  if (log_callback)
466  log_callback(avcl, level, fmt, vl);
467 }
468 
470 {
471  return av_log_level;
472 }
473 
475 {
477 }
478 
480 {
481  flags = arg;
482 }
483 
485 {
486  return flags;
487 }
488 
489 void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
490 {
492 }
493 
494 static void missing_feature_sample(int sample, void *avc, const char *msg,
495  va_list argument_list)
496 {
497  av_vlog(avc, AV_LOG_WARNING, msg, argument_list);
498  av_log(avc, AV_LOG_WARNING, " is not implemented. Update your FFmpeg "
499  "version to the newest one from Git. If the problem still "
500  "occurs, it means that your file has a feature which has not "
501  "been implemented.\n");
502  if (sample)
503  av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
504  "of this file to https://streams.videolan.org/upload/ "
505  "and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)\n");
506 }
507 
508 void avpriv_request_sample(void *avc, const char *msg, ...)
509 {
510  va_list argument_list;
511 
512  va_start(argument_list, msg);
513  missing_feature_sample(1, avc, msg, argument_list);
514  va_end(argument_list);
515 }
516 
517 void avpriv_report_missing_feature(void *avc, const char *msg, ...)
518 {
519  va_list argument_list;
520 
521  va_start(argument_list, msg);
522  missing_feature_sample(0, avc, msg, argument_list);
523  va_end(argument_list);
524 }
av_vlog
void av_vlog(void *avcl, int level, const char *fmt, va_list vl)
Send the specified message to the log if the level is less than or equal to the current av_log_level.
Definition: log.c:458
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
level
uint8_t level
Definition: svq3.c:205
av_clip
#define av_clip
Definition: common.h:100
AV_CLASS_CATEGORY_DECODER
@ AV_CLASS_CATEGORY_DECODER
Definition: log.h:35
color
Definition: vf_paletteuse.c:513
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
AV_LOG_QUIET
#define AV_LOG_QUIET
Print no output.
Definition: log.h:192
thread.h
AV_LOG_PANIC
#define AV_LOG_PANIC
Something went really wrong and we will crash now.
Definition: log.h:197
missing_feature_sample
static void missing_feature_sample(int sample, void *avc, const char *msg, va_list argument_list)
Definition: log.c:494
int64_t
long long int64_t
Definition: coverity.c:34
AVClass::version
int version
LIBAVUTIL_VERSION with which this structure was created.
Definition: log.h:104
av_log_format_line2
int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
Format a line of log the same way as the default callback.
Definition: log.c:365
AV_CLASS_CATEGORY_INPUT
@ AV_CLASS_CATEGORY_INPUT
Definition: log.h:30
AV_CLASS_CATEGORY_NA
@ AV_CLASS_CATEGORY_NA
Definition: log.h:29
format_line
static void format_line(void *avcl, int level, const char *fmt, va_list vl, AVBPrint part[5], int *print_prefix, int type[2])
Definition: log.c:319
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:226
LINE_SZ
#define LINE_SZ
Definition: log.c:50
ansi_fputs
static void ansi_fputs(int level, int tint, const char *str, int local_use_color)
Definition: log.c:188
AV_LOG_PRINT_TIME
#define AV_LOG_PRINT_TIME
Include system time in log output.
Definition: log.h:413
ff_mutex_unlock
static int ff_mutex_unlock(AVMutex *mutex)
Definition: thread.h:189
get_level_str
static const char * get_level_str(int level)
Definition: log.c:271
dummy
int dummy
Definition: motion.c:66
AV_BPRINT_SIZE_AUTOMATIC
#define AV_BPRINT_SIZE_AUTOMATIC
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_CLASS_CATEGORY_OUTPUT
@ AV_CLASS_CATEGORY_OUTPUT
Definition: log.h:31
AV_CLASS_CATEGORY_DEVICE_INPUT
@ AV_CLASS_CATEGORY_DEVICE_INPUT
Definition: log.h:46
GET_UTF8
#define GET_UTF8(val, GET_BYTE, ERROR)
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
Definition: common.h:488
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
Definition: log.h:44
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:236
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
AVMutex
#define AVMutex
Definition: thread.h:184
av_log_format_line
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix)
Format a line of log the same way as the default callback.
Definition: log.c:359
format_date_now
static void format_date_now(AVBPrint *bp_time, int include_date)
Definition: log.c:302
av_log_level
static int av_log_level
Definition: log.c:58
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
state
static struct @492 state
AV_CLASS_CATEGORY_HWDEVICE
@ AV_CLASS_CATEGORY_HWDEVICE
Definition: log.h:40
AV_CLASS_CATEGORY_NB
@ AV_CLASS_CATEGORY_NB
not part of ABI/API
Definition: log.h:47
NB_LEVELS
#define NB_LEVELS
Definition: log.c:61
callback
static void callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType devtype)
Definition: dshow.c:342
arg
const char * arg
Definition: jacosubdec.c:67
AV_CLASS_CATEGORY_DEMUXER
@ AV_CLASS_CATEGORY_DEMUXER
Definition: log.h:33
AV_LOG_PRINT_DATETIME
#define AV_LOG_PRINT_DATETIME
Include system date and time in log output.
Definition: log.h:418
time_internal.h
av_log_get_level
int av_log_get_level(void)
Get the current log level.
Definition: log.c:469
avpriv_report_missing_feature
void avpriv_report_missing_feature(void *avc, const char *msg,...)
Definition: log.c:517
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
NULL
#define NULL
Definition: coverity.c:32
tmp
static uint8_t tmp[20]
Definition: aes_ctr.c:47
PUT_UTF16
#define PUT_UTF16(val, tmp, PUT_16BIT)
Definition: common.h:575
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:240
av_log_set_flags
void av_log_set_flags(int arg)
Definition: log.c:479
AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
Definition: log.h:41
get_category
static int get_category(void *ptr)
Definition: log.c:258
time.h
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition: log.h:42
av_bprint_strftime
void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm)
Append a formatted date and time to a print buffer.
Definition: bprint.c:181
AV_CLASS_CATEGORY_FILTER
@ AV_CLASS_CATEGORY_FILTER
Definition: log.h:36
flags
static int flags
Definition: log.c:59
av_log_set_callback
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
Definition: log.c:489
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:240
AVClass::category
AVClassCategory category
Category used for visualization (like color).
Definition: log.h:133
localtime_r
#define localtime_r
Definition: time_internal.h:46
sample
#define sample
Definition: flacdsp_template.c:44
AV_MUTEX_INITIALIZER
#define AV_MUTEX_INITIALIZER
Definition: thread.h:185
AVClass::get_category
AVClassCategory(* get_category)(void *ctx)
Callback to return the instance category.
Definition: log.h:140
av_log_get_flags
int av_log_get_flags(void)
Definition: log.c:484
colored_fputs
static void colored_fputs(int level, int tint, const char *str)
Definition: log.c:212
line
Definition: graph2dot.c:48
ff_mutex_lock
static int ff_mutex_lock(AVMutex *mutex)
Definition: thread.h:188
AV_CLASS_CATEGORY_SWRESAMPLER
@ AV_CLASS_CATEGORY_SWRESAMPLER
Definition: log.h:39
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:221
av_log
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:441
av_log_set_level
void av_log_set_level(int level)
Set the log level.
Definition: log.c:474
bprint.h
AVClassCategory
AVClassCategory
Definition: log.h:28
log.h
internal.h
AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
Definition: log.h:43
common.h
use_color
static int use_color
Definition: log.c:126
check_color_terminal
static void check_color_terminal(void)
Definition: log.c:153
avpriv_request_sample
void avpriv_request_sample(void *avc, const char *msg,...)
Definition: log.c:508
ret
ret
Definition: filter_design.txt:187
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:204
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:99
av_log_callback
static void(* av_log_callback)(void *, int, const char *, va_list)
Definition: log.c:438
AV_LOG_SKIP_REPEATED
#define AV_LOG_SKIP_REPEATED
Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 woul...
Definition: log.h:400
AV_CLASS_CATEGORY_MUXER
@ AV_CLASS_CATEGORY_MUXER
Definition: log.h:32
av_default_get_category
AVClassCategory av_default_get_category(void *ptr)
Definition: log.c:245
av_vbprintf
void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg)
Append a formatted string to a print buffer.
Definition: bprint.c:122
AV_CLASS_CATEGORY_SWSCALER
@ AV_CLASS_CATEGORY_SWSCALER
Definition: log.h:38
AV_CLASS_CATEGORY_DEVICE_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_OUTPUT
Definition: log.h:45
item_name
static const char * item_name(void *obj, const AVClass *cls)
Definition: log.c:297
av_gettime
int64_t av_gettime(void)
Get the current time in microseconds.
Definition: time.c:39
av_log_once
void av_log_once(void *avcl, int initial_level, int subsequent_level, int *state, const char *fmt,...)
Definition: log.c:449
av_log_default_callback
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Default logging callback.
Definition: log.c:377
AV_CLASS_CATEGORY_BITSTREAM_FILTER
@ AV_CLASS_CATEGORY_BITSTREAM_FILTER
Definition: log.h:37
AVClass::log_level_offset_offset
int log_level_offset_offset
Offset in the structure where the log level offset is stored.
Definition: log.h:113
AV_CLASS_CATEGORY_ENCODER
@ AV_CLASS_CATEGORY_ENCODER
Definition: log.h:34
AVClass::parent_log_context_offset
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
Definition: log.h:124
isatty
#define isatty(fd)
Definition: checkasm.c:95
AVClass::item_name
const char *(* item_name)(void *ctx)
A pointer to a function which returns the name of a context instance ctx associated with the class.
Definition: log.h:87
snprintf
#define snprintf
Definition: snprintf.h:34
sanitize
static void sanitize(uint8_t *line)
Definition: log.c:250
log_callback
static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
Definition: ffprobe.c:357
AV_LOG_PRINT_LEVEL
#define AV_LOG_PRINT_LEVEL
Include the log severity in messages originating from codecs.
Definition: log.h:408
line
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line
Definition: swscale.txt:40
mutex
static AVMutex mutex
Definition: log.c:48