首页 > 其他 > 详细

在CB2010中调用ffmpeg(4)

时间:2014-03-19 12:05:05      阅读:500      评论:0      收藏:0      [点我收藏+]
  1. Log

多看一些代码,发现av_log函数。不用猜,av_log肯定是日志记录之类的。

一般而言,Log对于编程调试有较大帮助。今天先从这里入手。

不过看声明,倒是有点云里雾里。

/**

* 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.

* @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);

继续找,找到定义

#ifdef __GNUC__

# define av_builtin_constant_p __builtin_constant_p

# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos)))

#else

# define av_builtin_constant_p(x) 0

# define av_printf_format(fmtpos, attrpos)

#endif

还是不明白。还是看下注释。

哦,日志写到stderr,这下怎么看?

幸亏还有callback方式。

不过,这用法还有点奇葩,不然别人怎么会写得如此专业。我以前写的程序都是自己用,日志等功能基本都是写到文件中,级别倒是分了,但从来没有写成回调形式的。

看来我算是业余选手。

不过,回调应该好处理,自己加一个:

static void avLogByDrGraph(void *, int level, const char * szFmt, va_list varg) {

    UnicodeString info, fmt = szFmt;

    va_list args;

    va_start(args, fmt);

    info.vprintf(fmt.w_str(), args);

    va_end(args);

    FFMPEGTestForm->Memo1->Lines->Add(info);

}

这效果,刚刚的。

bubuko.com,布布扣

在CB2010中调用ffmpeg(4),布布扣,bubuko.com

在CB2010中调用ffmpeg(4)

原文:http://www.cnblogs.com/drgraph/p/3607694.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!