[MPlayer-dev-eng] [PATCH] cygwin mpdvdkit testing

Joey Parrish joey at nicewarrior.org
Mon Jun 9 15:53:27 CEST 2003


Hello,

I have not in the recent past been able to get cygwin mpdvdkit to work
properly.  At the moment, I have no cygwin box with a dvd player for
testing, but for some reason I picked this time to start thinking about
the problem again.

If someone can tell me whether their cygwin mpdvdkit is working at the
moment, that would be great.  (Please test on latest cygwin dll.)

Try these things without patching:
mplayer dvd://1 -dvd-device D:
mplayer dvd://1 -dvd-device //./D:
mplayer dvd://1 -dvd-device /dev/scd0

Try these with patch:
mplayer dvd://1 -dvd-device D:
mplayer dvd://1 -dvd-device //./D:

Replace the dvd title and drive name as needed, and use scd1 for second
cd device, etc.

To explain:

The big things to me are that devices in the form D: can't be statted in
latest cygwin.  So the form //./d: must be used as device name, but then
some parts of the code later expect the D: form.  I read something at
cygwin.com that also lead me to believe that /dev/scd0 would work right,
but again, I haven't been able to test myself yet.

This chunk is because I think that [3] is a typo, and [2] is correct.

--- ../main.cvs/libmpdvdkit2/device.c	2003-02-07 18:22:38.000000000 -0600
+++ libmpdvdkit2/device.c	2003-06-08 03:51:27.000000000 -0500
@@ -135,7 +135,7 @@
 
 #if defined( WIN32 )
     /* If device is not "X:", we are actually opening a file. */
-    dvdcss->b_file = !psz_device[0] || psz_device[1] != ':' || psz_device[3];
+    dvdcss->b_file = !psz_device[0] || psz_device[1] != ':' || psz_device[2];
 
     /* Initialize readv temporary buffer */
     dvdcss->p_readv_buffer   = NULL;

This chunk is a bad bad idea, and should never be comitted.  I used it
for debugging to get around the fact that stat fails for D:.  It is
assumed that this is a block device and moves on.  _ONLY FOR TESTING_

diff -ur ../main.cvs/libmpdvdkit2/dvd_reader.c libmpdvdkit2/dvd_reader.c
--- ../main.cvs/libmpdvdkit2/dvd_reader.c	2003-04-28 20:25:53.000000000 -0500
+++ libmpdvdkit2/dvd_reader.c	2003-06-08 03:51:04.000000000 -0500
@@ -265,10 +265,15 @@
 
     ret = stat( path, &fileinfo );
     if( ret < 0 ) {
+#ifdef WIN32
+	/* Is this a bad hack? */
+	fileinfo.st_mode = S_IFBLK;
+#else
 	/* If we can't stat the file, give up */
 	fprintf( stderr, "libdvdread: Can't stat %s\n", path );
 	perror("");
 	return 0;
+#endif
     }
 
     /* Try to open libdvdcss or fall back to standard functions */

This chunk sets the verbose level to 2, so that anyone who sends me back
logs won't have to remember to set a shell variable.
     
diff -ur ../main.cvs/libmpdvdkit2/libdvdcss.c libmpdvdkit2/libdvdcss.c
--- ../main.cvs/libmpdvdkit2/libdvdcss.c	2003-04-08 12:36:33.000000000 -0500
+++ libmpdvdkit2/libdvdcss.c	2003-06-08 02:50:07.000000000 -0500
@@ -154,7 +154,8 @@
     int i_ret;
 
     char *psz_method = getenv( "DVDCSS_METHOD" );
-    char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+//    char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+    char psz_verbose[2] = "2";
     char *psz_cache = getenv( "DVDCSS_CACHE" );
 #ifndef WIN32
     char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );

If /dev/scd0 form works on latest cygwin, then making that the default
device name on CYGWIN is the best fix.  However, I think that working
support for drive letters would be good.  In that case, the stat part
of the code should detect the X: syntax and convert it to //./X:, then
stat that, passing the X: form on, though.  Or, another fix would be to
make all the X: expecting parts look for //./X: instead and stick to
that.

Thoughts?

--Joey
-------------- next part --------------
diff -ur ../main.cvs/libmpdvdkit2/device.c libmpdvdkit2/device.c
--- ../main.cvs/libmpdvdkit2/device.c	2003-02-07 18:22:38.000000000 -0600
+++ libmpdvdkit2/device.c	2003-06-08 03:51:27.000000000 -0500
@@ -135,7 +135,7 @@
 
 #if defined( WIN32 )
     /* If device is not "X:", we are actually opening a file. */
-    dvdcss->b_file = !psz_device[0] || psz_device[1] != ':' || psz_device[3];
+    dvdcss->b_file = !psz_device[0] || psz_device[1] != ':' || psz_device[2];
 
     /* Initialize readv temporary buffer */
     dvdcss->p_readv_buffer   = NULL;
diff -ur ../main.cvs/libmpdvdkit2/dvd_reader.c libmpdvdkit2/dvd_reader.c
--- ../main.cvs/libmpdvdkit2/dvd_reader.c	2003-04-28 20:25:53.000000000 -0500
+++ libmpdvdkit2/dvd_reader.c	2003-06-08 03:51:04.000000000 -0500
@@ -265,10 +265,15 @@
 
     ret = stat( path, &fileinfo );
     if( ret < 0 ) {
+#ifdef WIN32
+	/* Is this a bad hack? */
+	fileinfo.st_mode = S_IFBLK;
+#else
 	/* If we can't stat the file, give up */
 	fprintf( stderr, "libdvdread: Can't stat %s\n", path );
 	perror("");
 	return 0;
+#endif
     }
 
     /* Try to open libdvdcss or fall back to standard functions */
diff -ur ../main.cvs/libmpdvdkit2/libdvdcss.c libmpdvdkit2/libdvdcss.c
--- ../main.cvs/libmpdvdkit2/libdvdcss.c	2003-04-08 12:36:33.000000000 -0500
+++ libmpdvdkit2/libdvdcss.c	2003-06-08 02:50:07.000000000 -0500
@@ -154,7 +154,8 @@
     int i_ret;
 
     char *psz_method = getenv( "DVDCSS_METHOD" );
-    char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+//    char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+    char psz_verbose[2] = "2";
     char *psz_cache = getenv( "DVDCSS_CACHE" );
 #ifndef WIN32
     char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );


More information about the MPlayer-dev-eng mailing list