1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

use av_log_get/set_level()

Originally committed as revision 11209 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Måns Rullgård 2007-12-12 21:48:50 +00:00
parent 0bc308de56
commit a309073bf4
5 changed files with 7 additions and 14 deletions

View File

@ -2169,7 +2169,7 @@ static int opt_default(const char *opt, const char *arg){
#endif #endif
if(avctx_opts[0]->debug) if(avctx_opts[0]->debug)
av_log_level = AV_LOG_DEBUG; av_log_set_level(AV_LOG_DEBUG);
return 0; return 0;
} }
@ -2186,7 +2186,7 @@ static void opt_me_threshold(const char *arg)
static void opt_verbose(const char *arg) static void opt_verbose(const char *arg)
{ {
verbose = atoi(arg); verbose = atoi(arg);
av_log_level = atoi(arg); av_log_set_level(atoi(arg));
} }
static void opt_frame_rate(const char *arg) static void opt_frame_rate(const char *arg)

View File

@ -2422,7 +2422,7 @@ static void opt_seek(const char *arg)
static void opt_debug(const char *arg) static void opt_debug(const char *arg)
{ {
av_log_level = 99; av_log_set_level(99);
debug = atoi(arg); debug = atoi(arg);
} }

View File

@ -1139,7 +1139,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
" [PAR %d:%d DAR %d:%d]", " [PAR %d:%d DAR %d:%d]",
enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den, enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den,
display_aspect_ratio.num, display_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); int g= ff_gcd(enc->time_base.num, enc->time_base.den);
snprintf(buf + strlen(buf), buf_size - strlen(buf), snprintf(buf + strlen(buf), buf_size - strlen(buf),
", %d/%d", ", %d/%d",

View File

@ -45,11 +45,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
vfprintf(stderr, fmt, 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; 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, ...) 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); va_end(vl);
} }
#if LIBAVUTIL_VERSION_INT < (50<<16)
void av_vlog(void* avcl, int level, const char *fmt, va_list vl) void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
{ {
av_log_callback(avcl, level, fmt, 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; av_log_callback = callback;
} }
#endif

View File

@ -81,7 +81,10 @@ struct AVCLASS {
*/ */
#define AV_LOG_DEBUG 48 #define AV_LOG_DEBUG 48
#endif #endif
#if LIBAVUTIL_VERSION_INT < (50<<16)
extern int av_log_level; extern int av_log_level;
#endif
/** /**
* Send the specified message to the log if the level is less than or equal to * 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, ...); extern void av_log(void*, int level, const char *fmt, ...);
#endif #endif
#if LIBAVUTIL_VERSION_INT < (50<<16)
extern void av_vlog(void*, int level, const char *fmt, va_list); extern void av_vlog(void*, int level, const char *fmt, va_list);
extern int av_log_get_level(void); extern int av_log_get_level(void);
extern void av_log_set_level(int); extern void av_log_set_level(int);
extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); 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); 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 */ #endif /* FFMPEG_LOG_H */