From aa40a7850c8cebd6b55a129af156d1e08a946dd2 Mon Sep 17 00:00:00 2001 From: aymeric Date: Thu, 23 Apr 2009 10:04:05 +0000 Subject: [PATCH] Add logging capabilities for ffmpeg (link with avutil) git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@428 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/mediastreamer2/src/videoenc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/linphone/mediastreamer2/src/videoenc.c b/linphone/mediastreamer2/src/videoenc.c index 8085e9b5a..7144093fe 100644 --- a/linphone/mediastreamer2/src/videoenc.c +++ b/linphone/mediastreamer2/src/videoenc.c @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #else #include #endif + #include "mediastreamer2/msfilter.h" #include "mediastreamer2/msvideo.h" #include "mediastreamer2/msticker.h" @@ -40,11 +41,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static bool_t avcodec_initialized=FALSE; +#ifdef ENABLE_LOG_FFMPEG + +void ms_ffmpeg_log_callback(void* ptr, int level, const char* fmt, va_list vl) +{ + static char message[8192]; + + vsnprintf(message, sizeof message, fmt, vl); + ms_message(message); +} + +#endif + void ms_ffmpeg_check_init(){ if(!avcodec_initialized){ avcodec_init(); avcodec_register_all(); avcodec_initialized=TRUE; +#ifdef ENABLE_LOG_FFMPEG + av_log_set_level(AV_LOG_WARNING); + av_log_set_callback(&ms_ffmpeg_log_callback); +#endif } }