3 * Copyright (c) 2003 Michel Bardiaux
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 int av_log_level = AV_LOG_INFO;
29 static void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
31 static int print_prefix=1;
32 AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
33 if(level>av_log_level)
36 if(print_prefix && avc) {
37 fprintf(stderr, "[%s @ %p]", avc->item_name(ptr), avc);
39 #define fprintf please_use_av_log
41 print_prefix= strstr(fmt, "\n") != NULL;
43 vfprintf(stderr, fmt, vl);
46 #if LIBAVUTIL_VERSION_INT < (50<<16)
47 static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;
49 void (*av_vlog)(void*, int, const char*, va_list) = av_log_default_callback;
52 void av_log(void* avcl, int level, const char *fmt, ...)
56 av_vlog(avcl, level, fmt, vl);
60 #if LIBAVUTIL_VERSION_INT < (50<<16)
61 void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
63 av_log_callback(avcl, level, fmt, vl);
66 int av_log_get_level(void)
71 void av_log_set_level(int level)
76 void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
78 av_log_callback = callback;