[vlc-commits] access: bluray: add debug handler

Francois Cartegnie git at videolan.org
Mon Oct 22 14:17:59 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Oct 18 18:06:40 2018 +0200| [fc3928f928b0e0d0ce61646287c306b1aac2402d] | committer: Francois Cartegnie

access: bluray: add debug handler

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fc3928f928b0e0d0ce61646287c306b1aac2402d
---

 modules/access/bluray.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 7ed11c1935..b21d30225d 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -63,6 +63,23 @@
 #include <libbluray/meta_data.h>
 #include <libbluray/overlay.h>
 
+//#define DEBUG_BLURAY
+#ifdef DEBUG_BLURAY
+#  include <libbluray/log_control.h>
+#  define BLURAY_DEBUG_MASK (0xFFFFF & ~DBG_STREAM)
+static vlc_object_t *p_bluray_DebugObject;
+static void bluray_DebugHandler(const char *psz)
+{
+    size_t len = strlen(psz);
+    if(len < 1) return;
+    char *psz_log = NULL;
+    if(psz[len - 1] == '\n')
+        psz_log = strndup(psz, len - 1);
+    msg_Dbg(p_bluray_DebugObject, "%s", psz_log ? psz_log : psz);
+    free(psz_log);
+}
+#endif
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -762,6 +779,12 @@ static int blurayOpen(vlc_object_t *object)
     var_Create( p_demux, "ts-cc-check", VLC_VAR_BOOL );
     var_SetBool( p_demux, "ts-cc-check", false );
 
+#ifdef DEBUG_BLURAY
+    p_bluray_DebugObject = VLC_OBJECT(p_demux);
+    bd_set_debug_mask(BLURAY_DEBUG_MASK);
+    bd_set_debug_handler(bluray_DebugHandler);
+#endif
+
     /* Open BluRay */
 #ifdef BLURAY_DEMUX
     if (p_demux->s) {



More information about the vlc-commits mailing list