]> git.sesse.net Git - vlc/blobdiff - include/vlc_messages.h
block: rewrite block_Fifo(Empty,Get,Put) with the new functions
[vlc] / include / vlc_messages.h
index 69aaea4465cb1a67e67b8adfb1cbeeedf2016f40..2da692e65ccd927807a34663a5e96fe952ffb997 100644 (file)
@@ -43,7 +43,7 @@
  */
 
 /** Message types */
-enum msg_item_type
+enum vlc_log_type
 {
     VLC_MSG_INFO=0, /**< Important information */
     VLC_MSG_ERR,    /**< Error */
@@ -54,28 +54,56 @@ enum msg_item_type
 /**
  * Log message
  */
-typedef struct
+typedef struct vlc_log_t
 {
     uintptr_t   i_object_id; /**< Emitter (temporaly) unique object ID or 0 */
     const char *psz_object_type; /**< Emitter object type name */
     const char *psz_module; /**< Emitter module (source code) */
     const char *psz_header; /**< Additional header (used by VLM media) */
-} msg_item_t;
+    const char *file; /**< Source code file name or NULL */
+    int line; /**< Source code file line number or -1 */
+    const char *func; /**< Source code calling function name or NULL */
+} vlc_log_t;
 
-VLC_API void vlc_Log(vlc_object_t *, int,
-                     const char *, const char *, ...) VLC_FORMAT( 4, 5 );
-VLC_API void vlc_vaLog(vlc_object_t *, int,
-                       const char *, const char *, va_list);
-#define msg_GenericVa(a, b, c, d, e) vlc_vaLog(VLC_OBJECT(a), b, c, d, e)
+VLC_API void vlc_Log(vlc_object_t *obj, int prio, const char *module,
+                     const char *file, unsigned line, const char *func,
+                     const char *format, ...) VLC_FORMAT(7, 8);
+VLC_API void vlc_vaLog(vlc_object_t *obj, int prio, const char *module,
+                       const char *file, unsigned line, const char *func,
+                       const char *format, va_list ap);
+#define msg_GenericVa(o, p, fmt, ap) \
+    vlc_vaLog(VLC_OBJECT(o), p, MODULE_STRING, __FILE__, __LINE__, __func__, \
+              fmt, ap)
 
-#define msg_Info( p_this, ... ) \
-    vlc_Log( VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, __VA_ARGS__ )
-#define msg_Err( p_this, ... ) \
-    vlc_Log( VLC_OBJECT(p_this), VLC_MSG_ERR,  MODULE_STRING, __VA_ARGS__ )
-#define msg_Warn( p_this, ... ) \
-    vlc_Log( VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, __VA_ARGS__ )
-#define msg_Dbg( p_this, ... ) \
-    vlc_Log( VLC_OBJECT(p_this), VLC_MSG_DBG,  MODULE_STRING, __VA_ARGS__ )
+#define msg_Generic(o, p, ...) \
+    vlc_Log(VLC_OBJECT(o), p, MODULE_STRING, __FILE__, __LINE__, \
+            __func__, __VA_ARGS__)
+#define msg_Info(p_this, ...) \
+    msg_Generic(p_this, VLC_MSG_INFO, __VA_ARGS__)
+#define msg_Err(p_this, ...) \
+    msg_Generic(p_this, VLC_MSG_ERR, __VA_ARGS__)
+#define msg_Warn(p_this, ...) \
+    msg_Generic(p_this, VLC_MSG_WARN, __VA_ARGS__)
+#define msg_Dbg(p_this, ...) \
+    msg_Generic(p_this, VLC_MSG_DBG, __VA_ARGS__)
+
+#ifndef MODULE_STRING
+# define MODULE_STRING __FILE__
+#endif
+
+VLC_API const char *vlc_strerror(int);
+VLC_API const char *vlc_strerror_c(int);
+
+/**
+ * Message logging callback signature.
+ * \param data data pointer as provided to vlc_msg_SetCallback().
+ * \param type message type (VLC_MSG_* values from enum vlc_log_type)
+ * \param item meta information
+ * \param fmt format string
+ * \param args format string arguments
+ */
+typedef void (*vlc_log_cb) (void *data, int type, const vlc_log_t *item,
+                            const char *fmt, va_list args);
 
 /**
  * @}