From e458cd5b952d8e313cc76f09215bb8f275bc344d Mon Sep 17 00:00:00 2001 From: jstebbins Date: Tue, 15 Sep 2009 17:35:00 +0000 Subject: [PATCH] dvdread: patch allows dvdread access to the raw dvd device under windows git-svn-id: svn://localhost/HandBrake/trunk@2825 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- contrib/libdvdread/A02-msc_ver-defs.patch | 85 +++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 contrib/libdvdread/A02-msc_ver-defs.patch diff --git a/contrib/libdvdread/A02-msc_ver-defs.patch b/contrib/libdvdread/A02-msc_ver-defs.patch new file mode 100644 index 00000000..9d58639b --- /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 + #ifndef HAVE_GETTIMEOFDAY + /* replacement gettimeofday implementation */ + #include +@@ -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 +-#endif /* _MSC_VER */ ++#endif /* _WIN32 */ + + #define CHECK_VALUE(arg) \ + if(!(arg)) { \ -- 2.11.0