From 9da70ef6b0967720f993d91c87e222b5e2f37927 Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Wed, 31 Aug 2005 19:09:50 +0000 Subject: [PATCH] * ALL: Do no longer assume a default DVD drive. If no DVD drive is specified (an empty string), forward the empty string to libdvdcss and let it do autodetection. * extras/contrib/src/Patches: Patched libdvdread to accept an empty string as a device path. --- extras/contrib/src/Patches/dvdnav.patch | 90 +++++++++++++-------- extras/contrib/src/Patches/libdvdread.patch | 37 +++++++-- include/vlc_config.h | 2 - modules/access/dvdnav.c | 8 +- modules/access/dvdread.c | 8 +- src/libvlc.h | 2 +- 6 files changed, 93 insertions(+), 54 deletions(-) diff --git a/extras/contrib/src/Patches/dvdnav.patch b/extras/contrib/src/Patches/dvdnav.patch index 12cba04fe7..5fd2991d45 100644 --- a/extras/contrib/src/Patches/dvdnav.patch +++ b/extras/contrib/src/Patches/dvdnav.patch @@ -1,6 +1,6 @@ -diff -ru libdvdnav-orig/configure.ac libdvdnav/configure.ac ---- libdvdnav-orig/configure.ac Sat Mar 12 16:44:18 2005 -+++ libdvdnav/configure.ac Sat Mar 12 16:44:26 2005 +diff -ru libdvdnav-0.1.10/configure.ac libdvdnav/configure.ac +--- libdvdnav-0.1.10/configure.ac 2004-06-10 23:13:02.000000000 +0200 ++++ libdvdnav/configure.ac 2005-08-31 19:56:21.000000000 +0200 @@ -8,7 +8,7 @@ dnl -------------------------------------------------------------- dnl Require autoconf version 2.53 @@ -110,9 +110,9 @@ diff -ru libdvdnav-orig/configure.ac libdvdnav/configure.ac dnl --------------------------------------------- dnl cflags -diff -ru libdvdnav-orig/examples/Makefile.am libdvdnav/examples/Makefile.am ---- libdvdnav-orig/examples/Makefile.am Sat Mar 12 16:44:18 2005 -+++ libdvdnav/examples/Makefile.am Sat Mar 12 16:44:26 2005 +diff -ru libdvdnav-0.1.10/examples/Makefile.am libdvdnav/examples/Makefile.am +--- libdvdnav-0.1.10/examples/Makefile.am 2004-01-11 22:43:12.000000000 +0100 ++++ libdvdnav/examples/Makefile.am 2005-08-31 19:56:21.000000000 +0200 @@ -7,7 +7,7 @@ noinst_PROGRAMS = menus @@ -122,9 +122,9 @@ diff -ru libdvdnav-orig/examples/Makefile.am libdvdnav/examples/Makefile.am menus_LDADD = $(DVDNAV_LIB) $(DVDNAV_LIB): -diff -ru libdvdnav-orig/src/dvdnav_internal.h libdvdnav/src/dvdnav_internal.h ---- libdvdnav-orig/src/dvdnav_internal.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdnav_internal.h Sat Mar 12 16:44:26 2005 +diff -ru libdvdnav-0.1.10/src/dvdnav_internal.h libdvdnav/src/dvdnav_internal.h +--- libdvdnav-0.1.10/src/dvdnav_internal.h 2004-02-13 20:16:17.000000000 +0100 ++++ libdvdnav/src/dvdnav_internal.h 2005-08-31 19:56:21.000000000 +0200 @@ -58,6 +58,15 @@ #include /* read() */ #define lseek64 _lseeki64 @@ -141,9 +141,9 @@ diff -ru libdvdnav-orig/src/dvdnav_internal.h libdvdnav/src/dvdnav_internal.h #else #include -diff -ru libdvdnav-orig/src/dvdread/bswap.h libdvdnav/src/dvdread/bswap.h ---- libdvdnav-orig/src/dvdread/bswap.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/bswap.h Sat Mar 12 16:44:26 2005 +diff -ru libdvdnav-0.1.10/src/dvdread/bswap.h libdvdnav/src/dvdread/bswap.h +--- libdvdnav-0.1.10/src/dvdread/bswap.h 2004-01-11 22:43:13.000000000 +0100 ++++ libdvdnav/src/dvdread/bswap.h 2005-08-31 19:56:21.000000000 +0200 @@ -65,7 +65,7 @@ * functionality! */ @@ -153,9 +153,9 @@ diff -ru libdvdnav-orig/src/dvdread/bswap.h libdvdnav/src/dvdread/bswap.h #define B2N_16(x) \ x = ((((x) & 0xff00) >> 8) | \ (((x) & 0x00ff) << 8)) -diff -ru libdvdnav-orig/src/dvdread/dvd_input.h libdvdnav/src/dvdread/dvd_input.h ---- libdvdnav-orig/src/dvdread/dvd_input.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/dvd_input.h Sat Mar 12 17:36:26 2005 +diff -ru libdvdnav-0.1.10/src/dvdread/dvd_input.h libdvdnav/src/dvdread/dvd_input.h +--- libdvdnav-0.1.10/src/dvdread/dvd_input.h 2004-01-11 22:43:13.000000000 +0100 ++++ libdvdnav/src/dvdread/dvd_input.h 2005-08-31 19:56:21.000000000 +0200 @@ -20,6 +20,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ @@ -165,10 +165,30 @@ diff -ru libdvdnav-orig/src/dvdread/dvd_input.h libdvdnav/src/dvdread/dvd_input. /** * Defines and flags. Make sure they fit the libdvdcss API! */ -diff -ru libdvdnav-orig/src/dvdread/dvd_reader.c libdvdnav/src/dvdread/dvd_reader.c ---- libdvdnav-orig/src/dvdread/dvd_reader.c Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/dvd_reader.c Sat Mar 12 17:34:48 2005 -@@ -403,14 +403,16 @@ +diff -ru libdvdnav-0.1.10/src/dvdread/dvd_reader.c libdvdnav/src/dvdread/dvd_reader.c +--- libdvdnav-0.1.10/src/dvdread/dvd_reader.c 2004-03-03 17:48:36.000000000 +0100 ++++ libdvdnav/src/dvdread/dvd_reader.c 2005-08-31 19:58:34.000000000 +0200 +@@ -346,9 +346,7 @@ + } + #endif + +- ret = stat( path, &fileinfo ); +- +- if( ret < 0 ) { ++ if( *path && (ret = stat( path, &fileinfo )) < 0 ) { + + /* maybe "host:port" url? try opening it with acCeSS library */ + if( strchr(path,':') ) { +@@ -365,7 +363,7 @@ + } + + /* First check if this is a block/char device or a file*/ +- if( S_ISBLK( fileinfo.st_mode ) || ++ if( !*path || S_ISBLK( fileinfo.st_mode ) || + S_ISCHR( fileinfo.st_mode ) || + S_ISREG( fileinfo.st_mode ) ) { + +@@ -403,14 +401,16 @@ /* Resolve any symlinks and get the absolut dir name. */ { @@ -189,7 +209,7 @@ diff -ru libdvdnav-orig/src/dvdread/dvd_reader.c libdvdnav/src/dvdread/dvd_reade if( new_path ) { free( path_copy ); path_copy = new_path; -@@ -585,10 +587,12 @@ +@@ -585,10 +585,12 @@ sprintf( filename, "%s%s%s", path, ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ), ent->d_name ); @@ -202,9 +222,9 @@ diff -ru libdvdnav-orig/src/dvdread/dvd_reader.c libdvdnav/src/dvdread/dvd_reade return -1; } -diff -ru libdvdnav-orig/src/dvdread/dvd_reader.h libdvdnav/src/dvdread/dvd_reader.h ---- libdvdnav-orig/src/dvdread/dvd_reader.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/dvd_reader.h Sat Mar 12 17:43:28 2005 +diff -ru libdvdnav-0.1.10/src/dvdread/dvd_reader.h libdvdnav/src/dvdread/dvd_reader.h +--- libdvdnav-0.1.10/src/dvdread/dvd_reader.h 2004-02-01 18:55:19.000000000 +0100 ++++ libdvdnav/src/dvdread/dvd_reader.h 2005-08-31 19:56:21.000000000 +0200 @@ -21,6 +21,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -226,9 +246,9 @@ diff -ru libdvdnav-orig/src/dvdread/dvd_reader.h libdvdnav/src/dvdread/dvd_reade #ifdef _MSC_VER #include -diff -ru libdvdnav-orig/src/dvdread/dvd_udf.h libdvdnav/src/dvdread/dvd_udf.h ---- libdvdnav-orig/src/dvdread/dvd_udf.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/dvd_udf.h Sat Mar 12 17:44:45 2005 +diff -ru libdvdnav-0.1.10/src/dvdread/dvd_udf.h libdvdnav/src/dvdread/dvd_udf.h +--- libdvdnav-0.1.10/src/dvdread/dvd_udf.h 2004-01-11 22:43:13.000000000 +0100 ++++ libdvdnav/src/dvdread/dvd_udf.h 2005-08-31 19:56:21.000000000 +0200 @@ -31,6 +31,13 @@ * http://www.gnu.org/copyleft/gpl.html */ @@ -243,9 +263,9 @@ diff -ru libdvdnav-orig/src/dvdread/dvd_udf.h libdvdnav/src/dvdread/dvd_udf.h #include #include "dvd_reader.h" -diff -ru libdvdnav-orig/src/dvdread/ifo_print.h libdvdnav/src/dvdread/ifo_print.h ---- libdvdnav-orig/src/dvdread/ifo_print.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/ifo_print.h Sat Mar 12 17:46:07 2005 +diff -ru libdvdnav-0.1.10/src/dvdread/ifo_print.h libdvdnav/src/dvdread/ifo_print.h +--- libdvdnav-0.1.10/src/dvdread/ifo_print.h 2004-01-11 22:43:13.000000000 +0100 ++++ libdvdnav/src/dvdread/ifo_print.h 2005-08-31 19:56:21.000000000 +0200 @@ -20,6 +20,21 @@ #ifndef IFO_PRINT_H_INCLUDED #define IFO_PRINT_H_INCLUDED @@ -268,9 +288,9 @@ diff -ru libdvdnav-orig/src/dvdread/ifo_print.h libdvdnav/src/dvdread/ifo_print. #include #ifdef DVDNAV_COMPILE # include "ifo_types.h" -diff -ru libdvdnav-orig/src/dvdread/ifo_read.h libdvdnav/src/dvdread/ifo_read.h ---- libdvdnav-orig/src/dvdread/ifo_read.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/ifo_read.h Sat Mar 12 17:48:22 2005 +diff -ru libdvdnav-0.1.10/src/dvdread/ifo_read.h libdvdnav/src/dvdread/ifo_read.h +--- libdvdnav-0.1.10/src/dvdread/ifo_read.h 2004-01-11 22:43:13.000000000 +0100 ++++ libdvdnav/src/dvdread/ifo_read.h 2005-08-31 19:56:21.000000000 +0200 @@ -20,6 +20,37 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -309,9 +329,9 @@ diff -ru libdvdnav-orig/src/dvdread/ifo_read.h libdvdnav/src/dvdread/ifo_read.h #include "ifo_types.h" #include "dvd_reader.h" -diff -ru libdvdnav-orig/src/dvdread/md5.h libdvdnav/src/dvdread/md5.h ---- libdvdnav-orig/src/dvdread/md5.h Sat Mar 12 16:44:18 2005 -+++ libdvdnav/src/dvdread/md5.h Sat Mar 12 17:49:33 2005 +diff -ru libdvdnav-0.1.10/src/dvdread/md5.h libdvdnav/src/dvdread/md5.h +--- libdvdnav-0.1.10/src/dvdread/md5.h 2004-01-11 22:43:13.000000000 +0100 ++++ libdvdnav/src/dvdread/md5.h 2005-08-31 19:56:21.000000000 +0200 @@ -21,6 +21,14 @@ #ifndef _MD5_H #define _MD5_H 1 diff --git a/extras/contrib/src/Patches/libdvdread.patch b/extras/contrib/src/Patches/libdvdread.patch index 6da659844b..e813215493 100644 --- a/extras/contrib/src/Patches/libdvdread.patch +++ b/extras/contrib/src/Patches/libdvdread.patch @@ -1,6 +1,7 @@ -diff -ru libdvdread-orig/dvdread/bswap.h libdvdread/dvdread/bswap.h ---- libdvdread-orig/dvdread/bswap.h Sat Mar 12 16:42:18 2005 -+++ libdvdread/dvdread/bswap.h Sat Mar 12 16:42:25 2005 +Only in libdvdread/dvdread: .dvd_input.c.swp +diff -ru libdvdread-0.9.4/dvdread/bswap.h libdvdread/dvdread/bswap.h +--- libdvdread-0.9.4/dvdread/bswap.h 2002-12-15 01:09:12.000000000 +0100 ++++ libdvdread/dvdread/bswap.h 2005-08-31 19:24:57.000000000 +0200 @@ -65,7 +65,7 @@ * functionality! */ @@ -10,10 +11,29 @@ diff -ru libdvdread-orig/dvdread/bswap.h libdvdread/dvdread/bswap.h #define B2N_16(x) \ x = ((((x) & 0xff00) >> 8) | \ (((x) & 0x00ff) << 8)) -diff -ru libdvdread-orig/dvdread/dvd_reader.c libdvdread/dvdread/dvd_reader.c ---- libdvdread-orig/dvdread/dvd_reader.c Sat Mar 12 16:42:18 2005 -+++ libdvdread/dvdread/dvd_reader.c Sat Mar 12 16:48:29 2005 -@@ -344,14 +344,16 @@ +diff -ru libdvdread-0.9.4/dvdread/dvd_reader.c libdvdread/dvdread/dvd_reader.c +--- libdvdread-0.9.4/dvdread/dvd_reader.c 2003-02-13 23:31:21.000000000 +0100 ++++ libdvdread/dvdread/dvd_reader.c 2005-08-31 19:24:57.000000000 +0200 +@@ -303,8 +303,7 @@ + if( path == NULL ) + return 0; + +- ret = stat( path, &fileinfo ); +- if( ret < 0 ) { ++ if( *path && (ret = stat( path, &fileinfo ) < 0) ) { + /* If we can't stat the file, give up */ + fprintf( stderr, "libdvdread: Can't stat %s\n", path ); + perror(""); +@@ -315,7 +314,7 @@ + have_css = dvdinput_setup(); + + /* First check if this is a block/char device or a file*/ +- if( S_ISBLK( fileinfo.st_mode ) || ++ if( !*path || S_ISBLK( fileinfo.st_mode ) || + S_ISCHR( fileinfo.st_mode ) || + S_ISREG( fileinfo.st_mode ) ) { + +@@ -344,14 +343,16 @@ /* Resolve any symlinks and get the absolut dir name. */ { @@ -35,7 +55,7 @@ diff -ru libdvdread-orig/dvdread/dvd_reader.c libdvdread/dvdread/dvd_reader.c if( new_path ) { free( path_copy ); path_copy = new_path; -@@ -504,10 +506,12 @@ +@@ -504,10 +505,12 @@ sprintf( filename, "%s%s%s", path, ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ), ent->d_name ); @@ -48,3 +68,4 @@ diff -ru libdvdread-orig/dvdread/dvd_reader.c libdvdread/dvdread/dvd_reader.c return -1; } +Only in libdvdread/dvdread: dvd_reader.c.orig diff --git a/include/vlc_config.h b/include/vlc_config.h index debf4225a0..6471acd843 100644 --- a/include/vlc_config.h +++ b/include/vlc_config.h @@ -92,11 +92,9 @@ /* DVD and VCD devices */ #if !defined( WIN32 ) && !defined( UNDER_CE ) -# define DVD_DEVICE "/dev/dvd" # define VCD_DEVICE "/dev/cdrom" # define CDAUDIO_DEVICE "/dev/cdrom" #else -# define DVD_DEVICE "D:" # define VCD_DEVICE "D:" # define CDAUDIO_DEVICE "D:" #endif diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c index d2d11f512c..a814f6adee 100644 --- a/modules/access/dvdnav.c +++ b/modules/access/dvdnav.c @@ -176,13 +176,13 @@ static int Open( vlc_object_t *p_this ) if( !p_this->b_force ) return VLC_EGENERIC; psz_name = var_CreateGetString( p_this, "dvd" ); - if( !psz_name || !*psz_name ) + if( !psz_name ) { - if( psz_name ) free( psz_name ); - return VLC_EGENERIC; + psz_name = strdup(""); } } - else psz_name = strdup( p_demux->psz_path ); + else + psz_name = strdup( p_demux->psz_path ); #ifdef WIN32 if( psz_name[0] && psz_name[1] == ':' && diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c index 978c8fa0ab..1667426339 100644 --- a/modules/access/dvdread.c +++ b/modules/access/dvdread.c @@ -192,13 +192,13 @@ static int Open( vlc_object_t *p_this ) if( !p_this->b_force ) return VLC_EGENERIC; psz_name = var_CreateGetString( p_this, "dvd" ); - if( !psz_name || !*psz_name ) + if( !psz_name ) { - if( psz_name ) free( psz_name ); - return VLC_EGENERIC; + psz_name = strdup(""); } } - else psz_name = strdup( p_demux->psz_path ); + else + psz_name = strdup( p_demux->psz_path ); #ifdef WIN32 if( psz_name[0] && psz_name[1] == ':' && diff --git a/src/libvlc.h b/src/libvlc.h index e41d8752ff..3166900575 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -1112,7 +1112,7 @@ vlc_module_begin(); set_section( N_( "Default devices") , NULL ) - add_file( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT, + add_file( "dvd", NULL, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT, VLC_FALSE ); add_file( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT, VLC_FALSE ); -- 2.39.2