Mercurial > mplayer.hg
annotate dvdread/libdvdread_changes.diff @ 23947:afce92865498
another little corrections
author | ptt |
---|---|
date | Tue, 31 Jul 2007 14:21:32 +0000 |
parents | ae0f4c4e4d9d |
children | 6e218aef8e05 |
rev | line source |
---|---|
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
1 diff -Naur dvdread.orig/bswap.h dvdread/bswap.h |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
2 --- dvdread.orig/bswap.h 2005-06-23 00:18:54.000000000 +0200 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
3 +++ dvdread/bswap.h 2005-06-23 00:19:10.000000000 +0200 |
20793 | 4 @@ -59,13 +63,57 @@ |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
5 #define B2N_32(x) x = be32toh(x) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
6 #define B2N_64(x) x = be64toh(x) |
14937 | 7 |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
8 +#elif defined(__DragonFly__) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
9 +#include <sys/endian.h> |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
10 +#define B2N_16(x) x = be16toh(x) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
11 +#define B2N_32(x) x = be32toh(x) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
12 +#define B2N_64(x) x = be64toh(x) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
13 + |
14937 | 14 +#elif defined(ARCH_X86) |
15 +inline static unsigned short bswap_16(unsigned short x) | |
16 +{ | |
17 + __asm("xchgb %b0,%h0" : | |
18 + "=q" (x) : | |
19 + "0" (x)); | |
20 + return x; | |
21 +} | |
22 +#define B2N_16(x) x = bswap_16(x) | |
23 + | |
24 +inline static unsigned int bswap_32(unsigned int x) | |
25 +{ | |
26 + __asm( | |
21592
ae0f4c4e4d9d
__CPU__ will be x86-64 under amd64 and fail the check "#if __CPU__ > 386".
diego
parents:
20983
diff
changeset
|
27 +#if __CPU__ != 386 |
14937 | 28 + "bswap %0": |
29 + "=r" (x) : | |
30 +#else | |
31 + "xchgb %b0,%h0\n" | |
32 + " rorl $16,%0\n" | |
33 + " xchgb %b0,%h0": | |
34 + "=q" (x) : | |
35 +#endif | |
36 + "0" (x)); | |
37 + return x; | |
38 +} | |
39 +#define B2N_32(x) x = bswap_32(x) | |
40 + | |
41 +inline static unsigned long long int bswap_64(unsigned long long int x) | |
42 +{ | |
43 + register union { __extension__ uint64_t __ll; | |
44 + uint32_t __l[2]; } __x; | |
45 + asm("xchgl %0,%1": | |
46 + "=r"(__x.__l[0]),"=r"(__x.__l[1]): | |
47 + "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32)))); | |
48 + return __x.__ll; | |
49 +} | |
50 +#define B2N_64(x) x = bswap_64(x) | |
51 + | |
52 /* This is a slow but portable implementation, it has multiple evaluation | |
53 * problems so beware. | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
54 * Old FreeBSD's and Solaris don't have <byteswap.h> or any other such |
14937 | 55 * functionality! |
56 */ | |
57 | |
58 -#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) | |
59 +#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__) | |
60 #define B2N_16(x) \ | |
61 x = ((((x) & 0xff00) >> 8) | \ | |
62 (((x) & 0x00ff) << 8)) | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
63 diff -Naur dvdread.orig/.cvsignore dvdread/.cvsignore |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
64 diff -Naur dvdread.orig/dvd_input.c dvdread/dvd_input.c |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
65 --- dvdread.orig/dvd_input.c 2005-06-23 00:18:54.000000000 +0200 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
66 +++ dvdread/dvd_input.c 2005-06-23 00:30:23.000000000 +0200 |
18371 | 67 @@ -74,7 +78,7 @@ |
14937 | 68 dvd_input_t dev; |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
69 |
14937 | 70 /* Allocate the handle structure */ |
71 - dev = (dvd_input_t) malloc(sizeof(dvd_input_t)); | |
72 + dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s)); | |
73 if(dev == NULL) { | |
74 fprintf(stderr, "libdvdread: Could not allocate memory.\n"); | |
75 return NULL; | |
18371 | 76 @@ -154,7 +158,7 @@ |
17786
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
77 dvd_input_t dev; |
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
78 |
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
79 /* Allocate the library structure */ |
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
80 - dev = (dvd_input_t) malloc(sizeof(dvd_input_t)); |
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
81 + dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s)); |
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
82 if(dev == NULL) { |
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
83 fprintf(stderr, "libdvdread: Could not allocate memory.\n"); |
f0f54034c7e9
fix another sizeof(dvd_input_t) bug (must be struct dvd_input_s instead)
reimar
parents:
17313
diff
changeset
|
84 return NULL; |
18371 | 85 @@ -320,8 +324,10 @@ |
14937 | 86 fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method); |
87 fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose); | |
88 */ | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
89 + /* |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
90 fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n", |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
91 *dvdcss_version); |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
92 + */ |
14937 | 93 |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
94 /* libdvdcss wrapper functions */ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
95 dvdinput_open = css_open; |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
96 diff -Naur dvdread.orig/dvd_input.h dvdread/dvd_input.h |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
97 diff -Naur dvdread.orig/dvd_reader.c dvdread/dvd_reader.c |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
98 --- dvdread.orig/dvd_reader.c 2005-06-23 00:18:54.000000000 +0200 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
99 +++ dvdread/dvd_reader.c 2005-06-23 00:19:10.000000000 +0200 |
18371 | 100 @@ -32,24 +36,36 @@ |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
101 #include <limits.h> |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
102 #include <dirent.h> |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
103 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
104 -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) |
17311 | 105 +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DARWIN__) || defined(__DragonFly__) |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
106 #define SYS_BSD 1 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
107 #endif |
14937 | 108 |
109 #if defined(__sun) | |
110 #include <sys/mnttab.h> | |
111 +#elif defined(hpux) | |
112 +#include </usr/conf/h/mnttab.h> | |
113 #elif defined(SYS_BSD) | |
114 #include <fstab.h> | |
15535 | 115 -#elif defined(__linux__) |
116 +#elif defined(__linux__) || defined(__CYGWIN__) | |
14937 | 117 #include <mntent.h> |
118 #endif | |
119 | |
18910 | 120 +#if defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION <= 3) && (__MINGW32_MINOR_VERSION < 10) |
14937 | 121 +#include <sys/timeb.h> |
122 +static void gettimeofday(struct timeval* t,void* timezone){ | |
123 + struct timeb timebuffer; | |
124 + ftime( &timebuffer ); | |
125 + t->tv_sec=timebuffer.time; | |
126 + t->tv_usec=1000*timebuffer.millitm; | |
127 +} | |
128 +#endif | |
129 + | |
130 #include "dvd_udf.h" | |
131 #include "dvd_input.h" | |
132 #include "dvd_reader.h" | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
133 #include "md5.h" |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
134 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
135 -#define DEFAULT_UDF_CACHE_LEVEL 1 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
136 +#define DEFAULT_UDF_CACHE_LEVEL 0 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
137 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
138 struct dvd_reader_s { |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
139 /* Basic information. */ |
18371 | 140 @@ -278,11 +301,16 @@ |
16510 | 141 Darwin /dev/rdisk0, it needs to be the raw device |
142 BSD/OS /dev/sr0c (if not mounted) or /dev/rsr0c ('c' any letter will do) */ | |
143 static char *bsd_block2char( const char *path ) | |
144 +#if defined(__FreeBSD__) | |
145 +{ | |
146 + return (char *) strdup( path ); | |
147 +} | |
148 +#else | |
149 { | |
14937 | 150 char *new_path; |
151 | |
152 /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */ | |
153 - if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) ) | |
154 + if( strncmp( path, "/dev/", 5 ) || !strncmp( path, "/dev/r", 6 ) ) | |
155 return (char *) strdup( path ); | |
156 | |
157 /* Replace "/dev/" with "/dev/r" */ | |
18371 | 158 @@ -292,6 +320,7 @@ |
16510 | 159 |
160 return new_path; | |
161 } | |
162 +#endif /* __FreeBSD__ */ | |
163 #endif | |
164 | |
165 dvd_reader_t *DVDOpen( const char *path ) | |
18371 | 166 @@ -303,6 +332,16 @@ |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
167 if( path == NULL ) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
168 return 0; |
14937 | 169 |
170 +#ifdef WIN32 | |
171 + /* Stat doesn't work on devices under mingwin/cygwin. */ | |
172 + if( path[0] && path[1] == ':' && path[2] == '\0' ) | |
173 + { | |
174 + /* Don't try to stat the file */ | |
175 + fileinfo.st_mode = S_IFBLK; | |
176 + } | |
177 + else | |
178 +#endif | |
179 + { | |
180 ret = stat( path, &fileinfo ); | |
181 if( ret < 0 ) { | |
182 /* If we can't stat the file, give up */ | |
18371 | 183 @@ -310,6 +349,7 @@ |
14937 | 184 perror(""); |
185 return 0; | |
186 } | |
187 + } | |
188 | |
189 /* Try to open libdvdcss or fall back to standard functions */ | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
190 have_css = dvdinput_setup(); |
18371 | 191 @@ -335,7 +375,7 @@ |
15535 | 192 char *path_copy; |
193 #if defined(SYS_BSD) | |
194 struct fstab* fe; | |
195 -#elif defined(__sun) || defined(__linux__) | |
196 +#elif defined(__sun) || defined(__linux__) || defined(__CYGWIN__) | |
197 FILE *mntfile; | |
198 #endif | |
199 | |
18371 | 200 @@ -350,7 +390,9 @@ |
14937 | 201 if( cdir >= 0 ) { |
202 chdir( path_copy ); | |
203 new_path = getcwd( NULL, PATH_MAX ); | |
204 +#ifndef __MINGW32__ | |
205 fchdir( cdir ); | |
206 +#endif | |
207 close( cdir ); | |
208 if( new_path ) { | |
209 free( path_copy ); | |
18371 | 210 @@ -406,7 +448,7 @@ |
15535 | 211 } |
212 fclose( mntfile ); | |
213 } | |
214 -#elif defined(__linux__) | |
215 +#elif defined(__linux__) || defined(__CYGWIN__) | |
216 mntfile = fopen( MOUNTED, "r" ); | |
217 if( mntfile ) { | |
218 struct mntent *me; | |
18371 | 219 @@ -425,6 +467,9 @@ |
14937 | 220 } |
221 fclose( mntfile ); | |
222 } | |
15535 | 223 +#elif defined(__MINGW32__) |
14937 | 224 + dev_name = strdup(path); |
225 + auth_drive = DVDOpenImageFile( path, have_css ); | |
226 #endif | |
227 if( !dev_name ) { | |
228 fprintf( stderr, "libdvdread: Couldn't find device name.\n" ); | |
18371 | 229 @@ -615,8 +660,8 @@ |
14937 | 230 } |
231 | |
232 if( dvd->css_state == 1 /* Need key init */ ) { | |
233 - initAllCSSKeys( dvd ); | |
234 - dvd->css_state = 2; | |
235 +// initAllCSSKeys( dvd ); | |
236 +// dvd->css_state = 2; | |
237 } | |
238 /* | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
239 if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) { |
18371 | 240 @@ -915,7 +960,7 @@ |
14937 | 241 return (ssize_t)ret; |
242 } | |
243 | |
244 -int32_t DVDFileSeek( dvd_file_t *dvd_file, int32_t offset ) | |
245 +int DVDFileSeek( dvd_file_t *dvd_file, int offset ) | |
246 { | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
247 /* Check arguments. */ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
248 if( dvd_file == NULL || offset < 0 ) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
249 diff -Naur dvdread.orig/dvdread_internal.h dvdread/dvdread_internal.h |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
250 --- dvdread.orig/dvdread_internal.h 2005-06-23 00:18:54.000000000 +0200 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
251 +++ dvdread/dvdread_internal.h 2005-06-23 00:19:10.000000000 +0200 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
252 @@ -2,11 +2,7 @@ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
253 #define DVDREAD_INTERNAL_H |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
254 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
255 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
256 -#define CHECK_VALUE(arg) \ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
257 - if(!(arg)) { \ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
258 - fprintf(stderr, "\n*** libdvdread: CHECK_VALUE failed in %s:%i ***" \ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
259 - "\n*** for %s ***\n\n", \ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
260 - __FILE__, __LINE__, # arg ); \ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
261 - } |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
262 +#define CHECK_VALUE(arg) |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
263 + |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
264 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
265 #endif /* DVDREAD_INTERNAL_H */ |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
266 diff -Naur dvdread.orig/dvd_udf.c dvdread/dvd_udf.c |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
267 --- dvdread.orig/dvd_udf.c 2005-06-23 00:18:54.000000000 +0200 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
268 +++ dvdread/dvd_udf.c 2005-06-23 00:19:10.000000000 +0200 |
18371 | 269 @@ -33,7 +37,9 @@ |
14937 | 270 #include <stdio.h> |
271 #include <stdlib.h> | |
272 #include <string.h> | |
273 +#ifndef __MINGW32__ | |
274 #include <sys/ioctl.h> | |
275 +#endif | |
276 #include <sys/types.h> | |
277 #include <sys/stat.h> | |
278 #include <unistd.h> | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
279 diff -Naur dvdread.orig/ifo_print.c dvdread/ifo_print.c |
16659 | 280 --- dvdread.orig/ifo_print.c 30 Jun 2005 22:48:26 -0000 1.4 |
281 +++ dvdread/ifo_print.c 3 Oct 2005 14:29:01 -0000 1.5 | |
282 @@ -761,14 +761,14 @@ | |
283 ifoPrint_USER_OPS(&pgc->prohibited_ops); | |
284 | |
285 for(i = 0; i < 8; i++) { | |
286 - if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */ | |
287 + if(pgc->audio_control[i].present) { | |
288 printf("Audio stream %i control: %04x\n", | |
289 i, pgc->audio_control[i]); | |
290 } | |
291 } | |
292 | |
293 for(i = 0; i < 32; i++) { | |
294 - if(pgc->subp_control[i] & 0x80000000) { /* The 'is present' bit */ | |
295 + if(pgc->subp_control[i].present) { | |
296 printf("Subpicture stream %2i control: %08x\n", | |
297 i, pgc->subp_control[i]); | |
298 } | |
299 | |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
300 diff -Naur dvdread.orig/ifo_read.c dvdread/ifo_read.c |
16659 | 301 --- dvdread.orig/ifo_read.c 30 Jun 2005 22:48:26 -0000 1.4 |
302 +++ dvdread/ifo_read.c 3 Oct 2005 14:29:01 -0000 1.5 | |
20790 | 303 @@ -97,7 +101,7 @@ |
304 ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) { | |
305 ifo_handle_t *ifofile; | |
306 | |
307 - ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); | |
308 + ifofile = malloc(sizeof(ifo_handle_t)); | |
309 if(!ifofile) | |
310 return 0; | |
311 | |
312 @@ -182,7 +186,7 @@ | |
313 ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) { | |
314 ifo_handle_t *ifofile; | |
315 | |
316 - ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); | |
317 + ifofile = malloc(sizeof(ifo_handle_t)); | |
318 if(!ifofile) | |
319 return 0; | |
320 | |
321 @@ -209,7 +213,7 @@ | |
322 ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) { | |
323 ifo_handle_t *ifofile; | |
324 | |
325 - ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t)); | |
326 + ifofile = malloc(sizeof(ifo_handle_t)); | |
327 if(!ifofile) | |
328 return 0; | |
329 | |
330 @@ -274,7 +278,7 @@ | |
331 static int ifoRead_VMG(ifo_handle_t *ifofile) { | |
332 vmgi_mat_t *vmgi_mat; | |
333 | |
334 - vmgi_mat = (vmgi_mat_t *)malloc(sizeof(vmgi_mat_t)); | |
335 + vmgi_mat = malloc(sizeof(vmgi_mat_t)); | |
336 if(!vmgi_mat) | |
337 return 0; | |
338 | |
339 @@ -365,7 +369,7 @@ | |
340 vtsi_mat_t *vtsi_mat; | |
341 int i; | |
342 | |
343 - vtsi_mat = (vtsi_mat_t *)malloc(sizeof(vtsi_mat_t)); | |
344 + vtsi_mat = malloc(sizeof(vtsi_mat_t)); | |
345 if(!vtsi_mat) | |
346 return 0; | |
347 | |
348 @@ -493,7 +497,7 @@ | |
349 | |
350 if(cmd_tbl->nr_of_pre != 0) { | |
351 unsigned int pre_cmds_size = cmd_tbl->nr_of_pre * COMMAND_DATA_SIZE; | |
352 - cmd_tbl->pre_cmds = (vm_cmd_t *)malloc(pre_cmds_size); | |
353 + cmd_tbl->pre_cmds = malloc(pre_cmds_size); | |
354 if(!cmd_tbl->pre_cmds) | |
355 return 0; | |
356 | |
357 @@ -505,7 +509,7 @@ | |
358 | |
359 if(cmd_tbl->nr_of_post != 0) { | |
360 unsigned int post_cmds_size = cmd_tbl->nr_of_post * COMMAND_DATA_SIZE; | |
361 - cmd_tbl->post_cmds = (vm_cmd_t *)malloc(post_cmds_size); | |
362 + cmd_tbl->post_cmds = malloc(post_cmds_size); | |
363 if(!cmd_tbl->post_cmds) { | |
364 if(cmd_tbl->pre_cmds) | |
365 free(cmd_tbl->pre_cmds); | |
366 @@ -521,7 +525,7 @@ | |
367 | |
368 if(cmd_tbl->nr_of_cell != 0) { | |
369 unsigned int cell_cmds_size = cmd_tbl->nr_of_cell * COMMAND_DATA_SIZE; | |
370 - cmd_tbl->cell_cmds = (vm_cmd_t *)malloc(cell_cmds_size); | |
371 + cmd_tbl->cell_cmds = malloc(cell_cmds_size); | |
372 if(!cmd_tbl->cell_cmds) { | |
373 if(cmd_tbl->pre_cmds) | |
374 free(cmd_tbl->pre_cmds); | |
375 @@ -638,10 +642,6 @@ | |
16659 | 376 B2N_16(pgc->cell_playback_offset); |
377 B2N_16(pgc->cell_position_offset); | |
378 | |
379 - for(i = 0; i < 8; i++) | |
380 - B2N_16(pgc->audio_control[i]); | |
381 - for(i = 0; i < 32; i++) | |
382 - B2N_32(pgc->subp_control[i]); | |
383 for(i = 0; i < 16; i++) | |
384 B2N_32(pgc->palette[i]); | |
385 | |
20790 | 386 @@ -650,10 +650,10 @@ |
16659 | 387 |
388 /* verify time (look at print_time) */ | |
389 for(i = 0; i < 8; i++) | |
390 - if(!pgc->audio_control[i] & 0x8000) /* The 'is present' bit */ | |
391 + if(!pgc->audio_control[i].present) | |
392 CHECK_ZERO(pgc->audio_control[i]); | |
393 for(i = 0; i < 32; i++) | |
394 - if(!pgc->subp_control[i] & 0x80000000) /* The 'is present' bit */ | |
395 + if(!pgc->subp_control[i].present) | |
396 CHECK_ZERO(pgc->subp_control[i]); | |
397 | |
398 /* Check that time is 0:0:0:0 also if nr_of_programs == 0 */ | |
20790 | 399 @@ -752,7 +752,7 @@ |
400 if(ifofile->vmgi_mat->first_play_pgc == 0) | |
401 return 1; | |
402 | |
403 - ifofile->first_play_pgc = (pgc_t *)malloc(sizeof(pgc_t)); | |
404 + ifofile->first_play_pgc = malloc(sizeof(pgc_t)); | |
405 if(!ifofile->first_play_pgc) | |
406 return 0; | |
407 | |
408 @@ -806,7 +806,7 @@ | |
409 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->tt_srpt * DVD_BLOCK_LEN)) | |
410 return 0; | |
411 | |
412 - tt_srpt = (tt_srpt_t *)malloc(sizeof(tt_srpt_t)); | |
413 + tt_srpt = malloc(sizeof(tt_srpt_t)); | |
414 if(!tt_srpt) | |
415 return 0; | |
416 | |
417 @@ -823,7 +823,7 @@ | |
418 | |
419 info_length = tt_srpt->last_byte + 1 - TT_SRPT_SIZE; | |
420 | |
421 - tt_srpt->title = (title_info_t *)malloc(info_length); | |
422 + tt_srpt->title = malloc(info_length); | |
423 if(!tt_srpt->title) { | |
424 free(tt_srpt); | |
425 ifofile->tt_srpt = 0; | |
426 @@ -908,7 +908,7 @@ | |
427 ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN)) | |
428 return 0; | |
429 | |
430 - vts_ptt_srpt = (vts_ptt_srpt_t *)malloc(sizeof(vts_ptt_srpt_t)); | |
431 + vts_ptt_srpt = malloc(sizeof(vts_ptt_srpt_t)); | |
432 if(!vts_ptt_srpt) | |
433 return 0; | |
434 | |
435 @@ -929,7 +929,7 @@ | |
436 | |
437 info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE; | |
438 | |
439 - data = (uint32_t *)malloc(info_length); | |
440 + data = malloc(info_length); | |
441 if(!data) { | |
442 free(vts_ptt_srpt); | |
443 ifofile->vts_ptt_srpt = 0; | |
444 @@ -1047,7 +1047,7 @@ | |
445 if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN)) | |
446 return 0; | |
447 | |
448 - ptl_mait = (ptl_mait_t *)malloc(sizeof(ptl_mait_t)); | |
449 + ptl_mait = malloc(sizeof(ptl_mait_t)); | |
450 if(!ptl_mait) | |
451 return 0; | |
452 | |
453 @@ -1071,7 +1071,7 @@ | |
454 <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE); | |
455 | |
456 info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t); | |
457 - ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length); | |
458 + ptl_mait->countries = malloc(info_length); | |
459 if(!ptl_mait->countries) { | |
460 free(ptl_mait); | |
461 ifofile->ptl_mait = 0; | |
462 @@ -1112,7 +1112,7 @@ | |
463 return 0; | |
464 } | |
465 info_length = (ptl_mait->nr_of_vtss + 1) * sizeof(pf_level_t); | |
466 - pf_temp = (uint16_t *)malloc(info_length); | |
467 + pf_temp = malloc(info_length); | |
468 if(!pf_temp) { | |
469 for(j = 0; j < i ; j++) { | |
470 free(ptl_mait->countries[j].pf_ptl_mai); | |
471 @@ -1134,7 +1134,7 @@ | |
472 for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) { | |
473 B2N_16(pf_temp[j]); | |
474 } | |
475 - ptl_mait->countries[i].pf_ptl_mai = (pf_level_t *)malloc(info_length); | |
476 + ptl_mait->countries[i].pf_ptl_mai = malloc(info_length); | |
477 if(!ptl_mait->countries[i].pf_ptl_mai) { | |
478 free(pf_temp); | |
479 for(j = 0; j < i ; j++) { | |
480 @@ -1198,7 +1198,7 @@ | |
481 if(!DVDFileSeek_(ifofile->file, offset)) | |
482 return 0; | |
483 | |
484 - vts_tmapt = (vts_tmapt_t *)malloc(sizeof(vts_tmapt_t)); | |
485 + vts_tmapt = malloc(sizeof(vts_tmapt_t)); | |
486 if(!vts_tmapt) | |
487 return 0; | |
488 | |
489 @@ -1218,7 +1218,7 @@ | |
490 | |
491 info_length = vts_tmapt->nr_of_tmaps * 4; | |
492 | |
493 - vts_tmap_srp = (uint32_t *)malloc(info_length); | |
494 + vts_tmap_srp = malloc(info_length); | |
495 if(!vts_tmap_srp) { | |
496 free(vts_tmapt); | |
497 ifofile->vts_tmapt = NULL; | |
498 @@ -1242,7 +1242,7 @@ | |
499 | |
500 info_length = vts_tmapt->nr_of_tmaps * sizeof(vts_tmap_t); | |
501 | |
502 - vts_tmapt->tmap = (vts_tmap_t *)malloc(info_length); | |
503 + vts_tmapt->tmap = malloc(info_length); | |
504 if(!vts_tmapt->tmap) { | |
505 free(vts_tmap_srp); | |
506 free(vts_tmapt); | |
507 @@ -1274,7 +1274,7 @@ | |
508 | |
509 info_length = vts_tmapt->tmap[i].nr_of_entries * sizeof(map_ent_t); | |
510 | |
511 - vts_tmapt->tmap[i].map_ent = (map_ent_t *)malloc(info_length); | |
512 + vts_tmapt->tmap[i].map_ent = malloc(info_length); | |
513 if(!vts_tmapt->tmap[i].map_ent) { | |
514 ifoFree_VTS_TMAPT(ifofile); | |
515 return 0; | |
516 @@ -1322,7 +1322,7 @@ | |
517 if(ifofile->vtsi_mat->vts_c_adt == 0) /* mandatory */ | |
518 return 0; | |
519 | |
520 - ifofile->vts_c_adt = (c_adt_t *)malloc(sizeof(c_adt_t)); | |
521 + ifofile->vts_c_adt = malloc(sizeof(c_adt_t)); | |
522 if(!ifofile->vts_c_adt) | |
523 return 0; | |
524 | |
525 @@ -1354,7 +1354,7 @@ | |
526 return 0; | |
527 } | |
528 | |
529 - ifofile->menu_c_adt = (c_adt_t *)malloc(sizeof(c_adt_t)); | |
530 + ifofile->menu_c_adt = malloc(sizeof(c_adt_t)); | |
531 if(!ifofile->menu_c_adt) | |
532 return 0; | |
533 | |
534 @@ -1396,7 +1396,7 @@ | |
535 c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t); | |
536 } | |
537 | |
538 - c_adt->cell_adr_table = (cell_adr_t *)malloc(info_length); | |
539 + c_adt->cell_adr_table = malloc(info_length); | |
540 if(!c_adt->cell_adr_table) | |
541 return 0; | |
542 | |
543 @@ -1456,7 +1456,7 @@ | |
544 if(ifofile->vtsi_mat->vts_vobu_admap == 0) /* mandatory */ | |
545 return 0; | |
546 | |
547 - ifofile->vts_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t)); | |
548 + ifofile->vts_vobu_admap = malloc(sizeof(vobu_admap_t)); | |
549 if(!ifofile->vts_vobu_admap) | |
550 return 0; | |
551 | |
552 @@ -1488,7 +1488,7 @@ | |
553 return 0; | |
554 } | |
555 | |
556 - ifofile->menu_vobu_admap = (vobu_admap_t *)malloc(sizeof(vobu_admap_t)); | |
557 + ifofile->menu_vobu_admap = malloc(sizeof(vobu_admap_t)); | |
558 if(!ifofile->menu_vobu_admap) | |
559 return 0; | |
560 | |
561 @@ -1521,7 +1521,7 @@ | |
562 Titles with a VOBS that has no VOBUs. */ | |
563 CHECK_VALUE(info_length % sizeof(uint32_t) == 0); | |
564 | |
565 - vobu_admap->vobu_start_sectors = (uint32_t *)malloc(info_length); | |
566 + vobu_admap->vobu_start_sectors = malloc(info_length); | |
567 if(!vobu_admap->vobu_start_sectors) { | |
568 return 0; | |
569 } | |
570 @@ -1573,7 +1573,7 @@ | |
571 if(ifofile->vtsi_mat->vts_pgcit == 0) /* mandatory */ | |
572 return 0; | |
573 | |
574 - ifofile->vts_pgcit = (pgcit_t *)malloc(sizeof(pgcit_t)); | |
575 + ifofile->vts_pgcit = malloc(sizeof(pgcit_t)); | |
576 if(!ifofile->vts_pgcit) | |
577 return 0; | |
578 | |
579 @@ -1703,7 +1703,7 @@ | |
580 return 0; | |
581 } | |
582 | |
583 - ifofile->pgci_ut = (pgci_ut_t *)malloc(sizeof(pgci_ut_t)); | |
584 + ifofile->pgci_ut = malloc(sizeof(pgci_ut_t)); | |
585 if(!ifofile->pgci_ut) | |
586 return 0; | |
587 | |
588 @@ -1893,7 +1893,7 @@ | |
589 if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN)) | |
590 return 0; | |
591 | |
592 - vts_atrt = (vts_atrt_t *)malloc(sizeof(vts_atrt_t)); | |
593 + vts_atrt = malloc(sizeof(vts_atrt_t)); | |
594 if(!vts_atrt) | |
595 return 0; | |
596 | |
597 @@ -1915,7 +1915,7 @@ | |
598 VTS_ATRT_SIZE < vts_atrt->last_byte + 1); | |
599 | |
600 info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t); | |
601 - data = (uint32_t *)malloc(info_length); | |
602 + data = malloc(info_length); | |
603 if(!data) { | |
604 free(vts_atrt); | |
605 ifofile->vts_atrt = 0; | |
606 @@ -1937,7 +1937,7 @@ | |
607 } | |
608 | |
609 info_length = vts_atrt->nr_of_vtss * sizeof(vts_attributes_t); | |
610 - vts_atrt->vts = (vts_attributes_t *)malloc(info_length); | |
611 + vts_atrt->vts = malloc(info_length); | |
612 if(!vts_atrt->vts) { | |
613 free(data); | |
614 free(vts_atrt); | |
615 @@ -1993,7 +1993,7 @@ | |
616 ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN)) | |
617 return 0; | |
618 | |
619 - txtdt_mgi = (txtdt_mgi_t *)malloc(sizeof(txtdt_mgi_t)); | |
620 + txtdt_mgi = malloc(sizeof(txtdt_mgi_t)); | |
621 if(!txtdt_mgi) { | |
622 return 0; | |
623 } | |
16659 | 624 |
15875
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
625 diff -Naur dvdread.orig/ifo_types.h dvdread/ifo_types.h |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
626 --- dvdread.orig/ifo_types.h 2005-06-23 00:18:54.000000000 +0200 |
50960b929dd0
update mplayer specific libdvdread diff to match v0.9.4
aurel
parents:
15535
diff
changeset
|
627 +++ dvdread/ifo_types.h 2005-06-23 00:19:10.000000000 +0200 |
18371 | 628 @@ -394,6 +398,55 @@ |
16659 | 629 } ATTRIBUTE_PACKED user_ops_t; |
630 | |
631 /** | |
632 + * Subpicture stream mapping for a subtitle | |
633 + */ | |
634 +typedef struct { | |
635 +#ifdef WORDS_BIGENDIAN | |
636 + unsigned int present : 1; | |
637 + unsigned int zero1 : 2; | |
638 + unsigned int s_4p3 : 5; /* stream for 4:3 on any display */ | |
639 + | |
640 + unsigned int zero2 : 3; | |
641 + unsigned int s_wide : 5; /* stream for 16:9 on widescreen display */ | |
642 + | |
643 + unsigned int zero3 : 3; | |
644 + unsigned int s_lbox : 5; /* stream for 16:9 on letterboxed 4:3 display */ | |
645 + | |
646 + unsigned int zero4 : 3; | |
647 + unsigned int s_panscan : 5; /* stream for 16:9 with pan&scan data on 4:3 display */ | |
648 +#else | |
649 + unsigned int s_4p3 : 5; /* stream for 4:3 on any display */ | |
650 + unsigned int zero1 : 2; | |
651 + unsigned int present : 1; | |
652 + | |
653 + unsigned int s_wide : 5; /* stream for 16:9 on widescreen display */ | |
654 + unsigned int zero2 : 3; | |
655 + | |
656 + unsigned int s_lbox : 5; /* stream for 16:9 on letterboxed 4:3 display */ | |
657 + unsigned int zero3 : 3; | |
658 + | |
659 + unsigned int s_panscan : 5; /* stream for 16:9 with pan&scan data on 4:3 display */ | |
660 + unsigned int zero4 : 3; | |
661 +#endif | |
662 +} ATTRIBUTE_PACKED subp_mapping_t; | |
663 + | |
664 +/** | |
665 + * Audio stream mapping for a soundtrack | |
666 + */ | |
667 +typedef struct { | |
668 +#ifdef WORDS_BIGENDIAN | |
669 + unsigned int present : 1; | |
670 + unsigned int zero1 : 4; | |
671 + unsigned int s_audio : 3; | |
672 +#else | |
673 + unsigned int s_audio : 3; | |
674 + unsigned int zero1 : 4; | |
675 + unsigned int present : 1; | |
676 +#endif | |
677 + uint8_t zero2; | |
678 +} ATTRIBUTE_PACKED audio_mapping_t; | |
679 + | |
680 +/** | |
681 * Program Chain Information. | |
682 */ | |
683 typedef struct { | |
18371 | 684 @@ -402,8 +455,8 @@ |
16659 | 685 uint8_t nr_of_cells; |
686 dvd_time_t playback_time; | |
687 user_ops_t prohibited_ops; | |
688 - uint16_t audio_control[8]; /* New type? */ | |
689 - uint32_t subp_control[32]; /* New type? */ | |
690 + audio_mapping_t audio_control[8]; | |
691 + subp_mapping_t subp_control[32]; | |
692 uint16_t next_pgc_nr; | |
693 uint16_t prev_pgc_nr; | |
694 uint16_t goup_pgc_nr; |