zoukankan      html  css  js  c++  java
  • 在CB2010中调用ffmpeg(4)

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

    }

    这效果,刚刚的。

  • 相关阅读:
    xxx端口被占用怎么办?
    JavaScript复习--JavaScript的特点和作用
    JavaScript复习--点击按钮,div边框(宽和高)动态增加
    JavaScript复习--评分控件(类似于淘宝给好差平的星星)
    canvas 小记
    overrideMimeType ,接口blob数据转成 base64格式;
    编写一个webpack插件
    html中资源加载优化
    css content 可以怎么用
    关于promise的思考
  • 原文地址:https://www.cnblogs.com/drgraph/p/3607694.html
Copyright © 2011-2022 走看看