summaryrefslogtreecommitdiffstats
path: root/vlc/build/libdvdread-20041028_static_dvdcss.patch
blob: a3dbcdf945c3d9501fe921c2d03baca730207610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
diff -urN libdvdread-20041028/dvdread/bswap.h libdvdread-20060107/dvdread/bswap.h
--- libdvdread-20041028/dvdread/bswap.h Wed Jun 18 13:35:04 2003
+++ libdvdread-20060107/dvdread/bswap.h Sat Jan  7 20:53:26 2006
@@ -84,6 +84,18 @@
       (((x) & 0x00ff0000) >>  8) | \
       (((x) & 0x0000ff00) <<  8) | \
       (((x) & 0x000000ff) << 24))
+
+#ifdef __GNUC__
+#define B2N_64(x) \
+ x = ((((x) & 0xff00000000000000LL) >> 56) | \
+      (((x) & 0x00ff000000000000LL) >> 40) | \
+      (((x) & 0x0000ff0000000000LL) >> 24) | \
+      (((x) & 0x000000ff00000000LL) >>  8) | \
+      (((x) & 0x00000000ff000000LL) <<  8) | \
+      (((x) & 0x0000000000ff0000LL) << 24) | \
+      (((x) & 0x000000000000ff00LL) << 40) | \
+      (((x) & 0x00000000000000ffLL) << 56))
+#else
 #define B2N_64(x) \
  x = ((((x) & 0xff00000000000000) >> 56) | \
       (((x) & 0x00ff000000000000) >> 40) | \
@@ -93,6 +105,7 @@
       (((x) & 0x0000000000ff0000) << 24) | \
       (((x) & 0x000000000000ff00) << 40) | \
       (((x) & 0x00000000000000ff) << 56))
+#endif

 #else

diff -urN libdvdread-20041028/dvdread/cmd_print.c libdvdread-20060107/dvdread/cmd_print.c
--- libdvdread-20041028/dvdread/cmd_print.c     Wed Jun 18 13:00:44 2003
+++ libdvdread-20060107/dvdread/cmd_print.c     Sat Jan  7 20:38:08 2006
@@ -19,6 +19,7 @@
 #include "config.h"

 #include <stdio.h>
+#include <ctype.h>

 #if defined(HAVE_INTTYPES_H)
 #include <inttypes.h>
diff -urN libdvdread-20041028/dvdread/dvd_input.c libdvdread-20060107/dvdread/dvd_input.c
--- libdvdread-20041028/dvdread/dvd_input.c     Thu Oct 28 14:09:02 2004
+++ libdvdread-20060107/dvdread/dvd_input.c     Sat Jan  7 20:41:16 2006
@@ -27,6 +27,11 @@
 #include "dvd_reader.h"
 #include "dvd_input.h"

+#ifndef HAVE_DVDCSS_DVDCSS_H
+
+/* dlopening libdvdcss */
+#include <dlfcn.h>
+
 /* The function pointers that is the exported interface of this file. */
 dvd_input_t (*dvdinput_open)  (const char *);
 int         (*dvdinput_close) (dvd_input_t);
@@ -35,18 +40,6 @@
 int         (*dvdinput_read)  (dvd_input_t, void *, int, int);
 char *      (*dvdinput_error) (dvd_input_t);

-#ifdef HAVE_DVDCSS_DVDCSS_H
-/* linking to libdvdcss */
-#include <dvdcss/dvdcss.h>
-#define DVDcss_open(a) dvdcss_open((char*)(a))
-#define DVDcss_close   dvdcss_close
-#define DVDcss_seek    dvdcss_seek
-#define DVDcss_title   dvdcss_title
-#define DVDcss_read    dvdcss_read
-#define DVDcss_error   dvdcss_error
-#else
-/* dlopening libdvdcss */
-#include <dlfcn.h>
 typedef struct dvdcss_s *dvdcss_handle;
 static dvdcss_handle (*DVDcss_open)  (const char *);
 static int           (*DVDcss_close) (dvdcss_handle);
@@ -54,7 +47,6 @@
 static int           (*DVDcss_title) (dvdcss_handle, int);
 static int           (*DVDcss_read)  (dvdcss_handle, void *, int, int);
 static char *        (*DVDcss_error) (dvdcss_handle);
-#endif

 /* The DVDinput handle, add stuff here for new input methods. */
 struct dvd_input_s {
@@ -260,23 +252,22 @@

   return 0;
 }
-
+#endif

 /**
  * Setup read functions with either libdvdcss or minimal DVD access.
  */
 int dvdinput_setup(void)
 {
-  void *dvdcss_library = NULL;
-  char **dvdcss_version = NULL;
-
 #ifdef HAVE_DVDCSS_DVDCSS_H
   /* linking to libdvdcss */
-  dvdcss_library = &dvdcss_library;  /* Give it some value != NULL */
-  /* the DVDcss_* functions have been #defined at the top */
-  dvdcss_version = &dvdcss_interface_2;
-
+  fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
+        dvdcss_interface_2);
+  return 1;
 #else
+  void *dvdcss_library = NULL;
+  char **dvdcss_version = NULL;
+
   /* dlopening libdvdcss */
   dvdcss_library = dlopen("libdvdcss.so.2", RTLD_LAZY);

@@ -315,7 +306,6 @@
       dlclose(dvdcss_library);
     }
   }
-#endif /* HAVE_DVDCSS_DVDCSS_H */

   if(dvdcss_library != NULL) {
     /*
@@ -348,4 +338,5 @@
     dvdinput_error = file_error;
     return 0;
   }
+#endif /* HAVE_DVDCSS_DVDCSS_H */
 }
diff -urN libdvdread-20041028/dvdread/dvd_input.h libdvdread-20060107/dvdread/dvd_input.h
--- libdvdread-20041028/dvdread/dvd_input.h     Thu Feb 13 22:06:56 2003
+++ libdvdread-20060107/dvdread/dvd_input.h     Sat Jan  7 20:27:42 2006
@@ -27,6 +27,21 @@

 #define DVDINPUT_READ_DECRYPT    (1 << 0)

+#ifdef HAVE_DVDCSS_DVDCSS_H
+
+/* linking to libdvdcss */
+#include <dvdcss/dvdcss.h>
+
+#define dvd_input_t dvdcss_t
+
+#define dvdinput_open(_a)           dvdcss_open(_a)
+#define dvdinput_close(_a)          dvdcss_close(_a)
+#define dvdinput_seek(_a, _b)       dvdcss_seek(_a,_b,DVDINPUT_NOFLAGS)
+#define dvdinput_title(_a, _b)      dvdcss_title(_a,_b)
+#define dvdinput_read(_a,_b,_c,_d)  dvdcss_read(_a,_b,_c,_d)
+#define dvdinput_error(_a)          dvdcss_error(_a)
+
+#else
 typedef struct dvd_input_s *dvd_input_t;

 /**
@@ -38,6 +53,7 @@
 extern int         (*dvdinput_title) (dvd_input_t, int);
 extern int         (*dvdinput_read)  (dvd_input_t, void *, int, int);
 extern char *      (*dvdinput_error) (dvd_input_t);
+#endif

 /**
  * Setup function accessed by dvd_reader.c.  Returns 1 if there is CSS support.
diff -urN libdvdread-20041028/dvdread/dvd_reader.c libdvdread-20060107/dvdread/dvd_reader.c
--- libdvdread-20041028/dvdread/dvd_reader.c    Tue Aug  5 12:44:12 2003
+++ libdvdread-20060107/dvdread/dvd_reader.c    Sat Jan  7 20:45:36 2006
@@ -1031,7 +1031,7 @@
            bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
            if( bytes_read != file_size ) {
                fprintf( stderr, "libdvdread: DVDDiscId read returned %d bytes"
-                        ", wanted %d\n", bytes_read, file_size );
+             ", wanted %d\n", (int)bytes_read, file_size );
                DVDCloseFile( dvd_file );
                return -1;
            }