Description: Adjust use of libdvdread to log to stderr not stdout, to avoid generating invalid json, xml, etc when not supporting encrypted DVD. Author: Petter Reinholdtsen Origin: commit:ceb584ef8e8c84e77b01bc2aab5d9cb912f2837e Forwarded: not-needed Last-Update: 2024-01-02 --- --- a/lsdvd.c +++ b/lsdvd.c @@ -424,7 +424,19 @@ int main(int argc, char *argv[]) return 1; } - dvd = DVDOpen(dvd_device); + /* Replacement logger to send output to stderr, ensuring + stdout is always understandable as xml, json, perl, python, + etc. Without this, the 'Encrypted DVD support unavailable' + message can show up in the generated files. */ + void dvdlogger(void *, dvd_logger_level_t, + const char *fmt, va_list list) + { + fprintf(stderr, "libdvdread: "); + vfprintf(stderr, fmt, list); + fprintf(stderr, "\n"); + } + dvd_logger_cb logcb = { dvdlogger }; + dvd = DVDOpen2(NULL, &logcb, dvd_device); if( !dvd ) { fprintf( stderr, "Can't open disc %s!\n", dvd_device); return 2;