static void vlc_LogCallback(libvlc_int_t *vlc, int type, const vlc_log_t *item, const char *format, ...) { va_list ap; va_start(ap, format); vlc_vaLogCallback(vlc, type, item, format, ap); va_end(ap); }
/** * Emit a log message. This function is the variable argument list equivalent * to vlc_Log(). */ void vlc_vaLog (vlc_object_t *obj, int type, const char *module, const char *file, unsigned line, const char *func, const char *format, va_list args) { if (obj != NULL && obj->obj.flags & OBJECT_FLAGS_QUIET) return; /* Get basename from the module filename */ char *p = strrchr(module, '/'); if (p != NULL) module = p + 1; p = strchr(module, '.'); size_t modlen = (p != NULL) ? (p - module) : 0; char modulebuf[modlen + 1]; if (p != NULL) { memcpy(modulebuf, module, modlen); modulebuf[modlen] = '\0'; module = modulebuf; } /* Fill message information fields */ vlc_log_t msg; msg.i_object_id = (uintptr_t)obj; msg.psz_object_type = (obj != NULL) ? obj->obj.object_type : "generic"; msg.psz_module = module; msg.psz_header = NULL; msg.file = file; msg.line = line; msg.func = func; msg.tid = vlc_thread_id(); for (vlc_object_t *o = obj; o != NULL; o = o->obj.parent) if (o->obj.header != NULL) { msg.psz_header = o->obj.header; break; } #ifdef _WIN32 va_list ap; va_copy (ap, args); Win32DebugOutputMsg (NULL, type, &msg, format, ap); va_end (ap); #endif /* Pass message to the callback */ if (obj != NULL) vlc_vaLogCallback(obj->obj.libvlc, type, &msg, format, args); }