From b1c77a83ee94ec17e56c70389d4957bcf7308ecd Mon Sep 17 00:00:00 2001 From: mru Date: Wed, 12 Dec 2007 21:48:50 +0000 Subject: [PATCH] use av_log_get/set_level() git-svn-id: file:///var/local/repositories/ffmpeg/trunk@11209 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- ffmpeg.c | 4 ++-- ffplay.c | 2 +- libavcodec/utils.c | 2 +- libavutil/log.c | 6 ------ libavutil/log.h | 7 +++---- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 7a8dcac38..9712a31fb 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -2169,7 +2169,7 @@ static int opt_default(const char *opt, const char *arg){ #endif if(avctx_opts[0]->debug) - av_log_level = AV_LOG_DEBUG; + av_log_set_level(AV_LOG_DEBUG); return 0; } @@ -2186,7 +2186,7 @@ static void opt_me_threshold(const char *arg) static void opt_verbose(const char *arg) { verbose = atoi(arg); - av_log_level = atoi(arg); + av_log_set_level(atoi(arg)); } static void opt_frame_rate(const char *arg) diff --git a/ffplay.c b/ffplay.c index c017ff8b5..288df2d41 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2422,7 +2422,7 @@ static void opt_seek(const char *arg) static void opt_debug(const char *arg) { - av_log_level = 99; + av_log_set_level(99); debug = atoi(arg); } diff --git a/libavcodec/utils.c b/libavcodec/utils.c index fdfa7bd4e..290814dcc 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1139,7 +1139,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) " [PAR %d:%d DAR %d:%d]", enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den, display_aspect_ratio.num, display_aspect_ratio.den); - if(av_log_level >= AV_LOG_DEBUG){ + if(av_log_get_level() >= AV_LOG_DEBUG){ int g= ff_gcd(enc->time_base.num, enc->time_base.den); snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %d/%d", diff --git a/libavutil/log.c b/libavutil/log.c index 4fd503d0d..fed0ce80a 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -45,11 +45,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) vfprintf(stderr, fmt, vl); } -#if LIBAVUTIL_VERSION_INT < (50<<16) static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback; -#else -void (*av_vlog)(void*, int, const char*, va_list) = av_log_default_callback; -#endif void av_log(void* avcl, int level, const char *fmt, ...) { @@ -59,7 +55,6 @@ void av_log(void* avcl, int level, const char *fmt, ...) va_end(vl); } -#if LIBAVUTIL_VERSION_INT < (50<<16) void av_vlog(void* avcl, int level, const char *fmt, va_list vl) { av_log_callback(avcl, level, fmt, vl); @@ -79,4 +74,3 @@ void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) { av_log_callback = callback; } -#endif diff --git a/libavutil/log.h b/libavutil/log.h index 243037239..5d18197ef 100644 --- a/libavutil/log.h +++ b/libavutil/log.h @@ -81,7 +81,10 @@ struct AVCLASS { */ #define AV_LOG_DEBUG 48 #endif + +#if LIBAVUTIL_VERSION_INT < (50<<16) extern int av_log_level; +#endif /** * Send the specified message to the log if the level is less than or equal to @@ -103,14 +106,10 @@ extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__for extern void av_log(void*, int level, const char *fmt, ...); #endif -#if LIBAVUTIL_VERSION_INT < (50<<16) extern void av_vlog(void*, int level, const char *fmt, va_list); extern int av_log_get_level(void); extern void av_log_set_level(int); extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); extern void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); -#else -extern void (*av_vlog)(void*, int, const char*, va_list); -#endif #endif /* FFMPEG_LOG_H */ -- 2.39.2