2005-06-30 22:52:59 +00:00
|
|
|
diff -Naur dvdread.orig/bswap.h dvdread/bswap.h
|
|
|
|
--- dvdread.orig/bswap.h 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/bswap.h 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -20,8 +24,6 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#include <config.h>
|
|
|
|
-
|
|
|
|
#if defined(WORDS_BIGENDIAN)
|
|
|
|
/* All bigendian systems are fine, just ignore the swaps. */
|
|
|
|
#define B2N_16(x) (void)(x)
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -59,13 +61,57 @@
|
|
|
|
#define B2N_32(x) x = be32toh(x)
|
|
|
|
#define B2N_64(x) x = be64toh(x)
|
|
|
|
|
|
|
|
+#elif defined(__DragonFly__)
|
|
|
|
+#include <sys/endian.h>
|
|
|
|
+#define B2N_16(x) x = be16toh(x)
|
|
|
|
+#define B2N_32(x) x = be32toh(x)
|
|
|
|
+#define B2N_64(x) x = be64toh(x)
|
|
|
|
+
|
2005-03-11 02:39:54 +00:00
|
|
|
+#elif defined(ARCH_X86)
|
|
|
|
+inline static unsigned short bswap_16(unsigned short x)
|
|
|
|
+{
|
|
|
|
+ __asm("xchgb %b0,%h0" :
|
|
|
|
+ "=q" (x) :
|
|
|
|
+ "0" (x));
|
|
|
|
+ return x;
|
|
|
|
+}
|
|
|
|
+#define B2N_16(x) x = bswap_16(x)
|
|
|
|
+
|
|
|
|
+inline static unsigned int bswap_32(unsigned int x)
|
|
|
|
+{
|
|
|
|
+ __asm(
|
|
|
|
+#if __CPU__ > 386
|
|
|
|
+ "bswap %0":
|
|
|
|
+ "=r" (x) :
|
|
|
|
+#else
|
|
|
|
+ "xchgb %b0,%h0\n"
|
|
|
|
+ " rorl $16,%0\n"
|
|
|
|
+ " xchgb %b0,%h0":
|
|
|
|
+ "=q" (x) :
|
|
|
|
+#endif
|
|
|
|
+ "0" (x));
|
|
|
|
+ return x;
|
|
|
|
+}
|
|
|
|
+#define B2N_32(x) x = bswap_32(x)
|
|
|
|
+
|
|
|
|
+inline static unsigned long long int bswap_64(unsigned long long int x)
|
|
|
|
+{
|
|
|
|
+ register union { __extension__ uint64_t __ll;
|
|
|
|
+ uint32_t __l[2]; } __x;
|
|
|
|
+ asm("xchgl %0,%1":
|
|
|
|
+ "=r"(__x.__l[0]),"=r"(__x.__l[1]):
|
|
|
|
+ "0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32))));
|
|
|
|
+ return __x.__ll;
|
|
|
|
+}
|
|
|
|
+#define B2N_64(x) x = bswap_64(x)
|
|
|
|
+
|
|
|
|
/* This is a slow but portable implementation, it has multiple evaluation
|
|
|
|
* problems so beware.
|
2005-06-30 22:52:59 +00:00
|
|
|
* Old FreeBSD's and Solaris don't have <byteswap.h> or any other such
|
2005-03-11 02:39:54 +00:00
|
|
|
* functionality!
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
|
|
|
|
+#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__)
|
|
|
|
#define B2N_16(x) \
|
|
|
|
x = ((((x) & 0xff00) >> 8) | \
|
|
|
|
(((x) & 0x00ff) << 8))
|
2005-06-30 22:52:59 +00:00
|
|
|
diff -Naur dvdread.orig/.cvsignore dvdread/.cvsignore
|
|
|
|
diff -Naur dvdread.orig/dvd_input.c dvdread/dvd_input.c
|
|
|
|
--- dvdread.orig/dvd_input.c 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/dvd_input.c 2005-06-23 00:30:23.000000000 +0200
|
|
|
|
@@ -37,7 +41,7 @@
|
|
|
|
|
|
|
|
#ifdef HAVE_DVDCSS_DVDCSS_H
|
|
|
|
/* linking to libdvdcss */
|
|
|
|
-#include <dvdcss/dvdcss.h>
|
2005-03-11 02:39:54 +00:00
|
|
|
+#include "dvdcss.h"
|
2005-06-30 22:52:59 +00:00
|
|
|
#define DVDcss_open(a) dvdcss_open((char*)(a))
|
|
|
|
#define DVDcss_close dvdcss_close
|
|
|
|
#define DVDcss_seek dvdcss_seek
|
|
|
|
@@ -74,7 +78,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
dvd_input_t dev;
|
2005-06-30 22:52:59 +00:00
|
|
|
|
2005-03-11 02:39:54 +00:00
|
|
|
/* Allocate the handle structure */
|
|
|
|
- dev = (dvd_input_t) malloc(sizeof(dvd_input_t));
|
|
|
|
+ dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s));
|
|
|
|
if(dev == NULL) {
|
|
|
|
fprintf(stderr, "libdvdread: Could not allocate memory.\n");
|
|
|
|
return NULL;
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -320,8 +324,10 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method);
|
|
|
|
fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
|
|
|
|
*/
|
2005-06-30 22:52:59 +00:00
|
|
|
+ /*
|
|
|
|
fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
|
|
|
|
*dvdcss_version);
|
|
|
|
+ */
|
2005-03-11 02:39:54 +00:00
|
|
|
|
2005-06-30 22:52:59 +00:00
|
|
|
/* libdvdcss wrapper functions */
|
|
|
|
dvdinput_open = css_open;
|
|
|
|
diff -Naur dvdread.orig/dvd_input.h dvdread/dvd_input.h
|
|
|
|
diff -Naur dvdread.orig/dvd_reader.c dvdread/dvd_reader.c
|
|
|
|
--- dvdread.orig/dvd_reader.c 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/dvd_reader.c 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -32,24 +36,36 @@
|
|
|
|
#include <limits.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
|
|
|
|
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
|
|
|
|
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) || defined(__DragonFly__)
|
|
|
|
#define SYS_BSD 1
|
|
|
|
#endif
|
2005-03-11 02:39:54 +00:00
|
|
|
|
|
|
|
#if defined(__sun)
|
|
|
|
#include <sys/mnttab.h>
|
|
|
|
+#elif defined(hpux)
|
|
|
|
+#include </usr/conf/h/mnttab.h>
|
|
|
|
#elif defined(SYS_BSD)
|
|
|
|
#include <fstab.h>
|
2005-05-21 11:41:30 +00:00
|
|
|
-#elif defined(__linux__)
|
|
|
|
+#elif defined(__linux__) || defined(__CYGWIN__)
|
2005-03-11 02:39:54 +00:00
|
|
|
#include <mntent.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef __MINGW32__
|
|
|
|
+#include <sys/timeb.h>
|
|
|
|
+static void gettimeofday(struct timeval* t,void* timezone){
|
|
|
|
+ struct timeb timebuffer;
|
|
|
|
+ ftime( &timebuffer );
|
|
|
|
+ t->tv_sec=timebuffer.time;
|
|
|
|
+ t->tv_usec=1000*timebuffer.millitm;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#include "dvd_udf.h"
|
|
|
|
#include "dvd_input.h"
|
|
|
|
#include "dvd_reader.h"
|
2005-06-30 22:52:59 +00:00
|
|
|
#include "md5.h"
|
|
|
|
|
|
|
|
-#define DEFAULT_UDF_CACHE_LEVEL 1
|
|
|
|
+#define DEFAULT_UDF_CACHE_LEVEL 0
|
|
|
|
|
|
|
|
struct dvd_reader_s {
|
|
|
|
/* Basic information. */
|
|
|
|
@@ -194,6 +210,13 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+#ifndef HAVE_MPLAYER
|
|
|
|
+ #include "get_path.c"
|
|
|
|
+#else
|
|
|
|
+ extern char * get_path( char * filename );
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+//extern char * dvdcss_cache_dir;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a DVD image or block device file.
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -282,7 +305,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
char *new_path;
|
|
|
|
|
|
|
|
/* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
|
|
|
|
- if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) )
|
|
|
|
+ if( strncmp( path, "/dev/", 5 ) || !strncmp( path, "/dev/r", 6 ) )
|
|
|
|
return (char *) strdup( path );
|
|
|
|
|
|
|
|
/* Replace "/dev/" with "/dev/r" */
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -303,6 +326,16 @@
|
|
|
|
if( path == NULL )
|
|
|
|
return 0;
|
2005-03-11 02:39:54 +00:00
|
|
|
|
|
|
|
+#ifdef WIN32
|
|
|
|
+ /* Stat doesn't work on devices under mingwin/cygwin. */
|
|
|
|
+ if( path[0] && path[1] == ':' && path[2] == '\0' )
|
|
|
|
+ {
|
|
|
|
+ /* Don't try to stat the file */
|
|
|
|
+ fileinfo.st_mode = S_IFBLK;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+#endif
|
|
|
|
+ {
|
|
|
|
ret = stat( path, &fileinfo );
|
|
|
|
if( ret < 0 ) {
|
|
|
|
/* If we can't stat the file, give up */
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -310,6 +343,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
perror("");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/* Try to open libdvdcss or fall back to standard functions */
|
2005-06-30 22:52:59 +00:00
|
|
|
have_css = dvdinput_setup();
|
|
|
|
@@ -335,7 +369,7 @@
|
2005-05-21 11:41:30 +00:00
|
|
|
char *path_copy;
|
|
|
|
#if defined(SYS_BSD)
|
|
|
|
struct fstab* fe;
|
|
|
|
-#elif defined(__sun) || defined(__linux__)
|
|
|
|
+#elif defined(__sun) || defined(__linux__) || defined(__CYGWIN__)
|
|
|
|
FILE *mntfile;
|
|
|
|
#endif
|
|
|
|
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -350,7 +384,9 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
if( cdir >= 0 ) {
|
|
|
|
chdir( path_copy );
|
|
|
|
new_path = getcwd( NULL, PATH_MAX );
|
|
|
|
+#ifndef __MINGW32__
|
|
|
|
fchdir( cdir );
|
|
|
|
+#endif
|
|
|
|
close( cdir );
|
|
|
|
if( new_path ) {
|
|
|
|
free( path_copy );
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -406,7 +442,7 @@
|
2005-05-21 11:41:30 +00:00
|
|
|
}
|
|
|
|
fclose( mntfile );
|
|
|
|
}
|
|
|
|
-#elif defined(__linux__)
|
|
|
|
+#elif defined(__linux__) || defined(__CYGWIN__)
|
|
|
|
mntfile = fopen( MOUNTED, "r" );
|
|
|
|
if( mntfile ) {
|
|
|
|
struct mntent *me;
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -425,6 +461,9 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
}
|
|
|
|
fclose( mntfile );
|
|
|
|
}
|
2005-05-21 11:41:30 +00:00
|
|
|
+#elif defined(__MINGW32__)
|
2005-03-11 02:39:54 +00:00
|
|
|
+ dev_name = strdup(path);
|
|
|
|
+ auth_drive = DVDOpenImageFile( path, have_css );
|
|
|
|
#endif
|
|
|
|
if( !dev_name ) {
|
|
|
|
fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
|
2005-06-30 22:52:59 +00:00
|
|
|
@@ -615,8 +654,8 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( dvd->css_state == 1 /* Need key init */ ) {
|
|
|
|
- initAllCSSKeys( dvd );
|
|
|
|
- dvd->css_state = 2;
|
|
|
|
+// initAllCSSKeys( dvd );
|
|
|
|
+// dvd->css_state = 2;
|
|
|
|
}
|
|
|
|
/*
|
2005-06-30 22:52:59 +00:00
|
|
|
if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
|
|
|
|
@@ -915,7 +954,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
return (ssize_t)ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int32_t DVDFileSeek( dvd_file_t *dvd_file, int32_t offset )
|
|
|
|
+int DVDFileSeek( dvd_file_t *dvd_file, int offset )
|
|
|
|
{
|
2005-06-30 22:52:59 +00:00
|
|
|
/* Check arguments. */
|
|
|
|
if( dvd_file == NULL || offset < 0 )
|
|
|
|
diff -Naur dvdread.orig/dvdread_internal.h dvdread/dvdread_internal.h
|
|
|
|
--- dvdread.orig/dvdread_internal.h 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/dvdread_internal.h 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -2,11 +2,7 @@
|
|
|
|
#define DVDREAD_INTERNAL_H
|
|
|
|
|
|
|
|
|
|
|
|
-#define CHECK_VALUE(arg) \
|
|
|
|
- if(!(arg)) { \
|
|
|
|
- fprintf(stderr, "\n*** libdvdread: CHECK_VALUE failed in %s:%i ***" \
|
|
|
|
- "\n*** for %s ***\n\n", \
|
|
|
|
- __FILE__, __LINE__, # arg ); \
|
|
|
|
- }
|
|
|
|
+#define CHECK_VALUE(arg)
|
|
|
|
+
|
|
|
|
|
|
|
|
#endif /* DVDREAD_INTERNAL_H */
|
|
|
|
diff -Naur dvdread.orig/dvd_udf.c dvdread/dvd_udf.c
|
|
|
|
--- dvdread.orig/dvd_udf.c 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/dvd_udf.c 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -33,7 +37,9 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
+#ifndef __MINGW32__
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
+#endif
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
2005-06-30 22:52:59 +00:00
|
|
|
diff -Naur dvdread.orig/ifo_print.c dvdread/ifo_print.c
|
|
|
|
diff -Naur dvdread.orig/ifo_print.h dvdread/ifo_print.h
|
|
|
|
diff -Naur dvdread.orig/ifo_read.c dvdread/ifo_read.c
|
|
|
|
diff -Naur dvdread.orig/ifo_read.h dvdread/ifo_read.h
|
|
|
|
--- dvdread.orig/ifo_read.h 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/ifo_read.h 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -20,8 +24,8 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#include <dvdread/ifo_types.h>
|
|
|
|
-#include <dvdread/dvd_reader.h>
|
|
|
|
+#include "ifo_types.h"
|
|
|
|
+#include "dvd_reader.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
2005-06-30 22:52:59 +00:00
|
|
|
diff -Naur dvdread.orig/ifo_types.h dvdread/ifo_types.h
|
|
|
|
--- dvdread.orig/ifo_types.h 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/ifo_types.h 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -21,7 +25,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
-#include <dvdread/dvd_reader.h>
|
|
|
|
+#include "dvd_reader.h"
|
|
|
|
|
|
|
|
|
|
|
|
#undef ATTRIBUTE_PACKED
|
2005-06-30 22:52:59 +00:00
|
|
|
diff -Naur dvdread.orig/nav_print.c dvdread/nav_print.c
|
|
|
|
diff -Naur dvdread.orig/nav_print.h dvdread/nav_print.h
|
|
|
|
--- dvdread.orig/nav_print.h 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/nav_print.h 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -20,7 +24,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#include <dvdread/nav_types.h>
|
|
|
|
+#include "nav_types.h"
|
|
|
|
|
2005-06-30 22:52:59 +00:00
|
|
|
/**
|
|
|
|
* Pretty printing of the NAV packets, PCI and DSI structs.
|
|
|
|
diff -Naur dvdread.orig/nav_read.c dvdread/nav_read.c
|
|
|
|
diff -Naur dvdread.orig/nav_read.h dvdread/nav_read.h
|
|
|
|
--- dvdread.orig/nav_read.h 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/nav_read.h 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -19,7 +23,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
-#include <dvdread/nav_types.h>
|
|
|
|
+#include "nav_types.h"
|
|
|
|
|
2005-06-30 22:52:59 +00:00
|
|
|
/**
|
|
|
|
* Parsing of NAV data, PCI and DSI parts.
|
|
|
|
diff -Naur dvdread.orig/nav_types.h dvdread/nav_types.h
|
|
|
|
--- dvdread.orig/nav_types.h 2005-06-23 00:18:54.000000000 +0200
|
|
|
|
+++ dvdread/nav_types.h 2005-06-23 00:19:10.000000000 +0200
|
|
|
|
@@ -30,7 +34,7 @@
|
2005-03-11 02:39:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
2005-06-30 22:52:59 +00:00
|
|
|
-#include <dvdread/ifo_types.h> /* only dvd_time_t, vm_cmd_t and user_ops_t */
|
|
|
|
+#include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */
|
2005-03-11 02:39:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
#undef ATTRIBUTE_PACKED
|