33 #if defined(__linux__) || defined(__APPLE__)
45 #include <android/log.h>
47 static char ni_log_tag[128] =
"libxcoder";
49 #define ALOGV(fmt, ...) \
50 __android_log_vprint(ANDROID_LOG_VERBOSE, ni_log_tag, fmt, ##__VA_ARGS__)
51 #define ALOGD(fmt, ...) \
52 __android_log_vprint(ANDROID_LOG_DEBUG, ni_log_tag, fmt, ##__VA_ARGS__)
53 #define ALOGI(fmt, ...) \
54 __android_log_vprint(ANDROID_LOG_INFO, ni_log_tag, fmt, ##__VA_ARGS__)
55 #define ALOGW(fmt, ...) \
56 __android_log_vprint(ANDROID_LOG_WARN, ni_log_tag, fmt, ##__VA_ARGS__)
57 #define ALOGE(fmt, ...) \
58 __android_log_vprint(ANDROID_LOG_ERROR, ni_log_tag, fmt, ##__VA_ARGS__)
73 if (level <= ni_log_level)
76 #ifdef NI_LOG_TRACE_TIMESTAMPS
81 fprintf(stderr,
"[%" PRIu64
"] ", tv.tv_sec * 1000000LL + tv.tv_usec);
94 vfprintf(stderr, fmt, vl);
108 ni_log_callback = log_callback;
123 void (*log_callback)(int,
const char*, va_list);
126 if (log_callback = ni_log_callback)
127 log_callback(level, fmt, vl);
140 ni_log_level = level;
163 if (fflog_level >= -8)
167 if (fflog_level >= 8)
171 if (fflog_level >= 16)
175 if (fflog_level >= 32)
179 if (fflog_level >= 48)
183 if (fflog_level >= 56)
187 return converted_ni_log_level;
198 void ni_log_set_log_tag(
const char *log_tag)
200 strcpy(ni_log_tag, log_tag);
201 ni_log_tag[strlen(log_tag)] =
'\0';
void ni_log_default_callback(int level, const char *fmt, va_list vl)
Default ni_log() callback.
ni_log_level_t ni_log_get_level(void)
Get ni_log_level.
ni_log_level_t ff_to_ni_log_level(int fflog_level)
Convert ffmpeg log level integer to appropriate ni_log_level_t.
void ni_log_set_callback(void(*log_callback)(int, const char *, va_list))
Set ni_log() callback.
void ni_log_set_level(ni_log_level_t level)
Set ni_log_level.
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
Exported logging routines definition.
int32_t ni_logan_gettimeofday(struct timeval *p_tp, void *p_tzp)