comparison libmpdvdkit2/libdvdread_changes.diff @ 16510:881e136ebf1a

add FreeBSD default cd/dvd devices
author nexus
date Sat, 17 Sep 2005 20:53:20 +0000
parents 50960b929dd0
children f734c20de10a
comparison
equal deleted inserted replaced
16509:d3ddabb15d4d 16510:881e136ebf1a
158 + 158 +
159 +//extern char * dvdcss_cache_dir; 159 +//extern char * dvdcss_cache_dir;
160 160
161 /** 161 /**
162 * Open a DVD image or block device file. 162 * Open a DVD image or block device file.
163 @@ -282,7 +305,7 @@ 163 @@ -278,11 +301,16 @@
164 Darwin /dev/rdisk0, it needs to be the raw device
165 BSD/OS /dev/sr0c (if not mounted) or /dev/rsr0c ('c' any letter will do) */
166 static char *bsd_block2char( const char *path )
167 +#if defined(__FreeBSD__)
168 +{
169 + return (char *) strdup( path );
170 +}
171 +#else
172 {
164 char *new_path; 173 char *new_path;
165 174
166 /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */ 175 /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
167 - if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) ) 176 - if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) )
168 + if( strncmp( path, "/dev/", 5 ) || !strncmp( path, "/dev/r", 6 ) ) 177 + if( strncmp( path, "/dev/", 5 ) || !strncmp( path, "/dev/r", 6 ) )
169 return (char *) strdup( path ); 178 return (char *) strdup( path );
170 179
171 /* Replace "/dev/" with "/dev/r" */ 180 /* Replace "/dev/" with "/dev/r" */
172 @@ -303,6 +326,16 @@ 181 @@ -292,6 +320,7 @@
182
183 return new_path;
184 }
185 +#endif /* __FreeBSD__ */
186 #endif
187
188 dvd_reader_t *DVDOpen( const char *path )
189 @@ -303,6 +332,16 @@
173 if( path == NULL ) 190 if( path == NULL )
174 return 0; 191 return 0;
175 192
176 +#ifdef WIN32 193 +#ifdef WIN32
177 + /* Stat doesn't work on devices under mingwin/cygwin. */ 194 + /* Stat doesn't work on devices under mingwin/cygwin. */
184 +#endif 201 +#endif
185 + { 202 + {
186 ret = stat( path, &fileinfo ); 203 ret = stat( path, &fileinfo );
187 if( ret < 0 ) { 204 if( ret < 0 ) {
188 /* If we can't stat the file, give up */ 205 /* If we can't stat the file, give up */
189 @@ -310,6 +343,7 @@ 206 @@ -310,6 +349,7 @@
190 perror(""); 207 perror("");
191 return 0; 208 return 0;
192 } 209 }
193 + } 210 + }
194 211
195 /* Try to open libdvdcss or fall back to standard functions */ 212 /* Try to open libdvdcss or fall back to standard functions */
196 have_css = dvdinput_setup(); 213 have_css = dvdinput_setup();
197 @@ -335,7 +369,7 @@ 214 @@ -335,7 +375,7 @@
198 char *path_copy; 215 char *path_copy;
199 #if defined(SYS_BSD) 216 #if defined(SYS_BSD)
200 struct fstab* fe; 217 struct fstab* fe;
201 -#elif defined(__sun) || defined(__linux__) 218 -#elif defined(__sun) || defined(__linux__)
202 +#elif defined(__sun) || defined(__linux__) || defined(__CYGWIN__) 219 +#elif defined(__sun) || defined(__linux__) || defined(__CYGWIN__)
203 FILE *mntfile; 220 FILE *mntfile;
204 #endif 221 #endif
205 222
206 @@ -350,7 +384,9 @@ 223 @@ -350,7 +390,9 @@
207 if( cdir >= 0 ) { 224 if( cdir >= 0 ) {
208 chdir( path_copy ); 225 chdir( path_copy );
209 new_path = getcwd( NULL, PATH_MAX ); 226 new_path = getcwd( NULL, PATH_MAX );
210 +#ifndef __MINGW32__ 227 +#ifndef __MINGW32__
211 fchdir( cdir ); 228 fchdir( cdir );
212 +#endif 229 +#endif
213 close( cdir ); 230 close( cdir );
214 if( new_path ) { 231 if( new_path ) {
215 free( path_copy ); 232 free( path_copy );
216 @@ -406,7 +442,7 @@ 233 @@ -406,7 +448,7 @@
217 } 234 }
218 fclose( mntfile ); 235 fclose( mntfile );
219 } 236 }
220 -#elif defined(__linux__) 237 -#elif defined(__linux__)
221 +#elif defined(__linux__) || defined(__CYGWIN__) 238 +#elif defined(__linux__) || defined(__CYGWIN__)
222 mntfile = fopen( MOUNTED, "r" ); 239 mntfile = fopen( MOUNTED, "r" );
223 if( mntfile ) { 240 if( mntfile ) {
224 struct mntent *me; 241 struct mntent *me;
225 @@ -425,6 +461,9 @@ 242 @@ -425,6 +467,9 @@
226 } 243 }
227 fclose( mntfile ); 244 fclose( mntfile );
228 } 245 }
229 +#elif defined(__MINGW32__) 246 +#elif defined(__MINGW32__)
230 + dev_name = strdup(path); 247 + dev_name = strdup(path);
231 + auth_drive = DVDOpenImageFile( path, have_css ); 248 + auth_drive = DVDOpenImageFile( path, have_css );
232 #endif 249 #endif
233 if( !dev_name ) { 250 if( !dev_name ) {
234 fprintf( stderr, "libdvdread: Couldn't find device name.\n" ); 251 fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
235 @@ -615,8 +654,8 @@ 252 @@ -615,8 +660,8 @@
236 } 253 }
237 254
238 if( dvd->css_state == 1 /* Need key init */ ) { 255 if( dvd->css_state == 1 /* Need key init */ ) {
239 - initAllCSSKeys( dvd ); 256 - initAllCSSKeys( dvd );
240 - dvd->css_state = 2; 257 - dvd->css_state = 2;
241 +// initAllCSSKeys( dvd ); 258 +// initAllCSSKeys( dvd );
242 +// dvd->css_state = 2; 259 +// dvd->css_state = 2;
243 } 260 }
244 /* 261 /*
245 if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) { 262 if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
246 @@ -915,7 +954,7 @@ 263 @@ -915,7 +960,7 @@
247 return (ssize_t)ret; 264 return (ssize_t)ret;
248 } 265 }
249 266
250 -int32_t DVDFileSeek( dvd_file_t *dvd_file, int32_t offset ) 267 -int32_t DVDFileSeek( dvd_file_t *dvd_file, int32_t offset )
251 +int DVDFileSeek( dvd_file_t *dvd_file, int offset ) 268 +int DVDFileSeek( dvd_file_t *dvd_file, int offset )