[FFmpeg-devel] new logging functionality

Martin Carroll martin.carroll at alcatel-lucent.com
Fri Jun 29 19:47:34 CEST 2012


In the process of trying to understand the implementation of
ffplay/ffmpeg, I found it necessary to implement some new
logging-related functions.  These functions make it easier to
understand (e.g.) the dynamic call graph of a multi-threaded
program.  I believe that these functions might be appreciated
by other ffmpeg developers; if so, I would be happy to send the
patch upstream (or discuss further).

Here, in more detail, is the new functionality:

1. Forced log messages
         The new function av_flog() forces the log message to come
         out, regardless of the current log-level setting.  To enable
         this feature, the variable do_flog in libavutil/log.c must
         be set to 1.

2. Thread-id logging
         To make it easier to see which thread is doing what, the
         logger can now be configured to prefix all log messages
         with either the numeric id or the name of the calling
         thread.  (The name is printed if the thread was previously
         registered with av_log_set_threadname().)  To enable this
         feature, the variable print_threadid in libavutil/log.c
         must be set to 1.

3. Indentation for dynamic call graph
         To make it easier to view the program's dynamic call graph,
         the logger can now be configured to push and pop indentation
         levels on the log messages.  The new macros LOGPUSH and
         LOGPOP respectively increase and decrease the current
         indentation level and also print information about the
         name and file location of the function that is being
         entered or returned from.  To enable this feature, the
         variable do_pushpop in libavutil/log.c must be set to 1.

Martin Carroll


More information about the ffmpeg-devel mailing list