summaryrefslogtreecommitdiffstats
path: root/contrib/libdvdread/A02-msc_ver-defs.patch
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-09-15 17:35:00 +0000
committerjstebbins <[email protected]>2009-09-15 17:35:00 +0000
commit2956f6f873dc96dabd391517161961bca3f25802 (patch)
tree4a162b87efeb7820138a4c5a89a29553806d5309 /contrib/libdvdread/A02-msc_ver-defs.patch
parent12436c6dd2b5a4356f925fd586bccab21c21dcf7 (diff)
dvdread: patch allows dvdread access to the raw dvd device under windows
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2825 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'contrib/libdvdread/A02-msc_ver-defs.patch')
-rw-r--r--contrib/libdvdread/A02-msc_ver-defs.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/contrib/libdvdread/A02-msc_ver-defs.patch b/contrib/libdvdread/A02-msc_ver-defs.patch
new file mode 100644
index 000000000..9d58639b5
--- /dev/null
+++ b/contrib/libdvdread/A02-msc_ver-defs.patch
@@ -0,0 +1,85 @@
+diff -Naur libdvdread.orig/src/dvd_reader.c libdvdread/src/dvd_reader.c
+--- libdvdread.orig/src/dvd_reader.c 2009-03-13 18:28:21.000000000 -0700
++++ libdvdread/src/dvd_reader.c 2009-09-15 10:15:25.201548319 -0700
+@@ -36,6 +36,7 @@
+
+ /* misc win32 helpers */
+ #ifdef WIN32
++#include <windows.h>
+ #ifndef HAVE_GETTIMEOFDAY
+ /* replacement gettimeofday implementation */
+ #include <sys/timeb.h>
+@@ -335,7 +336,7 @@
+ char *dev_name = NULL;
+ char *path;
+
+-#ifdef _MSC_VER
++#ifdef _WIN32
+ int len;
+ #endif
+
+@@ -349,7 +350,7 @@
+ /* Try to open libdvdcss or fall back to standard functions */
+ have_css = dvdinput_setup();
+
+-#ifdef _MSC_VER
++#ifdef _WIN32
+ /* Strip off the trailing \ if it is not a drive */
+ len = strlen(path);
+ if ((len > 1) &&
+@@ -447,6 +448,14 @@
+ }
+ }
+
++#ifdef _WIN32
++ if( strlen( path_copy ) > TITLES_MAX ) {
++ if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
++ "\\video_ts" ) ) {
++ path_copy[ strlen( path_copy ) - (TITLES_MAX-1) ] = '\0';
++ }
++ }
++#else
+ if( strlen( path_copy ) > TITLES_MAX ) {
+ if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
+ "/video_ts" ) ) {
+@@ -458,6 +467,7 @@
+ path_copy[0] = '/';
+ path_copy[1] = '\0';
+ }
++#endif
+
+ #if defined(SYS_BSD)
+ if( ( fe = getfsfile( path_copy ) ) ) {
+@@ -508,11 +518,14 @@
+ }
+ fclose( mntfile );
+ }
+-#elif defined(_MSC_VER) || defined(__OS2__)
+- auth_drive = DVDOpenImageFile( path, have_css );
++#elif defined(_WIN32) || defined(__OS2__)
++ if( GetDriveType( path_copy ) == DRIVE_CDROM ) {
++ path_copy[2] = '\0';
++ auth_drive = DVDOpenImageFile( path_copy, have_css );
++ }
+ #endif
+
+-#if !defined(_MSC_VER) && !defined(__OS2__)
++#if !defined(_WIN32) && !defined(__OS2__)
+ if( !dev_name ) {
+ fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
+ } else if( !auth_drive ) {
+diff -Naur libdvdread.orig/src/dvdread_internal.h libdvdread/src/dvdread_internal.h
+--- libdvdread.orig/src/dvdread_internal.h 2008-10-03 13:11:30.000000000 -0700
++++ libdvdread/src/dvdread_internal.h 2009-09-15 09:44:01.788301485 -0700
+@@ -19,9 +19,9 @@
+ #ifndef LIBDVDREAD_DVDREAD_INTERNAL_H
+ #define LIBDVDREAD_DVDREAD_INTERNAL_H
+
+-#ifdef _MSC_VER
++#ifdef _WIN32
+ #include <unistd.h>
+-#endif /* _MSC_VER */
++#endif /* _WIN32 */
+
+ #define CHECK_VALUE(arg) \
+ if(!(arg)) { \