author | Wuzzy <Wuzzy2@mail.ru> |
Fri, 31 Aug 2018 20:35:13 +0200 | |
changeset 13725 | ade61b4eb63f |
parent 7813 | 7ac83d79b897 |
permissions | -rw-r--r-- |
7813
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
1 |
/* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
2 |
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
3 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
4 |
* This file is part of Libav. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
5 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
6 |
* Libav is free software; you can redistribute it and/or |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
7 |
* modify it under the terms of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
8 |
* License as published by the Free Software Foundation; either |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
9 |
* version 2.1 of the License, or (at your option) any later version. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
10 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
11 |
* Libav is distributed in the hope that it will be useful, |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
14 |
* Lesser General Public License for more details. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
15 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU Lesser General Public |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
17 |
* License along with Libav; if not, write to the Free Software |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
19 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
20 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
21 |
#ifndef AVUTIL_LOG_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
22 |
#define AVUTIL_LOG_H |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
23 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
24 |
#include <stdarg.h> |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
25 |
#include "avutil.h" |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
26 |
#include "attributes.h" |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
27 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
28 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
29 |
* Describe the class of an AVClass context structure. That is an |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
30 |
* arbitrary struct of which the first field is a pointer to an |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
31 |
* AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
32 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
33 |
typedef struct AVClass { |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
34 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
35 |
* The name of the class; usually it is the same name as the |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
36 |
* context structure type to which the AVClass is associated. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
37 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
38 |
const char* class_name; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
39 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
40 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
41 |
* A pointer to a function which returns the name of a context |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
42 |
* instance ctx associated with the class. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
43 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
44 |
const char* (*item_name)(void* ctx); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
45 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
46 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
47 |
* a pointer to the first option specified in the class if any or NULL |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
48 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
49 |
* @see av_set_default_options() |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
50 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
51 |
const struct AVOption *option; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
52 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
53 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
54 |
* LIBAVUTIL_VERSION with which this structure was created. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
55 |
* This is used to allow fields to be added without requiring major |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
56 |
* version bumps everywhere. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
57 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
58 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
59 |
int version; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
60 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
61 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
62 |
* Offset in the structure where log_level_offset is stored. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
63 |
* 0 means there is no such variable |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
64 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
65 |
int log_level_offset_offset; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
66 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
67 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
68 |
* Offset in the structure where a pointer to the parent context for loging is stored. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
69 |
* for example a decoder that uses eval.c could pass its AVCodecContext to eval as such |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
70 |
* parent context. And a av_log() implementation could then display the parent context |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
71 |
* can be NULL of course |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
72 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
73 |
int parent_log_context_offset; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
74 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
75 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
76 |
* Return next AVOptions-enabled child or NULL |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
77 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
78 |
void* (*child_next)(void *obj, void *prev); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
79 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
80 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
81 |
* Return an AVClass corresponding to next potential |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
82 |
* AVOptions-enabled child. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
83 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
84 |
* The difference between child_next and this is that |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
85 |
* child_next iterates over _already existing_ objects, while |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
86 |
* child_class_next iterates over _all possible_ children. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
87 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
88 |
const struct AVClass* (*child_class_next)(const struct AVClass *prev); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
89 |
} AVClass; |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
90 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
91 |
/* av_log API */ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
92 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
93 |
#define AV_LOG_QUIET -8 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
94 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
95 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
96 |
* Something went really wrong and we will crash now. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
97 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
98 |
#define AV_LOG_PANIC 0 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
99 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
100 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
101 |
* Something went wrong and recovery is not possible. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
102 |
* For example, no header was found for a format which depends |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
103 |
* on headers or an illegal combination of parameters is used. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
104 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
105 |
#define AV_LOG_FATAL 8 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
106 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
107 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
108 |
* Something went wrong and cannot losslessly be recovered. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
109 |
* However, not all future data is affected. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
110 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
111 |
#define AV_LOG_ERROR 16 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
112 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
113 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
114 |
* Something somehow does not look correct. This may or may not |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
115 |
* lead to problems. An example would be the use of '-vstrict -2'. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
116 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
117 |
#define AV_LOG_WARNING 24 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
118 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
119 |
#define AV_LOG_INFO 32 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
120 |
#define AV_LOG_VERBOSE 40 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
121 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
122 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
123 |
* Stuff which is only useful for libav* developers. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
124 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
125 |
#define AV_LOG_DEBUG 48 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
126 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
127 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
128 |
* Send the specified message to the log if the level is less than or equal |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
129 |
* to the current av_log_level. By default, all logging messages are sent to |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
130 |
* stderr. This behavior can be altered by setting a different av_vlog callback |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
131 |
* function. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
132 |
* |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
133 |
* @param avcl A pointer to an arbitrary struct of which the first field is a |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
134 |
* pointer to an AVClass struct. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
135 |
* @param level The importance level of the message, lower values signifying |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
136 |
* higher importance. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
137 |
* @param fmt The format string (printf-compatible) that specifies how |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
138 |
* subsequent arguments are converted to output. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
139 |
* @see av_vlog |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
140 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
141 |
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
142 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
143 |
void av_vlog(void *avcl, int level, const char *fmt, va_list); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
144 |
int av_log_get_level(void); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
145 |
void av_log_set_level(int); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
146 |
void av_log_set_callback(void (*)(void*, int, const char*, va_list)); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
147 |
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
148 |
const char* av_default_item_name(void* ctx); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
149 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
150 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
151 |
* av_dlog macros |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
152 |
* Useful to print debug messages that shouldn't get compiled in normally. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
153 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
154 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
155 |
#ifdef DEBUG |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
156 |
# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
157 |
#else |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
158 |
# define av_dlog(pctx, ...) |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
159 |
#endif |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
160 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
161 |
/** |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
162 |
* Skip repeated messages, this requires the user app to use av_log() instead of |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
163 |
* (f)printf as the 2 would otherwise interfere and lead to |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
164 |
* "Last message repeated x times" messages below (f)printf messages with some |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
165 |
* bad luck. |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
166 |
* Also to receive the last, "last repeated" line if any, the user app must |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
167 |
* call av_log(NULL, AV_LOG_QUIET, ""); at the end |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
168 |
*/ |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
169 |
#define AV_LOG_SKIP_REPEATED 1 |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
170 |
void av_log_set_flags(int arg); |
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
171 |
|
7ac83d79b897
support video recording on windows with automation and headers
koda
parents:
diff
changeset
|
172 |
#endif /* AVUTIL_LOG_H */ |