【版权申明】转载请附上出处链接
ffmpeg里面的av_log实现
话不多说,直接上demo:
#include <stdio.h>
#include <libavutil/log.h>
/**
* Print no output.
*/
#define AV_LOG_QUIET -8
/**
* Something went really wrong and we will crash now.
*/
#define AV_LOG_PANIC 0
/**
* 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.
*/
#define AV_LOG_FATAL 8
/**
* Something went wrong and cannot losslessly be recovered.
* However, not all future data is affected.
*/
#define AV_LOG_ERROR 16
/**
* Something somehow does not look correct. This may or may not
* lead to problems. An example would be the use of '-vstrict -2'.
*/
#define AV_LOG_WARNING 24
/**
* Standard information.
*/
#define AV_LOG_INFO 32
/**
* Detailed information.
*/
#define AV_LOG_VERBOSE 40
/**
* Stuff which is only useful for libav* developers.
*/
#define AV_LOG_DEBUG 48
/**
* Extremely verbose debugging, useful for libav* development.
*/
#define AV_LOG_TRACE 56
#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET)
int main(int argc, char *argv[])
{
av_log_set_level(AV_LOG_MAX_OFFSET);
av_log(NULL, AV_LOG_MAX_OFFSET, "AV_LOG_MAX_OFFSET\n");
av_log(NULL, AV_LOG_TRACE, "AV_LOG_TRACE\n");
av_log(NULL, AV_LOG_DEBUG, "AV_LOG_DEBUG\n");
av_log(NULL, AV_LOG_VERBOSE, "AV_LOG_VERBOSE\n");
av_log(NULL, AV_LOG_INFO, "AV_LOG_INFO\n");
av_log(NULL, AV_LOG_WARNING, "AV_LOG_WARNING\n");
av_log(NULL, AV_LOG_ERROR, "AV_LOG_ERROR\n");
av_log(NULL, AV_LOG_FATAL, "AV_LOG_FATAL\n");
av_log(NULL, AV_LOG_PANIC, "AV_LOG_PANIC\n");
av_log(NULL, AV_LOG_QUIET, "AV_LOG_QUIET\n");
return 0;
FFmpeg av_log

本文介绍FFmpeg中av_log模块的实现细节,包括不同日志级别的定义及其对应的数值,通过示例代码展示了如何设置日志级别并输出不同类型的日志信息。
最低0.47元/天 解锁文章
1795

被折叠的 条评论
为什么被折叠?



