Mercurial > mplayer.hg
annotate dvdread/dvd_input.c @ 27014:5e0e6d992c7f
Fix mencoder built from dvdnav enabled.
(my bad, didn't compiled mencoder when i did the change).
Patch by Diogo Franco <diogomfranco at gmail com>
author | ben |
---|---|
date | Mon, 09 Jun 2008 18:43:18 +0000 |
parents | dcf5fe229d37 |
children |
rev | line source |
---|---|
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
1 /* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ |
7029 | 2 /* |
3 * Copyright (C) 2002 Samuel Hocevar <sam@zoy.org>, | |
4 * Håkan Hjort <d95hjort@dtek.chalmers.se> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. | |
19 */ | |
20 | |
15874 | 21 #include "config.h" |
22 | |
7029 | 23 #include <stdio.h> |
24 #include <stdlib.h> | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
25 #define __USE_GNU /* to get O_DIRECT in linux */ |
7029 | 26 #include <fcntl.h> |
27 #include <unistd.h> | |
28 | |
29 #include "dvd_reader.h" | |
30 #include "dvd_input.h" | |
31 | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
32 #include "dvdread_internal.h" |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
33 |
15874 | 34 /* The function pointers that is the exported interface of this file. */ |
35 dvd_input_t (*dvdinput_open) (const char *); | |
36 int (*dvdinput_close) (dvd_input_t); | |
37 int (*dvdinput_seek) (dvd_input_t, int); | |
38 int (*dvdinput_title) (dvd_input_t, int); | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
39 /** |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
40 * pointer must be aligned to 2048 bytes |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
41 * if reading from a raw/O_DIRECT file |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
42 */ |
15874 | 43 int (*dvdinput_read) (dvd_input_t, void *, int, int); |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
44 |
15874 | 45 char * (*dvdinput_error) (dvd_input_t); |
7029 | 46 |
15874 | 47 #ifdef HAVE_DVDCSS_DVDCSS_H |
48 /* linking to libdvdcss */ | |
20983 | 49 #include <dvdcss/dvdcss.h> |
15874 | 50 #define DVDcss_open(a) dvdcss_open((char*)(a)) |
51 #define DVDcss_close dvdcss_close | |
52 #define DVDcss_seek dvdcss_seek | |
53 #define DVDcss_title dvdcss_title | |
54 #define DVDcss_read dvdcss_read | |
55 #define DVDcss_error dvdcss_error | |
56 #else | |
57 /* dlopening libdvdcss */ | |
58 #include <dlfcn.h> | |
59 typedef struct dvdcss_s *dvdcss_handle; | |
60 static dvdcss_handle (*DVDcss_open) (const char *); | |
61 static int (*DVDcss_close) (dvdcss_handle); | |
62 static int (*DVDcss_seek) (dvdcss_handle, int, int); | |
63 static int (*DVDcss_title) (dvdcss_handle, int); | |
64 static int (*DVDcss_read) (dvdcss_handle, void *, int, int); | |
65 static char * (*DVDcss_error) (dvdcss_handle); | |
66 #endif | |
7029 | 67 |
68 /* The DVDinput handle, add stuff here for new input methods. */ | |
69 struct dvd_input_s { | |
70 /* libdvdcss handle */ | |
71 dvdcss_handle dvdcss; | |
72 | |
73 /* dummy file input */ | |
74 int fd; | |
75 }; | |
76 | |
77 | |
78 /** | |
79 * initialize and open a DVD device or file. | |
80 */ | |
81 static dvd_input_t css_open(const char *target) | |
82 { | |
83 dvd_input_t dev; | |
15874 | 84 |
7029 | 85 /* Allocate the handle structure */ |
11776
12615e408fb9
Fix (possible) memory corruption. dvd_input_t is pointer to struct dvd_input_s and not a struct.
lumag
parents:
7033
diff
changeset
|
86 dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s)); |
7029 | 87 if(dev == NULL) { |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
88 /* malloc has set errno to ENOMEM */ |
7029 | 89 return NULL; |
90 } | |
91 | |
92 /* Really open it with libdvdcss */ | |
93 dev->dvdcss = DVDcss_open(target); | |
94 if(dev->dvdcss == 0) { | |
95 free(dev); | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
96 dev = NULL; |
7029 | 97 } |
98 | |
99 return dev; | |
100 } | |
101 | |
102 /** | |
103 * return the last error message | |
104 */ | |
105 static char *css_error(dvd_input_t dev) | |
106 { | |
107 return DVDcss_error(dev->dvdcss); | |
108 } | |
109 | |
110 /** | |
111 * seek into the device. | |
112 */ | |
15874 | 113 static int css_seek(dvd_input_t dev, int blocks) |
7029 | 114 { |
15874 | 115 /* DVDINPUT_NOFLAGS should match the DVDCSS_NOFLAGS value. */ |
116 return DVDcss_seek(dev->dvdcss, blocks, DVDINPUT_NOFLAGS); | |
7029 | 117 } |
118 | |
119 /** | |
120 * set the block for the begining of a new title (key). | |
121 */ | |
122 static int css_title(dvd_input_t dev, int block) | |
123 { | |
124 return DVDcss_title(dev->dvdcss, block); | |
125 } | |
126 | |
127 /** | |
128 * read data from the device. | |
129 */ | |
130 static int css_read(dvd_input_t dev, void *buffer, int blocks, int flags) | |
131 { | |
132 return DVDcss_read(dev->dvdcss, buffer, blocks, flags); | |
133 } | |
134 | |
135 /** | |
136 * close the DVD device and clean up the library. | |
137 */ | |
138 static int css_close(dvd_input_t dev) | |
139 { | |
140 int ret; | |
141 | |
142 ret = DVDcss_close(dev->dvdcss); | |
143 | |
144 if(ret < 0) | |
145 return ret; | |
146 | |
147 free(dev); | |
148 | |
149 return 0; | |
150 } | |
151 | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
152 /* Need to use O_BINARY for WIN32 */ |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
153 #ifndef O_BINARY |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
154 #ifdef _O_BINARY |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
155 #define O_BINARY _O_BINARY |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
156 #else |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
157 #define O_BINARY 0 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
158 #endif |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
159 #endif |
15874 | 160 |
161 /** | |
162 * initialize and open a DVD device or file. | |
163 */ | |
164 static dvd_input_t file_open(const char *target) | |
165 { | |
166 dvd_input_t dev; | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
167 char *use_odirect; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
168 int oflags; |
15874 | 169 |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
170 oflags = O_RDONLY | O_BINARY; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
171 use_odirect = getenv("DVDREAD_USE_DIRECT"); |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
172 if(use_odirect) { |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
173 #ifndef O_DIRECT |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
174 #define O_DIRECT 0 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
175 #endif |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
176 oflags |= O_DIRECT; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
177 } |
15874 | 178 /* Allocate the library structure */ |
17786
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
15874
diff
changeset
|
179 dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s)); |
15874 | 180 if(dev == NULL) { |
181 return NULL; | |
182 } | |
183 | |
184 /* Open the device */ | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
185 dev->fd = open(target, oflags); |
15874 | 186 if(dev->fd < 0) { |
187 free(dev); | |
188 return NULL; | |
189 } | |
190 | |
191 return dev; | |
192 } | |
193 | |
194 /** | |
195 * return the last error message | |
196 */ | |
197 static char *file_error(dvd_input_t dev) | |
198 { | |
199 /* use strerror(errno)? */ | |
200 return (char *)"unknown error"; | |
201 } | |
202 | |
203 /** | |
204 * seek into the device. | |
205 */ | |
206 static int file_seek(dvd_input_t dev, int blocks) | |
207 { | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
208 off_t pos = (off_t)blocks * (off_t)DVD_VIDEO_LB_LEN; |
15874 | 209 |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
210 pos = lseek(dev->fd, pos, SEEK_SET); |
15874 | 211 if(pos < 0) { |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
212 return pos; |
15874 | 213 } |
214 /* assert pos % DVD_VIDEO_LB_LEN == 0 */ | |
215 return (int) (pos / DVD_VIDEO_LB_LEN); | |
216 } | |
217 | |
218 /** | |
219 * set the block for the begining of a new title (key). | |
220 */ | |
221 static int file_title(dvd_input_t dev, int block) | |
222 { | |
223 return -1; | |
224 } | |
225 | |
226 /** | |
227 * read data from the device. | |
228 */ | |
229 static int file_read(dvd_input_t dev, void *buffer, int blocks, int flags) | |
230 { | |
231 size_t len; | |
232 ssize_t ret; | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
233 unsigned char *buf = buffer; |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
234 |
15874 | 235 len = (size_t)blocks * DVD_VIDEO_LB_LEN; |
236 | |
237 while(len > 0) { | |
238 | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
239 ret = read(dev->fd, buf, len); |
15874 | 240 |
241 if(ret < 0) { | |
242 /* One of the reads failed, too bad. We won't even bother | |
243 * returning the reads that went ok, and as in the posix spec | |
244 * the file postition is left unspecified after a failure. */ | |
245 return ret; | |
246 } | |
247 | |
248 if(ret == 0) { | |
249 /* Nothing more to read. Return the whole blocks, if any, that we got. | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
250 and adjust the file possition back to the previous block boundary. */ |
15874 | 251 size_t bytes = (size_t)blocks * DVD_VIDEO_LB_LEN - len; |
252 off_t over_read = -(bytes % DVD_VIDEO_LB_LEN); | |
253 /*off_t pos =*/ lseek(dev->fd, over_read, SEEK_CUR); | |
254 /* should have pos % 2048 == 0 */ | |
255 return (int) (bytes / DVD_VIDEO_LB_LEN); | |
256 } | |
257 | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
258 buf+=ret; |
15874 | 259 len -= ret; |
260 } | |
261 | |
262 return blocks; | |
263 } | |
264 | |
265 /** | |
266 * close the DVD device and clean up. | |
267 */ | |
268 static int file_close(dvd_input_t dev) | |
269 { | |
270 int ret; | |
271 | |
272 ret = close(dev->fd); | |
273 | |
274 if(ret < 0) | |
275 return ret; | |
276 | |
277 free(dev); | |
278 | |
279 return 0; | |
280 } | |
281 | |
282 | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
283 static void *dvdcss_library = NULL; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
284 static int dvdcss_library_init = 0; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
285 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
286 /** |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
287 * Free any objects allocated by dvdinput_setup. |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
288 * Should only be called when libdvdread is not to be used any more. |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
289 * Closes dlopened libraries. |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
290 */ |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
291 void dvdinput_free(void) |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
292 { |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
293 #ifdef HAVE_DVDCSS_DVDCSS_H |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
294 /* linked statically, nothing to free */ |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
295 return; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
296 #else |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
297 if(dvdcss_library) { |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
298 dlclose(dvdcss_library); |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
299 dvdcss_library = NULL; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
300 } |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
301 dvdcss_library_init = 0; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
302 return; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
303 #endif |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
304 } |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
305 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
306 |
7029 | 307 /** |
308 * Setup read functions with either libdvdcss or minimal DVD access. | |
309 */ | |
15874 | 310 int dvdinput_setup(void) |
7029 | 311 { |
15874 | 312 char **dvdcss_version = NULL; |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
313 int verbose; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
314 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
315 /* dlopening libdvdcss */ |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
316 if(dvdcss_library_init) { |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
317 /* libdvdcss is already dlopened, function ptrs set */ |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
318 if(dvdcss_library) { |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
319 return 1; /* css available */ |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
320 } else { |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
321 return 0; /* css not available */ |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
322 } |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
323 } |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
324 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
325 verbose = get_verbose(); |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
326 |
15874 | 327 #ifdef HAVE_DVDCSS_DVDCSS_H |
328 /* linking to libdvdcss */ | |
329 dvdcss_library = &dvdcss_library; /* Give it some value != NULL */ | |
330 /* the DVDcss_* functions have been #defined at the top */ | |
331 dvdcss_version = &dvdcss_interface_2; | |
332 | |
333 #else | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
334 |
15874 | 335 dvdcss_library = dlopen("libdvdcss.so.2", RTLD_LAZY); |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
336 |
15874 | 337 if(dvdcss_library != NULL) { |
338 #if defined(__OpenBSD__) && !defined(__ELF__) | |
339 #define U_S "_" | |
340 #else | |
341 #define U_S | |
342 #endif | |
343 DVDcss_open = (dvdcss_handle (*)(const char*)) | |
344 dlsym(dvdcss_library, U_S "dvdcss_open"); | |
345 DVDcss_close = (int (*)(dvdcss_handle)) | |
346 dlsym(dvdcss_library, U_S "dvdcss_close"); | |
347 DVDcss_title = (int (*)(dvdcss_handle, int)) | |
348 dlsym(dvdcss_library, U_S "dvdcss_title"); | |
349 DVDcss_seek = (int (*)(dvdcss_handle, int, int)) | |
350 dlsym(dvdcss_library, U_S "dvdcss_seek"); | |
351 DVDcss_read = (int (*)(dvdcss_handle, void*, int, int)) | |
352 dlsym(dvdcss_library, U_S "dvdcss_read"); | |
353 DVDcss_error = (char* (*)(dvdcss_handle)) | |
354 dlsym(dvdcss_library, U_S "dvdcss_error"); | |
7029 | 355 |
15874 | 356 dvdcss_version = (char **)dlsym(dvdcss_library, U_S "dvdcss_interface_2"); |
357 | |
358 if(dlsym(dvdcss_library, U_S "dvdcss_crack")) { | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
359 if(verbose >= 0) { |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
360 fprintf(stderr, |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
361 "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n" |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
362 "libdvdread: You should get the latest version from " |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
363 "http://www.videolan.org/\n" ); |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
364 } |
15874 | 365 dlclose(dvdcss_library); |
366 dvdcss_library = NULL; | |
367 } else if(!DVDcss_open || !DVDcss_close || !DVDcss_title || !DVDcss_seek | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
368 || !DVDcss_read || !DVDcss_error || !dvdcss_version) { |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
369 if(verbose >= 0) { |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
370 fprintf(stderr, "libdvdread: Missing symbols in libdvdcss.so.2, " |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
371 "this shouldn't happen !\n"); |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
372 } |
15874 | 373 dlclose(dvdcss_library); |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
374 dvdcss_library = NULL; |
15874 | 375 } |
376 } | |
377 #endif /* HAVE_DVDCSS_DVDCSS_H */ | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
378 |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
379 dvdcss_library_init = 1; |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
380 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
381 if(dvdcss_library) { |
7029 | 382 /* |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
383 char *psz_method = getenv( "DVDCSS_METHOD" ); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
384 char *psz_verbose = getenv( "DVDCSS_VERBOSE" ); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
385 fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
386 fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose); |
7029 | 387 */ |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
388 if(verbose >= 1) { |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
389 fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n", |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
390 *dvdcss_version); |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
391 } |
15874 | 392 /* libdvdcss wrapper functions */ |
393 dvdinput_open = css_open; | |
394 dvdinput_close = css_close; | |
395 dvdinput_seek = css_seek; | |
396 dvdinput_title = css_title; | |
397 dvdinput_read = css_read; | |
398 dvdinput_error = css_error; | |
7029 | 399 return 1; |
400 | |
15874 | 401 } else { |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
402 if(verbose >= 1) { |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
403 fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n"); |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20983
diff
changeset
|
404 } |
15874 | 405 /* libdvdcss replacement functions */ |
406 dvdinput_open = file_open; | |
407 dvdinput_close = file_close; | |
408 dvdinput_seek = file_seek; | |
409 dvdinput_title = file_title; | |
410 dvdinput_read = file_read; | |
411 dvdinput_error = file_error; | |
412 return 0; | |
413 } | |
7029 | 414 } |