为了方便在Android中调试基于FFMPEG的程序,需要对FFMPEG的log工具进行修改:
原来的av_log函数在log.h / log.c中声明和定义,如下
/** * 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);
#ifdef MTK_ANDROID_LOG #define av_log(avcl, level, fmt, args...) __android_log_print(ANDROID_LOG_INFO, "ALONG_FFMPEG", fmt, ##args) //void av_log(void* avcl, int level, const char *fmt, ...); #else void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); #endif