changeset 24050:1542693b2a30

Sync libdvdread with version 0.9.5 (cosmetic changes).
author diego
date Wed, 15 Aug 2007 11:57:30 +0000
parents 39b8ccb91251
children dcf5fe229d37
files dvdread/bswap.h dvdread/dvd_input.c dvdread/dvd_input.h dvdread/dvd_reader.c dvdread/dvd_reader.h dvdread/dvd_udf.c dvdread/dvd_udf.h dvdread/dvdread_internal.h dvdread/ifo_print.c dvdread/ifo_print.h dvdread/ifo_read.c dvdread/ifo_read.h dvdread/ifo_types.h dvdread/md5.c dvdread/md5.h dvdread/nav_print.c dvdread/nav_print.h dvdread/nav_read.c dvdread/nav_read.h dvdread/nav_types.h
diffstat 20 files changed, 1399 insertions(+), 1378 deletions(-) [+]
line wrap: on
line diff
--- a/dvdread/bswap.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/bswap.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef BSWAP_H_INCLUDED
 #define BSWAP_H_INCLUDED
 
@@ -126,23 +127,23 @@
  */
 
 #elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined(__BEOS__) || defined(__INTERIX) || defined(__CYGWIN__)
-#define B2N_16(x) \
- x = ((((x) & 0xff00) >> 8) | \
-      (((x) & 0x00ff) << 8))
-#define B2N_32(x) \
- x = ((((x) & 0xff000000) >> 24) | \
-      (((x) & 0x00ff0000) >>  8) | \
-      (((x) & 0x0000ff00) <<  8) | \
-      (((x) & 0x000000ff) << 24))
-#define B2N_64(x) \
- x = ((((x) & 0xff00000000000000) >> 56) | \
-      (((x) & 0x00ff000000000000) >> 40) | \
-      (((x) & 0x0000ff0000000000) >> 24) | \
-      (((x) & 0x000000ff00000000) >>  8) | \
-      (((x) & 0x00000000ff000000) <<  8) | \
-      (((x) & 0x0000000000ff0000) << 24) | \
-      (((x) & 0x000000000000ff00) << 40) | \
-      (((x) & 0x00000000000000ff) << 56))
+#define B2N_16(x)                               \
+  x = ((((x) & 0xff00) >> 8) |                  \
+       (((x) & 0x00ff) << 8))
+#define B2N_32(x)                               \
+  x = ((((x) & 0xff000000) >> 24) |             \
+       (((x) & 0x00ff0000) >>  8) |             \
+       (((x) & 0x0000ff00) <<  8) |             \
+       (((x) & 0x000000ff) << 24))
+#define B2N_64(x)                               \
+  x = ((((x) & 0xff00000000000000) >> 56) |     \
+       (((x) & 0x00ff000000000000) >> 40) |     \
+       (((x) & 0x0000ff0000000000) >> 24) |     \
+       (((x) & 0x000000ff00000000) >>  8) |     \
+       (((x) & 0x00000000ff000000) <<  8) |     \
+       (((x) & 0x0000000000ff0000) << 24) |     \
+       (((x) & 0x000000000000ff00) << 40) |     \
+       (((x) & 0x00000000000000ff) << 56))
 
 #else
 
--- a/dvdread/dvd_input.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/dvd_input.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /*
  * Copyright (C) 2002 Samuel Hocevar <sam@zoy.org>,
  *                    Håkan Hjort <d95hjort@dtek.chalmers.se>
@@ -212,7 +213,7 @@
 
   pos = lseek(dev->fd, pos, SEEK_SET);
   if(pos < 0) {
-      return pos;
+    return pos;
   }
   /* assert pos % DVD_VIDEO_LB_LEN == 0 */
   return (int) (pos / DVD_VIDEO_LB_LEN);
@@ -234,7 +235,7 @@
   size_t len;
   ssize_t ret;
   unsigned char *buf = buffer;
-  
+
   len = (size_t)blocks * DVD_VIDEO_LB_LEN;
   
   while(len > 0) {
@@ -250,7 +251,7 @@
     
     if(ret == 0) {
       /* Nothing more to read.  Return the whole blocks, if any, that we got.
-	 and adjust the file possition back to the previous block boundary. */
+         and adjust the file possition back to the previous block boundary. */
       size_t bytes = (size_t)blocks * DVD_VIDEO_LB_LEN - len;
       off_t over_read = -(bytes % DVD_VIDEO_LB_LEN);
       /*off_t pos =*/ lseek(dev->fd, over_read, SEEK_CUR);
@@ -326,7 +327,7 @@
   }
 
   verbose = get_verbose();
-
+  
 #ifdef HAVE_DVDCSS_DVDCSS_H
   /* linking to libdvdcss */
   dvdcss_library = &dvdcss_library;  /* Give it some value != NULL */
@@ -336,7 +337,7 @@
 #else
 
   dvdcss_library = dlopen("libdvdcss.so.2", RTLD_LAZY);
-  
+
   if(dvdcss_library != NULL) {
 #if defined(__OpenBSD__) && !defined(__ELF__)
 #define U_S "_"
@@ -360,37 +361,37 @@
 
     if(dlsym(dvdcss_library, U_S "dvdcss_crack")) {
       if(verbose >= 0) {
-      fprintf(stderr, 
-	      "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n"
-	      "libdvdread: You should get the latest version from "
-	      "http://www.videolan.org/\n" );
+        fprintf(stderr, 
+                "libdvdread: Old (pre-0.0.2) version of libdvdcss found.\n"
+                "libdvdread: You should get the latest version from "
+                "http://www.videolan.org/\n" );
       }
       dlclose(dvdcss_library);
       dvdcss_library = NULL;
     } else if(!DVDcss_open  || !DVDcss_close || !DVDcss_title || !DVDcss_seek
-	      || !DVDcss_read || !DVDcss_error || !dvdcss_version) {
+              || !DVDcss_read || !DVDcss_error || !dvdcss_version) {
       if(verbose >= 0) {
-      fprintf(stderr,  "libdvdread: Missing symbols in libdvdcss.so.2, "
-	      "this shouldn't happen !\n");
+        fprintf(stderr,  "libdvdread: Missing symbols in libdvdcss.so.2, "
+                "this shouldn't happen !\n");
       }
       dlclose(dvdcss_library);
       dvdcss_library = NULL;
     }
   }
 #endif /* HAVE_DVDCSS_DVDCSS_H */
-  
+
   dvdcss_library_init = 1;
   
   if(dvdcss_library) {
     /*
-    char *psz_method = getenv( "DVDCSS_METHOD" );
-    char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
-    fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method);
-    fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
+      char *psz_method = getenv( "DVDCSS_METHOD" );
+      char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+      fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method);
+      fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
     */
     if(verbose >= 1) {
-    fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
-	    *dvdcss_version);
+      fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
+              *dvdcss_version);
     }
     /* libdvdcss wrapper functions */
     dvdinput_open  = css_open;
@@ -403,7 +404,7 @@
     
   } else {
     if(verbose >= 1) {
-    fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n");
+      fprintf(stderr, "libdvdread: Encrypted DVD support unavailable.\n");
     }
     /* libdvdcss replacement functions */
     dvdinput_open  = file_open;
--- a/dvdread/dvd_input.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/dvd_input.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef DVD_INPUT_H_INCLUDED
 #define DVD_INPUT_H_INCLUDED
 
--- a/dvdread/dvd_reader.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/dvd_reader.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /*
  * Copyright (C) 2001, 2002, 2003 Billy Biggs <vektor@dumbterm.net>,
  *                                Håkan Hjort <d95hjort@dtek.chalmers.se>,
@@ -36,7 +37,7 @@
 #include <limits.h>
 #include <dirent.h>
  
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DARWIN__) || defined(__DragonFly__)
 #define SYS_BSD 1
 #endif
 
@@ -70,23 +71,23 @@
 #define DEFAULT_UDF_CACHE_LEVEL 0
 
 struct dvd_reader_s {
-    /* Basic information. */
-    int isImageFile;
+  /* Basic information. */
+  int isImageFile;
   
-    /* Hack for keeping track of the css status. 
-     * 0: no css, 1: perhaps (need init of keys), 2: have done init */
-    int css_state;
-    int css_title; /* Last title that we have called dvdinpute_title for. */
+  /* Hack for keeping track of the css status. 
+   * 0: no css, 1: perhaps (need init of keys), 2: have done init */
+  int css_state;
+  int css_title; /* Last title that we have called dvdinpute_title for. */
 
-    /* Information required for an image file. */
-    dvd_input_t dev;
+  /* Information required for an image file. */
+  dvd_input_t dev;
 
-    /* Information required for a directory path drive. */
-    char *path_root;
+  /* Information required for a directory path drive. */
+  char *path_root;
   
-    /* Filesystem cache */
-    int udfcache_level; /* 0 - turned off, 1 - on */
-    void *udfcache;
+  /* Filesystem cache */
+  int udfcache_level; /* 0 - turned off, 1 - on */
+  void *udfcache;
 
   /* block aligned malloc */
   void *align;
@@ -96,22 +97,22 @@
 };
 
 struct dvd_file_s {
-    /* Basic information. */
-    dvd_reader_t *dvd;
+  /* Basic information. */
+  dvd_reader_t *dvd;
   
-    /* Hack for selecting the right css title. */
-    int css_title;
+  /* Hack for selecting the right css title. */
+  int css_title;
 
-    /* Information required for an image file. */
-    uint32_t lb_start;
-    uint32_t seek_pos;
+  /* Information required for an image file. */
+  uint32_t lb_start;
+  uint32_t seek_pos;
 
-    /* Information required for a directory path drive. */
-    size_t title_sizes[ 9 ];
-    dvd_input_t title_devs[ 9 ];
+  /* Information required for a directory path drive. */
+  size_t title_sizes[ 9 ];
+  dvd_input_t title_devs[ 9 ];
 
-    /* Calculated at open-time, size in blocks. */
-    ssize_t filesize;
+  /* Calculated at open-time, size in blocks. */
+  ssize_t filesize;
 };
 
 
@@ -214,84 +215,84 @@
 /* Loop over all titles and call dvdcss_title to crack the keys. */
 static int initAllCSSKeys( dvd_reader_t *dvd )
 {
-    struct timeval all_s, all_e;
-    struct timeval t_s, t_e;
-    char filename[ MAX_UDF_FILE_NAME_LEN ];
-    uint32_t start, len;
-    int title;
-	
-    char *nokeys_str = getenv("DVDREAD_NOKEYS");
-    if(nokeys_str != NULL)
-      return 0;
+  struct timeval all_s, all_e;
+  struct timeval t_s, t_e;
+  char filename[ MAX_UDF_FILE_NAME_LEN ];
+  uint32_t start, len;
+  int title;
+        
+  char *nokeys_str = getenv("DVDREAD_NOKEYS");
+  if(nokeys_str != NULL)
+    return 0;
     
   if(dvd->verbose >= 1) {
     fprintf( stderr, "\n" );
     fprintf( stderr, "libdvdread: Attempting to retrieve all CSS keys\n" );
     fprintf( stderr, "libdvdread: This can take a _long_ time, "
-	     "please be patient\n\n" );
+             "please be patient\n\n" );
   }
-    gettimeofday(&all_s, NULL);
-	
-    for( title = 0; title < 100; title++ ) {
-	gettimeofday( &t_s, NULL );
-	if( title == 0 ) {
-	    sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
-	} else {
-	    sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 );
-	}
-	start = UDFFindFile( dvd, filename, &len );
-	if( start != 0 && len != 0 ) {
-	    /* Perform CSS key cracking for this title. */
+  gettimeofday(&all_s, NULL);
+        
+  for( title = 0; title < 100; title++ ) {
+    gettimeofday( &t_s, NULL );
+    if( title == 0 ) {
+      sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
+    } else {
+      sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 0 );
+    }
+    start = UDFFindFile( dvd, filename, &len );
+    if( start != 0 && len != 0 ) {
+      /* Perform CSS key cracking for this title. */
       if(dvd->verbose >= 1) {
-	    fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n", 
-		     filename, start );
+        fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n", 
+                 filename, start );
       }
-	    if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
+      if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
         if(dvd->verbose >= 0) {
-		fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)\n", filename, start);
-	    }
+          fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)\n", filename, start);
+        }
       }
-	    gettimeofday( &t_e, NULL );
+      gettimeofday( &t_e, NULL );
       if(dvd->verbose >= 1) {
-	    fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
-		     (long int) t_e.tv_sec - t_s.tv_sec );
-	}
+        fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
+                 (long int) t_e.tv_sec - t_s.tv_sec );
+      }
     }
-	    
-	if( title == 0 ) continue;
-	    
-	gettimeofday( &t_s, NULL );
-	sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 1 );
-	start = UDFFindFile( dvd, filename, &len );
-	if( start == 0 || len == 0 ) break;
-	    
-	/* Perform CSS key cracking for this title. */
+            
+    if( title == 0 ) continue;
+            
+    gettimeofday( &t_s, NULL );
+    sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, 1 );
+    start = UDFFindFile( dvd, filename, &len );
+    if( start == 0 || len == 0 ) break;
+            
+    /* Perform CSS key cracking for this title. */
     if(dvd->verbose >= 1) {
-	fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n", 
-		 filename, start );
+      fprintf( stderr, "libdvdread: Get key for %s at 0x%08x\n", 
+               filename, start );
     }
-	if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
+    if( dvdinput_title( dvd->dev, (int)start ) < 0 ) {
       if(dvd->verbose >= 0) {
-	    fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)!!\n", filename, start);
-	}
+        fprintf( stderr, "libdvdread: Error cracking CSS key for %s (0x%08x)!!\n", filename, start);
+      }
     }
-	gettimeofday( &t_e, NULL );
+    gettimeofday( &t_e, NULL );
     if(dvd->verbose >= 1) {
-	fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
-		 (long int) t_e.tv_sec - t_s.tv_sec );
+      fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
+               (long int) t_e.tv_sec - t_s.tv_sec );
     }
   }
-    title--;
+  title--;
     
   if(dvd->verbose >= 1) {
     fprintf( stderr, "libdvdread: Found %d VTS's\n", title );
   }
-    gettimeofday(&all_e, NULL);
+  gettimeofday(&all_e, NULL);
   if(dvd->verbose >= 1) {
     fprintf( stderr, "libdvdread: Elapsed time %ld\n",  
-	     (long int) all_e.tv_sec - all_s.tv_sec );
+             (long int) all_e.tv_sec - all_s.tv_sec );
   }
-    return 0;
+  return 0;
 }
 
 
@@ -303,22 +304,22 @@
  */
 static dvd_reader_t *DVDOpenImageFile( const char *location, int have_css )
 {
-    dvd_reader_t *dvd;
-    dvd_input_t dev;
+  dvd_reader_t *dvd;
+  dvd_input_t dev;
   int verbose;
 
   verbose = get_verbose();
-    
-    dev = dvdinput_open( location );
-    if( !dev ) {
+
+  dev = dvdinput_open( location );
+  if( !dev ) {
     if(verbose >= 1) {
       fprintf( stderr, "libdvdread: Can't open '%s' for reading: %s\n",
                location, strerror(errno));
     }
     return NULL;
-    }
+  }
 
-    dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
+  dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
   if( !dvd ) {
     int tmp_errno = errno;
     dvdinput_close(dev);
@@ -326,24 +327,24 @@
     return NULL;
   }
   dvd->verbose = verbose;
-    dvd->isImageFile = 1;
-    dvd->dev = dev;
+  dvd->isImageFile = 1;
+  dvd->dev = dev;
   dvd->path_root = NULL;
     
-    dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
-    dvd->udfcache = NULL;
+  dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
+  dvd->udfcache = NULL;
 
   dvd->align = NULL;
 
-    if( have_css ) {
-      /* Only if DVDCSS_METHOD = title, a bit if it's disc or if
-       * DVDCSS_METHOD = key but region missmatch. Unfortunaly we
-       * don't have that information. */
+  if( have_css ) {
+    /* Only if DVDCSS_METHOD = title, a bit if it's disc or if
+     * DVDCSS_METHOD = key but region missmatch. Unfortunaly we
+     * don't have that information. */
     
-      dvd->css_state = 1; /* Need key init. */
-    }
-    dvd->css_title = 0;
-    
+    dvd->css_state = 1; /* Need key init. */
+  }
+  dvd->css_title = 0;
+  
   /* sanity check, is it a valid UDF image, can we find the root dir */
   if(!UDFFindFile(dvd, "/", NULL)) {
     dvdinput_close(dvd->dev);
@@ -358,34 +359,34 @@
     free(dvd);
     return NULL;
   }
-    return dvd;
+  return dvd;
 }
 
 static dvd_reader_t *DVDOpenPath( const char *path_root )
 {
-    dvd_reader_t *dvd;
+  dvd_reader_t *dvd;
 
-    dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
+  dvd = (dvd_reader_t *) malloc( sizeof( dvd_reader_t ) );
   if( !dvd ) {
     return NULL;
   }
   dvd->verbose = get_verbose();
-    dvd->isImageFile = 0;
-    dvd->dev = 0;
-    dvd->path_root = strdup( path_root );
+  dvd->isImageFile = 0;
+  dvd->dev = 0;
+  dvd->path_root = strdup( path_root );
   if(!dvd->path_root) {
     free(dvd);
     return 0;
   }
-    dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
-    dvd->udfcache = NULL;
-    
+  dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
+  dvd->udfcache = NULL;
+
   dvd->align = NULL;
 
-    dvd->css_state = 0; /* Only used in the UDF path */
-    dvd->css_title = 0; /* Only matters in the UDF path */
+  dvd->css_state = 0; /* Only used in the UDF path */
+  dvd->css_title = 0; /* Only matters in the UDF path */
 
-    return dvd;
+  return dvd;
 }
 
 #if defined(__sun)
@@ -394,19 +395,19 @@
    /vol/rdsk/<name> */
 static char *sun_block2char( const char *path )
 {
-    char *new_path;
+  char *new_path;
 
-    /* Must contain "/dsk/" */ 
-    if( !strstr( path, "/dsk/" ) ) return (char *) strdup( path );
+  /* Must contain "/dsk/" */ 
+  if( !strstr( path, "/dsk/" ) ) return (char *) strdup( path );
 
-    /* Replace "/dsk/" with "/rdsk/" */
-    new_path = malloc( strlen(path) + 2 );
-    strcpy( new_path, path );
-    strcpy( strstr( new_path, "/dsk/" ), "" );
-    strcat( new_path, "/rdsk/" );
-    strcat( new_path, strstr( path, "/dsk/" ) + strlen( "/dsk/" ) );
+  /* Replace "/dsk/" with "/rdsk/" */
+  new_path = malloc( strlen(path) + 2 );
+  strcpy( new_path, path );
+  strcpy( strstr( new_path, "/dsk/" ), "" );
+  strcat( new_path, "/rdsk/" );
+  strcat( new_path, strstr( path, "/dsk/" ) + strlen( "/dsk/" ) );
 
-    return new_path;
+  return new_path;
 }
 #endif
 
@@ -423,26 +424,27 @@
 }
 #else
 {
-    char *new_path;
+  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 ) ) 
-      return (char *) strdup( 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 ) ) 
+    return (char *) strdup( path );
 
-    /* Replace "/dev/" with "/dev/r" */
-    new_path = malloc( strlen(path) + 2 );
-    strcpy( new_path, "/dev/r" );
-    strcat( new_path, path + strlen( "/dev/" ) );
+  /* Replace "/dev/" with "/dev/r" */
+  new_path = malloc( strlen(path) + 2 );
+  strcpy( new_path, "/dev/r" );
+  strcat( new_path, path + strlen( "/dev/" ) );
 
-    return new_path;
+  return new_path;
 }
 #endif /* __FreeBSD__ */
 #endif
 
+
 dvd_reader_t *DVDOpen( const char *path )
 {
-    struct stat fileinfo;
-    int ret, have_css;
+  struct stat fileinfo;
+  int ret, have_css;
   char *dev_name = NULL;
   int internal_errno = 0;
   int verbose;
@@ -455,65 +457,65 @@
   verbose = get_verbose();
 
 #ifdef WIN32
-    /* Stat doesn't work on devices under mingwin/cygwin. */
-    if( path[0] && path[1] == ':' && path[2] == '\0' )
+  /* 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;
+      /* Don't try to stat the file */
+      fileinfo.st_mode = S_IFBLK;
     }
-    else
+  else
 #endif
     {
-    ret = stat( path, &fileinfo );
-    if( ret < 0 ) {
+      ret = stat( path, &fileinfo );
+      if( ret < 0 ) {
         int tmp_errno = errno;
-	/* If we can't stat the file, give up */
+        /* If we can't stat the file, give up */
         if(verbose >= 1) {
           fprintf( stderr, "libdvdread: Can't stat '%s': %s\n",
                    path, strerror(errno));
         }
         errno = tmp_errno;
         return NULL;
-    }
+      }
     }
 
-    /* Try to open libdvdcss or fall back to standard functions */
-    have_css = dvdinput_setup();
+  /* Try to open libdvdcss or fall back to standard functions */
+  have_css = dvdinput_setup();
 
-    /* First check if this is a block/char device or a file*/
-    if( S_ISBLK( fileinfo.st_mode ) || 
-	S_ISCHR( fileinfo.st_mode ) || 
-	S_ISREG( fileinfo.st_mode ) ) {
+  /* First check if this is a block/char device or a file*/
+  if( S_ISBLK( fileinfo.st_mode ) || 
+      S_ISCHR( fileinfo.st_mode ) || 
+      S_ISREG( fileinfo.st_mode ) ) {
 
-	/**
-	 * Block devices and regular files are assumed to be DVD-Video images.
-	 */
+    /**
+     * Block devices and regular files are assumed to be DVD-Video images.
+     */
 #if defined(__sun)
-	return DVDOpenImageFile( sun_block2char( path ), have_css );
+    return DVDOpenImageFile( sun_block2char( path ), have_css );
 #elif defined(SYS_BSD)
-	return DVDOpenImageFile( bsd_block2char( path ), have_css );
+    return DVDOpenImageFile( bsd_block2char( path ), have_css );
 #else
-	return DVDOpenImageFile( path, have_css );
+    return DVDOpenImageFile( path, have_css );
 #endif
 
-    } else if( S_ISDIR( fileinfo.st_mode ) ) {
-	dvd_reader_t *auth_drive = 0;
-	char *path_copy;
+  } else if( S_ISDIR( fileinfo.st_mode ) ) {
+    dvd_reader_t *auth_drive = 0;
+    char *path_copy;
 #if defined(SYS_BSD)
-	struct fstab* fe;
+    struct fstab* fe;
 #elif defined(__sun) || defined(__linux__) || defined(__CYGWIN__)
-	FILE *mntfile;
+    FILE *mntfile;
 #endif
 
-	/* XXX: We should scream real loud here. */
-	if( !(path_copy = strdup( path ) ) ) return 0;
+    /* XXX: We should scream real loud here. */
+    if( !(path_copy = strdup( path ) ) ) return 0;
 
 #ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
-	/* Resolve any symlinks and get the absolut dir name. */
-	{
-	    char *new_path;
+    /* Resolve any symlinks and get the absolut dir name. */
+    {
+      char *new_path;
       char *current_path;
-	    
+
       current_path = malloc(PATH_MAX);
       if(current_path) {
         if(!getcwd(current_path, PATH_MAX)) {
@@ -522,7 +524,7 @@
         }
       }
       if(current_path) {
-		chdir( path_copy );
+        chdir( path_copy );
         new_path = malloc(PATH_MAX);
         if(new_path) {
           if(!getcwd(new_path, PATH_MAX )) {
@@ -533,147 +535,147 @@
 
         chdir(current_path);
         free(current_path);
-		if( new_path ) {
-		    free( path_copy );
-		    path_copy = new_path;
-		}
-	    }
-	}
+        if( new_path ) {
+          free( path_copy );
+          path_copy = new_path;
+        }
+      }
+    }
 #endif
-	
-	/**
-	 * If we're being asked to open a directory, check if that directory
-	 * is the mountpoint for a DVD-ROM which we can use instead.
-	 */
+        
+    /**
+     * If we're being asked to open a directory, check if that directory
+     * is the mountpoint for a DVD-ROM which we can use instead.
+     */
 
-	if( strlen( path_copy ) > 1 ) {
+    if( strlen( path_copy ) > 1 ) {
       if( path_copy[ strlen( path_copy ) - 1 ] == '/' ) {
-		path_copy[ strlen( path_copy ) - 1 ] = '\0';
-	}
+        path_copy[ strlen( path_copy ) - 1 ] = '\0';
+      }
     }
 
     if( strlen( path_copy ) >= 9 ) {
-	    if( !strcasecmp( &(path_copy[ strlen( path_copy ) - 9 ]), 
-			     "/video_ts" ) ) {
-	      path_copy[ strlen( path_copy ) - 9 ] = '\0';
+      if( !strcasecmp( &(path_copy[ strlen( path_copy ) - 9 ]), 
+                       "/video_ts" ) ) {
+        path_copy[ strlen( path_copy ) - 9 ] = '\0';
         if(path_copy[0] == '\0') {
           path_copy[0] = '/';
           path_copy[1] = '\0';
         }
-	    }
-	}
+      }
+    }
 
 #if defined(SYS_BSD)
-	if( ( fe = getfsfile( path_copy ) ) ) {
-	    dev_name = bsd_block2char( fe->fs_spec );
+    if( ( fe = getfsfile( path_copy ) ) ) {
+      dev_name = bsd_block2char( fe->fs_spec );
       if(verbose >= 1) {
-	    fprintf( stderr,
-		     "libdvdread: Attempting to use device %s"
+        fprintf( stderr,
+                 "libdvdread: Attempting to use device %s"
                  " mounted on %s%s\n",
-		     dev_name,
+                 dev_name,
                  fe->fs_file,
                  have_css ? " for CSS authentication" : "");
       }
-	    auth_drive = DVDOpenImageFile( dev_name, have_css );
+      auth_drive = DVDOpenImageFile( dev_name, have_css );
       if(!auth_drive) {
         internal_errno = errno;
       }
-	}
+    }
 #elif defined(__sun)
-	mntfile = fopen( MNTTAB, "r" );
-	if( mntfile ) {
-	    struct mnttab mp;
-	    int res;
-
-	    while( ( res = getmntent( mntfile, &mp ) ) != -1 ) {
-		if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) {
-		    dev_name = sun_block2char( mp.mnt_special );
+    mntfile = fopen( MNTTAB, "r" );
+    if( mntfile ) {
+      struct mnttab mp;
+      int res;
+      
+      while( ( res = getmntent( mntfile, &mp ) ) != -1 ) {
+        if( res == 0 && !strcmp( mp.mnt_mountp, path_copy ) ) {
+          dev_name = sun_block2char( mp.mnt_special );
           if(verbose >= 1) {
-		    fprintf( stderr, 
-			     "libdvdread: Attempting to use device %s"
+            fprintf( stderr, 
+                     "libdvdread: Attempting to use device %s"
                      " mounted on %s%s\n",
-			     dev_name,
+                     dev_name,
                      mp.mnt_mountp,
                      have_css ? " for CSS authentication" : "");
           }
-		    auth_drive = DVDOpenImageFile( dev_name, have_css );
+          auth_drive = DVDOpenImageFile( dev_name, have_css );
           if(!auth_drive) {
             internal_errno = errno;
           }
-		    break;
-		}
-	    }
-	    fclose( mntfile );
-	}
+          break;
+        }
+      }
+      fclose( mntfile );
+    }
 #elif defined(__linux__) || defined(__CYGWIN__)
-        mntfile = fopen( MOUNTED, "r" );
-        if( mntfile ) {
-            struct mntent *me;
+    mntfile = fopen( MOUNTED, "r" );
+    if( mntfile ) {
+      struct mntent *me;
  
-            while( ( me = getmntent( mntfile ) ) ) {
-                if( !strcmp( me->mnt_dir, path_copy ) ) {
+      while( ( me = getmntent( mntfile ) ) ) {
+        if( !strcmp( me->mnt_dir, path_copy ) ) {
           if(verbose >= 1) {
-		    fprintf( stderr, 
-			     "libdvdread: Attempting to use device %s"
+            fprintf( stderr, 
+                     "libdvdread: Attempting to use device %s"
                      " mounted on %s%s\n",
-			     me->mnt_fsname,
+                     me->mnt_fsname,
                      me->mnt_dir,
                      have_css ? " for CSS authentication" : "");
           }
-                    auth_drive = DVDOpenImageFile( me->mnt_fsname, have_css );
+          auth_drive = DVDOpenImageFile( me->mnt_fsname, have_css );
           if(!auth_drive) {
             internal_errno = errno;
           }
-		    dev_name = strdup(me->mnt_fsname);
-                    break;
-                }
-            }
-            fclose( mntfile );
-	}
-#elif defined(__MINGW32__)	
-	dev_name = strdup(path);
-	auth_drive = DVDOpenImageFile( path, have_css );
+          dev_name = strdup(me->mnt_fsname);
+          break;
+        }
+      }
+      fclose( mntfile );
+    }
+#elif defined(__MINGW32__)
+    dev_name = strdup(path);
+    auth_drive = DVDOpenImageFile( path, have_css );
 #endif
-	if( !dev_name ) {
+    if( !dev_name ) {
       if(verbose >= 1) {
-	  fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
+        fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
       }
-	} else if( !auth_drive ) {
+    } else if( !auth_drive ) {
       if(verbose >= 1) {
         fprintf( stderr, "libdvdread: Device %s inaccessible%s: %s\n",
                  dev_name,
                  have_css ? ", CSS authentication not available" : "",
                  strerror(internal_errno));
       }
-	}
+    }
 
-	free( dev_name );
-	free( path_copy );
+    free( dev_name );
+    free( path_copy );
 
-        /**
-         * If we've opened a drive, just use that.
-         */
+    /**
+     * If we've opened a drive, just use that.
+     */
     if( auth_drive ) {
       return auth_drive;
     }
-        /**
-         * Otherwise, we now try to open the directory tree instead.
-         */
-        return DVDOpenPath( path );
-    }
+    /**
+     * Otherwise, we now try to open the directory tree instead.
+     */
+    return DVDOpenPath( path );
+  }
 
-    /* If it's none of the above, screw it. */
+  /* If it's none of the above, screw it. */
   if(verbose >= 1) {
     fprintf( stderr, "libdvdread: Could not open %s\n", path );
   }
-    return 0;
+  return 0;
 }
 
 void DVDClose( dvd_reader_t *dvd )
 {
-    if( dvd ) {
-        if( dvd->dev ) dvdinput_close( dvd->dev );
-        if( dvd->path_root ) free( dvd->path_root );
+  if( dvd ) {
+    if( dvd->dev ) dvdinput_close( dvd->dev );
+    if( dvd->path_root ) free( dvd->path_root );
     if( dvd->udfcache ) FreeUDFCache( dvd, dvd->udfcache );
     if(dvd->align) {
       if(dvd->verbose >= 0) {
@@ -681,8 +683,8 @@
       }
     }
     dvdinput_free();
-        free( dvd );
-    }
+    free( dvd );
+  }
 }
 
 void DVDInit(void)
@@ -700,22 +702,22 @@
  */
 static dvd_file_t *DVDOpenFileUDF( dvd_reader_t *dvd, char *filename )
 {
-    uint32_t start, len;
-    dvd_file_t *dvd_file;
+  uint32_t start, len;
+  dvd_file_t *dvd_file;
 
-    start = UDFFindFile( dvd, filename, &len );
-    if( !start ) return 0;
+  start = UDFFindFile( dvd, filename, &len );
+  if( !start ) return 0;
 
-    dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
-    if( !dvd_file ) return 0;
-    dvd_file->dvd = dvd;
-    dvd_file->lb_start = start;
-    dvd_file->seek_pos = 0;
-    memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
-    memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
-    dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
+  dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+  if( !dvd_file ) return 0;
+  dvd_file->dvd = dvd;
+  dvd_file->lb_start = start;
+  dvd_file->seek_pos = 0;
+  memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+  memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+  dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
 
-    return dvd_file;
+  return dvd_file;
 }
 
 /**
@@ -726,54 +728,54 @@
  */
 static int findDirFile( const char *path, const char *file, char *filename ) 
 {
-    DIR *dir;
-    struct dirent *ent;
+  DIR *dir;
+  struct dirent *ent;
 
-    dir = opendir( path );
-    if( !dir ) return -2;
+  dir = opendir( path );
+  if( !dir ) return -2;
 
-    while( ( ent = readdir( dir ) ) != NULL ) {
-        if( !strcasecmp( ent->d_name, file ) ) {
-            sprintf( filename, "%s%s%s", path,
-                     ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
-                     ent->d_name );
+  while( ( ent = readdir( dir ) ) != NULL ) {
+    if( !strcasecmp( ent->d_name, file ) ) {
+      sprintf( filename, "%s%s%s", path,
+               ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
+               ent->d_name );
       closedir(dir);
-            return 0;
-        }
+      return 0;
     }
+  }
   closedir(dir);
-    return -1;
+  return -1;
 }
 
 static int findDVDFile( dvd_reader_t *dvd, const char *file, char *filename )
 {
-    char video_path[ PATH_MAX + 1 ];
-    const char *nodirfile;
-    int ret;
+  char video_path[ PATH_MAX + 1 ];
+  const char *nodirfile;
+  int ret;
 
-    /* Strip off the directory for our search */
-    if( !strncasecmp( "/VIDEO_TS/", file, 10 ) ) {
-        nodirfile = &(file[ 10 ]);
-    } else {
-        nodirfile = file;
-    }
+  /* Strip off the directory for our search */
+  if( !strncasecmp( "/VIDEO_TS/", file, 10 ) ) {
+    nodirfile = &(file[ 10 ]);
+  } else {
+    nodirfile = file;
+  }
 
-    ret = findDirFile( dvd->path_root, nodirfile, filename );
+  ret = findDirFile( dvd->path_root, nodirfile, filename );
+  if( ret < 0 ) {
+    /* Try also with adding the path, just in case. */
+    sprintf( video_path, "%s/VIDEO_TS/", dvd->path_root );
+    ret = findDirFile( video_path, nodirfile, filename );
     if( ret < 0 ) {
-        /* Try also with adding the path, just in case. */
-        sprintf( video_path, "%s/VIDEO_TS/", dvd->path_root );
-        ret = findDirFile( video_path, nodirfile, filename );
-        if( ret < 0 ) {
-            /* Try with the path, but in lower case. */
-            sprintf( video_path, "%s/video_ts/", dvd->path_root );
-            ret = findDirFile( video_path, nodirfile, filename );
-            if( ret < 0 ) {
-                return 0;
-            }
-        }
+      /* Try with the path, but in lower case. */
+      sprintf( video_path, "%s/video_ts/", dvd->path_root );
+      ret = findDirFile( video_path, nodirfile, filename );
+      if( ret < 0 ) {
+        return 0;
+      }
     }
+  }
 
-    return 1;
+  return 1;
 }
 
 /**
@@ -781,241 +783,241 @@
  */
 static dvd_file_t *DVDOpenFilePath( dvd_reader_t *dvd, char *filename )
 {
-    char full_path[ PATH_MAX + 1 ];
-    dvd_file_t *dvd_file;
-    struct stat fileinfo;
-    dvd_input_t dev;
+  char full_path[ PATH_MAX + 1 ];
+  dvd_file_t *dvd_file;
+  struct stat fileinfo;
+  dvd_input_t dev;
 
-    /* Get the full path of the file. */
-    if( !findDVDFile( dvd, filename, full_path ) ) return 0;
+  /* Get the full path of the file. */
+  if( !findDVDFile( dvd, filename, full_path ) ) return 0;
 
-    dev = dvdinput_open( full_path );
-    if( !dev ) return 0;
+  dev = dvdinput_open( full_path );
+  if( !dev ) return 0;
 
-    dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
-    if( !dvd_file ) return 0;
-    dvd_file->dvd = dvd;
-    dvd_file->lb_start = 0;
-    dvd_file->seek_pos = 0;
-    memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
-    memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
-    dvd_file->filesize = 0;
+  dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+  if( !dvd_file ) return 0;
+  dvd_file->dvd = dvd;
+  dvd_file->lb_start = 0;
+  dvd_file->seek_pos = 0;
+  memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+  memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+  dvd_file->filesize = 0;
 
-    if( stat( full_path, &fileinfo ) < 0 ) {
+  if( stat( full_path, &fileinfo ) < 0 ) {
     if(dvd->verbose >= 1) {
-        fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
-    }
-        free( dvd_file );
-        return 0;
+      fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
     }
-    dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
-    dvd_file->title_devs[ 0 ] = dev;
-    dvd_file->filesize = dvd_file->title_sizes[ 0 ];
+    free( dvd_file );
+    return 0;
+  }
+  dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
+  dvd_file->title_devs[ 0 ] = dev;
+  dvd_file->filesize = dvd_file->title_sizes[ 0 ];
 
-    return dvd_file;
+  return dvd_file;
 }
 
 static dvd_file_t *DVDOpenVOBUDF( dvd_reader_t *dvd, int title, int menu )
 {
-    char filename[ MAX_UDF_FILE_NAME_LEN ];
-    uint32_t start, len;
-    dvd_file_t *dvd_file;
+  char filename[ MAX_UDF_FILE_NAME_LEN ];
+  uint32_t start, len;
+  dvd_file_t *dvd_file;
 
-    if( title == 0 ) {
-        sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
-    } else {
-        sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
-    }
-    start = UDFFindFile( dvd, filename, &len );
-    if( start == 0 ) return 0;
+  if( title == 0 ) {
+    sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
+  } else {
+    sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
+  }
+  start = UDFFindFile( dvd, filename, &len );
+  if( start == 0 ) return 0;
 
-    dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
-    if( !dvd_file ) return 0;
-    dvd_file->dvd = dvd;
-    /*Hack*/ dvd_file->css_title = title << 1 | menu;
-    dvd_file->lb_start = start;
-    dvd_file->seek_pos = 0;
-    memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
-    memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
-    dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
+  dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+  if( !dvd_file ) return 0;
+  dvd_file->dvd = dvd;
+  /*Hack*/ dvd_file->css_title = title << 1 | menu;
+  dvd_file->lb_start = start;
+  dvd_file->seek_pos = 0;
+  memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+  memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+  dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
 
-    /* Calculate the complete file size for every file in the VOBS */
-    if( !menu ) {
-        int cur;
+  /* Calculate the complete file size for every file in the VOBS */
+  if( !menu ) {
+    int cur;
 
-        for( cur = 2; cur < 10; cur++ ) {
-            sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, cur );
-            if( !UDFFindFile( dvd, filename, &len ) ) break;
-            dvd_file->filesize += len / DVD_VIDEO_LB_LEN;
-        }
+    for( cur = 2; cur < 10; cur++ ) {
+      sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, cur );
+      if( !UDFFindFile( dvd, filename, &len ) ) break;
+      dvd_file->filesize += len / DVD_VIDEO_LB_LEN;
     }
+  }
     
-    if( dvd->css_state == 1 /* Need key init */ ) {
-//        initAllCSSKeys( dvd );
-//	dvd->css_state = 2;
-    }
-    /*    
-    if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
+  if( dvd->css_state == 1 /* Need key init */ ) {
+//    initAllCSSKeys( dvd );
+//    dvd->css_state = 2;
+  }
+  /*    
+        if( dvdinput_title( dvd_file->dvd->dev, (int)start ) < 0 ) {
         fprintf( stderr, "libdvdread: Error cracking CSS key for %s\n",
-		 filename );
-    }
-    */
+        filename );
+        }
+  */
     
-    return dvd_file;
+  return dvd_file;
 }
 
 static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *dvd, int title, int menu )
 {
-    char filename[ MAX_UDF_FILE_NAME_LEN ];
-    char full_path[ PATH_MAX + 1 ];
-    struct stat fileinfo;
-    dvd_file_t *dvd_file;
-    int i;
-
-    dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
-    if( !dvd_file ) return 0;
-    dvd_file->dvd = dvd;
-    /*Hack*/ dvd_file->css_title = title << 1 | menu;
-    dvd_file->lb_start = 0;
-    dvd_file->seek_pos = 0;
-    memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
-    memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
-    dvd_file->filesize = 0;
-    
-    if( menu ) {
-        dvd_input_t dev;
-
-        if( title == 0 ) {
-            sprintf( filename, "VIDEO_TS.VOB" );
-        } else {
-            sprintf( filename, "VTS_%02i_0.VOB", title );
-        }
-        if( !findDVDFile( dvd, filename, full_path ) ) {
-            free( dvd_file );
-            return 0;
-        }
-
-        dev = dvdinput_open( full_path );
-        if( dev == NULL ) {
-            free( dvd_file );
-            return 0;
-        }
+  char filename[ MAX_UDF_FILE_NAME_LEN ];
+  char full_path[ PATH_MAX + 1 ];
+  struct stat fileinfo;
+  dvd_file_t *dvd_file;
+  int i;
 
-        if( stat( full_path, &fileinfo ) < 0 ) {
-      if(dvd->verbose >= 1) {
-            fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
-      }
-            free( dvd_file );
-            return 0;
-        }
-        dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
-        dvd_file->title_devs[ 0 ] = dev;
-	dvdinput_title( dvd_file->title_devs[0], 0);
-        dvd_file->filesize = dvd_file->title_sizes[ 0 ];
-
-    } else {
-        for( i = 0; i < 9; ++i ) {
+  dvd_file = (dvd_file_t *) malloc( sizeof( dvd_file_t ) );
+  if( !dvd_file ) return 0;
+  dvd_file->dvd = dvd;
+  /*Hack*/ dvd_file->css_title = title << 1 | menu;
+  dvd_file->lb_start = 0;
+  dvd_file->seek_pos = 0;
+  memset( dvd_file->title_sizes, 0, sizeof( dvd_file->title_sizes ) );
+  memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
+  dvd_file->filesize = 0;
+    
+  if( menu ) {
+    dvd_input_t dev;
 
-            sprintf( filename, "VTS_%02i_%i.VOB", title, i + 1 );
-            if( !findDVDFile( dvd, filename, full_path ) ) {
-                break;
-            }
+    if( title == 0 ) {
+      sprintf( filename, "VIDEO_TS.VOB" );
+    } else {
+      sprintf( filename, "VTS_%02i_0.VOB", title );
+    }
+    if( !findDVDFile( dvd, filename, full_path ) ) {
+      free( dvd_file );
+      return 0;
+    }
 
-            if( stat( full_path, &fileinfo ) < 0 ) {
-        if(dvd->verbose >= 1) {
-                fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
-        }
-                break;
-            }
-
-            dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
-            dvd_file->title_devs[ i ] = dvdinput_open( full_path );
-	    dvdinput_title( dvd_file->title_devs[ i ], 0 );
-            dvd_file->filesize += dvd_file->title_sizes[ i ];
-        }
-        if( !dvd_file->title_devs[ 0 ] ) {
-            free( dvd_file );
-            return 0;
-        }
+    dev = dvdinput_open( full_path );
+    if( dev == NULL ) {
+      free( dvd_file );
+      return 0;
     }
 
-    return dvd_file;
+    if( stat( full_path, &fileinfo ) < 0 ) {
+      if(dvd->verbose >= 1) {
+        fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+      }
+      free( dvd_file );
+      return 0;
+    }
+    dvd_file->title_sizes[ 0 ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
+    dvd_file->title_devs[ 0 ] = dev;
+    dvdinput_title( dvd_file->title_devs[0], 0);
+    dvd_file->filesize = dvd_file->title_sizes[ 0 ];
+
+  } else {
+    for( i = 0; i < 9; ++i ) {
+
+      sprintf( filename, "VTS_%02i_%i.VOB", title, i + 1 );
+      if( !findDVDFile( dvd, filename, full_path ) ) {
+        break;
+      }
+
+      if( stat( full_path, &fileinfo ) < 0 ) {
+        if(dvd->verbose >= 1) {
+          fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+        }
+        break;
+      }
+
+      dvd_file->title_sizes[ i ] = fileinfo.st_size / DVD_VIDEO_LB_LEN;
+      dvd_file->title_devs[ i ] = dvdinput_open( full_path );
+      dvdinput_title( dvd_file->title_devs[ i ], 0 );
+      dvd_file->filesize += dvd_file->title_sizes[ i ];
+    }
+    if( !dvd_file->title_devs[ 0 ] ) {
+      free( dvd_file );
+      return 0;
+    }
+  }
+
+  return dvd_file;
 }
 
 dvd_file_t *DVDOpenFile( dvd_reader_t *dvd, int titlenum, 
-			 dvd_read_domain_t domain )
+                         dvd_read_domain_t domain )
 {
-    char filename[ MAX_UDF_FILE_NAME_LEN ];
+  char filename[ MAX_UDF_FILE_NAME_LEN ];
     
-    /* Check arguments. */
+  /* Check arguments. */
   if( dvd == NULL || titlenum < 0 ) {
     errno = EINVAL;
-      return NULL;
+    return NULL;
   }
 
-    switch( domain ) {
-    case DVD_READ_INFO_FILE:
-        if( titlenum == 0 ) {
-            sprintf( filename, "/VIDEO_TS/VIDEO_TS.IFO" );
-        } else {
-            sprintf( filename, "/VIDEO_TS/VTS_%02i_0.IFO", titlenum );
-        }
-        break;
-    case DVD_READ_INFO_BACKUP_FILE:
-        if( titlenum == 0 ) {
-            sprintf( filename, "/VIDEO_TS/VIDEO_TS.BUP" );
-        } else {
-            sprintf( filename, "/VIDEO_TS/VTS_%02i_0.BUP", titlenum );
-        }
-        break;
-    case DVD_READ_MENU_VOBS:
-        if( dvd->isImageFile ) {
-            return DVDOpenVOBUDF( dvd, titlenum, 1 );
-        } else {
-            return DVDOpenVOBPath( dvd, titlenum, 1 );
-        }
-        break;
-    case DVD_READ_TITLE_VOBS:
-        if( titlenum == 0 ) return 0;
-        if( dvd->isImageFile ) {
-            return DVDOpenVOBUDF( dvd, titlenum, 0 );
-        } else {
-            return DVDOpenVOBPath( dvd, titlenum, 0 );
-        }
-        break;
-    default:
+  switch( domain ) {
+  case DVD_READ_INFO_FILE:
+    if( titlenum == 0 ) {
+      sprintf( filename, "/VIDEO_TS/VIDEO_TS.IFO" );
+    } else {
+      sprintf( filename, "/VIDEO_TS/VTS_%02i_0.IFO", titlenum );
+    }
+    break;
+  case DVD_READ_INFO_BACKUP_FILE:
+    if( titlenum == 0 ) {
+      sprintf( filename, "/VIDEO_TS/VIDEO_TS.BUP" );
+    } else {
+      sprintf( filename, "/VIDEO_TS/VTS_%02i_0.BUP", titlenum );
+    }
+    break;
+  case DVD_READ_MENU_VOBS:
+    if( dvd->isImageFile ) {
+      return DVDOpenVOBUDF( dvd, titlenum, 1 );
+    } else {
+      return DVDOpenVOBPath( dvd, titlenum, 1 );
+    }
+    break;
+  case DVD_READ_TITLE_VOBS:
+    if( titlenum == 0 ) return 0;
+    if( dvd->isImageFile ) {
+      return DVDOpenVOBUDF( dvd, titlenum, 0 );
+    } else {
+      return DVDOpenVOBPath( dvd, titlenum, 0 );
+    }
+    break;
+  default:
     if(dvd->verbose >= 1) {
-        fprintf( stderr, "libdvdread: Invalid domain for file open.\n" );
+      fprintf( stderr, "libdvdread: Invalid domain for file open.\n" );
     }
     errno = EINVAL;
-        return NULL;
-    }
+    return NULL;
+  }
     
-    if( dvd->isImageFile ) {
-        return DVDOpenFileUDF( dvd, filename );
-    } else {
-        return DVDOpenFilePath( dvd, filename );
-    }
+  if( dvd->isImageFile ) {
+    return DVDOpenFileUDF( dvd, filename );
+  } else {
+    return DVDOpenFilePath( dvd, filename );
+  }
 }
 
 void DVDCloseFile( dvd_file_t *dvd_file )
 {
-    int i;
+  int i;
 
-    if( dvd_file ) {
-        if( dvd_file->dvd->isImageFile ) {
-	    ;
-	} else {
-            for( i = 0; i < 9; ++i ) {
-                if( dvd_file->title_devs[ i ] ) {
-                    dvdinput_close( dvd_file->title_devs[i] );
-                }
-            }
+  if( dvd_file ) {
+    if( dvd_file->dvd->isImageFile ) {
+      ;
+    } else {
+      for( i = 0; i < 9; ++i ) {
+        if( dvd_file->title_devs[ i ] ) {
+          dvdinput_close( dvd_file->title_devs[i] );
         }
+      }
+    }
 
-        free( dvd_file );
-        dvd_file = 0;
-    }
+    free( dvd_file );
+    dvd_file = 0;
+  }
 }
 
 /**
@@ -1033,30 +1035,30 @@
  * @param return Returns number of blocks read on success, negative on error
  */
 int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
-			 size_t block_count, unsigned char *data, 
-			 int encrypted )
+                      size_t block_count, unsigned char *data, 
+                      int encrypted )
 {
-   int ret;
+  int ret;
 
-   if( !device->dev ) {
+  if( !device->dev ) {
     if(device->verbose >= 1) {
-     	fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
+      fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
     }
-	return 0;
-   }
+    return 0;
+  }
 
-   ret = dvdinput_seek( device->dev, (int) lb_number );
-   if( ret != (int) lb_number ) {
+  ret = dvdinput_seek( device->dev, (int) lb_number );
+  if( ret != (int) lb_number ) {
     if(device->verbose >= 1) {
       fprintf( stderr,
                "libdvdread: UDFReadBlocksRaw: Can't seek to block %u\n",
                lb_number );
     }
-	return 0;
-   }
+    return 0;
+  }
 
-   return dvdinput_read( device->dev, (char *) data, 
-			 (int) block_count, encrypted );
+  return dvdinput_read( device->dev, (char *) data, 
+                        (int) block_count, encrypted );
 }
 
 /**
@@ -1074,11 +1076,11 @@
  * @return Returns the number of blocks read on success or a negative error.
  */
 static int DVDReadBlocksUDF( dvd_file_t *dvd_file, uint32_t offset,
-			     size_t block_count, unsigned char *data,
-			     int encrypted )
+                             size_t block_count, unsigned char *data,
+                             int encrypted )
 {
-    return UDFReadBlocksRaw( dvd_file->dvd, dvd_file->lb_start + offset,
-			     block_count, data, encrypted );
+  return UDFReadBlocksRaw( dvd_file->dvd, dvd_file->lb_start + offset,
+                           block_count, data, encrypted );
 }
 
 /**
@@ -1095,123 +1097,123 @@
  * @return Returns number of blocks read on success, negative on error.
  */
 static int DVDReadBlocksPath( dvd_file_t *dvd_file, unsigned int offset,
-			      size_t block_count, unsigned char *data,
-			      int encrypted )
+                              size_t block_count, unsigned char *data,
+                              int encrypted )
 {
-    int i;
-    int ret, ret2, off;
+  int i;
+  int ret, ret2, off;
 
-    ret = 0;
-    ret2 = 0;
-    for( i = 0; i < 9; ++i ) {
-      if( !dvd_file->title_sizes[ i ] ) return 0; /* Past end of file */
+  ret = 0;
+  ret2 = 0;
+  for( i = 0; i < 9; ++i ) {
+    if( !dvd_file->title_sizes[ i ] ) return 0; /* Past end of file */
 
-        if( offset < dvd_file->title_sizes[ i ] ) {
-            if( ( offset + block_count ) <= dvd_file->title_sizes[ i ] ) {
-		off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
-                if( off < 0 || off != (int)offset ) {
+    if( offset < dvd_file->title_sizes[ i ] ) {
+      if( ( offset + block_count ) <= dvd_file->title_sizes[ i ] ) {
+        off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
+        if( off < 0 || off != (int)offset ) {
           if(dvd_file->dvd->verbose >= 1) {
             fprintf( stderr, "libdvdread: DVDReadBlocksPath1: Can't seek to block %d\n", 
-			     offset );
+                     offset );
           }
-		    return off < 0 ? off : 0;
-		}
-                ret = dvdinput_read( dvd_file->title_devs[ i ], data,
-				     (int)block_count, encrypted );
-                break;
-            } else {
-                size_t part1_size = dvd_file->title_sizes[ i ] - offset;
-		/* FIXME: Really needs to be a while loop.
-                 * (This is only true if you try and read >1GB at a time) */
-		
-                /* Read part 1 */
-                off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
-                if( off < 0 || off != (int)offset ) {
+          return off < 0 ? off : 0;
+        }
+        ret = dvdinput_read( dvd_file->title_devs[ i ], data,
+                             (int)block_count, encrypted );
+        break;
+      } else {
+        size_t part1_size = dvd_file->title_sizes[ i ] - offset;
+        /* FIXME: Really needs to be a while loop.
+         * (This is only true if you try and read >1GB at a time) */
+                
+        /* Read part 1 */
+        off = dvdinput_seek( dvd_file->title_devs[ i ], (int)offset );
+        if( off < 0 || off != (int)offset ) {
           if(dvd_file->dvd->verbose >= 1) {
             fprintf( stderr, "libdvdread: DVDReadBlocksPath2: Can't seek to block %d\n", 
-			     offset );
+                     offset );
           }
-		    return off < 0 ? off : 0;
-		}
-                ret = dvdinput_read( dvd_file->title_devs[ i ], data,
-				     (int)part1_size, encrypted );
-		if( ret < 0 ) return ret;
-		/* FIXME: This is wrong if i is the last file in the set. 
-                 * also error from this read will not show in ret. */
-		
-		/* Does the next part exist? If not then return now. */
-		if( !dvd_file->title_devs[ i + 1 ] ) return ret;
+          return off < 0 ? off : 0;
+        }
+        ret = dvdinput_read( dvd_file->title_devs[ i ], data,
+                             (int)part1_size, encrypted );
+        if( ret < 0 ) return ret;
+        /* FIXME: This is wrong if i is the last file in the set. 
+         * also error from this read will not show in ret. */
+                
+        /* Does the next part exist? If not then return now. */
+        if( !dvd_file->title_devs[ i + 1 ] ) return ret;
 
-                /* Read part 2 */
-                off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );
-                if( off < 0 || off != 0 ) {
+        /* Read part 2 */
+        off = dvdinput_seek( dvd_file->title_devs[ i + 1 ], 0 );
+        if( off < 0 || off != 0 ) {
           if(dvd_file->dvd->verbose >= 1) {
             fprintf( stderr, "libdvdread: DVDReadBlocksPath3: Can't seek to block %d\n", 0 );
           }
-		    return off < 0 ? off : 0;
-		}
-                ret2 = dvdinput_read( dvd_file->title_devs[ i + 1 ], 
-				      data + ( part1_size
-					       * (int64_t)DVD_VIDEO_LB_LEN ),
-				      (int)(block_count - part1_size),
-				      encrypted );
-                if( ret2 < 0 ) return ret2;
-		break;
-            }
-        } else {
-            offset -= dvd_file->title_sizes[ i ];
+          return off < 0 ? off : 0;
         }
+        ret2 = dvdinput_read( dvd_file->title_devs[ i + 1 ], 
+                              data + ( part1_size
+                                       * (int64_t)DVD_VIDEO_LB_LEN ),
+                              (int)(block_count - part1_size),
+                              encrypted );
+        if( ret2 < 0 ) return ret2;
+        break;
+      }
+    } else {
+      offset -= dvd_file->title_sizes[ i ];
     }
+  }
 
-    return ret + ret2;
+  return ret + ret2;
 }
 
 /**
  * This is broken reading more than 2Gb at a time if ssize_t is 32-bit.
  */
 ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset, 
-		       size_t block_count, unsigned char *data )
+                       size_t block_count, unsigned char *data )
 {
-    int ret;
+  int ret;
     
-    /* Check arguments. */
-    if( dvd_file == NULL || offset < 0 || data == NULL )
-      return -1;
+  /* Check arguments. */
+  if( dvd_file == NULL || offset < 0 || data == NULL )
+    return -1;
     
-    /* Hack, and it will still fail for multiple opens in a threaded app ! */
-    if( dvd_file->dvd->css_title != dvd_file->css_title ) {
-      dvd_file->dvd->css_title = dvd_file->css_title;
-      if( dvd_file->dvd->isImageFile ) {
-	dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start );
-      } 
-      /* Here each vobu has it's own dvdcss handle, so no need to update 
-      else {
-	dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start );
-      }*/
-    }
+  /* Hack, and it will still fail for multiple opens in a threaded app ! */
+  if( dvd_file->dvd->css_title != dvd_file->css_title ) {
+    dvd_file->dvd->css_title = dvd_file->css_title;
+    if( dvd_file->dvd->isImageFile ) {
+      dvdinput_title( dvd_file->dvd->dev, (int)dvd_file->lb_start );
+    } 
+    /* Here each vobu has it's own dvdcss handle, so no need to update 
+       else {
+       dvdinput_title( dvd_file->title_devs[ 0 ], (int)dvd_file->lb_start );
+       }*/
+  }
     
-    if( dvd_file->dvd->isImageFile ) {
-	ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset, 
-				block_count, data, DVDINPUT_READ_DECRYPT );
-    } else {
-	ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset, 
-				 block_count, data, DVDINPUT_READ_DECRYPT );
-    }
+  if( dvd_file->dvd->isImageFile ) {
+    ret = DVDReadBlocksUDF( dvd_file, (uint32_t)offset, 
+                            block_count, data, DVDINPUT_READ_DECRYPT );
+  } else {
+    ret = DVDReadBlocksPath( dvd_file, (unsigned int)offset, 
+                             block_count, data, DVDINPUT_READ_DECRYPT );
+  }
     
-    return (ssize_t)ret;
+  return (ssize_t)ret;
 }
 
 int DVDFileSeek( dvd_file_t *dvd_file, int offset )
 {
-    /* Check arguments. */
-    if( dvd_file == NULL || offset < 0 )
-       return -1;
+  /* Check arguments. */
+  if( dvd_file == NULL || offset < 0 )
+    return -1;
     
-    if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {
-       return -1;
-    }
-    dvd_file->seek_pos = (uint32_t) offset;
-    return offset;
+  if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {
+    return -1;
+  }
+  dvd_file->seek_pos = (uint32_t) offset;
+  return offset;
 }
 
 #ifndef HAVE_UINTPTR_T
@@ -1226,122 +1228,122 @@
 {
   unsigned char *secbuf_start;
   unsigned char *secbuf; //must be aligned to 2048-bytes for raw/O_DIRECT
-    unsigned int numsec, seek_sector, seek_byte;
-    int ret;
+  unsigned int numsec, seek_sector, seek_byte;
+  int ret;
     
-    /* Check arguments. */
+  /* Check arguments. */
   if( dvd_file == NULL || data == NULL ) {
     errno = EINVAL;
-      return -1;
+    return -1;
   }
-    seek_sector = dvd_file->seek_pos / DVD_VIDEO_LB_LEN;
-    seek_byte   = dvd_file->seek_pos % DVD_VIDEO_LB_LEN;
+  seek_sector = dvd_file->seek_pos / DVD_VIDEO_LB_LEN;
+  seek_byte   = dvd_file->seek_pos % DVD_VIDEO_LB_LEN;
 
-    numsec = ( ( seek_byte + byte_size ) / DVD_VIDEO_LB_LEN ) +
-      ( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
-    
+  numsec = ( ( seek_byte + byte_size ) / DVD_VIDEO_LB_LEN ) +
+    ( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
+
   /* must align to 2048 bytes if we are reading from raw/O_DIRECT */
   secbuf_start = (unsigned char *) malloc( (numsec+1) * DVD_VIDEO_LB_LEN );
   if( !secbuf_start ) {
     /* errno will be set to ENOMEM by malloc */
     return -1;
-    }
-    
+  }
+
   secbuf = DVD_ALIGN(secbuf_start);
 
-    if( dvd_file->dvd->isImageFile ) {
-	ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector, 
-				(size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
-    } else {
-	ret = DVDReadBlocksPath( dvd_file, seek_sector, 
-				 (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
-    }
+  if( dvd_file->dvd->isImageFile ) {
+    ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector, 
+                            (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
+  } else {
+    ret = DVDReadBlocksPath( dvd_file, seek_sector, 
+                             (size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
+  }
 
-    if( ret != (int) numsec ) {
+  if( ret != (int) numsec ) {
     free( secbuf_start );
-        return ret < 0 ? ret : 0;
-    }
+    return ret < 0 ? ret : 0;
+  }
 
-    memcpy( data, &(secbuf[ seek_byte ]), byte_size );
+  memcpy( data, &(secbuf[ seek_byte ]), byte_size );
   free( secbuf_start );
 
-    dvd_file->seek_pos += byte_size;
-    return byte_size;
+  dvd_file->seek_pos += byte_size;
+  return byte_size;
 }
 
 ssize_t DVDFileSize( dvd_file_t *dvd_file )
 {
-    /* Check arguments. */
-    if( dvd_file == NULL )
-      return -1;
+  /* Check arguments. */
+  if( dvd_file == NULL )
+    return -1;
     
-    return dvd_file->filesize;
+  return dvd_file->filesize;
 }
 
 int DVDDiscID( dvd_reader_t *dvd, unsigned char *discid )
 {
-    struct md5_ctx ctx;
-    int title;
+  struct md5_ctx ctx;
+  int title;
   int nr_of_files = 0;
   int tmp_errno;
   int nofiles_errno = ENOENT;
-    /* Check arguments. */
+  /* Check arguments. */
   if( dvd == NULL || discid == NULL ) {
     errno = EINVAL;
     return -1;
   }
-    /* Go through the first 10 IFO:s, in order, 
-     * and md5sum them, i.e  VIDEO_TS.IFO and VTS_0?_0.IFO */
-    md5_init_ctx( &ctx );
-    for( title = 0; title < 10; title++ ) {
-	dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE );
-	if( dvd_file != NULL ) {
-	    ssize_t bytes_read;
-	    size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
-	    char *buffer = malloc( file_size );
-	    
+  /* Go through the first 10 IFO:s, in order, 
+   * and md5sum them, i.e  VIDEO_TS.IFO and VTS_0?_0.IFO */
+  md5_init_ctx( &ctx );
+  for( title = 0; title < 10; title++ ) {
+    dvd_file_t *dvd_file = DVDOpenFile( dvd, title, DVD_READ_INFO_FILE );
+    if( dvd_file != NULL ) {
+      ssize_t bytes_read;
+      size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
+      char *buffer = malloc( file_size );
+
       nr_of_files++;
 
-	    if( buffer == NULL ) {
+      if( buffer == NULL ) {
         /* errno will be set to ENOMEM by malloc */
-		return -1;
-	    }
+        return -1;
+      }
 
-	    bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
-	    if( bytes_read != file_size ) {
+      bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
+      if( bytes_read != file_size ) {
         tmp_errno = errno;
         if(dvd->verbose >= 1) {
-		fprintf( stderr, "libdvdread: DVDDiscId read returned %d bytes"
+          fprintf( stderr, "libdvdread: DVDDiscId read returned %d bytes"
                    ", wanted %d\n", (int)bytes_read, (int)file_size );
         }
         free(buffer);
-		DVDCloseFile( dvd_file );
+        DVDCloseFile( dvd_file );
         errno = tmp_errno;
-		return -1;
-	    }
-	    
-	    md5_process_bytes( buffer, file_size,  &ctx );
-	    
-	    DVDCloseFile( dvd_file );
-	    free( buffer );
+        return -1;
+      }
+            
+      md5_process_bytes( buffer, file_size,  &ctx );
+            
+      DVDCloseFile( dvd_file );
+      free( buffer );
     } else {
       if(errno != ENOENT) {
         nofiles_errno = errno;
       }
-	}
     }
-    md5_finish_ctx( &ctx, discid );
+  }
+  md5_finish_ctx( &ctx, discid );
   if(nr_of_files == 0) {
     errno = nofiles_errno;
     return -1;
   }
-    return 0;
+  return 0;
 }
 
 
 int DVDISOVolumeInfo( dvd_reader_t *dvd,
-		      char *volid, unsigned int volid_size,
-		      unsigned char *volsetid, unsigned int volsetid_size )
+                      char *volid, unsigned int volid_size,
+                      unsigned char *volsetid, unsigned int volsetid_size )
 {
   unsigned char *buffer; /* must be aligned to 2048 for raw/O_DIRECT */
   unsigned char *buffer_start; 
@@ -1369,8 +1371,8 @@
   ret = UDFReadBlocksRaw( dvd, 16, 1, buffer, 0 );
   if( ret != 1 ) {
     if(dvd->verbose >= 1) {
-    fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
-	     "read ISO9660 Primary Volume Descriptor!\n" );
+      fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
+               "read ISO9660 Primary Volume Descriptor!\n" );
     }
     free(buffer_start);
     return -1;
@@ -1380,7 +1382,7 @@
     unsigned int n;
     for(n = 0; n < 32; n++) {
       if(buffer[40+n] == 0x20) {
-	break;
+        break;
       }
     }
     
@@ -1405,8 +1407,8 @@
 
 
 int DVDUDFVolumeInfo( dvd_reader_t *dvd,
-		      char *volid, unsigned int volid_size,
-		      unsigned char *volsetid, unsigned int volsetid_size )
+                      char *volid, unsigned int volid_size,
+                      unsigned char *volsetid, unsigned int volsetid_size )
 {
   int ret;
   /* Check arguments. */
--- a/dvdread/dvd_reader.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/dvd_reader.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef DVD_READER_H_INCLUDED
 #define DVD_READER_H_INCLUDED
 
@@ -140,8 +141,8 @@
   DVD_READ_INFO_BACKUP_FILE, /**< VIDEO_TS.BUP  or VTS_XX_0.BUP (title) */
   DVD_READ_MENU_VOBS,        /**< VIDEO_TS.VOB  or VTS_XX_0.VOB (title) */
   DVD_READ_TITLE_VOBS        /**< VTS_XX_[1-9].VOB (title).  All files in 
-				  the title set are opened and read as a
-				  single file. */
+                                the title set are opened and read as a
+                                single file. */
 } dvd_read_domain_t;
 
 /**
@@ -214,7 +215,7 @@
  * bytes_read = DVDReadBytes(dvd_file, data, bytes);
  */
 ssize_t DVDReadBytes( dvd_file_t *, void *, size_t );
-
+  
 /**
  * Returns the file size in blocks.
  *
@@ -224,7 +225,7 @@
  * blocks = DVDFileSize(dvd_file);
  */
 ssize_t DVDFileSize( dvd_file_t * );
-
+  
 /**
  * Get a unique 128 bit disc ID.
  * This is the MD5 sum of VIDEO_TS.IFO and the VTS_0?_0.IFO files
@@ -259,7 +260,7 @@
  * @return 0 on success, -1 on error.
  */
 int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int,
-		      unsigned char *, unsigned int );
+                      unsigned char *, unsigned int );
 
 /**
  * Get the ISO9660 VolumeIdentifier and VolumeSetIdentifier
@@ -283,7 +284,7 @@
  * @return 0 on success, -1 on error.
  */
 int DVDISOVolumeInfo( dvd_reader_t *, char *, unsigned int,
-		      unsigned char *, unsigned int );
+                      unsigned char *, unsigned int );
 
 /**
  * Sets the level of caching that is done when reading from a device
@@ -298,7 +299,7 @@
  * @return The level of caching.
  */
 int DVDUDFCacheLevel( dvd_reader_t *, int );
-
+  
 #ifdef __cplusplus
 };
 #endif
--- a/dvdread/dvd_udf.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/dvd_udf.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /*
  * This code is based on dvdudf by:
  *   Christian Wolff <scarabaeus@convergence.de>.
@@ -6,15 +7,15 @@
  *   Billy Biggs <vektor@dumbterm.net>.
  *   Björn Englund <d4bjorn@dtek.chalmers.se>.
  *
- * Modified for use with MPlayer, changes contained in libdvdread_changes.diff.
- * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
- * $Id$
- *
  * dvdudf: parse and read the UDF volume information of a DVD Video
  * Copyright (C) 1999 Christian Wolff for convergence integrated media
  * GmbH The author can be reached at scarabaeus@convergence.de, the
  * project's page is at http://linuxtv.org/dvd/
  * 
+ * Modified for use with MPlayer, changes contained in libdvdread_changes.diff.
+ * detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
+ * $Id$
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or (at
@@ -193,8 +194,8 @@
 
 /* Private but located in/shared with dvd_reader.c */
 extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
-				size_t block_count, unsigned char *data, 
-				int encrypted );
+                             size_t block_count, unsigned char *data, 
+                             int encrypted );
 
 /** @internal
  * Its required to either fail or deliver all the blocks asked for. 
@@ -205,8 +206,8 @@
  *   reading from raw/O_DIRECT device.
  */
 static int DVDReadLBUDF( dvd_reader_t *device, uint32_t lb_number,
-			 size_t block_count, unsigned char *data, 
-			 int encrypted )
+                         size_t block_count, unsigned char *data, 
+                         int encrypted )
 {
   int ret;
   size_t count = block_count;
@@ -234,21 +235,21 @@
 #endif
 
 struct Partition {
-    int valid;
-    char VolumeDesc[128];
-    uint16_t Flags;
-    uint16_t Number;
-    char Contents[32];
-    uint32_t AccessType;
-    uint32_t Start;
-    uint32_t Length;
+  int valid;
+  char VolumeDesc[128];
+  uint16_t Flags;
+  uint16_t Number;
+  char Contents[32];
+  uint32_t AccessType;
+  uint32_t Start;
+  uint32_t Length;
 };
 
 struct AD {
-    uint32_t Location;
-    uint32_t Length;
-    uint8_t  Flags;
-    uint16_t Partition;
+  uint32_t Location;
+  uint32_t Length;
+  uint8_t  Flags;
+  uint16_t Partition;
 };
 
 struct extent_ad {
@@ -328,7 +329,7 @@
 
 
 static int GetUDFCache(dvd_reader_t *device, UDFCacheType type,
-		       uint32_t nr, void *data)
+                       uint32_t nr, void *data)
 {
   int n;
   struct udf_cache *c;
@@ -371,16 +372,16 @@
   case LBUDFCache:
     for(n = 0; n < c->lb_num; n++) {
       if(c->lbs[n].lb == nr) {
-      *(uint8_t **)data = c->lbs[n].data;
-      return 1;
+        *(uint8_t **)data = c->lbs[n].data;
+        return 1;
       }
     }
     break;
   case MapCache:
     for(n = 0; n < c->map_num; n++) {
       if(c->maps[n].lbn == nr) {
-       *(struct icbmap *)data = c->maps[n];
-       return 1;
+        *(struct icbmap *)data = c->maps[n];
+        return 1;
       }
     }
     break;
@@ -392,7 +393,7 @@
 }
 
 static int SetUDFCache(dvd_reader_t *device, UDFCacheType type,
-		       uint32_t nr, void *data)
+                       uint32_t nr, void *data)
 {
   int n;
   struct udf_cache *c;
@@ -433,18 +434,18 @@
   case LBUDFCache:
     for(n = 0; n < c->lb_num; n++) {
       if(c->lbs[n].lb == nr) {
-       /* replace with new data */
-       c->lbs[n].data = *(uint8_t **)data;
-       c->lbs[n].lb = nr;
-       return 1;
+        /* replace with new data */
+        c->lbs[n].data = *(uint8_t **)data;
+        c->lbs[n].lb = nr;
+        return 1;
       }
     }
     c->lb_num++;
     c->lbs = realloc(c->lbs, c->lb_num * sizeof(struct lbudf));
     /*
-    fprintf(stderr, "realloc lb: %d * %d = %d\n",
-	    c->lb_num, sizeof(struct lbudf),
-	    c->lb_num * sizeof(struct lbudf));
+      fprintf(stderr, "realloc lb: %d * %d = %d\n",
+      c->lb_num, sizeof(struct lbudf),
+      c->lb_num * sizeof(struct lbudf));
     */
     if(c->lbs == NULL) {
       c->lb_num = 0;
@@ -456,18 +457,18 @@
   case MapCache:
     for(n = 0; n < c->map_num; n++) {
       if(c->maps[n].lbn == nr) {
-       /* replace with new data */
-       c->maps[n] = *(struct icbmap *)data;
-       c->maps[n].lbn = nr;
-       return 1;
+        /* replace with new data */
+        c->maps[n] = *(struct icbmap *)data;
+        c->maps[n].lbn = nr;
+        return 1;
       }
     }
     c->map_num++;
     c->maps = realloc(c->maps, c->map_num * sizeof(struct icbmap));
     /*
-    fprintf(stderr, "realloc maps: %d * %d = %d\n",
-	    c->map_num, sizeof(struct icbmap),
-	    c->map_num * sizeof(struct icbmap));
+      fprintf(stderr, "realloc maps: %d * %d = %d\n",
+      c->map_num, sizeof(struct icbmap),
+      c->map_num * sizeof(struct icbmap));
     */
     if(c->maps == NULL) {
       c->map_num = 0;
@@ -487,94 +488,94 @@
 /* For direct data access, LSB first */
 #define GETN1(p) ((uint8_t)data[p])
 #define GETN2(p) ((uint16_t)data[p] | ((uint16_t)data[(p) + 1] << 8))
-#define GETN3(p) ((uint32_t)data[p] | ((uint32_t)data[(p) + 1] << 8) \
-		  | ((uint32_t)data[(p) + 2] << 16))
-#define GETN4(p) ((uint32_t)data[p] \
-		  | ((uint32_t)data[(p) + 1] << 8) \
-		  | ((uint32_t)data[(p) + 2] << 16) \
-		  | ((uint32_t)data[(p) + 3] << 24))
+#define GETN3(p) ((uint32_t)data[p] | ((uint32_t)data[(p) + 1] << 8)    \
+                  | ((uint32_t)data[(p) + 2] << 16))
+#define GETN4(p) ((uint32_t)data[p]                     \
+                  | ((uint32_t)data[(p) + 1] << 8)      \
+                  | ((uint32_t)data[(p) + 2] << 16)     \
+                  | ((uint32_t)data[(p) + 3] << 24))
 /* This is wrong with regard to endianess */
 #define GETN(p, n, target) memcpy(target, &data[p], n)
 
 static int Unicodedecode( uint8_t *data, int len, char *target ) 
 {
-    int p = 1, i = 0;
+  int p = 1, i = 0;
 
-    if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
-        if( data[ 0 ] == 16 ) p++;  /* Ignore MSB of unicode16 */
-        if( p < len ) {
-            target[ i++ ] = data[ p++ ];
-        }
-    } while( p < len );
+  if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
+    if( data[ 0 ] == 16 ) p++;  /* Ignore MSB of unicode16 */
+    if( p < len ) {
+      target[ i++ ] = data[ p++ ];
+    }
+  } while( p < len );
 
-    target[ i ] = '\0';
-    return 0;
+  target[ i ] = '\0';
+  return 0;
 }
 
 static int UDFDescriptor( uint8_t *data, uint16_t *TagID ) 
 {
-    *TagID = GETN2(0);
-    // TODO: check CRC 'n stuff
-    return 0;
+  *TagID = GETN2(0);
+  // TODO: check CRC 'n stuff
+  return 0;
 }
 
 static int UDFExtentAD( uint8_t *data, uint32_t *Length, uint32_t *Location ) 
 {
-    *Length   = GETN4(0);
-    *Location = GETN4(4);
-    return 0;
+  *Length   = GETN4(0);
+  *Location = GETN4(4);
+  return 0;
 }
 
 static int UDFShortAD( uint8_t *data, struct AD *ad, 
-		       struct Partition *partition ) 
+                       struct Partition *partition ) 
 {
-    ad->Length = GETN4(0);
-    ad->Flags = ad->Length >> 30;
-    ad->Length &= 0x3FFFFFFF;
-    ad->Location = GETN4(4);
-    ad->Partition = partition->Number; // use number of current partition
-    return 0;
+  ad->Length = GETN4(0);
+  ad->Flags = ad->Length >> 30;
+  ad->Length &= 0x3FFFFFFF;
+  ad->Location = GETN4(4);
+  ad->Partition = partition->Number; // use number of current partition
+  return 0;
 }
 
 static int UDFLongAD( uint8_t *data, struct AD *ad )
 {
-    ad->Length = GETN4(0);
-    ad->Flags = ad->Length >> 30;
-    ad->Length &= 0x3FFFFFFF;
-    ad->Location = GETN4(4);
-    ad->Partition = GETN2(8);
-    //GETN(10, 6, Use);
-    return 0;
+  ad->Length = GETN4(0);
+  ad->Flags = ad->Length >> 30;
+  ad->Length &= 0x3FFFFFFF;
+  ad->Location = GETN4(4);
+  ad->Partition = GETN2(8);
+  //GETN(10, 6, Use);
+  return 0;
 }
 
 static int UDFExtAD( uint8_t *data, struct AD *ad )
 {
-    ad->Length = GETN4(0);
-    ad->Flags = ad->Length >> 30;
-    ad->Length &= 0x3FFFFFFF;
-    ad->Location = GETN4(12);
-    ad->Partition = GETN2(16);
-    //GETN(10, 6, Use);
-    return 0;
+  ad->Length = GETN4(0);
+  ad->Flags = ad->Length >> 30;
+  ad->Length &= 0x3FFFFFFF;
+  ad->Location = GETN4(12);
+  ad->Partition = GETN2(16);
+  //GETN(10, 6, Use);
+  return 0;
 }
 
 static int UDFICB( uint8_t *data, uint8_t *FileType, uint16_t *Flags )
 {
-    *FileType = GETN1(11);
-    *Flags = GETN2(18);
-    return 0;
+  *FileType = GETN1(11);
+  *Flags = GETN2(18);
+  return 0;
 }
 
 
 static int UDFPartition( uint8_t *data, uint16_t *Flags, uint16_t *Number,
-			 char *Contents, uint32_t *Start, uint32_t *Length )
+                         char *Contents, uint32_t *Start, uint32_t *Length )
 {
-    *Flags = GETN2(20);
-    *Number = GETN2(22);
-    GETN(24, 32, Contents);
-    *Start = GETN4(188);
-    *Length = GETN4(192);
-    return 0;
+  *Flags = GETN2(20);
+  *Number = GETN2(22);
+  GETN(24, 32, Contents);
+  *Start = GETN4(188);
+  *Length = GETN4(192);
+  return 0;
 }
 
 /**
@@ -583,66 +584,66 @@
  */
 static int UDFLogVolume( uint8_t *data, char *VolumeDescriptor )
 {
-    uint32_t lbsize, MT_L, N_PM;
-    Unicodedecode(&data[84], 128, VolumeDescriptor);
-    lbsize = GETN4(212);  // should be 2048
-    MT_L = GETN4(264);    // should be 6
-    N_PM = GETN4(268);    // should be 1
-    if (lbsize != DVD_VIDEO_LB_LEN) return 1;
-    return 0;
+  uint32_t lbsize, MT_L, N_PM;
+  Unicodedecode(&data[84], 128, VolumeDescriptor);
+  lbsize = GETN4(212);  // should be 2048
+  MT_L = GETN4(264);    // should be 6
+  N_PM = GETN4(268);    // should be 1
+  if (lbsize != DVD_VIDEO_LB_LEN) return 1;
+  return 0;
 }
 
 static int UDFFileEntry( uint8_t *data, uint8_t *FileType, 
-			 struct Partition *partition, struct AD *ad )
+                         struct Partition *partition, struct AD *ad )
 {
-    uint16_t flags;
-    uint32_t L_EA, L_AD;
-    unsigned int p;
+  uint16_t flags;
+  uint32_t L_EA, L_AD;
+  unsigned int p;
 
-    UDFICB( &data[ 16 ], FileType, &flags );
+  UDFICB( &data[ 16 ], FileType, &flags );
    
-    /* Init ad for an empty file (i.e. there isn't a AD, L_AD == 0 ) */
-    ad->Length = GETN4( 60 ); // Really 8 bytes a 56
-    ad->Flags = 0;
-    ad->Location = 0; // what should we put here? 
-    ad->Partition = partition->Number; // use number of current partition
+  /* Init ad for an empty file (i.e. there isn't a AD, L_AD == 0 ) */
+  ad->Length = GETN4( 60 ); // Really 8 bytes a 56
+  ad->Flags = 0;
+  ad->Location = 0; // what should we put here? 
+  ad->Partition = partition->Number; // use number of current partition
 
-    L_EA = GETN4( 168 );
-    L_AD = GETN4( 172 );
-    p = 176 + L_EA;
-    while( p < 176 + L_EA + L_AD ) {
-        switch( flags & 0x0007 ) {
-            case 0: UDFShortAD( &data[ p ], ad, partition ); p += 8;  break;
-            case 1: UDFLongAD( &data[ p ], ad );  p += 16; break;
-            case 2: UDFExtAD( &data[ p ], ad );   p += 20; break;
-            case 3:
-                switch( L_AD ) {
-                    case 8:  UDFShortAD( &data[ p ], ad, partition ); break;
-                    case 16: UDFLongAD( &data[ p ], ad );  break;
-                    case 20: UDFExtAD( &data[ p ], ad );   break;
-                }
-                p += L_AD;
-                break;
-            default:
-                p += L_AD; break;
-        }
+  L_EA = GETN4( 168 );
+  L_AD = GETN4( 172 );
+  p = 176 + L_EA;
+  while( p < 176 + L_EA + L_AD ) {
+    switch( flags & 0x0007 ) {
+    case 0: UDFShortAD( &data[ p ], ad, partition ); p += 8;  break;
+    case 1: UDFLongAD( &data[ p ], ad );  p += 16; break;
+    case 2: UDFExtAD( &data[ p ], ad );   p += 20; break;
+    case 3:
+      switch( L_AD ) {
+      case 8:  UDFShortAD( &data[ p ], ad, partition ); break;
+      case 16: UDFLongAD( &data[ p ], ad );  break;
+      case 20: UDFExtAD( &data[ p ], ad );   break;
+      }
+      p += L_AD;
+      break;
+    default:
+      p += L_AD; break;
     }
-    return 0;
+  }
+  return 0;
 }
 
 static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics,
-			      char *FileName, struct AD *FileICB )
+                              char *FileName, struct AD *FileICB )
 {
-    uint8_t L_FI;
-    uint16_t L_IU;
+  uint8_t L_FI;
+  uint16_t L_IU;
 
-    *FileCharacteristics = GETN1(18);
-    L_FI = GETN1(19);
-    UDFLongAD(&data[20], FileICB);
-    L_IU = GETN2(36);
-    if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
-    else FileName[0] = '\0';
-    return 4 * ((38 + L_FI + L_IU + 3) / 4);
+  *FileCharacteristics = GETN1(18);
+  L_FI = GETN1(19);
+  UDFLongAD(&data[20], FileICB);
+  L_IU = GETN2(36);
+  if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
+  else FileName[0] = '\0';
+  return 4 * ((38 + L_FI + L_IU + 3) / 4);
 }
 
 /**
@@ -653,46 +654,46 @@
  * return 1 on success, 0 on error;
  */
 static int UDFMapICB( dvd_reader_t *device, struct AD ICB, uint8_t *FileType,
-		      struct Partition *partition, struct AD *File ) 
+                      struct Partition *partition, struct AD *File ) 
 {
   uint8_t *LogBlock;
-    uint32_t lbnum;
-    uint16_t TagID;
-    struct icbmap tmpmap;
+  uint32_t lbnum;
+  uint16_t TagID;
+  struct icbmap tmpmap;
 
-    lbnum = partition->Start + ICB.Location;
-    tmpmap.lbn = lbnum;
-    if(GetUDFCache(device, MapCache, lbnum, &tmpmap)) {
-      *FileType = tmpmap.filetype;
-      *File = tmpmap.file;
-      return 1;
-    }
+  lbnum = partition->Start + ICB.Location;
+  tmpmap.lbn = lbnum;
+  if(GetUDFCache(device, MapCache, lbnum, &tmpmap)) {
+    *FileType = tmpmap.filetype;
+    *File = tmpmap.file;
+    return 1;
+  }
 
   LogBlock = dvdalign_lbmalloc(device, 1);
   if(!LogBlock) {
     return 0;
   }
     
-    do {
-        if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) {
-            TagID = 0;
-        } else {
-            UDFDescriptor( LogBlock, &TagID );
-        }
+  do {
+    if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) {
+      TagID = 0;
+    } else {
+      UDFDescriptor( LogBlock, &TagID );
+    }
 
-        if( TagID == 261 ) {
-            UDFFileEntry( LogBlock, FileType, partition, File );
-           tmpmap.file = *File;
-           tmpmap.filetype = *FileType;
-           SetUDFCache(device, MapCache, tmpmap.lbn, &tmpmap);
+    if( TagID == 261 ) {
+      UDFFileEntry( LogBlock, FileType, partition, File );
+      tmpmap.file = *File;
+      tmpmap.filetype = *FileType;
+      SetUDFCache(device, MapCache, tmpmap.lbn, &tmpmap);
       dvdalign_lbfree(device, LogBlock);
-            return 1;
-        };
-    } while( ( lbnum <= partition->Start + ICB.Location + ( ICB.Length - 1 )
+      return 1;
+    };
+  } while( ( lbnum <= partition->Start + ICB.Location + ( ICB.Length - 1 )
              / DVD_VIDEO_LB_LEN ) && ( TagID != 261 ) );
 
   dvdalign_lbfree(device, LogBlock);
-    return 0;
+  return 0;
 }
 
 /**
@@ -703,122 +704,122 @@
  */
 static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
                        struct Partition *partition, struct AD *FileICB,
-		       int cache_file_info) 
+                       int cache_file_info) 
 {
-    char filename[ MAX_UDF_FILE_NAME_LEN ];
+  char filename[ MAX_UDF_FILE_NAME_LEN ];
   uint8_t *directory;
-    uint32_t lbnum;
-    uint16_t TagID;
-    uint8_t filechar;
-    unsigned int p;
-    uint8_t *cached_dir = NULL;
-    uint32_t dir_lba;
-    struct AD tmpICB;
-    int found = 0;
-    int in_cache = 0;
+  uint32_t lbnum;
+  uint16_t TagID;
+  uint8_t filechar;
+  unsigned int p;
+  uint8_t *cached_dir = NULL;
+  uint32_t dir_lba;
+  struct AD tmpICB;
+  int found = 0;
+  int in_cache = 0;
 
-    /* Scan dir for ICB of file */
-    lbnum = partition->Start + Dir.Location;
+  /* Scan dir for ICB of file */
+  lbnum = partition->Start + Dir.Location;
     
-    if(DVDUDFCacheLevel(device, -1) > 0) {
-      /* caching */
-      
-      if(!GetUDFCache(device, LBUDFCache, lbnum, &cached_dir)) {
-	dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN;
-      if((cached_dir = dvdalign_lbmalloc(device, dir_lba)) == NULL) {
-	  return 0;
-	}
-	if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
-        dvdalign_lbfree(device, cached_dir);
-	  cached_dir = NULL;
-	}
-	SetUDFCache(device, LBUDFCache, lbnum, &cached_dir);
-      } else {
-	in_cache = 1;
-      }
+  if(DVDUDFCacheLevel(device, -1) > 0) {
+    /* caching */
       
-      if(cached_dir == NULL) {
-	return 0;
+    if(!GetUDFCache(device, LBUDFCache, lbnum, &cached_dir)) {
+      dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN;
+      if((cached_dir = dvdalign_lbmalloc(device, dir_lba)) == NULL) {
+        return 0;
       }
-      
-      p = 0;
+      if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
+        dvdalign_lbfree(device, cached_dir);
+        cached_dir = NULL;
+      }
+      SetUDFCache(device, LBUDFCache, lbnum, &cached_dir);
+    } else {
+      in_cache = 1;
+    }
       
-      while( p < Dir.Length ) {
-        UDFDescriptor( &cached_dir[ p ], &TagID );
-        if( TagID == 257 ) {
-	  p += UDFFileIdentifier( &cached_dir[ p ], &filechar,
-				  filename, &tmpICB );
-	  if(cache_file_info && !in_cache) {
-	    uint8_t tmpFiletype;
-	    struct AD tmpFile;
-	    
-	    if( !strcasecmp( FileName, filename ) ) {
-	      *FileICB = tmpICB;
-	      found = 1;
-	      
-	    }
-	    UDFMapICB(device, tmpICB, &tmpFiletype,
-		      partition, &tmpFile);
-	  } else {
-	    if( !strcasecmp( FileName, filename ) ) {
-	      *FileICB = tmpICB;
-	      return 1;
-	    }
-	  }
-        } else {
-	  if(cache_file_info && (!in_cache) && found) {
-	    return 1;
-	  }
-	  return 0;
-        }
-      }
-      if(cache_file_info && (!in_cache) && found) {
-	return 1;
-      }
+    if(cached_dir == NULL) {
       return 0;
     }
+      
+    p = 0;
+      
+    while( p < Dir.Length ) {
+      UDFDescriptor( &cached_dir[ p ], &TagID );
+      if( TagID == 257 ) {
+        p += UDFFileIdentifier( &cached_dir[ p ], &filechar,
+                                filename, &tmpICB );
+        if(cache_file_info && !in_cache) {
+          uint8_t tmpFiletype;
+          struct AD tmpFile;
+            
+          if( !strcasecmp( FileName, filename ) ) {
+            *FileICB = tmpICB;
+            found = 1;
+              
+          }
+          UDFMapICB(device, tmpICB, &tmpFiletype,
+                    partition, &tmpFile);
+        } else {
+          if( !strcasecmp( FileName, filename ) ) {
+            *FileICB = tmpICB;
+            return 1;
+          }
+        }
+      } else {
+        if(cache_file_info && (!in_cache) && found) {
+          return 1;
+        }
+        return 0;
+      }
+    }
+    if(cache_file_info && (!in_cache) && found) {
+      return 1;
+    }
+    return 0;
+  }
 
   directory = dvdalign_lbmalloc(device, 2);
   if(!directory) {
     return 0;
   }
-    if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 ) {
+  if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 ) {
     dvdalign_lbfree(device, directory);
-        return 0;
-    }
+    return 0;
+  }
 
-    p = 0;
-    while( p < Dir.Length ) {
-        if( p > DVD_VIDEO_LB_LEN ) {
-            ++lbnum;
-            p -= DVD_VIDEO_LB_LEN;
-            Dir.Length -= DVD_VIDEO_LB_LEN;
-            if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 ) {
+  p = 0;
+  while( p < Dir.Length ) {
+    if( p > DVD_VIDEO_LB_LEN ) {
+      ++lbnum;
+      p -= DVD_VIDEO_LB_LEN;
+      Dir.Length -= DVD_VIDEO_LB_LEN;
+      if( DVDReadLBUDF( device, lbnum, 2, directory, 0 ) <= 0 ) {
         dvdalign_lbfree(device, directory);
-                return 0;
-            }
-        }
-        UDFDescriptor( &directory[ p ], &TagID );
-        if( TagID == 257 ) {
-            p += UDFFileIdentifier( &directory[ p ], &filechar,
-                                    filename, FileICB );
-            if( !strcasecmp( FileName, filename ) ) {
+        return 0;
+      }
+    }
+    UDFDescriptor( &directory[ p ], &TagID );
+    if( TagID == 257 ) {
+      p += UDFFileIdentifier( &directory[ p ], &filechar,
+                              filename, FileICB );
+      if( !strcasecmp( FileName, filename ) ) {
         dvdalign_lbfree(device, directory);
-                return 1;
-            }
-        } else {
+        return 1;
+      }
+    } else {
       dvdalign_lbfree(device, directory);
-            return 0;
-        }
+      return 0;
     }
+  }
 
   dvdalign_lbfree(device, directory);
-    return 0;
+  return 0;
 }
 
 
 static int UDFGetAVDP( dvd_reader_t *device,
-		       struct avdp_t *avdp)
+                       struct avdp_t *avdp)
 {
   uint8_t *Anchor;
   uint32_t lbnum, MVDS_location, MVDS_length;
@@ -830,7 +831,7 @@
   if(GetUDFCache(device, AVDPCache, 0, avdp)) {
     return 1;
   }
-
+  
   /* Find Anchor */
   lastsector = 0;
   lbnum = 256;   /* Try #1, prime anchor */
@@ -855,22 +856,22 @@
       } 
       
       if( lastsector ) {
-	/* We already found the last sector.  Try #3, alternative
-	 * backup anchor.  If that fails, don't try again.
-	 */
-	lbnum = lastsector;
-	terminate = 1;
+        /* We already found the last sector.  Try #3, alternative
+         * backup anchor.  If that fails, don't try again.
+         */
+        lbnum = lastsector;
+        terminate = 1;
       } else {
-	/* TODO: Find last sector of the disc (this is optional). */
-	if( lastsector ) {
-	  /* Try #2, backup anchor */
-	  lbnum = lastsector - 256;
-	} else {
-	  /* Unable to find last sector */
+        /* TODO: Find last sector of the disc (this is optional). */
+        if( lastsector ) {
+          /* Try #2, backup anchor */
+          lbnum = lastsector - 256;
+        } else {
+          /* Unable to find last sector */
           dvdalign_lbfree(device, Anchor);
           errno = EMEDIUMTYPE;
-	  return 0;
-	}
+          return 0;
+        }
       }
     } else {
       /* It's an anchor! We can leave */
@@ -899,116 +900,116 @@
  *   part: structure to fill with the partition information
  */
 static int UDFFindPartition( dvd_reader_t *device, int partnum,
-			     struct Partition *part ) 
+                             struct Partition *part ) 
 {
   uint8_t *LogBlock;
-    uint32_t lbnum, MVDS_location, MVDS_length;
-    uint16_t TagID;
-    int i, volvalid;
-    struct avdp_t avdp;
+  uint32_t lbnum, MVDS_location, MVDS_length;
+  uint16_t TagID;
+  int i, volvalid;
+  struct avdp_t avdp;
 
     
-    if(!UDFGetAVDP(device, &avdp)) {
-      return 0;
-    }
+  if(!UDFGetAVDP(device, &avdp)) {
+    return 0;
+  }
 
   LogBlock = dvdalign_lbmalloc(device, 1);
   if(!LogBlock) {
     return 0;
   }
-    /* Main volume descriptor */
-    MVDS_location = avdp.mvds.location;
-    MVDS_length = avdp.mvds.length;
+  /* Main volume descriptor */
+  MVDS_location = avdp.mvds.location;
+  MVDS_length = avdp.mvds.length;
 
-    part->valid = 0;
-    volvalid = 0;
-    part->VolumeDesc[ 0 ] = '\0';
-    i = 1;
+  part->valid = 0;
+  volvalid = 0;
+  part->VolumeDesc[ 0 ] = '\0';
+  i = 1;
+  do {
+    /* Find Volume Descriptor */
+    lbnum = MVDS_location;
     do {
-        /* Find Volume Descriptor */
-        lbnum = MVDS_location;
-        do {
 
-            if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) {
-                TagID = 0;
-            } else {
-                UDFDescriptor( LogBlock, &TagID );
-            }
+      if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) {
+        TagID = 0;
+      } else {
+        UDFDescriptor( LogBlock, &TagID );
+      }
 
-            if( ( TagID == 5 ) && ( !part->valid ) ) {
-                /* Partition Descriptor */
-                UDFPartition( LogBlock, &part->Flags, &part->Number,
-                              part->Contents, &part->Start, &part->Length );
-                part->valid = ( partnum == part->Number );
-            } else if( ( TagID == 6 ) && ( !volvalid ) ) {
-                /* Logical Volume Descriptor */
-                if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) {  
-                    /* TODO: sector size wrong! */
-                } else {
-                    volvalid = 1;
-                }
-            }
+      if( ( TagID == 5 ) && ( !part->valid ) ) {
+        /* Partition Descriptor */
+        UDFPartition( LogBlock, &part->Flags, &part->Number,
+                      part->Contents, &part->Start, &part->Length );
+        part->valid = ( partnum == part->Number );
+      } else if( ( TagID == 6 ) && ( !volvalid ) ) {
+        /* Logical Volume Descriptor */
+        if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) {  
+          /* TODO: sector size wrong! */
+        } else {
+          volvalid = 1;
+        }
+      }
 
-        } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
-                 / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
-                 && ( ( !part->valid ) || ( !volvalid ) ) );
+    } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
+               / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
+             && ( ( !part->valid ) || ( !volvalid ) ) );
 
-        if( ( !part->valid) || ( !volvalid ) ) {
-	  /* Backup volume descriptor */
-	  MVDS_location = avdp.mvds.location;
-	  MVDS_length = avdp.mvds.length;
-        }
-    } while( i-- && ( ( !part->valid ) || ( !volvalid ) ) );
+    if( ( !part->valid) || ( !volvalid ) ) {
+      /* Backup volume descriptor */
+      MVDS_location = avdp.mvds.location;
+      MVDS_length = avdp.mvds.length;
+    }
+  } while( i-- && ( ( !part->valid ) || ( !volvalid ) ) );
 
   dvdalign_lbfree(device, LogBlock);
-    /* We only care for the partition, not the volume */
-    return part->valid;
+  /* We only care for the partition, not the volume */
+  return part->valid;
 }
 
 uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
-		      uint32_t *filesize )
+                      uint32_t *filesize )
 {
   uint8_t *LogBlock;
-    uint32_t lbnum;
-    uint16_t TagID;
-    struct Partition partition;
-    struct AD RootICB, File, ICB;
-    char tokenline[ MAX_UDF_FILE_NAME_LEN ];
-    char *token;
-    uint8_t filetype;
-
+  uint32_t lbnum;
+  uint16_t TagID;
+  struct Partition partition;
+  struct AD RootICB, File, ICB;
+  char tokenline[ MAX_UDF_FILE_NAME_LEN ];
+  char *token;
+  uint8_t filetype;
+  
   if(filesize) {
     *filesize = 0;
   }
-    tokenline[0] = '\0';
-    strcat( tokenline, filename );
+  tokenline[0] = '\0';
+  strcat( tokenline, filename );
 
     
-    if(!(GetUDFCache(device, PartitionCache, 0, &partition) &&
-        GetUDFCache(device, RootICBCache, 0, &RootICB))) {
-      /* Find partition, 0 is the standard location for DVD Video.*/
+  if(!(GetUDFCache(device, PartitionCache, 0, &partition) &&
+       GetUDFCache(device, RootICBCache, 0, &RootICB))) {
+    /* Find partition, 0 is the standard location for DVD Video.*/
     if( !UDFFindPartition( device, 0, &partition ) ) {
       return 0;
     }
-      SetUDFCache(device, PartitionCache, 0, &partition);
-      
+    SetUDFCache(device, PartitionCache, 0, &partition);
+    
     LogBlock = dvdalign_lbmalloc(device, 1);
     if(!LogBlock) {
       return 0;
     }
-      /* Find root dir ICB */
-      lbnum = partition.Start;
-      do {
-        if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) {
-            TagID = 0;
-        } else {
-            UDFDescriptor( LogBlock, &TagID );
-        }
+    /* Find root dir ICB */
+    lbnum = partition.Start;
+    do {
+      if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 ) {
+        TagID = 0;
+      } else {
+        UDFDescriptor( LogBlock, &TagID );
+      }
 
-        /* File Set Descriptor */
-        if( TagID == 256 ) {  // File Set Descriptor
-            UDFLongAD( &LogBlock[ 400 ], &RootICB );
-        }
+      /* File Set Descriptor */
+      if( TagID == 256 ) {  // File Set Descriptor
+        UDFLongAD( &LogBlock[ 400 ], &RootICB );
+      }
     } while( ( lbnum < partition.Start + partition.Length )
              && ( TagID != 8 ) && ( TagID != 256 ) );
 
@@ -1022,50 +1023,50 @@
       return 0;
     }
     SetUDFCache(device, RootICBCache, 0, &RootICB);
-    }
+  }
 
-    /* Find root dir */
+  /* Find root dir */
   if( !UDFMapICB( device, RootICB, &filetype, &partition, &File ) ) {
     return 0;
   }
   if( filetype != 4 ) {
     return 0;  /* Root dir should be dir */
   }
-    {
-      int cache_file_info = 0;
-      /* Tokenize filepath */
-      token = strtok(tokenline, "/");
+  {
+    int cache_file_info = 0;
+    /* Tokenize filepath */
+    token = strtok(tokenline, "/");
+    
+    while( token != NULL ) {
       
-      while( token != NULL ) {
-       
-        if( !UDFScanDir( device, File, token, &partition, &ICB,
-                        cache_file_info)) {
-         return 0;
-       }
-        if( !UDFMapICB( device, ICB, &filetype, &partition, &File ) ) {
-         return 0;
-       }
-       if(!strcmp(token, "VIDEO_TS")) {
-         cache_file_info = 1;
-       }
-        token = strtok( NULL, "/" );
+      if( !UDFScanDir( device, File, token, &partition, &ICB,
+                       cache_file_info)) {
+        return 0;
+      }
+      if( !UDFMapICB( device, ICB, &filetype, &partition, &File ) ) {
+        return 0;
       }
-    } 
+      if(!strcmp(token, "VIDEO_TS")) {
+        cache_file_info = 1;
+      }
+      token = strtok( NULL, "/" );
+    }
+  } 
 
-    /* Sanity check. */
+  /* Sanity check. */
   if( File.Partition != 0 ) {
     return 0;
   }
-   
+
   if(filesize) {
     *filesize = File.Length;
   }
-    /* Hack to not return partition.Start for empty files. */
+  /* Hack to not return partition.Start for empty files. */
   if( !File.Location ) {
-      return 0;
+    return 0;
   } else {
-      return partition.Start + File.Location;
-}
+    return partition.Start + File.Location;
+  }
 }
 
 
@@ -1078,7 +1079,7 @@
  * and aligned for raw/O_DIRECT read.
  */
 static int UDFGetDescriptor( dvd_reader_t *device, int id,
-			     uint8_t *descriptor, int bufsize) 
+                             uint8_t *descriptor, int bufsize) 
 {
   uint32_t lbnum, MVDS_location, MVDS_length;
   struct avdp_t avdp;
@@ -1109,18 +1110,18 @@
     do {
       
       if( DVDReadLBUDF( device, lbnum++, 1, descriptor, 0 ) <= 0 ) {
-	TagID = 0;
+        TagID = 0;
       } else {
-	UDFDescriptor( descriptor, &TagID );
+        UDFDescriptor( descriptor, &TagID );
       }
       
       if( (TagID == id) && ( !desc_found ) ) {
-	/* Descriptor */
-	desc_found = 1;
+        /* Descriptor */
+        desc_found = 1;
       }
     } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
-	       / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
-	     && ( !desc_found) );
+               / DVD_VIDEO_LB_LEN ) && ( TagID != 8 )
+             && ( !desc_found) );
     
     if( !desc_found ) {
       /* Backup volume descriptor */
@@ -1128,7 +1129,7 @@
       MVDS_length = avdp.rvds.length;
     }
   } while( i-- && ( !desc_found )  );
-  
+
   
   return desc_found;
 }
@@ -1141,7 +1142,7 @@
   if(GetUDFCache(device, PVDCache, 0, pvd)) {
     return 1;
   }
-
+  
   pvd_buf = dvdalign_lbmalloc(device, 1);
   if(!pvd_buf) {
     return 0;
@@ -1167,7 +1168,7 @@
  * returns the size of buffer needed for all data
  */
 int UDFGetVolumeIdentifier(dvd_reader_t *device, char *volid,
-			   unsigned int volid_size)
+                           unsigned int volid_size)
 {
   struct pvd_t pvd;
   unsigned int volid_len;
@@ -1200,7 +1201,7 @@
  * or 0 on error
  */
 int UDFGetVolumeSetIdentifier(dvd_reader_t *device, uint8_t *volsetid,
-			      unsigned int volsetid_size)
+                              unsigned int volsetid_size)
 {
   struct pvd_t pvd;
 
--- a/dvdread/dvd_udf.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/dvd_udf.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef DVD_UDF_H_INCLUDED
 #define DVD_UDF_H_INCLUDED
 
@@ -51,12 +52,12 @@
  * the file in bytes.
  */
 uint32_t UDFFindFile( dvd_reader_t *device, char *filename, uint32_t *size );
-
+  
 void FreeUDFCache(dvd_reader_t *device, void *cache);
 int UDFGetVolumeIdentifier(dvd_reader_t *device,
-			   char *volid, unsigned int volid_size);
+                           char *volid, unsigned int volid_size);
 int UDFGetVolumeSetIdentifier(dvd_reader_t *device,
-			      uint8_t *volsetid, unsigned int volsetid_size);
+                              uint8_t *volsetid, unsigned int volsetid_size);
 #ifdef __cplusplus
 };
 #endif
--- a/dvdread/dvdread_internal.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/dvdread_internal.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef DVDREAD_INTERNAL_H
 #define DVDREAD_INTERNAL_H
 
--- a/dvdread/ifo_print.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/ifo_print.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /* 
  * Copyright (C) 2000, 2001, 2002, 2003
  *               Björn Englund <d4bjorn@dtek.chalmers.se>, 
@@ -51,10 +52,10 @@
   CHECK_VALUE((dtime->frame_u&0xf) < 0xa);
   
   printf("%02x:%02x:%02x.%02x", 
-	 dtime->hour,
-	 dtime->minute,
-	 dtime->second,
-	 dtime->frame_u & 0x3f);
+         dtime->hour,
+         dtime->minute,
+         dtime->second,
+         dtime->frame_u & 0x3f);
   switch((dtime->frame_u & 0xc0) >> 6) {
   case 1:
     rate = "25.00";
@@ -155,14 +156,14 @@
   }
 
   switch(attr->bit_rate) {
-    case 0:
-      printf("Variable Bit Rate ");
-      break;
-    case 1:
-      printf("Constant Bit Rate ");
-      break;
-    default:
-      printf("(please send a bug report)");
+  case 0:
+    printf("Variable Bit Rate ");
+    break;
+  case 1:
+    printf("Constant Bit Rate ");
+    break;
+  default:
+    printf("(please send a bug report)");
   }
   
   {
@@ -298,17 +299,17 @@
     }
     break;
   case 4:
-  switch(attr->quantization) {
-  case 0:
-    printf("16bit ");
-    break;
-  case 1:
-    printf("20bit ");
-    break;
-  case 2:
-    printf("24bit ");
-    break;
-  case 3:
+    switch(attr->quantization) {
+    case 0:
+      printf("16bit ");
+      break;
+    case 1:
+      printf("20bit ");
+      break;
+    case 2:
+      printf("24bit ");
+      break;
+    case 3:
       printf("(please send a bug report) lpcm reserved quant/drc  (%d)",
              attr->quantization);
       break;
@@ -323,7 +324,7 @@
   default:
     break;
   }
-  
+
   switch(attr->sample_frequency) {
   case 0:
     printf("48kHz ");
@@ -333,7 +334,7 @@
     break;
   default:
     printf("sample_frequency %i (please send a bug report) ", 
-	   attr->sample_frequency);
+           attr->sample_frequency);
   }
   
   printf("%dCh ", attr->channels + 1);
@@ -409,7 +410,7 @@
       printf("%02x%02x ", attr->lang_code >> 8, attr->lang_code & 0xff);
     }
   } else {
-      printf("lang not specified ");
+    printf("lang not specified ");
   }
   
   printf("%d ", attr->zero1);
@@ -547,8 +548,8 @@
   printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector);
   printf("Last Sector of VMGI: %08x\n", vmgi_mat->vmgi_last_sector);
   printf("Specification version number: %01x.%01x\n", 
-	 vmgi_mat->specification_version >> 4, 
-	 vmgi_mat->specification_version & 0xf);
+         vmgi_mat->specification_version >> 4, 
+         vmgi_mat->specification_version & 0xf);
   /* Byte 2 of 'VMG Category' (00xx0000) is the Region Code */
   printf("VMG Category: %08x\n", vmgi_mat->vmg_category);
   printf("VMG Number of Volumes: %i\n", vmgi_mat->vmg_nr_of_volumes);
@@ -560,7 +561,7 @@
   printf("%08x\n", (uint32_t)vmgi_mat->vmg_pos_code);
   printf("End byte of VMGI_MAT: %08x\n", vmgi_mat->vmgi_last_byte);
   printf("Start byte of First Play PGC FP PGC: %08x\n", 
-	 vmgi_mat->first_play_pgc);
+         vmgi_mat->first_play_pgc);
   printf("Start sector of VMGM_VOBS: %08x\n", vmgi_mat->vmgm_vobs);
   printf("Start sector of TT_SRPT: %08x\n", vmgi_mat->tt_srpt);
   printf("Start sector of VMGM_PGCI_UT: %08x\n", vmgi_mat->vmgm_pgci_ut);
@@ -569,19 +570,19 @@
   printf("Start sector of TXTDT_MG: %08x\n", vmgi_mat->txtdt_mgi);
   printf("Start sector of VMGM_C_ADT: %08x\n", vmgi_mat->vmgm_c_adt);
   printf("Start sector of VMGM_VOBU_ADMAP: %08x\n", 
-	 vmgi_mat->vmgm_vobu_admap);
+         vmgi_mat->vmgm_vobu_admap);
   printf("Video attributes of VMGM_VOBS: ");
   ifoPrint_video_attributes(&vmgi_mat->vmgm_video_attr);
   printf("\n");
   printf("VMGM Number of Audio attributes: %i\n", 
-	 vmgi_mat->nr_of_vmgm_audio_streams);
+         vmgi_mat->nr_of_vmgm_audio_streams);
   if(vmgi_mat->nr_of_vmgm_audio_streams > 0) {
     printf("\tstream %i status: ", 1);
     ifoPrint_audio_attributes(&vmgi_mat->vmgm_audio_attr);
     printf("\n");
   }
   printf("VMGM Number of Sub-picture attributes: %i\n", 
-	 vmgi_mat->nr_of_vmgm_subp_streams);
+         vmgi_mat->nr_of_vmgm_subp_streams);
   if(vmgi_mat->nr_of_vmgm_subp_streams > 0) {
     printf("\tstream %2i status: ", 1);
     ifoPrint_subp_attributes(&vmgi_mat->vmgm_subp_attr);
@@ -597,8 +598,8 @@
   printf("Last Sector of VTS: %08x\n", vtsi_mat->vts_last_sector);
   printf("Last Sector of VTSI: %08x\n", vtsi_mat->vtsi_last_sector);
   printf("Specification version number: %01x.%01x\n", 
-	 vtsi_mat->specification_version>>4, 
-	 vtsi_mat->specification_version&0xf);
+         vtsi_mat->specification_version>>4, 
+         vtsi_mat->specification_version&0xf);
   printf("VTS Category: %08x\n", vtsi_mat->vts_category);
   printf("End byte of VTSI_MAT: %08x\n", vtsi_mat->vtsi_last_byte);
   printf("Start sector of VTSM_VOBS:  %08x\n", vtsi_mat->vtsm_vobs);
@@ -617,7 +618,7 @@
   printf("\n");
   
   printf("VTSM Number of Audio attributes: %i\n", 
-	 vtsi_mat->nr_of_vtsm_audio_streams);
+         vtsi_mat->nr_of_vtsm_audio_streams);
   if(vtsi_mat->nr_of_vtsm_audio_streams > 0) {
     printf("\tstream %i status: ", 1);
     ifoPrint_audio_attributes(&vtsi_mat->vtsm_audio_attr);
@@ -625,7 +626,7 @@
   }
   
   printf("VTSM Number of Sub-picture attributes: %i\n", 
-	 vtsi_mat->nr_of_vtsm_subp_streams);
+         vtsi_mat->nr_of_vtsm_subp_streams);
   if(vtsi_mat->nr_of_vtsm_subp_streams > 0) {
     printf("\tstream %2i status: ", 1);
     ifoPrint_subp_attributes(&vtsi_mat->vtsm_subp_attr);
@@ -637,7 +638,7 @@
   printf("\n");
   
   printf("VTS Number of Audio attributes: %i\n", 
-	 vtsi_mat->nr_of_vts_audio_streams);
+         vtsi_mat->nr_of_vts_audio_streams);
   for(i = 0; i < vtsi_mat->nr_of_vts_audio_streams; i++) {
     printf("\tstream %i status: ", i);
     ifoPrint_audio_attributes(&vtsi_mat->vts_audio_attr[i]);
@@ -645,7 +646,7 @@
   }
   
   printf("VTS Number of Subpicture attributes: %i\n", 
-	 vtsi_mat->nr_of_vts_subp_streams);
+         vtsi_mat->nr_of_vts_subp_streams);
   for(i = 0; i < vtsi_mat->nr_of_vts_subp_streams; i++) {
     printf("\tstream %2i status: ", i);
     ifoPrint_subp_attributes(&vtsi_mat->vts_subp_attr[i]);
@@ -713,28 +714,28 @@
       const char *s;
       switch(cell_playback[i].block_mode) {
       case 0:
-	s = "not a"; break;
+        s = "not a"; break;
       case 1:
-	s = "the first"; break;
+        s = "the first"; break;
       case 2:
       default:
-	s = ""; break;
+        s = ""; break;
       case 3:
-	s = "last"; break;
+        s = "last"; break;
       }
       printf("%s cell in the block ", s);
       
       switch(cell_playback[i].block_type) {
       case 0:
-	printf("not part of the block ");
-	break;
+        printf("not part of the block ");
+        break;
       case 1:
-	printf("angle block ");
-	break;
+        printf("angle block ");
+        break;
       case 2:
       case 3:
-	printf("(send bug repport) ");
-	break;
+        printf("(send bug repport) ");
+        break;
       }
     }
     if(cell_playback[i].seamless_play)
@@ -754,11 +755,11 @@
       printf("cell command %d", cell_playback[i].cell_cmd_nr);
     
     printf("\n\tStart sector: %08x\tFirst ILVU end  sector: %08x\n", 
-	   cell_playback[i].first_sector, 
-	   cell_playback[i].first_ilvu_end_sector);
+           cell_playback[i].first_sector, 
+           cell_playback[i].first_ilvu_end_sector);
     printf("\tEnd   sector: %08x\tLast VOBU start sector: %08x\n", 
-	   cell_playback[i].last_sector, 
-	   cell_playback[i].last_vobu_start_sector);
+           cell_playback[i].last_sector, 
+           cell_playback[i].last_vobu_start_sector);
   }
 }
 
@@ -772,7 +773,7 @@
   
   for(i=0;i<nr;i++) {
     printf("Cell: %3i has VOB ID: %3i, Cell ID: %3i\n", i + 1, 
-	   cell_position[i].vob_id_nr, cell_position[i].cell_nr);
+           cell_position[i].vob_id_nr, cell_position[i].cell_nr);
   }
 }
 
@@ -795,17 +796,17 @@
   printf("Prohibited user operations: ");
   ifoPrint_USER_OPS(&pgc->prohibited_ops);
   
-    for(i = 0; i < 8; i++) {
+  for(i = 0; i < 8; i++) {
     if(pgc->audio_control[i].present) { /* The 'is present' bit */
-	printf("Audio stream %i control: %04x\n", 
-	       i, pgc->audio_control[i]);
-      }
+      printf("Audio stream %i control: %04x\n", 
+             i, pgc->audio_control[i]);
     }
+  }
   
   for(i = 0; i < 32; i++) {
     if(pgc->subp_control[i].present) { /* The 'is present' bit */
       printf("Subpicture stream %2i control: %08x\n", 
-	     i, pgc->subp_control[i]);
+             i, pgc->subp_control[i]);
     }
   }
   
@@ -840,36 +841,36 @@
   int i;
   
   printf("Number of TitleTrack search pointers: %i\n",
-	 tt_srpt->nr_of_srpts);
+         tt_srpt->nr_of_srpts);
   for(i=0;i<tt_srpt->nr_of_srpts;i++) {
     printf("Title Track index %i\n", i + 1);
     printf("\tTitle set number (VTS): %i", 
-	   tt_srpt->title[i].title_set_nr);
+           tt_srpt->title[i].title_set_nr);
     printf("\tVTS_TTN: %i\n", tt_srpt->title[i].vts_ttn);
     printf("\tNumber of PTTs: %i\n", tt_srpt->title[i].nr_of_ptts);
     printf("\tNumber of angles: %i\n", 
-	   tt_srpt->title[i].nr_of_angles);
+           tt_srpt->title[i].nr_of_angles);
     printf("\tTitle playback type: %s%s%s%s%s%s%s\n",
-	   tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? 
-	   " One Random PGC Title or Multi PGC Title" : 
-	   " One Sequential PGC Title",
-	   tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd ?
-	   "" : ", No Link/Jump/Call exists in Cell command",
-	   tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd ?
-	   "" : ", No Link/Jump/Call exists in Pre- and/or Post-command",
-	   tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd ?
-	   "" : ", No Link/Jump/Call exists in Button command",
-	   tt_srpt->title[i].pb_ty.jlc_exists_in_tt_dom ?
-	   "" : ", No Link/Jump/Call exists in TT_DOM",
-	   tt_srpt->title[i].pb_ty.chapter_search_or_play ?
-	   ", UOP1 (TT_Play and PTT_Search) prohibited" : "",
-	   tt_srpt->title[i].pb_ty.title_or_time_play ?
-	   ", UOP0 (Time_Play and Time_Search) prohibited" : ""
-	   );    
+           tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? 
+           " One Random PGC Title or Multi PGC Title" : 
+           " One Sequential PGC Title",
+           tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd ?
+           "" : ", No Link/Jump/Call exists in Cell command",
+           tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd ?
+           "" : ", No Link/Jump/Call exists in Pre- and/or Post-command",
+           tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd ?
+           "" : ", No Link/Jump/Call exists in Button command",
+           tt_srpt->title[i].pb_ty.jlc_exists_in_tt_dom ?
+           "" : ", No Link/Jump/Call exists in TT_DOM",
+           tt_srpt->title[i].pb_ty.chapter_search_or_play ?
+           ", UOP1 (TT_Play and PTT_Search) prohibited" : "",
+           tt_srpt->title[i].pb_ty.title_or_time_play ?
+           ", UOP0 (Time_Play and Time_Search) prohibited" : ""
+           );    
     printf("\tParental ID field: %04x\n",
-	   tt_srpt->title[i].parental_id);
+           tt_srpt->title[i].parental_id);
     printf("\tTitle set starting sector %08x\n", 
-	   tt_srpt->title[i].title_set_sector);
+           tt_srpt->title[i].title_set_sector);
   }
 }
 
@@ -877,16 +878,16 @@
 void ifoPrint_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
   int i, j;
   printf(" nr_of_srpts %i last byte %i\n", 
-	 vts_ptt_srpt->nr_of_srpts, 
-	 vts_ptt_srpt->last_byte);
+         vts_ptt_srpt->nr_of_srpts, 
+         vts_ptt_srpt->last_byte);
   for(i=0;i<vts_ptt_srpt->nr_of_srpts;i++) {
     printf("\nVTS_PTT number %d has a offset %d relative to VTS_PTT_SRPT\n", 
-				i + 1, vts_ptt_srpt->ttu_offset[i]);
+           i + 1, vts_ptt_srpt->ttu_offset[i]);
     for(j=0;j<vts_ptt_srpt->title[i].nr_of_ptts;j++) {
       printf("VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n",
-	     i + 1, j + 1, 
-	     vts_ptt_srpt->title[i].ptt[j].pgcn,
-	     vts_ptt_srpt->title[i].ptt[j].pgn );
+             i + 1, j + 1, 
+             vts_ptt_srpt->title[i].ptt[j].pgcn,
+             vts_ptt_srpt->title[i].ptt[j].pgn );
     }
   }
 }
@@ -903,18 +904,18 @@
     
     printf("Start byte: %i\n", ptl_mait->countries[i].pf_ptl_mai_start_byte);
     printf("Parental Masks for country: %c%c\n",
-	   ptl_mait->countries[i].country_code >> 8,
-	   ptl_mait->countries[i].country_code & 0xff);
+           ptl_mait->countries[i].country_code >> 8,
+           ptl_mait->countries[i].country_code & 0xff);
     
     for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) {
       if( vts == 0 ) {
-	printf("VMG    "); 
+        printf("VMG    "); 
       } else {
-	printf("VTS %2d ", vts);
+        printf("VTS %2d ", vts);
       }
       for(level = 0; level < 8; level++) {
-	printf("%d: %04x  ", level,
-	       ptl_mait->countries[i].pf_ptl_mai[vts][level] );
+        printf("%d: %04x  ", level,
+               ptl_mait->countries[i].pf_ptl_mai[vts][level] );
       }
       printf("\n");
     }
@@ -937,9 +938,9 @@
     for(j = 0; j < vts_tmapt->tmap[i].nr_of_entries; j++) {
       unsigned int ac_time = timeunit * (j + 1);
       printf("Time: %2i:%02i:%02i  VOBU Sector: 0x%08x %s\n", 
-	     ac_time / (60 * 60), (ac_time / 60) % 60, ac_time % 60,
-	     vts_tmapt->tmap[i].map_ent[j] & 0x7fffffff,
-	     (vts_tmapt->tmap[i].map_ent[j] >> 31) ? "discontinuity" : "");
+             ac_time / (60 * 60), (ac_time / 60) % 60, ac_time % 60,
+             vts_tmapt->tmap[i].map_ent[j] & 0x7fffffff,
+             (vts_tmapt->tmap[i].map_ent[j] >> 31) ? "discontinuity" : "");
     }
   }
 }
@@ -953,10 +954,10 @@
   
   for(i = 0; i < entries; i++) {
     printf("VOB ID: %3i, Cell ID: %3i   ", 
-	   c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
+           c_adt->cell_adr_table[i].vob_id, c_adt->cell_adr_table[i].cell_id);
     printf("Sector (first): 0x%08x   (last): 0x%08x\n",
-	   c_adt->cell_adr_table[i].start_sector, 
-	   c_adt->cell_adr_table[i].last_sector);
+           c_adt->cell_adr_table[i].start_sector, 
+           c_adt->cell_adr_table[i].last_sector);
   }
 }
 
@@ -967,7 +968,7 @@
   entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4;
   for(i = 0; i < entries; i++) {
     printf("VOBU %5i  First sector: 0x%08x\n", i + 1,
-	   vobu_admap->vobu_start_sectors[i]);
+           vobu_admap->vobu_start_sectors[i]);
   }
 }
 
@@ -990,9 +991,9 @@
   printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus);
   for(i = 0; i < pgci_ut->nr_of_lus; i++) {
     printf("\nMenu Language Code: %c%c (%c)\n",
-	   pgci_ut->lu[i].lang_code >> 8,
-	   pgci_ut->lu[i].lang_code & 0xff,
-	   pgci_ut->lu[i].lang_extension ? pgci_ut->lu[i].lang_extension :' ');
+           pgci_ut->lu[i].lang_code >> 8,
+           pgci_ut->lu[i].lang_code & 0xff,
+           pgci_ut->lu[i].lang_extension ? pgci_ut->lu[i].lang_extension :' ');
     printf("Menu Existence: %02x\n", pgci_ut->lu[i].exists);
     ifoPrint_PGCIT(pgci_ut->lu[i].pgcit);
   }
@@ -1008,14 +1009,14 @@
   ifoPrint_video_attributes(&vts_attributes->vtsm_vobs_attr);
   printf("\n");
   printf("Number of Audio streams: %i\n", 
-	 vts_attributes->nr_of_vtsm_audio_streams);
+         vts_attributes->nr_of_vtsm_audio_streams);
   if(vts_attributes->nr_of_vtsm_audio_streams > 0) {
     printf("\tstream %i attributes: ", 1);
     ifoPrint_audio_attributes(&vts_attributes->vtsm_audio_attr);
     printf("\n");
   }
   printf("Number of Subpicture streams: %i\n", 
-	 vts_attributes->nr_of_vtsm_subp_streams);
+         vts_attributes->nr_of_vtsm_subp_streams);
   if(vts_attributes->nr_of_vtsm_subp_streams > 0) {
     printf("\tstream %2i attributes: ", 1);
     ifoPrint_subp_attributes(&vts_attributes->vtsm_subp_attr);
@@ -1026,7 +1027,7 @@
   ifoPrint_video_attributes(&vts_attributes->vtstt_vobs_video_attr);
   printf("\n");
   printf("Number of Audio streams: %i\n", 
-	 vts_attributes->nr_of_vtstt_audio_streams);
+         vts_attributes->nr_of_vtstt_audio_streams);
   for(i = 0; i < vts_attributes->nr_of_vtstt_audio_streams; i++) {
     printf("\tstream %i attributes: ", i);
     ifoPrint_audio_attributes(&vts_attributes->vtstt_audio_attr[i]);
@@ -1034,7 +1035,7 @@
   }
   
   printf("Number of Subpicture streams: %i\n", 
-	 vts_attributes->nr_of_vtstt_subp_streams);
+         vts_attributes->nr_of_vtstt_subp_streams);
   for(i = 0; i < vts_attributes->nr_of_vtstt_subp_streams; i++) {
     printf("\tstream %2i attributes: ", i);    
     ifoPrint_subp_attributes(&vts_attributes->vtstt_subp_attr[i]);
@@ -1050,7 +1051,7 @@
   for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
     printf("\nVideo Title Set %i\n", i + 1);
     printf("  offset %d relative to VMG_VTS_ATRT\n", 
-	   vts_atrt->vts_atrt_offsets[i]);
+           vts_atrt->vts_atrt_offsets[i]);
     ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
   }
 }
@@ -1062,7 +1063,7 @@
   ifohandle = ifoOpen(dvd, title);
   if(!ifohandle) {
     if(dvdread_verbose(dvd) >= 0) {
-    fprintf(stderr, "Can't open info file for title %d\n", title);
+      fprintf(stderr, "Can't open info file for title %d\n", title);
     }
     return;
   }
@@ -1075,7 +1076,7 @@
 
     printf("\nFirst Play PGC\n--------------\n");
     if(ifohandle->first_play_pgc) {
-    ifoPrint_PGC(ifohandle->first_play_pgc);
+      ifoPrint_PGC(ifohandle->first_play_pgc);
     } else {
       printf("No First Play PGC present\n");
     }
--- a/dvdread/ifo_print.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/ifo_print.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef IFO_PRINT_H_INCLUDED
 #define IFO_PRINT_H_INCLUDED
 
--- a/dvdread/ifo_read.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/ifo_read.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003
  *               Björn Englund <d4bjorn@dtek.chalmers.se>, 
@@ -47,19 +48,19 @@
 #endif
 
 #ifndef NDEBUG
-#define CHECK_ZERO0(arg) \
-  if(arg != 0) { \
+#define CHECK_ZERO0(arg)                                                \
+  if(arg != 0) {                                                        \
     fprintf(stderr, "*** Zero check failed in %s:%i\n    for %s = 0x%x\n", \
-            __FILE__, __LINE__, # arg, arg); \
+            __FILE__, __LINE__, # arg, arg);                            \
   }
-#define CHECK_ZERO(arg) \
-  if(memcmp(my_friendly_zeros, &arg, sizeof(arg))) { \
-    unsigned int i_CZ; \
-    fprintf(stderr, "*** Zero check failed in %s:%i\n    for %s = 0x", \
-            __FILE__, __LINE__, # arg ); \
-    for(i_CZ = 0; i_CZ < sizeof(arg); i_CZ++) \
-      fprintf(stderr, "%02x", *((uint8_t *)&arg + i_CZ)); \
-    fprintf(stderr, "\n"); \
+#define CHECK_ZERO(arg)                                                 \
+  if(memcmp(my_friendly_zeros, &arg, sizeof(arg))) {                    \
+    unsigned int i_CZ;                                                  \
+    fprintf(stderr, "*** Zero check failed in %s:%i\n    for %s = 0x",  \
+            __FILE__, __LINE__, # arg );                                \
+    for(i_CZ = 0; i_CZ < sizeof(arg); i_CZ++)                           \
+      fprintf(stderr, "%02x", *((uint8_t *)&arg + i_CZ));               \
+    fprintf(stderr, "\n");                                              \
   }
 static const uint8_t my_friendly_zeros[2048];
 #else
@@ -74,7 +75,7 @@
 static int ifoRead_PGC(ifo_handle_t *ifofile, pgc_t *pgc, unsigned int offset);
 static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, 
                                    pgc_command_tbl_t *cmd_tbl, 
-				   unsigned int offset);
+                                   unsigned int offset);
 static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile, 
                                    pgc_program_map_t *program_map, 
                                    unsigned int nr, unsigned int offset);
@@ -91,7 +92,7 @@
                                   unsigned int sector);
 static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, 
                                        vobu_admap_t *vobu_admap, 
-				       unsigned int sector);
+                                       unsigned int sector);
 static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit, 
                                   unsigned int offset);
 
@@ -140,19 +141,19 @@
 
     ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
     if(!ifoOpen_File(ifofile, title, "BUP")) {
-    if(title) {
+      if(title) {
         if(dvdread_verbose(dvd) >= 1) {
           fprintf(stderr, "libdvdread: Can't open file VTS_%02d_0.%s.\n", 
                   title, "BUP");
         }
-    } else {
+      } else {
         if(dvdread_verbose(dvd) >= 1) {
           fprintf(stderr, "libdvdread: Can't open file VIDEO_TS.%s.\n", "BUP");
         }
       }
       return NULL;
     }
-    }
+  }
   return ifofile;
 }
 
@@ -303,7 +304,7 @@
   
   if(title <= 0 || title > 99) {
     if(dvdread_verbose(dvd) >= 0) {
-    fprintf(stderr, "libdvdread: ifoOpenVTSI invalid title (%d).\n", title);
+      fprintf(stderr, "libdvdread: ifoOpenVTSI invalid title (%d).\n", title);
     }
     free(ifofile);
     errno = EINVAL;
@@ -451,12 +452,12 @@
   CHECK_VALUE(vmgi_mat->vmg_nr_of_title_sets != 0);
   CHECK_VALUE(vmgi_mat->vmgi_last_byte >= 341);
   CHECK_VALUE(vmgi_mat->vmgi_last_byte / DVD_BLOCK_LEN <= 
-         vmgi_mat->vmgi_last_sector);
+              vmgi_mat->vmgi_last_sector);
   /* It seems that first_play_pgc is optional. */
   CHECK_VALUE(vmgi_mat->first_play_pgc < vmgi_mat->vmgi_last_byte);
   CHECK_VALUE(vmgi_mat->vmgm_vobs == 0 || 
-        (vmgi_mat->vmgm_vobs > vmgi_mat->vmgi_last_sector &&
-         vmgi_mat->vmgm_vobs < vmgi_mat->vmg_last_sector));
+              (vmgi_mat->vmgm_vobs > vmgi_mat->vmgi_last_sector &&
+               vmgi_mat->vmgm_vobs < vmgi_mat->vmg_last_sector));
   CHECK_VALUE(vmgi_mat->tt_srpt <= vmgi_mat->vmgi_last_sector);
   CHECK_VALUE(vmgi_mat->vmgm_pgci_ut <= vmgi_mat->vmgi_last_sector);
   CHECK_VALUE(vmgi_mat->ptl_mait <= vmgi_mat->vmgi_last_sector);
@@ -546,11 +547,11 @@
   CHECK_VALUE(vtsi_mat->vtsi_last_sector*2 <= vtsi_mat->vts_last_sector);
   CHECK_VALUE(vtsi_mat->vtsi_last_byte/DVD_BLOCK_LEN <= vtsi_mat->vtsi_last_sector);
   CHECK_VALUE(vtsi_mat->vtsm_vobs == 0 || 
-       (vtsi_mat->vtsm_vobs > vtsi_mat->vtsi_last_sector &&
-         vtsi_mat->vtsm_vobs < vtsi_mat->vts_last_sector));
+              (vtsi_mat->vtsm_vobs > vtsi_mat->vtsi_last_sector &&
+               vtsi_mat->vtsm_vobs < vtsi_mat->vts_last_sector));
   CHECK_VALUE(vtsi_mat->vtstt_vobs == 0 || 
-        (vtsi_mat->vtstt_vobs > vtsi_mat->vtsi_last_sector &&
-         vtsi_mat->vtstt_vobs < vtsi_mat->vts_last_sector));
+              (vtsi_mat->vtstt_vobs > vtsi_mat->vtsi_last_sector &&
+               vtsi_mat->vtstt_vobs < vtsi_mat->vts_last_sector));
   CHECK_VALUE(vtsi_mat->vts_ptt_srpt <= vtsi_mat->vtsi_last_sector);
   CHECK_VALUE(vtsi_mat->vts_pgcit <= vtsi_mat->vtsi_last_sector);
   CHECK_VALUE(vtsi_mat->vtsm_pgci_ut <= vtsi_mat->vtsi_last_sector);
@@ -586,11 +587,11 @@
 
 static int ifoRead_PGC_COMMAND_TBL(ifo_handle_t *ifofile, 
                                    pgc_command_tbl_t *cmd_tbl, 
-				   unsigned int offset) {
+                                   unsigned int offset) {
   unsigned int total;
-  
+
   memset(cmd_tbl, 0, sizeof(pgc_command_tbl_t));
-  
+
   if(!DVDFileSeek_(ifofile->file, offset))
     return 0;
 
@@ -601,12 +602,12 @@
   B2N_16(cmd_tbl->nr_of_post);
   B2N_16(cmd_tbl->nr_of_cell);
   B2N_16(cmd_tbl->last_byte);
-
+  
   total = cmd_tbl->nr_of_pre + cmd_tbl->nr_of_post + cmd_tbl->nr_of_cell;
   CHECK_VALUE(PGC_COMMAND_TBL_SIZE + total * COMMAND_DATA_SIZE 
               <= cmd_tbl->last_byte + 1U);
   CHECK_VALUE(total <= 255);
-     
+
   if(cmd_tbl->nr_of_pre != 0) {
     unsigned int pre_cmds_size  = cmd_tbl->nr_of_pre * COMMAND_DATA_SIZE;
     cmd_tbl->pre_cmds = malloc(pre_cmds_size);
@@ -618,18 +619,18 @@
       return 0;
     }
   }
-  
+
   if(cmd_tbl->nr_of_post != 0) {
     unsigned int post_cmds_size = cmd_tbl->nr_of_post * COMMAND_DATA_SIZE;
     cmd_tbl->post_cmds = malloc(post_cmds_size);
     if(!cmd_tbl->post_cmds) {
       if(cmd_tbl->pre_cmds) 
-	free(cmd_tbl->pre_cmds);
+        free(cmd_tbl->pre_cmds);
       return 0;
     }
     if(!(DVDReadBytes(ifofile->file, cmd_tbl->post_cmds, post_cmds_size))) {
       if(cmd_tbl->pre_cmds) 
-	free(cmd_tbl->pre_cmds);
+        free(cmd_tbl->pre_cmds);
       free(cmd_tbl->post_cmds);
       return 0;
     }
@@ -640,16 +641,16 @@
     cmd_tbl->cell_cmds = malloc(cell_cmds_size);
     if(!cmd_tbl->cell_cmds) {
       if(cmd_tbl->pre_cmds)
-	free(cmd_tbl->pre_cmds);
+        free(cmd_tbl->pre_cmds);
       if(cmd_tbl->post_cmds)
-	free(cmd_tbl->post_cmds);
+        free(cmd_tbl->post_cmds);
       return 0;
     }
     if(!(DVDReadBytes(ifofile->file, cmd_tbl->cell_cmds, cell_cmds_size))) {
       if(cmd_tbl->pre_cmds) 
-	free(cmd_tbl->pre_cmds);
+        free(cmd_tbl->pre_cmds);
       if(cmd_tbl->post_cmds) 
-	free(cmd_tbl->post_cmds);
+        free(cmd_tbl->post_cmds);
       free(cmd_tbl->cell_cmds);
       return 0;
     }
@@ -676,7 +677,7 @@
 
 static int ifoRead_PGC_PROGRAM_MAP(ifo_handle_t *ifofile, 
                                    pgc_program_map_t *program_map, 
-				   unsigned int nr, unsigned int offset) {
+                                   unsigned int nr, unsigned int offset) {
   unsigned int size = nr * sizeof(pgc_program_map_t);
 
   if(!DVDFileSeek_(ifofile->file, offset))
@@ -708,9 +709,9 @@
     
     /* Changed < to <= because this was false in the movie 'Pi'. */
     CHECK_VALUE(cell_playback[i].last_vobu_start_sector <= 
-           cell_playback[i].last_sector);
+                cell_playback[i].last_sector);
     CHECK_VALUE(cell_playback[i].first_sector <= 
-           cell_playback[i].last_vobu_start_sector);
+                cell_playback[i].last_vobu_start_sector);
   }
 
   return 1;
@@ -809,9 +810,9 @@
       free(pgc->program_map);
       return 0;
     }
-  } else {
-    pgc->program_map = NULL;
-  }
+    } else {
+      pgc->program_map = NULL;
+    }
   } else {
     pgc->program_map = NULL;
   }
@@ -823,21 +824,21 @@
     if(!pgc->cell_playback) {
       ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
       if(pgc->program_map)
-	free(pgc->program_map);
+        free(pgc->program_map);
       return 0;
     }
     if(!ifoRead_CELL_PLAYBACK_TBL(ifofile, pgc->cell_playback, 
-				  pgc->nr_of_cells,
+                                  pgc->nr_of_cells,
                                   offset + pgc->cell_playback_offset)) {
       ifoFree_PGC_COMMAND_TBL(pgc->command_tbl);
       if(pgc->program_map)
-	free(pgc->program_map);
+        free(pgc->program_map);
       free(pgc->cell_playback);
       return 0;
     }
-  } else {
-    pgc->cell_playback = NULL;
-  }
+    } else {
+      pgc->cell_playback = NULL;
+    }
   } else {
     pgc->cell_playback = NULL;
   }
@@ -851,14 +852,14 @@
       return 0;
     }
     if(!ifoRead_CELL_POSITION_TBL(ifofile, pgc->cell_position, 
-				  pgc->nr_of_cells,
+                                  pgc->nr_of_cells,
                                   offset + pgc->cell_position_offset)) {
       ifoFree_PGC(pgc);
       return 0;
     }
-  } else {
-    pgc->cell_position = NULL;
-  }
+    } else {
+      pgc->cell_position = NULL;
+    }
   } else {
     pgc->cell_position = NULL;
   }
@@ -941,7 +942,7 @@
   
   if(!(DVDReadBytes(ifofile->file, tt_srpt, TT_SRPT_SIZE))) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: Unable to read read TT_SRPT.\n");
+      fprintf(stderr, "libdvdread: Unable to read read TT_SRPT.\n");
     }
     free(tt_srpt);
     return 0;
@@ -960,7 +961,7 @@
   }
   if(!(DVDReadBytes(ifofile->file, tt_srpt->title, info_length))) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: Unable to read read TT_SRPT.\n");
+      fprintf(stderr, "libdvdread: Unable to read read TT_SRPT.\n");
     }
     ifoFree_TT_SRPT(ifofile);
     return 0;
@@ -1036,7 +1037,7 @@
     return 0;
     
   if(!DVDFileSeek_(ifofile->file,
-		   ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN))
+                   ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN))
     return 0;
 
   vts_ptt_srpt = malloc(sizeof(vts_ptt_srpt_t));
@@ -1047,7 +1048,7 @@
 
   if(!(DVDReadBytes(ifofile->file, vts_ptt_srpt, VTS_PTT_SRPT_SIZE))) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
+      fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
     }
     free(vts_ptt_srpt);
     return 0;
@@ -1070,7 +1071,7 @@
   }
   if(!(DVDReadBytes(ifofile->file, data, info_length))) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
+      fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
     }
     free(vts_ptt_srpt);
     free(data);
@@ -1203,7 +1204,7 @@
   CHECK_VALUE(ptl_mait->nr_of_vtss != 0);
   CHECK_VALUE(ptl_mait->nr_of_vtss < 100); // ??  
   CHECK_VALUE(ptl_mait->nr_of_countries * PTL_MAIT_COUNTRY_SIZE 
-	      <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE);
+              <= ptl_mait->last_byte + 1 - PTL_MAIT_SIZE);
   
   info_length = ptl_mait->nr_of_countries * sizeof(ptl_mait_country_t);
   ptl_mait->countries = malloc(info_length);
@@ -1216,7 +1217,7 @@
   for(i = 0; i < ptl_mait->nr_of_countries; i++) {
     if(!(DVDReadBytes(ifofile->file, &ptl_mait->countries[i], PTL_MAIT_COUNTRY_SIZE))) {
       if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-      fprintf(stderr, "libdvdread: Unable to read PTL_MAIT.\n");
+        fprintf(stderr, "libdvdread: Unable to read PTL_MAIT.\n");
       }
       free(ptl_mait->countries);
       free(ptl_mait);
@@ -1241,10 +1242,10 @@
     uint16_t *pf_temp;
     
     if(!DVDFileSeek_(ifofile->file, 
-		     ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN
+                     ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN
                      + ptl_mait->countries[i].pf_ptl_mai_start_byte)) {
       if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-      fprintf(stderr, "libdvdread: Unable to seak PTL_MAIT table.\n");
+        fprintf(stderr, "libdvdread: Unable to seak PTL_MAIT table.\n");
       }
       free(ptl_mait->countries);
       free(ptl_mait);
@@ -1254,7 +1255,7 @@
     pf_temp = malloc(info_length);
     if(!pf_temp) {
       for(j = 0; j < i ; j++) {
-         free(ptl_mait->countries[j].pf_ptl_mai);
+        free(ptl_mait->countries[j].pf_ptl_mai);
       }
       free(ptl_mait->countries);
       free(ptl_mait);
@@ -1262,24 +1263,24 @@
     }
     if(!(DVDReadBytes(ifofile->file, pf_temp, info_length))) {
       if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-       fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table.\n");
+        fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table.\n");
       }
-       free(pf_temp);
-       for(j = 0; j < i ; j++) {
-	  free(ptl_mait->countries[j].pf_ptl_mai);
-       }
-       free(ptl_mait->countries);
-       free(ptl_mait);
-       return 0;
+      free(pf_temp);
+      for(j = 0; j < i ; j++) {
+        free(ptl_mait->countries[j].pf_ptl_mai);
+      }
+      free(ptl_mait->countries);
+      free(ptl_mait);
+      return 0;
     }
     for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) {
-        B2N_16(pf_temp[j]);
+      B2N_16(pf_temp[j]);
     }
     ptl_mait->countries[i].pf_ptl_mai = malloc(info_length);
     if(!ptl_mait->countries[i].pf_ptl_mai) {
       free(pf_temp);
       for(j = 0; j < i ; j++) {
-	free(ptl_mait->countries[j].pf_ptl_mai);
+        free(ptl_mait->countries[j].pf_ptl_mai);
       }
       free(ptl_mait->countries);
       free(ptl_mait);
@@ -1288,10 +1289,10 @@
     { /* Transpose the array so we can use C indexing. */
       int level, vts;
       for(level = 0; level < 8; level++) {
-	for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) {
-	  ptl_mait->countries[i].pf_ptl_mai[vts][level] =
-	    pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts];
-	}
+        for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) {
+          ptl_mait->countries[i].pf_ptl_mai[vts][level] =
+            pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts];
+        }
       }
       free(pf_temp);
     }
@@ -1307,7 +1308,7 @@
   
   if(ifofile->ptl_mait) {
     for(i = 0; i < ifofile->ptl_mait->nr_of_countries; i++) {
-       free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
+      free(ifofile->ptl_mait->countries[i].pf_ptl_mai);
     }
     free(ifofile->ptl_mait->countries);
     free(ifofile->ptl_mait);
@@ -1347,7 +1348,7 @@
   
   if(!(DVDReadBytes(ifofile->file, vts_tmapt, VTS_TMAPT_SIZE))) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
+      fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
     }
     free(vts_tmapt);
     ifofile->vts_tmapt = NULL;
@@ -1372,7 +1373,7 @@
   
   if(!(DVDReadBytes(ifofile->file, vts_tmap_srp, info_length))) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
+      fprintf(stderr, "libdvdread: Unable to read VTS_TMAPT.\n");
     }
     free(vts_tmap_srp);
     free(vts_tmapt);
@@ -1381,7 +1382,7 @@
   }
 
   for (i = 0; i < vts_tmapt->nr_of_tmaps; i++) {
-     B2N_32(vts_tmap_srp[i]); 
+    B2N_32(vts_tmap_srp[i]); 
   }
 
   
@@ -1405,7 +1406,7 @@
 
     if(!(DVDReadBytes(ifofile->file, &vts_tmapt->tmap[i], VTS_TMAP_SIZE))) {
       if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-      fprintf(stderr, "libdvdread: Unable to read VTS_TMAP.\n");
+        fprintf(stderr, "libdvdread: Unable to read VTS_TMAP.\n");
       }
       ifoFree_VTS_TMAPT(ifofile);
       return 0;
@@ -1429,7 +1430,7 @@
 
     if(!(DVDReadBytes(ifofile->file, vts_tmapt->tmap[i].map_ent, info_length))) {
       if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-      fprintf(stderr, "libdvdread: Unable to read VTS_TMAP_ENT.\n");
+        fprintf(stderr, "libdvdread: Unable to read VTS_TMAP_ENT.\n");
       }
       ifoFree_VTS_TMAPT(ifofile);
       return 0;
@@ -1451,7 +1452,7 @@
   if(ifofile->vts_tmapt) {  
     for(i = 0; i < ifofile->vts_tmapt->nr_of_tmaps; i++)
       if(ifofile->vts_tmapt->tmap[i].map_ent)
-	free(ifofile->vts_tmapt->tmap[i].map_ent);
+        free(ifofile->vts_tmapt->tmap[i].map_ent);
     free(ifofile->vts_tmapt->tmap);
     free(ifofile->vts_tmapt->tmap_offset);
     free(ifofile->vts_tmapt);
@@ -1542,7 +1543,7 @@
      is to high, they high ones are never referenced though. */
   if(info_length / sizeof(cell_adr_t) < c_adt->nr_of_vobs) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n");
+      fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n");
     }
     c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t);
   }
@@ -1567,7 +1568,7 @@
     CHECK_VALUE(c_adt->cell_adr_table[i].vob_id <= c_adt->nr_of_vobs);
     CHECK_VALUE(c_adt->cell_adr_table[i].cell_id > 0);
     CHECK_VALUE(c_adt->cell_adr_table[i].start_sector < 
-	   c_adt->cell_adr_table[i].last_sector);
+                c_adt->cell_adr_table[i].last_sector);
   }
 
   return 1;
@@ -1654,7 +1655,7 @@
 
 static int ifoRead_VOBU_ADMAP_internal(ifo_handle_t *ifofile, 
                                        vobu_admap_t *vobu_admap, 
-				       unsigned int sector) {
+                                       unsigned int sector) {
   unsigned int i;
   int info_length;
 
@@ -1678,7 +1679,7 @@
   }
   if(info_length && 
      !(DVDReadBytes(ifofile->file, 
-		    vobu_admap->vobu_start_sectors, info_length))) {
+                    vobu_admap->vobu_start_sectors, info_length))) {
     free(vobu_admap->vobu_start_sectors);
     return 0;
   }
@@ -1904,7 +1905,7 @@
     free(data);
     free(pgci_ut);
     ifofile->pgci_ut = 0;
-   return 0;
+    return 0;
   }
   ptr = data;
   for(i = 0; i < pgci_ut->nr_of_lus; i++) {
@@ -1918,7 +1919,7 @@
   for(i = 0; i < pgci_ut->nr_of_lus; i++) {
     // Maybe this is only defined for v1.1 and later titles?
     /* If the bits in 'lu[i].exists' are enumerated abcd efgh then:
-            VTS_x_yy.IFO        VIDEO_TS.IFO
+       VTS_x_yy.IFO        VIDEO_TS.IFO
        a == 0x83 "Root"         0x82 "Title"
        b == 0x84 "Subpicture"
        c == 0x85 "Audio"
@@ -2068,7 +2069,7 @@
   CHECK_VALUE(vts_atrt->nr_of_vtss != 0);
   CHECK_VALUE(vts_atrt->nr_of_vtss < 100); //??
   CHECK_VALUE((uint32_t)vts_atrt->nr_of_vtss * (4 + VTS_ATTRIBUTES_MIN_SIZE) + 
-         VTS_ATRT_SIZE < vts_atrt->last_byte + 1);
+              VTS_ATRT_SIZE < vts_atrt->last_byte + 1);
 
   info_length = vts_atrt->nr_of_vtss * sizeof(uint32_t);
   data = malloc(info_length);
@@ -2146,7 +2147,7 @@
     return 1;
 
   if(!DVDFileSeek_(ifofile->file, 
-		   ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN))
+                   ifofile->vmgi_mat->txtdt_mgi * DVD_BLOCK_LEN))
     return 0;
   
   txtdt_mgi = malloc(sizeof(txtdt_mgi_t));
@@ -2157,7 +2158,7 @@
 
   if(!(DVDReadBytes(ifofile->file, txtdt_mgi, TXTDT_MGI_SIZE))) {
     if(dvdread_verbose(device_of_file(ifofile->file)) >= 1) {
-    fprintf(stderr, "libdvdread: Unable to read TXTDT_MGI.\n");
+      fprintf(stderr, "libdvdread: Unable to read TXTDT_MGI.\n");
     }
     free(txtdt_mgi);
     ifofile->txtdt_mgi = 0;
--- a/dvdread/ifo_read.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/ifo_read.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef IFO_READ_H_INCLUDED
 #define IFO_READ_H_INCLUDED
 
--- a/dvdread/ifo_types.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/ifo_types.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef IFO_TYPES_H_INCLUDED
 #define IFO_TYPES_H_INCLUDED
 
--- a/dvdread/md5.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/md5.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /* md5.c - Functions to compute MD5 message digest of files or memory blocks
    according to the definition of MD5 in RFC 1321 from April 1992.
    Copyright (C) 1995, 1996, 2001 Free Software Foundation, Inc.
@@ -46,8 +47,8 @@
 #endif
 
 #ifdef WORDS_BIGENDIAN
-# define SWAP(n)							\
-    (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
+# define SWAP(n)                                                        \
+  (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
 #else
 # define SWAP(n) (n)
 #endif
@@ -116,7 +117,7 @@
   /* Put the 64-bit file length in *bits* at the end of the buffer.  */
   *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
   *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
-							(ctx->total[0] >> 29));
+                                                        (ctx->total[0] >> 29));
 
   /* Process last bytes.  */
   md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
@@ -145,29 +146,29 @@
   while (1)
     {
       /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
-	 computation function processes the whole buffer so that with the
-	 next round of the loop another block can be read.  */
+         computation function processes the whole buffer so that with the
+         next round of the loop another block can be read.  */
       size_t n;
       sum = 0;
 
       /* Read block.  Take care for partial reads.  */
       do
-	{
-	  n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+        {
+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
 
-	  sum += n;
-	}
+          sum += n;
+        }
       while (sum < BLOCKSIZE && n != 0);
       if (n == 0 && ferror (stream))
         return 1;
 
       /* If end of file is reached, end the loop.  */
       if (n == 0)
-	break;
+        break;
 
       /* Process buffer with BLOCKSIZE bytes.  Note that
-			BLOCKSIZE % 64 == 0
-       */
+         BLOCKSIZE % 64 == 0
+      */
       md5_process_block (buffer, BLOCKSIZE, &ctx);
     }
 
@@ -220,13 +221,13 @@
       ctx->buflen += add;
 
       if (left_over + add > 64)
-	{
-	  md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
-	  /* The regions in the following copy operation cannot overlap.  */
-	  memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
-		  (left_over + add) & 63);
-	  ctx->buflen = (left_over + add) & 63;
-	}
+        {
+          md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
+          /* The regions in the following copy operation cannot overlap.  */
+          memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+                  (left_over + add) & 63);
+          ctx->buflen = (left_over + add) & 63;
+        }
 
       buffer = (const char *) buffer + add;
       len -= add;
@@ -294,28 +295,28 @@
       md5_uint32 D_save = D;
 
       /* First round: using the given function, the context and a constant
-	 the next context is computed.  Because the algorithms processing
-	 unit is a 32-bit word and it is determined to work on words in
-	 little endian byte order we perhaps have to change the byte order
-	 before the computation.  To reduce the work for the next steps
-	 we store the swapped words in the array CORRECT_WORDS.  */
+         the next context is computed.  Because the algorithms processing
+         unit is a 32-bit word and it is determined to work on words in
+         little endian byte order we perhaps have to change the byte order
+         before the computation.  To reduce the work for the next steps
+         we store the swapped words in the array CORRECT_WORDS.  */
 
-#define OP(a, b, c, d, s, T)						\
-      do								\
-        {								\
-	  a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;		\
-	  ++words;							\
-	  a = rol (a, s);						\
-	  a += b;							\
-        }								\
+#define OP(a, b, c, d, s, T)                                    \
+      do                                                        \
+        {                                                       \
+          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;     \
+          ++words;                                              \
+          a = rol (a, s);                                       \
+          a += b;                                               \
+        }                                                       \
       while (0)
 
       /* Before we start, one word to the strange constants.
-	 They are defined in RFC 1321 as
+         They are defined in RFC 1321 as
 
-	 T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
-	 perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
-       */
+         T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
+         perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}'
+      */
 
       /* Round 1.  */
       OP (A, B, C, D,  7, 0xd76aa478);
@@ -336,16 +337,16 @@
       OP (B, C, D, A, 22, 0x49b40821);
 
       /* For the second to fourth round we have the possibly swapped words
-	 in CORRECT_WORDS.  Redefine the macro to take an additional first
-	 argument specifying the function to use.  */
+         in CORRECT_WORDS.  Redefine the macro to take an additional first
+         argument specifying the function to use.  */
 #undef OP
-#define OP(f, a, b, c, d, k, s, T)					\
-      do 								\
-	{								\
-	  a += f (b, c, d) + correct_words[k] + T;			\
-	  a = rol (a, s);						\
-	  a += b;							\
-	}								\
+#define OP(f, a, b, c, d, k, s, T)                      \
+      do                                                \
+        {                                               \
+          a += f (b, c, d) + correct_words[k] + T;      \
+          a = rol (a, s);                               \
+          a += b;                                       \
+        }                                               \
       while (0)
 
       /* Round 2.  */
--- a/dvdread/md5.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/md5.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /* md5.h - Declaration of functions and data types used for MD5 sum
    computing library functions.
    Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
@@ -54,17 +55,17 @@
 # endif
 
 # if UINT_MAX == UINT_MAX_32_BITS
-   typedef unsigned int md5_uint32;
+typedef unsigned int md5_uint32;
 # else
 #  if USHRT_MAX == UINT_MAX_32_BITS
-    typedef unsigned short md5_uint32;
+typedef unsigned short md5_uint32;
 #  else
 #   if ULONG_MAX == UINT_MAX_32_BITS
-     typedef unsigned long md5_uint32;
+typedef unsigned long md5_uint32;
 #   else
-     /* The following line is intended to evoke an error.
-        Using #error is not portable enough.  */
-     "Cannot determine unsigned 32-bit data type."
+/* The following line is intended to evoke an error.
+   Using #error is not portable enough.  */
+"Cannot determine unsigned 32-bit data type."
 #   endif
 #  endif
 # endif
@@ -72,9 +73,9 @@
 
 #undef __P
 #if defined (__STDC__) && __STDC__
-#define	__P(x) x
+#define __P(x) x
 #else
-#define	__P(x) ()
+#define __P(x) ()
 #endif
 
 /* Structure to save state of computation between the single steps.  */
@@ -104,14 +105,14 @@
    starting at BUFFER.
    It is necessary that LEN is a multiple of 64!!! */
 extern void md5_process_block __P ((const void *buffer, size_t len,
-				    struct md5_ctx *ctx));
+                                    struct md5_ctx *ctx));
 
 /* Starting with the result of former calls of this function (or the
    initialization function update the context for the next LEN bytes
    starting at BUFFER.
    It is NOT required that LEN is a multiple of 64.  */
 extern void md5_process_bytes __P ((const void *buffer, size_t len,
-				    struct md5_ctx *ctx));
+                                    struct md5_ctx *ctx));
 
 /* Process the remaining bytes in the buffer and put result from CTX
    in first 16 bytes following RESBUF.  The result is always in little
@@ -150,8 +151,8 @@
 rol(md5_uint32 x, int n)
 {
   __asm__("roll %%cl,%0"
-	  :"=r" (x)
-	  :"0" (x),"c" (n));
+          :"=r" (x)
+          :"0" (x),"c" (n));
   return x;
 }
 #else
--- a/dvdread/nav_print.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/nav_print.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Håkan Hjort <d95hjort@dtek.chalmers.se>
  *
@@ -46,10 +47,10 @@
   CHECK_VALUE((dtime->frame_u&0xf) < 0xa);
   
   printf("%02x:%02x:%02x.%02x", 
-	 dtime->hour,
-	 dtime->minute,
-	 dtime->second,
-	 dtime->frame_u & 0x3f);
+         dtime->hour,
+         dtime->minute,
+         dtime->second,
+         dtime->frame_u & 0x3f);
   switch((dtime->frame_u & 0xc0) >> 6) {
   case 1:
     rate = "25.00";
@@ -102,7 +103,7 @@
   for(i = 0; i < 9; i++)
     if(nsml_agli->nsml_agl_dsta[i])
       printf("nsml_agl_c%d_dsta  0x%08x\n", i + 1, 
-	     nsml_agli->nsml_agl_dsta[i]);
+             nsml_agli->nsml_agl_dsta[i]);
 }
 
 static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
@@ -143,8 +144,8 @@
   for(i = 0; i < 3; i++)
     for(j = 0; j < 2; j++)
       printf("btn_cqoli %d  %s_coli:  %08x\n",
-	     i, (j == 0) ? "sl" : "ac",
-	     btn_colit->btn_coli[i][j]);
+             i, (j == 0) ? "sl" : "ac",
+             btn_colit->btn_coli[i][j]);
 }
 
 static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) {
@@ -160,21 +161,21 @@
   for(i = 0; i < btngr_ns; i++) {
     for(j = 0; j < (36 / btngr_ns); j++) {
       if(j < btn_ns) {
-	btni_t *btni = &btni_table[(36 / btngr_ns) * i + j];
-	
-	printf("group %d btni %d:  ", i+1, j+1);
-	printf("btn_coln %d, auto_action_mode %d\n",
-	       btni->btn_coln, btni->auto_action_mode);
-	printf("coords   (%d, %d) .. (%d, %d)\n",
-	       btni->x_start, btni->y_start, btni->x_end, btni->y_end);
-	
-	printf("up %d, ", btni->up);
-	printf("down %d, ", btni->down);
-	printf("left %d, ", btni->left);
-	printf("right %d\n", btni->right);
-	
+        btni_t *btni = &btni_table[(36 / btngr_ns) * i + j];
+        
+        printf("group %d btni %d:  ", i+1, j+1);
+        printf("btn_coln %d, auto_action_mode %d\n",
+               btni->btn_coln, btni->auto_action_mode);
+        printf("coords   (%d, %d) .. (%d, %d)\n",
+               btni->x_start, btni->y_start, btni->x_end, btni->y_end);
+        
+        printf("up %d, ", btni->up);
+        printf("down %d, ", btni->down);
+        printf("left %d, ", btni->left);
+        printf("right %d\n", btni->right);
+        
         cmdPrint_CMD(0, &btni->cmd);
-	printf("\n");
+        printf("\n");
       }
     }
   }
@@ -238,14 +239,14 @@
   printf("sml_agli:\n");
   for(i = 0; i < 9; i++) {
     printf("agl_c%d address: 0x%08x size 0x%04x\n", i,
-	   sml_agli->data[i].address, sml_agli->data[i].size);
+           sml_agli->data[i].address, sml_agli->data[i].size);
   }
 }
 
 static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) {
   int i;
   int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11, 
-		     10,   9,  8,  7,  6,  5,  4,  3,  2, 1};
+                    10,   9,  8,  7,  6,  5,  4,  3,  2, 1};
   printf("vobu_sri:\n");
   printf("Next VOBU with Video %08x\n", vobu_sri->next_video);
   for(i = 0; i < 19; i++) {
--- a/dvdread/nav_print.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/nav_print.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef NAV_PRINT_H_INCLUDED
 #define NAV_PRINT_H_INCLUDED
 
--- a/dvdread/nav_read.c	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/nav_read.c	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Håkan Hjort <d95hjort@dtek.chalmers.se>
  *
@@ -109,7 +110,7 @@
     CHECK_VALUE(pci->hli.hl_gi.btngr_ns != 0); 
   } else {
     CHECK_VALUE((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0) 
-	   || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0));
+                || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0));
   }
 
   /* pci hli btnit */
@@ -123,28 +124,28 @@
       CHECK_VALUE(pci->hli.btnit[n].zero5 == 0);
       CHECK_VALUE(pci->hli.btnit[n].zero6 == 0);
       
-      if (j < pci->hli.hl_gi.btn_ns) {	
-	CHECK_VALUE(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end);
-	CHECK_VALUE(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end);
-	CHECK_VALUE(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns);
-	CHECK_VALUE(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns);
-	CHECK_VALUE(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns);
-	CHECK_VALUE(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns);
-	//vmcmd_verify(pci->hli.btnit[n].cmd);
+      if (j < pci->hli.hl_gi.btn_ns) {  
+        CHECK_VALUE(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end);
+        CHECK_VALUE(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end);
+        CHECK_VALUE(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns);
+        CHECK_VALUE(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns);
+        CHECK_VALUE(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns);
+        CHECK_VALUE(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns);
+        //vmcmd_verify(pci->hli.btnit[n].cmd);
       } else {
-	int k;
-	CHECK_VALUE(pci->hli.btnit[n].btn_coln == 0);
-	CHECK_VALUE(pci->hli.btnit[n].auto_action_mode == 0);
-	CHECK_VALUE(pci->hli.btnit[n].x_start == 0);
-	CHECK_VALUE(pci->hli.btnit[n].y_start == 0);
-	CHECK_VALUE(pci->hli.btnit[n].x_end == 0);
-	CHECK_VALUE(pci->hli.btnit[n].y_end == 0);
-	CHECK_VALUE(pci->hli.btnit[n].up == 0);
-	CHECK_VALUE(pci->hli.btnit[n].down == 0);
-	CHECK_VALUE(pci->hli.btnit[n].left == 0);
-	CHECK_VALUE(pci->hli.btnit[n].right == 0);
-	for (k = 0; k < 8; k++)
-	  CHECK_VALUE(pci->hli.btnit[n].cmd.bytes[k] == 0); //CHECK_ZERO?
+        int k;
+        CHECK_VALUE(pci->hli.btnit[n].btn_coln == 0);
+        CHECK_VALUE(pci->hli.btnit[n].auto_action_mode == 0);
+        CHECK_VALUE(pci->hli.btnit[n].x_start == 0);
+        CHECK_VALUE(pci->hli.btnit[n].y_start == 0);
+        CHECK_VALUE(pci->hli.btnit[n].x_end == 0);
+        CHECK_VALUE(pci->hli.btnit[n].y_end == 0);
+        CHECK_VALUE(pci->hli.btnit[n].up == 0);
+        CHECK_VALUE(pci->hli.btnit[n].down == 0);
+        CHECK_VALUE(pci->hli.btnit[n].left == 0);
+        CHECK_VALUE(pci->hli.btnit[n].right == 0);
+        for (k = 0; k < 8; k++)
+          CHECK_VALUE(pci->hli.btnit[n].cmd.bytes[k] == 0); //CHECK_ZERO?
       }
     }
   }
--- a/dvdread/nav_read.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/nav_read.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef NAV_READ_H_INCLUDED
 #define NAV_READ_H_INCLUDED
 
--- a/dvdread/nav_types.h	Wed Aug 15 11:49:17 2007 +0000
+++ b/dvdread/nav_types.h	Wed Aug 15 11:57:30 2007 +0000
@@ -1,3 +1,4 @@
+/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */
 #ifndef NAV_TYPES_H_INCLUDED
 #define NAV_TYPES_H_INCLUDED
 
@@ -253,8 +254,8 @@
  * Seamless Angle Infromation for one angle
  */
 typedef struct {
-    uint32_t address; /**< offset to next ILVU, high bit is before/after */
-    uint16_t size;    /**< byte size of the ILVU pointed to by address */
+  uint32_t address; /**< offset to next ILVU, high bit is before/after */
+  uint16_t size;    /**< byte size of the ILVU pointed to by address */
 } ATTRIBUTE_PACKED sml_agl_data_t;
 
 /**