2006-09-10 14:02:42 +00:00
|
|
|
/*
|
|
|
|
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2006-09-10 14:02:42 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 15:30:46 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2006-09-10 14:02:42 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2006-09-10 14:02:42 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-10-07 15:30:46 +00:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-09-10 14:02:42 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#ifndef AVUTIL_LOG_H
|
|
|
|
#define AVUTIL_LOG_H
|
2006-07-18 11:00:55 +00:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
2009-01-13 00:14:43 +00:00
|
|
|
#include "avutil.h"
|
2011-06-17 07:31:11 +00:00
|
|
|
#include "attributes.h"
|
2006-07-18 11:00:55 +00:00
|
|
|
|
2012-05-28 10:49:23 +00:00
|
|
|
typedef enum {
|
|
|
|
AV_CLASS_CATEGORY_NA = 0,
|
|
|
|
AV_CLASS_CATEGORY_INPUT,
|
|
|
|
AV_CLASS_CATEGORY_OUTPUT,
|
|
|
|
AV_CLASS_CATEGORY_MUXER,
|
|
|
|
AV_CLASS_CATEGORY_DEMUXER,
|
|
|
|
AV_CLASS_CATEGORY_ENCODER,
|
|
|
|
AV_CLASS_CATEGORY_DECODER,
|
|
|
|
AV_CLASS_CATEGORY_FILTER,
|
|
|
|
AV_CLASS_CATEGORY_BITSTREAM_FILTER,
|
2012-07-04 17:22:16 +00:00
|
|
|
AV_CLASS_CATEGORY_SWSCALER,
|
|
|
|
AV_CLASS_CATEGORY_SWRESAMPLER,
|
2012-06-03 19:57:17 +00:00
|
|
|
AV_CLASS_CATEGORY_NB, ///< not part of ABI/API
|
2012-05-28 10:49:23 +00:00
|
|
|
}AVClassCategory;
|
|
|
|
|
2006-07-18 11:00:55 +00:00
|
|
|
/**
|
2010-06-30 15:38:06 +00:00
|
|
|
* Describe the class of an AVClass context structure. That is an
|
2008-04-24 10:13:38 +00:00
|
|
|
* arbitrary struct of which the first field is a pointer to an
|
|
|
|
* AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
|
2006-07-18 11:00:55 +00:00
|
|
|
*/
|
2011-10-12 20:30:56 +00:00
|
|
|
typedef struct AVClass {
|
2008-04-24 10:13:38 +00:00
|
|
|
/**
|
2008-05-06 08:41:13 +00:00
|
|
|
* The name of the class; usually it is the same name as the
|
2008-05-06 08:03:30 +00:00
|
|
|
* context structure type to which the AVClass is associated.
|
2008-04-24 10:13:38 +00:00
|
|
|
*/
|
2006-07-18 11:00:55 +00:00
|
|
|
const char* class_name;
|
2008-04-24 10:13:38 +00:00
|
|
|
|
|
|
|
/**
|
2009-01-28 23:03:17 +00:00
|
|
|
* A pointer to a function which returns the name of a context
|
2009-06-06 09:35:15 +00:00
|
|
|
* instance ctx associated with the class.
|
2008-04-24 10:13:38 +00:00
|
|
|
*/
|
|
|
|
const char* (*item_name)(void* ctx);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* a pointer to the first option specified in the class if any or NULL
|
|
|
|
*
|
|
|
|
* @see av_set_default_options()
|
|
|
|
*/
|
2006-11-16 00:29:15 +00:00
|
|
|
const struct AVOption *option;
|
2010-04-28 20:00:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* LIBAVUTIL_VERSION with which this structure was created.
|
2010-04-28 20:08:02 +00:00
|
|
|
* This is used to allow fields to be added without requiring major
|
2010-04-28 20:00:23 +00:00
|
|
|
* version bumps everywhere.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int version;
|
2010-05-08 20:41:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Offset in the structure where log_level_offset is stored.
|
|
|
|
* 0 means there is no such variable
|
|
|
|
*/
|
|
|
|
int log_level_offset_offset;
|
2010-05-19 22:50:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Offset in the structure where a pointer to the parent context for loging is stored.
|
|
|
|
* for example a decoder that uses eval.c could pass its AVCodecContext to eval as such
|
|
|
|
* parent context. And a av_log() implementation could then display the parent context
|
|
|
|
* can be NULL of course
|
|
|
|
*/
|
|
|
|
int parent_log_context_offset;
|
2011-05-22 11:25:19 +00:00
|
|
|
|
|
|
|
/**
|
2011-10-03 17:49:12 +00:00
|
|
|
* Return next AVOptions-enabled child or NULL
|
2011-05-22 11:25:19 +00:00
|
|
|
*/
|
2011-10-03 17:49:12 +00:00
|
|
|
void* (*child_next)(void *obj, void *prev);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an AVClass corresponding to next potential
|
|
|
|
* AVOptions-enabled child.
|
|
|
|
*
|
|
|
|
* The difference between child_next and this is that
|
|
|
|
* child_next iterates over _already existing_ objects, while
|
|
|
|
* child_class_next iterates over _all possible_ children.
|
|
|
|
*/
|
|
|
|
const struct AVClass* (*child_class_next)(const struct AVClass *prev);
|
2012-05-28 10:49:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Category used for visualization (like color)
|
2012-06-03 20:39:54 +00:00
|
|
|
* This is only set if the category is equal for all objects using this class.
|
2012-05-28 10:49:23 +00:00
|
|
|
* available since version (51 << 16 | 56 << 8 | 100)
|
|
|
|
*/
|
|
|
|
AVClassCategory category;
|
2012-06-03 20:39:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback to return the category.
|
|
|
|
* available since version (51 << 16 | 59 << 8 | 100)
|
|
|
|
*/
|
|
|
|
AVClassCategory (*get_category)(void* ctx);
|
2009-07-12 11:30:42 +00:00
|
|
|
} AVClass;
|
2006-07-18 11:00:55 +00:00
|
|
|
|
|
|
|
/* av_log API */
|
|
|
|
|
2007-01-21 20:47:10 +00:00
|
|
|
#define AV_LOG_QUIET -8
|
|
|
|
|
|
|
|
/**
|
2009-01-28 23:03:17 +00:00
|
|
|
* Something went really wrong and we will crash now.
|
2007-01-21 20:47:10 +00:00
|
|
|
*/
|
|
|
|
#define AV_LOG_PANIC 0
|
|
|
|
|
|
|
|
/**
|
2009-01-28 23:16:49 +00:00
|
|
|
* Something went wrong and recovery is not possible.
|
|
|
|
* For example, no header was found for a format which depends
|
|
|
|
* on headers or an illegal combination of parameters is used.
|
2007-01-21 20:47:10 +00:00
|
|
|
*/
|
|
|
|
#define AV_LOG_FATAL 8
|
|
|
|
|
|
|
|
/**
|
2009-01-28 23:16:49 +00:00
|
|
|
* Something went wrong and cannot losslessly be recovered.
|
|
|
|
* However, not all future data is affected.
|
2007-01-21 20:47:10 +00:00
|
|
|
*/
|
|
|
|
#define AV_LOG_ERROR 16
|
|
|
|
|
|
|
|
/**
|
2009-01-28 23:16:49 +00:00
|
|
|
* Something somehow does not look correct. This may or may not
|
|
|
|
* lead to problems. An example would be the use of '-vstrict -2'.
|
2007-01-21 20:47:10 +00:00
|
|
|
*/
|
|
|
|
#define AV_LOG_WARNING 24
|
|
|
|
|
|
|
|
#define AV_LOG_INFO 32
|
|
|
|
#define AV_LOG_VERBOSE 40
|
|
|
|
|
|
|
|
/**
|
2009-01-28 23:03:17 +00:00
|
|
|
* Stuff which is only useful for libav* developers.
|
2007-01-21 20:47:10 +00:00
|
|
|
*/
|
|
|
|
#define AV_LOG_DEBUG 48
|
2006-07-18 11:00:55 +00:00
|
|
|
|
2012-01-17 14:25:14 +00:00
|
|
|
#define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET)
|
|
|
|
|
2007-03-04 23:04:49 +00:00
|
|
|
/**
|
2010-06-30 15:38:06 +00:00
|
|
|
* Send the specified message to the log if the level is less than or equal
|
2009-01-28 23:03:17 +00:00
|
|
|
* to the current av_log_level. By default, all logging messages are sent to
|
2007-03-04 23:04:49 +00:00
|
|
|
* stderr. This behavior can be altered by setting a different av_vlog callback
|
|
|
|
* function.
|
|
|
|
*
|
|
|
|
* @param avcl A pointer to an arbitrary struct of which the first field is a
|
|
|
|
* pointer to an AVClass struct.
|
|
|
|
* @param level The importance level of the message, lower values signifying
|
|
|
|
* higher importance.
|
|
|
|
* @param fmt The format string (printf-compatible) that specifies how
|
|
|
|
* subsequent arguments are converted to output.
|
|
|
|
* @see av_vlog
|
|
|
|
*/
|
2011-06-17 07:31:11 +00:00
|
|
|
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
|
2006-07-18 11:00:55 +00:00
|
|
|
|
2010-07-02 11:03:23 +00:00
|
|
|
void av_vlog(void *avcl, int level, const char *fmt, va_list);
|
2008-04-11 14:18:33 +00:00
|
|
|
int av_log_get_level(void);
|
|
|
|
void av_log_set_level(int);
|
|
|
|
void av_log_set_callback(void (*)(void*, int, const char*, va_list));
|
|
|
|
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
|
2010-05-19 22:45:04 +00:00
|
|
|
const char* av_default_item_name(void* ctx);
|
2012-06-03 20:39:54 +00:00
|
|
|
AVClassCategory av_default_get_category(void *ptr);
|
2006-07-18 11:00:55 +00:00
|
|
|
|
2011-12-08 12:54:05 +00:00
|
|
|
/**
|
|
|
|
* Format a line of log the same way as the default callback.
|
|
|
|
* @param line buffer to receive the formated line
|
|
|
|
* @param line_size size of the buffer
|
|
|
|
* @param print_prefix used to store whether the prefix must be printed;
|
|
|
|
* must point to a persistent integer initially set to 1
|
|
|
|
*/
|
|
|
|
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
|
|
|
|
char *line, int line_size, int *print_prefix);
|
|
|
|
|
2011-01-29 16:46:18 +00:00
|
|
|
/**
|
|
|
|
* av_dlog macros
|
|
|
|
* Useful to print debug messages that shouldn't get compiled in normally.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
|
|
|
|
#else
|
2011-05-11 10:26:25 +00:00
|
|
|
# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
|
2011-01-29 16:46:18 +00:00
|
|
|
#endif
|
|
|
|
|
2010-09-24 15:37:01 +00:00
|
|
|
/**
|
|
|
|
* Skip repeated messages, this requires the user app to use av_log() instead of
|
|
|
|
* (f)printf as the 2 would otherwise interfere and lead to
|
|
|
|
* "Last message repeated x times" messages below (f)printf messages with some
|
|
|
|
* bad luck.
|
|
|
|
* Also to receive the last, "last repeated" line if any, the user app must
|
2011-06-15 09:24:00 +00:00
|
|
|
* call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end
|
2010-09-24 15:37:01 +00:00
|
|
|
*/
|
|
|
|
#define AV_LOG_SKIP_REPEATED 1
|
|
|
|
void av_log_set_flags(int arg);
|
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#endif /* AVUTIL_LOG_H */
|