FFmpeg
log.h
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 #include "version.h"
28 
29 typedef enum {
30  AV_CLASS_CATEGORY_NA = 0,
31  AV_CLASS_CATEGORY_INPUT,
32  AV_CLASS_CATEGORY_OUTPUT,
33  AV_CLASS_CATEGORY_MUXER,
34  AV_CLASS_CATEGORY_DEMUXER,
35  AV_CLASS_CATEGORY_ENCODER,
36  AV_CLASS_CATEGORY_DECODER,
37  AV_CLASS_CATEGORY_FILTER,
38  AV_CLASS_CATEGORY_BITSTREAM_FILTER,
39  AV_CLASS_CATEGORY_SWSCALER,
40  AV_CLASS_CATEGORY_SWRESAMPLER,
41  AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
42  AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
43  AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
44  AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
45  AV_CLASS_CATEGORY_DEVICE_OUTPUT,
46  AV_CLASS_CATEGORY_DEVICE_INPUT,
47  AV_CLASS_CATEGORY_NB
48 }AVClassCategory;
49 
50 #define AV_IS_INPUT_DEVICE(category) \
51  (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \
52  ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \
53  ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT))
54 
55 #define AV_IS_OUTPUT_DEVICE(category) \
56  (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \
57  ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \
58  ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT))
59 
60 struct AVOptionRanges;
61 
67 typedef struct AVClass {
72  const char* class_name;
73 
78  const char* (*item_name)(void* ctx);
79 
85  const struct AVOption *option;
86 
93  int version;
94 
100 
109 
113  void* (*child_next)(void *obj, void *prev);
114 
123  const struct AVClass* (*child_class_next)(const struct AVClass *prev);
124 
130  AVClassCategory category;
131 
136  AVClassCategory (*get_category)(void* ctx);
137 
142  int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
143 } AVClass;
144 
158 #define AV_LOG_QUIET -8
159 
163 #define AV_LOG_PANIC 0
164 
170 #define AV_LOG_FATAL 8
171 
176 #define AV_LOG_ERROR 16
177 
182 #define AV_LOG_WARNING 24
183 
187 #define AV_LOG_INFO 32
188 
192 #define AV_LOG_VERBOSE 40
193 
197 #define AV_LOG_DEBUG 48
198 
202 #define AV_LOG_TRACE 56
203 
204 #define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
205 
218 #define AV_LOG_C(x) ((x) << 8)
219 
234 void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
235 
236 
252 void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
253 
261 int av_log_get_level(void);
262 
270 void av_log_set_level(int level);
271 
282 void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
283 
297 void av_log_default_callback(void *avcl, int level, const char *fmt,
298  va_list vl);
299 
307 const char* av_default_item_name(void* ctx);
308 AVClassCategory av_default_get_category(void *ptr);
309 
317 void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
318  char *line, int line_size, int *print_prefix);
319 
334 int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
335  char *line, int line_size, int *print_prefix);
336 
345 #define AV_LOG_SKIP_REPEATED 1
346 
353 #define AV_LOG_PRINT_LEVEL 2
354 
355 void av_log_set_flags(int arg);
356 int av_log_get_flags(void);
357 
362 #endif /* AVUTIL_LOG_H */
AVOption.
Definition: opt.h:246
void av_log_set_level(int level)
Set the log level.
Definition: log.c:385
const char * av_default_item_name(void *ctx)
Return the context name.
Definition: log.c:191
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...
Convenience header that includes libavutil&#39;s core.
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:72
const struct AVOption * option
a pointer to the first option specified in the class if any or NULL
Definition: log.h:85
int log_level_offset_offset
Offset in the structure where log_level_offset is stored.
Definition: log.h:99
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:282
int(* query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags)
Callback to return the supported/allowed ranges.
Definition: log.h:142
Definition: graph2dot.c:48
int av_log_get_level(void)
Get the current log level.
Definition: log.c:380
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
Definition: log.h:130
Libavutil version macros.
void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl)
Default logging callback.
Definition: log.c:300
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:288
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
Definition: log.c:400
Describe the class of an AVClass context structure.
Definition: log.h:67
void 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:373
int version
LIBAVUTIL_VERSION with which this structure was created.
Definition: log.h:93
int parent_log_context_offset
Offset in the structure where a pointer to the parent context for logging is stored.
Definition: log.h:108
List of AVOptionRange structs.
Definition: opt.h:328
AVClassCategory(* get_category)(void *ctx)
Callback to return the category.
Definition: log.h:136