log.h
Go to the documentation of this file.
1 /*
2  * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVUTIL_LOG_H
22 #define AVUTIL_LOG_H
23 
24 #include <stdarg.h>
25 #include "avutil.h"
26 #include "attributes.h"
27 
28 typedef enum {
42 
43 struct AVOptionRanges;
44 
50 typedef struct AVClass {
55  const char* class_name;
56 
61  const char* (*item_name)(void* ctx);
62 
68  const struct AVOption *option;
69 
76  int version;
77 
83 
92 
96  void* (*child_next)(void *obj, void *prev);
97 
106  const struct AVClass* (*child_class_next)(const struct AVClass *prev);
107 
114 
120 
125  int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
126 } AVClass;
127 
128 /* av_log API */
129 
130 #define AV_LOG_QUIET -8
131 
135 #define AV_LOG_PANIC 0
136 
142 #define AV_LOG_FATAL 8
143 
148 #define AV_LOG_ERROR 16
149 
154 #define AV_LOG_WARNING 24
155 
156 #define AV_LOG_INFO 32
157 #define AV_LOG_VERBOSE 40
158 
162 #define AV_LOG_DEBUG 48
163 
164 #define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET)
165 
180 void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
181 
182 void av_vlog(void *avcl, int level, const char *fmt, va_list);
183 int av_log_get_level(void);
184 void av_log_set_level(int);
185 void av_log_set_callback(void (*)(void*, int, const char*, va_list));
186 void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
187 const char* av_default_item_name(void* ctx);
189 
197 void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
198  char *line, int line_size, int *print_prefix);
199 
205 #ifdef DEBUG
206 # define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
207 #else
208 # define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
209 #endif
210 
219 #define AV_LOG_SKIP_REPEATED 1
220 void av_log_set_flags(int arg);
221 
222 #endif /* AVUTIL_LOG_H */
AVClassCategory av_default_get_category(void *ptr)
Definition: log.c:144
AVOption.
Definition: opt.h:251
const char * fmt
Definition: avisynth_c.h:669
external API header
void av_log_set_level(int)
Definition: log.c:269
Macro definitions for various function/variable attributes.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:55
const struct AVOption * option
a pointer to the first option specified in the class if any or NULL
Definition: log.h:68
void av_log_set_callback(void(*)(void *, int, const char *, va_list))
Definition: log.c:279
int log_level_offset_offset
Offset in the structure where log_level_offset is stored.
Definition: log.h:82
struct AVClass AVClass
Describe the class of an AVClass context structure.
const char * av_default_item_name(void *ctx)
Definition: log.c:139
int(* query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags)
Callback to return the supported/allowed ranges.
Definition: log.h:125
const char * arg
void av_log_default_callback(void *ptr, int level, const char *fmt, va_list vl)
Definition: log.c:204
Definition: graph2dot.c:48
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
Definition: log.h:113
int av_log_get_level(void)
Definition: log.c:264
#define av_printf_format(fmtpos, attrpos)
Definition: attributes.h:145
not part of ABI/API
Definition: log.h:40
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:196
FIXME Range Coding of cr are level
Definition: snow.txt:367
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
Describe the class of an AVClass context structure.
Definition: log.h:50
static int flags
Definition: cpu.c:23
int version
LIBAVUTIL_VERSION with which this structure was created.
Definition: log.h:76
void av_log_set_flags(int arg)
Definition: log.c:274
void void av_vlog(void *avcl, int level, const char *fmt, va_list)
Definition: log.c:258
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
Definition: log.h:91
List of AVOptionRange structs.
Definition: opt.h:311
AVClassCategory
Definition: log.h:28
AVClassCategory(* get_category)(void *ctx)
Callback to return the category.
Definition: log.h:119