+void
+FFmpeg::ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl)
+{
+ if (level > AV_LOG_WARNING) {
+ return;
+ }
+
+ char line[1024];
+ static int prefix = 0;
+ av_log_format_line (ptr, level, fmt, vl, line, sizeof (line), &prefix);
+ shared_ptr<Log> log = _ffmpeg_log.lock ();
+ if (log) {
+ string str (line);
+ boost::algorithm::trim (str);
+ log->log (String::compose ("FFmpeg: %1", str), Log::TYPE_GENERAL);
+ } else {
+ cerr << line;
+ }
+}
+