[libdvdnav-devel] [Git][videolan/libdvdread][master] Logging: prevent library messages from writing to stdout

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Dec 20 14:20:02 UTC 2025



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread


Commits:
8a49922d by Saifelden Mohamed Ismail at 2025-12-15T18:46:10+00:00
Logging: prevent library messages from writing to stdout

- - - - -


1 changed file:

- src/logger.c


Changes:

=====================================
src/logger.c
=====================================
@@ -23,6 +23,12 @@
 #include "dvdread/dvd_reader.h"
 #include "logger.h"
 
+#ifdef _WIN32
+    #define TTY_DEVICE "CON"
+#else
+    #define TTY_DEVICE "/dev/tty"
+#endif
+
 void DVDReadLog( void *priv, const dvd_logger_cb *logcb,
                  dvd_logger_level_t level, const char *fmt, ... )
 {
@@ -32,7 +38,12 @@ void DVDReadLog( void *priv, const dvd_logger_cb *logcb,
         logcb->pf_log(priv, level, fmt, list);
     else
     {
-        FILE *stream = (level == DVD_LOGGER_LEVEL_ERROR) ? stderr : stdout;
+        static FILE *tty_stream = NULL;
+        if (!tty_stream)
+            tty_stream = fopen(TTY_DEVICE, "w");
+
+        FILE *stream = (level == DVD_LOGGER_LEVEL_ERROR) ? stderr : tty_stream;
+
         fprintf(stream, "libdvdread: ");
         vfprintf(stream, fmt, list);
         fprintf(stream, "\n");



View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/8a49922d77b8df77de540c5afba6718353ee8047

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/commit/8a49922d77b8df77de540c5afba6718353ee8047
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdnav-devel mailing list