FFmpeg
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 #include "libavutil/log.c"
23 
24 #include <string.h>
25 
26 static int call_log_format_line2(const char *fmt, char *buffer, int buffer_size, ...)
27 {
28  va_list args;
29  int ret;
30  int print_prefix=1;
31  va_start(args, buffer_size);
32  ret = av_log_format_line2(NULL, AV_LOG_INFO, fmt, args, buffer, buffer_size, &print_prefix);
33  va_end(args);
34  return ret;
35 }
36 
37 int main(int argc, char **argv)
38 {
39  int i;
41  for (use_color=0; use_color<=256; use_color = 255*use_color+1) {
42  av_log(NULL, AV_LOG_FATAL, "use_color: %d\n", use_color);
43  for (i = AV_LOG_DEBUG; i>=AV_LOG_QUIET; i-=8) {
44  av_log(NULL, i, " %d", i);
45  av_log(NULL, AV_LOG_INFO, "e ");
46  av_log(NULL, i + 256*123, "C%d", i);
47  av_log(NULL, AV_LOG_INFO, "e");
48  }
49  av_log(NULL, AV_LOG_PANIC, "\n");
50  }
51  {
52  int result;
53  char buffer[4];
54  result = call_log_format_line2("foo", NULL, 0);
55  if(result != 3) {
56  printf("Test NULL buffer failed.\n");
57  return 1;
58  }
59  result = call_log_format_line2("foo", buffer, 2);
60  if(result != 3 || strncmp(buffer, "f", 2)) {
61  printf("Test buffer too small failed.\n");
62  return 1;
63  }
64  result = call_log_format_line2("foo", buffer, 4);
65  if(result != 3 || strncmp(buffer, "foo", 4)) {
66  printf("Test buffer sufficiently big failed.\n");
67  return 1;
68  }
69  }
70  return 0;
71 }
call_log_format_line2
static int call_log_format_line2(const char *fmt, char *buffer, int buffer_size,...)
Definition: log.c:26
AV_LOG_QUIET
#define AV_LOG_QUIET
Print no output.
Definition: log.h:191
AV_LOG_PANIC
#define AV_LOG_PANIC
Something went really wrong and we will crash now.
Definition: log.h:196
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:341
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:230
result
and forward the result(frame or status change) to the corresponding input. If nothing is possible
NULL
#define NULL
Definition: coverity.c:32
printf
printf("static const uint8_t my_array[100] = {\n")
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:220
av_log
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:414
av_log_set_level
void av_log_set_level(int level)
Set the log level.
Definition: log.c:447
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
use_color
static int use_color
Definition: log.c:123
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:203
log.c
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
main
int main(int argc, char **argv)
Definition: log.c:37