我是靠谱客的博主 积极唇彩,最近开发中收集的这篇文章主要介绍Linux下开发ffmpeg(3),Ffmpeg版本的HelloWorld,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述


目录


重要函数

/**
 * @addtogroup lavu_log
 *
 * @{
 *
 * @defgroup lavu_log_constants Logging Constants
 *
 * @{
 */

/**
 * 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
/**
 * Set the log level
 *
 * @see lavu_log_constants
 *
 * @param level Logging level
 */
void av_log_set_level(int level);
/**
 * Send the specified message to the log if the level is less than or equal
 * to the current av_log_level. By default, all logging messages are sent to
 * stderr. This behavior can be altered by setting a different logging callback
 * function.
 * @see av_log_set_callback
 *
 * @param avcl A pointer to an arbitrary struct of which the first field is a
 *        pointer to an AVClass struct or NULL if general log.
 * @param level The importance level of the message expressed using a @ref
 *        lavu_log_constants "Logging Constant".
 * @param fmt The format string (printf-compatible) that specifies how
 *        subsequent arguments are converted to output.
 */
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);

在(1)(2)的基础上写一个ffmpeg版本的HelloWorld

mylog.c


#include <libavutil/log.h>
#include <stdio.h>

int main(int argc,char* argv[]){
        //设置debug级别以上的日志都被打印
        av_log_set_level(AV_LOG_DEBUG);
        av_log(NULL,AV_LOG_DEBUG,"Hello Worldn");
        return 0;
}

编译mylog

gcc -g -o mylog mylog.c -I /usr/local/ffmpeg/include/ -L /usr/local/ffmpeg/lib/ -lavutil

运行

root@zhangyu-virtual-machine:/home/zhangyu/test# gcc -g -o mylog mylog.c -I /usr/local/ffmpeg/include/ -L /usr/local/ffmpeg/lib/ -lavutil
root@zhangyu-virtual-machine:/home/zhangyu/test# ./mylog 
Hello World

最后

以上就是积极唇彩为你收集整理的Linux下开发ffmpeg(3),Ffmpeg版本的HelloWorld的全部内容,希望文章能够帮你解决Linux下开发ffmpeg(3),Ffmpeg版本的HelloWorld所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(63)

评论列表共有 0 条评论

立即
投稿
返回
顶部