OSDN Git Service

fix: cannot preview with QT
[handbrake-jp/handbrake-jp.git] / contrib / libdvdread / A02-msc_ver-defs.patch
1 diff -Naur libdvdread.orig/src/dvd_reader.c libdvdread/src/dvd_reader.c
2 --- libdvdread.orig/src/dvd_reader.c    2009-03-13 18:28:21.000000000 -0700
3 +++ libdvdread/src/dvd_reader.c 2009-09-15 10:15:25.201548319 -0700
4 @@ -36,6 +36,7 @@
5  
6  /* misc win32 helpers */
7  #ifdef WIN32
8 +#include <windows.h>
9  #ifndef HAVE_GETTIMEOFDAY
10  /* replacement gettimeofday implementation */
11  #include <sys/timeb.h>
12 @@ -335,7 +336,7 @@
13    char *dev_name = NULL;
14    char *path;
15  
16 -#ifdef _MSC_VER
17 +#ifdef _WIN32
18        int len;
19  #endif
20  
21 @@ -349,7 +350,7 @@
22    /* Try to open libdvdcss or fall back to standard functions */
23    have_css = dvdinput_setup();
24  
25 -#ifdef _MSC_VER
26 +#ifdef _WIN32
27    /* Strip off the trailing \ if it is not a drive */
28    len = strlen(path);
29    if ((len > 1) &&
30 @@ -447,6 +448,14 @@
31        }
32      }
33  
34 +#ifdef _WIN32
35 +    if( strlen( path_copy ) > TITLES_MAX ) {
36 +      if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
37 +                       "\\video_ts" ) ) {
38 +        path_copy[ strlen( path_copy ) - (TITLES_MAX-1) ] = '\0';
39 +      }
40 +    }
41 +#else
42      if( strlen( path_copy ) > TITLES_MAX ) {
43        if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
44                         "/video_ts" ) ) {
45 @@ -458,6 +467,7 @@
46        path_copy[0] = '/';
47        path_copy[1] = '\0';
48      }
49 +#endif
50  
51  #if defined(SYS_BSD)
52      if( ( fe = getfsfile( path_copy ) ) ) {
53 @@ -508,11 +518,14 @@
54        }
55        fclose( mntfile );
56      }
57 -#elif defined(_MSC_VER) || defined(__OS2__)
58 -    auth_drive = DVDOpenImageFile( path, have_css );
59 +#elif defined(_WIN32) || defined(__OS2__)
60 +    if( GetDriveType( path_copy ) == DRIVE_CDROM ) {
61 +      path_copy[2] = '\0';
62 +      auth_drive = DVDOpenImageFile( path_copy, have_css );
63 +    }
64  #endif
65  
66 -#if !defined(_MSC_VER) && !defined(__OS2__)
67 +#if !defined(_WIN32) && !defined(__OS2__)
68      if( !dev_name ) {
69        fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
70      } else if( !auth_drive ) {
71 diff -Naur libdvdread.orig/src/dvdread_internal.h libdvdread/src/dvdread_internal.h
72 --- libdvdread.orig/src/dvdread_internal.h      2008-10-03 13:11:30.000000000 -0700
73 +++ libdvdread/src/dvdread_internal.h   2009-09-15 09:44:01.788301485 -0700
74 @@ -19,9 +19,9 @@
75  #ifndef LIBDVDREAD_DVDREAD_INTERNAL_H
76  #define LIBDVDREAD_DVDREAD_INTERNAL_H
77  
78 -#ifdef _MSC_VER
79 +#ifdef _WIN32
80  #include <unistd.h>
81 -#endif /* _MSC_VER */
82 +#endif /* _WIN32 */
83  
84  #define CHECK_VALUE(arg)                                                \
85    if(!(arg)) {                                                          \