1 diff -Naur dvdread.orig/bswap.h dvdread/bswap.h
2 --- dvdread.orig/bswap.h 2005-06-23 00:18:54.000000000 +0200
3 +++ dvdread/bswap.h 2005-06-23 00:19:10.000000000 +0200
5 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10 #if defined(WORDS_BIGENDIAN)
11 /* All bigendian systems are fine, just ignore the swaps. */
12 #define B2N_16(x) (void)(x)
14 #define B2N_32(x) x = be32toh(x)
15 #define B2N_64(x) x = be64toh(x)
17 +#elif defined(__DragonFly__)
18 +#include <sys/endian.h>
19 +#define B2N_16(x) x = be16toh(x)
20 +#define B2N_32(x) x = be32toh(x)
21 +#define B2N_64(x) x = be64toh(x)
23 +#elif defined(ARCH_X86)
24 +inline static unsigned short bswap_16(unsigned short x)
26 + __asm("xchgb %b0,%h0" :
31 +#define B2N_16(x) x = bswap_16(x)
33 +inline static unsigned int bswap_32(unsigned int x)
48 +#define B2N_32(x) x = bswap_32(x)
50 +inline static unsigned long long int bswap_64(unsigned long long int x)
52 + register union { __extension__ uint64_t __ll;
53 + uint32_t __l[2]; } __x;
55 + "=r"(__x.__l[0]),"=r"(__x.__l[1]):
56 + "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32))));
59 +#define B2N_64(x) x = bswap_64(x)
61 /* This is a slow but portable implementation, it has multiple evaluation
63 * Old FreeBSD's and Solaris don't have <byteswap.h> or any other such
67 -#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
68 +#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__)
70 x = ((((x) & 0xff00) >> 8) | \
71 (((x) & 0x00ff) << 8))
72 diff -Naur dvdread.orig/.cvsignore dvdread/.cvsignore
73 diff -Naur dvdread.orig/dvd_input.c dvdread/dvd_input.c
74 --- dvdread.orig/dvd_input.c 2005-06-23 00:18:54.000000000 +0200
75 +++ dvdread/dvd_input.c 2005-06-23 00:30:23.000000000 +0200
78 #ifdef HAVE_DVDCSS_DVDCSS_H
79 /* linking to libdvdcss */
80 -#include <dvdcss/dvdcss.h>
82 #define DVDcss_open(a) dvdcss_open((char*)(a))
83 #define DVDcss_close dvdcss_close
84 #define DVDcss_seek dvdcss_seek
88 /* Allocate the handle structure */
89 - dev = (dvd_input_t) malloc(sizeof(dvd_input_t));
90 + dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s));
92 fprintf(stderr, "libdvdread: Could not allocate memory.\n");
95 fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method);
96 fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
99 fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
103 /* libdvdcss wrapper functions */
104 dvdinput_open = css_open;
105 diff -Naur dvdread.orig/dvd_input.h dvdread/dvd_input.h
106 diff -Naur dvdread.orig/dvd_reader.c dvdread/dvd_reader.c
107 --- dvdread.orig/dvd_reader.c 2005-06-23 00:18:54.000000000 +0200
108 +++ dvdread/dvd_reader.c 2005-06-23 00:19:10.000000000 +0200
113 -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
114 +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) || defined(__DragonFly__)
119 #include <sys/mnttab.h>
121 +#include </usr/conf/h/mnttab.h>
122 #elif defined(SYS_BSD)
124 -#elif defined(__linux__)
125 +#elif defined(__linux__) || defined(__CYGWIN__)
130 +#include <sys/timeb.h>
131 +static void gettimeofday(struct timeval* t,void* timezone){
132 + struct timeb timebuffer;
133 + ftime( &timebuffer );
134 + t->tv_sec=timebuffer.time;
135 + t->tv_usec=1000*timebuffer.millitm;
140 #include "dvd_input.h"
141 #include "dvd_reader.h"
144 -#define DEFAULT_UDF_CACHE_LEVEL 1
145 +#define DEFAULT_UDF_CACHE_LEVEL 0
147 struct dvd_reader_s {
148 /* Basic information. */
153 +#ifndef HAVE_MPLAYER
154 + #include "get_path.c"
156 + extern char * get_path( char * filename );
159 +//extern char * dvdcss_cache_dir;
162 * Open a DVD image or block device file.
166 /* 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 ) )
168 + if( strncmp( path, "/dev/", 5 ) || !strncmp( path, "/dev/r", 6 ) )
169 return (char *) strdup( path );
171 /* Replace "/dev/" with "/dev/r" */
177 + /* Stat doesn't work on devices under mingwin/cygwin. */
178 + if( path[0] && path[1] == ':' && path[2] == '\0' )
180 + /* Don't try to stat the file */
181 + fileinfo.st_mode = S_IFBLK;
186 ret = stat( path, &fileinfo );
188 /* If we can't stat the file, give up */
195 /* Try to open libdvdcss or fall back to standard functions */
196 have_css = dvdinput_setup();
201 -#elif defined(__sun) || defined(__linux__)
202 +#elif defined(__sun) || defined(__linux__) || defined(__CYGWIN__)
209 new_path = getcwd( NULL, PATH_MAX );
220 -#elif defined(__linux__)
221 +#elif defined(__linux__) || defined(__CYGWIN__)
222 mntfile = fopen( MOUNTED, "r" );
229 +#elif defined(__MINGW32__)
230 + dev_name = strdup(path);
231 + auth_drive = DVDOpenImageFile( path, have_css );
234 fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
238 if( dvd->css_state == 1 /* Need key init */ ) {
239 - initAllCSSKeys( dvd );
240 - dvd->css_state = 2;
241 +// initAllCSSKeys( dvd );
242 +// dvd->css_state = 2;
245 if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
250 -int32_t DVDFileSeek( dvd_file_t *dvd_file, int32_t offset )
251 +int DVDFileSeek( dvd_file_t *dvd_file, int offset )
253 /* Check arguments. */
254 if( dvd_file == NULL || offset < 0 )
255 diff -Naur dvdread.orig/dvdread_internal.h dvdread/dvdread_internal.h
256 --- dvdread.orig/dvdread_internal.h 2005-06-23 00:18:54.000000000 +0200
257 +++ dvdread/dvdread_internal.h 2005-06-23 00:19:10.000000000 +0200
259 #define DVDREAD_INTERNAL_H
262 -#define CHECK_VALUE(arg) \
264 - fprintf(stderr, "\n*** libdvdread: CHECK_VALUE failed in %s:%i ***" \
265 - "\n*** for %s ***\n\n", \
266 - __FILE__, __LINE__, # arg ); \
268 +#define CHECK_VALUE(arg)
271 #endif /* DVDREAD_INTERNAL_H */
272 diff -Naur dvdread.orig/dvd_udf.c dvdread/dvd_udf.c
273 --- dvdread.orig/dvd_udf.c 2005-06-23 00:18:54.000000000 +0200
274 +++ dvdread/dvd_udf.c 2005-06-23 00:19:10.000000000 +0200
280 #include <sys/ioctl.h>
282 #include <sys/types.h>
283 #include <sys/stat.h>
285 diff -Naur dvdread.orig/ifo_print.c dvdread/ifo_print.c
286 diff -Naur dvdread.orig/ifo_print.h dvdread/ifo_print.h
287 diff -Naur dvdread.orig/ifo_read.c dvdread/ifo_read.c
288 diff -Naur dvdread.orig/ifo_read.h dvdread/ifo_read.h
289 --- dvdread.orig/ifo_read.h 2005-06-23 00:18:54.000000000 +0200
290 +++ dvdread/ifo_read.h 2005-06-23 00:19:10.000000000 +0200
292 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
295 -#include <dvdread/ifo_types.h>
296 -#include <dvdread/dvd_reader.h>
297 +#include "ifo_types.h"
298 +#include "dvd_reader.h"
302 diff -Naur dvdread.orig/ifo_types.h dvdread/ifo_types.h
303 --- dvdread.orig/ifo_types.h 2005-06-23 00:18:54.000000000 +0200
304 +++ dvdread/ifo_types.h 2005-06-23 00:19:10.000000000 +0200
308 #include <inttypes.h>
309 -#include <dvdread/dvd_reader.h>
310 +#include "dvd_reader.h"
313 #undef ATTRIBUTE_PACKED
314 diff -Naur dvdread.orig/nav_print.c dvdread/nav_print.c
315 diff -Naur dvdread.orig/nav_print.h dvdread/nav_print.h
316 --- dvdread.orig/nav_print.h 2005-06-23 00:18:54.000000000 +0200
317 +++ dvdread/nav_print.h 2005-06-23 00:19:10.000000000 +0200
319 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
322 -#include <dvdread/nav_types.h>
323 +#include "nav_types.h"
326 * Pretty printing of the NAV packets, PCI and DSI structs.
327 diff -Naur dvdread.orig/nav_read.c dvdread/nav_read.c
328 diff -Naur dvdread.orig/nav_read.h dvdread/nav_read.h
329 --- dvdread.orig/nav_read.h 2005-06-23 00:18:54.000000000 +0200
330 +++ dvdread/nav_read.h 2005-06-23 00:19:10.000000000 +0200
332 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
335 -#include <dvdread/nav_types.h>
336 +#include "nav_types.h"
339 * Parsing of NAV data, PCI and DSI parts.
340 diff -Naur dvdread.orig/nav_types.h dvdread/nav_types.h
341 --- dvdread.orig/nav_types.h 2005-06-23 00:18:54.000000000 +0200
342 +++ dvdread/nav_types.h 2005-06-23 00:19:10.000000000 +0200
346 #include <inttypes.h>
347 -#include <dvdread/ifo_types.h> /* only dvd_time_t, vm_cmd_t and user_ops_t */
348 +#include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */
351 #undef ATTRIBUTE_PACKED