注册自己的log函数,拦截出错时候的错误信息

来源:互联网 发布:sql 视频 百度云 编辑:程序博客网 时间:2024/06/06 17:49

编程时,若要知道自己的错误所在,可以注册自己的log函数,如下:

#include <stdarg.h> extern "C" static void av_log_callback(void* ptr, int level, const char* fmt, va_list vl) { #ifdef _DEBUG   static FILE *fp = NULL;   //if(level > AV_LOG_ERROR)   //  return;   if(!fp)     fp = fopen("e:/av_debug.log","a+");   if(fp){     vfprintf(fp,fmt,vl);     fflush(fp);   } #endif } ....    av_log_set_callback(av_log_callback);    // Now register the rest of FFmpeg.    av_register_all() .... 



 

原创粉丝点击