Ticket #8537: dvdnav_1206.resync.fixes.diff

File dvdnav_1206.resync.fixes.diff, 27.1 KB (added by robertm, 10 years ago)

dvdnav/read resync to 1204

  • mythtv/libs/libmythdvdnav/dvdnav/vm/vm.c

     
    5454#ifdef __OS2__
    5555#define INCL_DOS
    5656#include <os2.h>
     57#include <io.h>     /* setmode() */
     58#include <fcntl.h>  /* O_BINARY  */
    5759#endif
    5860
    5961/*
     
    144146    ULONG ulAction;
    145147    ULONG rc;
    146148
    147     rc = DosOpen( name, &hfile, &ulAction, 0, FILE_NORMAL,
     149    rc = DosOpenL(name, &hfile, &ulAction, 0, FILE_NORMAL,
    148150                  OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
    149151                  OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
    150                   NULL );
     152                  NULL);
    151153
    152     if( rc )
     154    if(rc)
    153155        return -1;
    154156
    155     return ( int )hfile;
     157    setmode(hfile, O_BINARY);
     158
     159    return (int)hfile;
    156160}
    157161#endif
    158162
     
    354358      fprintf(MSG_OUT, "libdvdnav: vm: failed to open/read the DVD\n");
    355359      return 0;
    356360    }
    357     dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
    358     vm->map  = remap_loadmap(vm->dvd_name);
    359361    vm->vmgi = ifoOpenVMGI(vm->dvd);
    360362    if(!vm->vmgi) {
    361363      fprintf(MSG_OUT, "libdvdnav: vm: failed to read VIDEO_TS.IFO\n");
     
    386388      /* return 0; Not really used for now.. */
    387389    }
    388390    /* ifoRead_TXTDT_MGI(vmgi); Not implemented yet */
     391    dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
     392    vm->map  = remap_loadmap(vm->dvd_name);
    389393  }
    390394  if (vm->vmgi) {
    391395    int i, mask;
     
    861865    break;
    862866  }
    863867}
     868#endif
    864869
    865 /* currently unused */
    866870void vm_get_subp_info(vm_t *vm, int *current, int *num_avail) {
    867871  switch ((vm->state).domain) {
    868872  case VTS_DOMAIN:
     
    905909    break;
    906910  }
    907911}
    908 #endif
    909912
    910913int vm_get_video_aspect(vm_t *vm) {
    911914  int aspect = vm_get_video_attr(vm).display_aspect_ratio;
     
    17171720/* Figure out the correct pgN from the cell and update (vm->state). */
    17181721static int set_PGN(vm_t *vm) {
    17191722  int new_pgN = 0;
     1723  int dummy, part;
    17201724
    17211725  while(new_pgN < (vm->state).pgc->nr_of_programs
    17221726        && (vm->state).cellN >= (vm->state).pgc->program_map[new_pgN])
     
    17331737    if((vm->state).TTN_REG > vm->vmgi->tt_srpt->nr_of_srpts)
    17341738      return 0; /* ?? */
    17351739    pb_ty = &vm->vmgi->tt_srpt->title[(vm->state).TTN_REG - 1].pb_ty;
    1736     if(pb_ty->multi_or_random_pgc_title == /* One_Sequential_PGC_Title */ 0) {
    1737       int dummy, part;
    17381740      vm_get_current_title_part(vm, &dummy, &part);
    17391741      (vm->state).PTTN_REG = part;
    1740     } else {
    1741       /* FIXME: Handle RANDOM or SHUFFLE titles.
    1742       fprintf(MSG_OUT, "libdvdnav: RANDOM or SHUFFLE titles are NOT handled yet.\n");
    1743       */
    1744     }
    17451742  }
    17461743  return 1;
    17471744}
  • mythtv/libs/libmythdvdnav/dvdnav/vm/vm.h

     
    160160/* currently unused */
    161161void vm_get_audio_info(vm_t *vm, int *current, int *num_avail);
    162162void vm_get_subp_info(vm_t *vm, int *current, int *num_avail);
     163#endif
    163164void vm_get_video_res(vm_t *vm, int *width, int *height);
    164 #endif
    165165int  vm_get_video_aspect(vm_t *vm);
    166166int  vm_get_video_scale_permission(vm_t *vm);
    167167int  vm_get_video_format(vm_t *vm);
  • mythtv/libs/libmythdvdnav/dvdnav/dvdnav.c

     
    845845  return retval;
    846846}
    847847
     848int dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *height) {
     849  int w, h;
     850
     851  if(!this->started) {
     852    printerr("Virtual DVD machine not started.");
     853    return -1;
     854  }
     855
     856  pthread_mutex_lock(&this->vm_lock);
     857  vm_get_video_res(this->vm, &w, &h);
     858  pthread_mutex_unlock(&this->vm_lock);
     859
     860  *width  = w;
     861  *height = h;
     862  return 0;
     863}
     864
    848865uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) {
    849866  uint8_t         retval;
    850867
  • mythtv/libs/libmythdvdnav/dvdnav/dvdnav_internal.h

     
    3434#define pthread_mutex_init(a, b) InitializeCriticalSection(a)
    3535#define pthread_mutex_lock(a)    EnterCriticalSection(a)
    3636#define pthread_mutex_unlock(a)  LeaveCriticalSection(a)
    37 #define pthread_mutex_destroy(a)
     37#define pthread_mutex_destroy(a) DeleteCriticalSection(a)
    3838
    3939#if HAVE_GETTIMEOFDAY == 0
    4040/* replacement gettimeofday implementation */
     
    6060#endif /* WIN32 */
    6161
    6262/* where should libdvdnav write its messages (stdout/stderr) */
    63 #define MSG_OUT stdout
     63#define MSG_OUT stderr
    6464
    6565/* Maximum length of an error string */
    6666#define MAX_ERR_LEN 255
  • mythtv/libs/libmythdvdnav/dvdnav/dvdnav.h

     
    561561uint8_t dvdnav_get_video_aspect(dvdnav_t *self);
    562562
    563563/*
     564 * Get video resolution.
     565 */
     566int dvdnav_get_video_resolution(dvdnav_t *self, uint32_t *width, uint32_t *height);
     567
     568/*
    564569 * Get video scaling permissions.
    565570 * The scaling permission does only change on VTS boundaries.
    566571 * See the DVDNAV_VTS_CHANGE event.
  • mythtv/libs/libmythdvdnav/dvdread/dvd_reader.c

     
    2020 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    2121 */
    2222
    23 #include "config.h"
    24 
    2523#include <sys/types.h>
    2624#include <sys/stat.h>
    2725#include <sys/time.h> /* For the timing of dvdcss_title crack. */
     
    3028#include <stdio.h>
    3129#include <errno.h>
    3230#include <string.h>
     31#include <ctype.h>
    3332#include <unistd.h>
    3433#include <limits.h>
    3534#include <dirent.h>
     
    5352#define lseek64 _lseeki64
    5453#endif
    5554
    56 #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DARWIN__)
     55#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__APPLE__)
    5756#define SYS_BSD 1
    5857#endif
    5958
     
    249248
    250249  if( have_css ) {
    251250    /* Only if DVDCSS_METHOD = title, a bit if it's disc or if
    252      * DVDCSS_METHOD = key but region missmatch. Unfortunaly we
     251     * DVDCSS_METHOD = key but region mismatch. Unfortunately we
    253252     * don't have that information. */
    254253
    255254    dvd->css_state = 1; /* Need key init. */
     
    304303#endif
    305304
    306305#if defined(SYS_BSD)
    307 /* FreeBSD /dev/(r)(a)cd0c (a is for atapi), recomended to _not_ use r
     306/* FreeBSD /dev/(r)(a)cd0c (a is for atapi), recommended to _not_ use r
     307   update: FreeBSD and DragonFly no longer uses the prefix so don't add it.
    308308   OpenBSD /dev/rcd0c, it needs to be the raw device
    309309   NetBSD  /dev/rcd0[d|c|..] d for x86, c (for non x86), perhaps others
    310310   Darwin  /dev/rdisk0,  it needs to be the raw device
    311    BSD/OS  /dev/sr0c (if not mounted) or /dev/rsr0c ('c' any letter will do) */
     311   BSD/OS  /dev/sr0c (if not mounted) or /dev/rsr0c ('c' any letter will do)
     312   returns a string allocated with strdup. It should be freed when no longer
     313   used. */
    312314static char *bsd_block2char( const char *path )
    313315{
     316#if defined(__FreeBSD__) || defined(__DragonFly__)
     317  return (char *) strdup( path );
     318#else
    314319  char *new_path;
    315320
    316321  /* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
     
    323328  strcat( new_path, path + strlen( "/dev/" ) );
    324329
    325330  return new_path;
     331#endif /* __FreeBSD__ || __DragonFly__ */
    326332}
    327333#endif
    328334
     
    330336dvd_reader_t *DVDOpen( const char *ppath )
    331337{
    332338  struct stat fileinfo;
    333   int ret, have_css;
     339  int ret, have_css, retval, cdir = -1;
    334340  dvd_reader_t *ret_val = NULL;
    335341  char *dev_name = NULL;
    336   char *path;
     342  char *path = NULL, *new_path = NULL, *path_copy = NULL;
    337343
    338 #ifdef _MSC_VER
     344#if defined(_WIN32) || defined(__OS2__)
    339345      int len;
    340346#endif
    341347
    342348  if( ppath == NULL )
    343     return 0;
     349    goto DVDOpen_error;
    344350
    345351      path = strdup(ppath);
    346352  if( path == NULL )
    347     return 0;
     353    goto DVDOpen_error;
    348354
    349355  /* Try to open libdvdcss or fall back to standard functions */
    350356  have_css = dvdinput_setup();
    351357
    352 #ifdef _MSC_VER
     358#if defined(_WIN32) || defined(__OS2__)
    353359  /* Strip off the trailing \ if it is not a drive */
    354360  len = strlen(path);
    355361  if ((len > 1) &&
     
    374380    /* If we can't stat the file, give up */
    375381    fprintf( stderr, "libdvdread: Can't stat %s\n", path );
    376382    perror("");
    377     free(path);
    378     return NULL;
     383    goto DVDOpen_error;
    379384  }
    380385
    381386  /* First check if this is a block/char device or a file*/
     
    386391    /**
    387392     * Block devices and regular files are assumed to be DVD-Video images.
    388393     */
     394    dvd_reader_t *dvd = NULL;
    389395#if defined(__sun)
    390     ret_val = DVDOpenImageFile( sun_block2char( path ), have_css );
     396    dev_name = sun_block2char( path );
    391397#elif defined(SYS_BSD)
    392     ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css );
     398    dev_name = bsd_block2char( path );
    393399#else
    394     ret_val = DVDOpenImageFile( path, have_css );
     400    dev_name = strdup( path );
    395401#endif
    396 
     402    dvd = DVDOpenImageFile( dev_name, have_css );
     403    free( dev_name );
    397404    free(path);
    398     return ret_val;
    399 
     405    return dvd;
    400406  } else if( S_ISDIR( fileinfo.st_mode ) ) {
    401407    dvd_reader_t *auth_drive = 0;
    402     char *path_copy;
    403408#if defined(SYS_BSD)
    404409    struct fstab* fe;
    405410#elif defined(__sun) || defined(__linux__)
     
    407412#endif
    408413
    409414    /* XXX: We should scream real loud here. */
    410     if( !(path_copy = strdup( path ) ) ) {
    411       free(path);
    412       return NULL;
    413     }
     415    if( !(path_copy = strdup( path ) ) )
     416      goto DVDOpen_error;
    414417
    415418#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
    416419              /* Also WIN32 does not have symlinks, so we don't need this bit of code. */
    417420
    418     /* Resolve any symlinks and get the absolut dir name. */
     421    /* Resolve any symlinks and get the absolute dir name. */
    419422    {
    420       char *new_path;
    421       int cdir = open( ".", O_RDONLY );
    422 
    423       if( cdir >= 0 ) {
    424         chdir( path_copy );
     423      if( ( cdir  = open( ".", O_RDONLY ) ) >= 0 ) {
     424        if( chdir( path_copy ) == -1 ) {
     425          goto DVDOpen_error;
     426        }
    425427        new_path = malloc(PATH_MAX+1);
    426428        if(!new_path) {
    427           free(path);
    428           return NULL;
     429          goto DVDOpen_error;
    429430        }
    430         getcwd(new_path, PATH_MAX );
    431         fchdir( cdir );
     431        if( getcwd( new_path, PATH_MAX ) == NULL ) {
     432          goto DVDOpen_error;
     433        }
     434        retval = fchdir( cdir );
    432435        close( cdir );
    433           free( path_copy );
    434           path_copy = new_path;
     436        cdir = -1;
     437        if( retval == -1 ) {
     438          goto DVDOpen_error;
     439        }
     440        path_copy = new_path;
     441        new_path = NULL;
    435442      }
    436443    }
    437444#endif
    438445
    439446    /**
    440447     * If we're being asked to open a directory, check if that directory
    441      * is the mountpoint for a DVD-ROM which we can use instead.
     448     * is the mount point for a DVD-ROM which we can use instead.
    442449     */
    443450
    444451    if( strlen( path_copy ) > 1 ) {
     
    447454      }
    448455    }
    449456
     457#if defined(_WIN32) || defined(__OS2__)
     458    if(strlen(path_copy) > TITLES_MAX) {
     459      if(!strcasecmp(&(path_copy[strlen( path_copy ) - TITLES_MAX]),
     460                       "\\video_ts"))
     461        path_copy[strlen(path_copy) - (TITLES_MAX-1)] = '\0';
     462    }
     463#endif
    450464    if( strlen( path_copy ) > TITLES_MAX ) {
    451465      if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
    452466                       "/video_ts" ) ) {
     
    508522      }
    509523      fclose( mntfile );
    510524    }
    511 #elif defined(_MSC_VER) || defined(__OS2__)
     525#elif defined(_WIN32) || defined(__OS2__)
     526#ifdef __OS2__
     527    /* Use DVDOpenImageFile() only if it is a drive */
     528    if(isalpha(path[0]) && path[1] == ':' &&
     529        ( !path[2] ||
     530          ((path[2] == '\\' || path[2] == '/') && !path[3])))
     531#endif
    512532    auth_drive = DVDOpenImageFile( path, have_css );
    513533#endif
    514534
    515 #if !defined(_MSC_VER) && !defined(__OS2__)
     535#if !defined(_WIN32) && !defined(__OS2__)
    516536    if( !dev_name ) {
    517537      fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
    518538    } else if( !auth_drive ) {
     
    522542#else
    523543    if( !auth_drive ) {
    524544        fprintf( stderr, "libdvdread: Device %s inaccessible, "
    525                  "CSS authentication not available.\n", dev_name );
     545                 "CSS authentication not available.\n", path );
    526546    }
    527547#endif
    528548
    529549    free( dev_name );
     550    dev_name = NULL;
    530551    free( path_copy );
     552    path_copy = NULL;
    531553
    532554    /**
    533555     * If we've opened a drive, just use that.
     
    544566      return ret_val;
    545567  }
    546568
     569DVDOpen_error:
    547570  /* If it's none of the above, screw it. */
    548571  fprintf( stderr, "libdvdread: Could not open %s\n", path );
     572  if( path != NULL )
    549573    free( path );
     574  if ( path_copy != NULL )
     575    free( path_copy );
     576  if ( cdir >= 0 )
     577    close( cdir );
     578  if ( new_path != NULL )
     579    free( new_path );
    550580  return NULL;
    551581}
    552582
     
    875905  int i;
    876906
    877907  if( dvd_file ) {
    878     if( dvd_file->dvd->isImageFile ) {
    879       ;
    880     } else {
     908    if( !dvd_file->dvd->isImageFile ) {
    881909      for( i = 0; i < TITLES_MAX; ++i ) {
    882910        if( dvd_file->title_devs[ i ] ) {
    883911          dvdinput_close( dvd_file->title_devs[i] );
     
    890918  }
    891919}
    892920
     921static int DVDFileStatVOBUDF( dvd_reader_t *dvd, int title,
     922                              int menu, dvd_stat_t *statbuf )
     923{
     924  char filename[ MAX_UDF_FILE_NAME_LEN ];
     925  uint32_t size;
     926  off_t tot_size;
     927  off_t parts_size[ 9 ];
     928  int nr_parts = 0;
     929  int n;
     930
     931  if( title == 0 )
     932    sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
     933  else
     934    sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
     935
     936  if( !UDFFindFile( dvd, filename, &size ) )
     937    return -1;
     938
     939  tot_size = size;
     940  nr_parts = 1;
     941  parts_size[ 0 ] = size;
     942
     943  if( !menu ) {
     944    int cur;
     945
     946    for( cur = 2; cur < 10; cur++ ) {
     947      sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, cur );
     948      if( !UDFFindFile( dvd, filename, &size ) )
     949        break;
     950
     951      parts_size[ nr_parts ] = size;
     952      tot_size += size;
     953      nr_parts++;
     954    }
     955  }
     956
     957  statbuf->size = tot_size;
     958  statbuf->nr_parts = nr_parts;
     959  for( n = 0; n < nr_parts; n++ )
     960    statbuf->parts_size[ n ] = parts_size[ n ];
     961
     962  return 0;
     963}
     964
     965
     966static int DVDFileStatVOBPath( dvd_reader_t *dvd, int title,
     967                               int menu, dvd_stat_t *statbuf )
     968{
     969  char filename[ MAX_UDF_FILE_NAME_LEN ];
     970  char full_path[ PATH_MAX + 1 ];
     971  struct stat fileinfo;
     972  off_t tot_size;
     973  off_t parts_size[ 9 ];
     974  int nr_parts = 0;
     975  int n;
     976
     977  if( title == 0 )
     978    sprintf( filename, "VIDEO_TS.VOB" );
     979  else
     980    sprintf( filename, "VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
     981
     982  if( !findDVDFile( dvd, filename, full_path ) )
     983    return -1;
     984
     985  if( stat( full_path, &fileinfo ) < 0 ) {
     986    fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
     987    return -1;
     988  }
     989
     990  tot_size = fileinfo.st_size;
     991  nr_parts = 1;
     992  parts_size[ 0 ] = fileinfo.st_size;
     993
     994  if( !menu ) {
     995    int cur;
     996    for( cur = 2; cur < 10; cur++ ) {
     997      sprintf( filename, "VTS_%02d_%d.VOB", title, cur );
     998      if( !findDVDFile( dvd, filename, full_path ) )
     999        break;
     1000
     1001      if( stat( full_path, &fileinfo ) < 0 ) {
     1002        fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
     1003        break;
     1004      }
     1005
     1006      parts_size[ nr_parts ] = fileinfo.st_size;
     1007      tot_size += parts_size[ nr_parts ];
     1008      nr_parts++;
     1009    }
     1010  }
     1011
     1012  statbuf->size = tot_size;
     1013  statbuf->nr_parts = nr_parts;
     1014  for( n = 0; n < nr_parts; n++ )
     1015    statbuf->parts_size[ n ] = parts_size[ n ];
     1016
     1017  return 0;
     1018}
     1019
     1020
     1021int DVDFileStat( dvd_reader_t *dvd, int titlenum,
     1022                 dvd_read_domain_t domain, dvd_stat_t *statbuf )
     1023{
     1024  char filename[ MAX_UDF_FILE_NAME_LEN ];
     1025  char full_path[ PATH_MAX + 1 ];
     1026  struct stat fileinfo;
     1027  uint32_t size;
     1028
     1029  /* Check arguments. */
     1030  if( dvd == NULL || titlenum < 0 ) {
     1031    errno = EINVAL;
     1032    return -1;
     1033  }
     1034
     1035  switch( domain ) {
     1036  case DVD_READ_INFO_FILE:
     1037    if( titlenum == 0 )
     1038      sprintf( filename, "/VIDEO_TS/VIDEO_TS.IFO" );
     1039    else
     1040      sprintf( filename, "/VIDEO_TS/VTS_%02i_0.IFO", titlenum );
     1041
     1042    break;
     1043  case DVD_READ_INFO_BACKUP_FILE:
     1044    if( titlenum == 0 )
     1045      sprintf( filename, "/VIDEO_TS/VIDEO_TS.BUP" );
     1046    else
     1047      sprintf( filename, "/VIDEO_TS/VTS_%02i_0.BUP", titlenum );
     1048
     1049    break;
     1050  case DVD_READ_MENU_VOBS:
     1051    if( dvd->isImageFile )
     1052      return DVDFileStatVOBUDF( dvd, titlenum, 1, statbuf );
     1053    else
     1054      return DVDFileStatVOBPath( dvd, titlenum, 1, statbuf );
     1055
     1056    break;
     1057  case DVD_READ_TITLE_VOBS:
     1058    if( titlenum == 0 )
     1059      return -1;
     1060
     1061    if( dvd->isImageFile )
     1062      return DVDFileStatVOBUDF( dvd, titlenum, 0, statbuf );
     1063    else
     1064      return DVDFileStatVOBPath( dvd, titlenum, 0, statbuf );
     1065
     1066    break;
     1067  default:
     1068    fprintf( stderr, "libdvdread: Invalid domain for file stat.\n" );
     1069    errno = EINVAL;
     1070    return -1;
     1071  }
     1072
     1073  if( dvd->isImageFile ) {
     1074    if( UDFFindFile( dvd, filename, &size ) ) {
     1075      statbuf->size = size;
     1076      statbuf->nr_parts = 1;
     1077      statbuf->parts_size[ 0 ] = size;
     1078      return 0;
     1079    }
     1080  } else {
     1081    if( findDVDFile( dvd, filename, full_path ) ) {
     1082      if( stat( full_path, &fileinfo ) < 0 )
     1083        fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
     1084      else {
     1085        statbuf->size = fileinfo.st_size;
     1086        statbuf->nr_parts = 1;
     1087        statbuf->parts_size[ 0 ] = statbuf->size;
     1088        return 0;
     1089      }
     1090    }
     1091  }
     1092  return -1;
     1093}
     1094
    8931095/* Internal, but used from dvd_udf.c */
    8941096int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
    8951097                      size_t block_count, unsigned char *data,
  • mythtv/libs/libmythdvdnav/dvdread/nav_print.c

     
    2323 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    2424 */
    2525
    26 #include "config.h"
    27 
    2826#include <stdio.h>
    2927#include <inttypes.h>
    3028
  • mythtv/libs/libmythdvdnav/dvdread/dvd_input.h

     
    3131
    3232typedef struct dvd_input_s *dvd_input_t;
    3333
     34#if defined( __MINGW32__ )
     35#   undef  lseek
     36#   define lseek  _lseeki64
     37#   undef  off_t
     38#   define off_t off64_t
     39#   undef  stat
     40#   define stat  _stati64
     41#   define fstat _fstati64
     42#   define wstat _wstati64
     43#endif
     44
    3445/**
    3546 * Function pointers that will be filled in by the input implementation.
    3647 * These functions provide the main API.
  • mythtv/libs/libmythdvdnav/dvdread/bitreader.c

     
    1818 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    1919 */
    2020
    21 #include "config.h"
    22 
    2321#include <stdio.h>
    2422#include <stdlib.h>
    2523#include <string.h>
  • mythtv/libs/libmythdvdnav/dvdread/dvd_reader.h

     
    7070typedef struct dvd_file_s dvd_file_t;
    7171
    7272/**
     73 * Public type that is used to provide statistics on a handle.
     74 */
     75typedef struct {
     76  off_t size;          /**< Total size of file in bytes */
     77  int nr_parts;        /**< Number of file parts */
     78  off_t parts_size[9]; /**< Size of each part in bytes */
     79} dvd_stat_t;
     80
     81/**
    7382 * Opens a block device of a DVD-ROM file, or an image file, or a directory
    7483 * name for a mounted DVD or HD copy of a DVD.
    7584 *
     
    117126} dvd_read_domain_t;
    118127
    119128/**
     129 * Stats a file on the DVD given the title number and domain.
     130 * The information about the file is stored in a dvd_stat_t
     131 * which contains information about the size of the file and
     132 * the number of parts in case of a multipart file and the respective
     133 * sizes of the parts.
     134 * A multipart file is for instance VTS_02_1.VOB, VTS_02_2.VOB, VTS_02_3.VOB
     135 * The size of VTS_02_1.VOB will be stored in stat->parts_size[0],
     136 * VTS_02_2.VOB in stat->parts_size[1], ...
     137 * The total size (sum of all parts) is stored in stat->size and
     138 * stat->nr_parts will hold the number of parts.
     139 * Only DVD_READ_TITLE_VOBS (VTS_??_[1-9].VOB) can be multipart files.
     140 *
     141 * This function is only of use if you want to get the size of each file
     142 * in the filesystem. These sizes are not needed to use any other
     143 * functions in libdvdread.
     144 *
     145 * @param dvd  A dvd read handle.
     146 * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0.
     147 * @param domain Which domain.
     148 * @param stat Pointer to where the result is stored.
     149 * @return If successful 0, otherwise -1.
     150 *
     151 * int DVDFileStat(dvd, titlenum, domain, stat);
     152 */
     153int DVDFileStat(dvd_reader_t *, int, dvd_read_domain_t, dvd_stat_t *);
     154
     155/**
    120156 * Opens a file on the DVD given the title number and domain.
    121157 *
    122158 * If the title number is 0, the video manager information is opened
  • mythtv/libs/libmythdvdnav/dvdread/dvdread_internal.h

     
    1919#ifndef LIBDVDREAD_DVDREAD_INTERNAL_H
    2020#define LIBDVDREAD_DVDREAD_INTERNAL_H
    2121
    22 #ifdef _MSC_VER
     22#ifdef _WIN32
    2323#include <unistd.h>
    24 #endif /* _MSC_VER */
     24#endif /* _WIN32 */
    2525
    2626#define CHECK_VALUE(arg)                                                \
    2727  if(!(arg)) {                                                          \
  • mythtv/libs/libmythdvdnav/dvdread/dvd_udf.c

     
    2828 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    2929 */
    3030
    31 #include "config.h"
    32 
    3331#include <stdio.h>
    3432#include <stdlib.h>
    3533#include <string.h>
     
    445443
    446444  L_EA = GETN4( 168 );
    447445  L_AD = GETN4( 172 );
     446
     447  if (176 + L_EA + L_AD > DVD_VIDEO_LB_LEN)
     448    return 0;
     449
    448450  p = 176 + L_EA;
    449451  while( p < 176 + L_EA + L_AD ) {
    450452    switch( flags & 0x0007 ) {
     
    928930  if(GetUDFCache(device, PVDCache, 0, pvd))
    929931    return 1;
    930932
    931   if(!UDFGetDescriptor( device, 1, pvd_buf,
    932                     sizeof(pvd_buf_base) - (pvd_buf - pvd_buf_base)))
     933  if(!UDFGetDescriptor( device, 1, pvd_buf, DVD_VIDEO_LB_LEN))
    933934    return 0;
    934935
    935936  memcpy(pvd->VolumeIdentifier, &pvd_buf[24], 32);
  • mythtv/libs/libmythdvdnav/dvdread/md5.c

     
    2020
    2121/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
    2222
    23 #ifdef HAVE_CONFIG_H
    24 # include <config.h>
    25 #endif
    26 
    2723#include <sys/types.h>
    2824
    2925#include <stdlib.h>
  • mythtv/libs/libmythdvdnav/dvdread/ifo_print.c

     
    130130    printf("(please send a bug report), ");
    131131  }
    132132
    133   // Wide is allways allowed..!!!
     133  // Wide is always allowed..!!!
    134134  switch(attr->permitted_df) {
    135135  case 0:
    136136    printf("pan&scan+letterboxed, ");
     
    328328  case 1: // Normal audio
    329329    printf("Normal Caption ");
    330330    break;
    331   case 2: // visually imparied
     331  case 2: // visually impaired
    332332    printf("Audio for visually impaired ");
    333333    break;
    334334  case 3: // Directors 1
     
    685685        break;
    686686      case 2:
    687687      case 3:
    688         printf("(send bug repport) ");
     688        printf("(send bug report) ");
    689689        break;
    690690      }
    691691    }
     
    781781    }
    782782  }
    783783
    784   /* Memmory offsets to div. tables. */
     784  /* Memory offsets to div. tables. */
    785785  ifoPrint_PGC_COMMAND_TBL(pgc->command_tbl);
    786786  ifoPrint_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
    787787  ifoPrint_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
     
    806806    printf("\tTitle playback type: (%02x)\n",
    807807           *(uint8_t *)&(tt_srpt->title[i].pb_ty));
    808808    printf("\t\t%s\n",
    809            tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequencial");
     809           tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequential");
    810810    if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n");
    811811    if (tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd) printf("\t\tJump/Link/Call exists in pre/post cmd\n");
    812812    if (tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd) printf("\t\tJump/Link/Call exists in button cmd\n");
     
    11091109      printf("No PGCI Unit table present\n");
    11101110    }
    11111111
    1112     printf("\nParental Manegment Information table\n");
     1112    printf("\nParental Management Information table\n");
    11131113    printf(  "------------------------------------\n");
    11141114    if(ifohandle->ptl_mait) {
    11151115      ifoPrint_PTL_MAIT(ifohandle->ptl_mait);
     
    11291129      printf("No Text Data Manager Information present\n");
    11301130    }
    11311131
    1132     printf("\nMenu Cell Adress table\n");
     1132
     1133    printf("\nMenu Cell Address table\n");
    11331134    printf(  "-----------------\n");
    11341135    if(ifohandle->menu_c_adt) {
    11351136      ifoPrint_C_ADT(ifohandle->menu_c_adt);
    11361137    } else {
    1137       printf("No Menu Cell Adress table present\n");
     1138      printf("No Menu Cell Address table present\n");
    11381139    }
    11391140
    11401141    printf("\nVideo Manager Menu VOBU address map\n");
     
    11761177      printf("No VTS Time Map table present\n");
    11771178    }
    11781179
    1179     printf("\nMenu Cell Adress table\n");
     1180    printf("\nMenu Cell Address table\n");
    11801181    printf(  "-----------------\n");
    11811182    if(ifohandle->menu_c_adt) {
    11821183      ifoPrint_C_ADT(ifohandle->menu_c_adt);
    11831184    } else {
    1184       printf("No Cell Adress table present\n");
     1185      printf("No Cell Address table present\n");
    11851186    }
    11861187
    11871188    printf("\nVideo Title Set Menu VOBU address map\n");
  • mythtv/libs/libmythdvdnav/dvdread/dvd_input.c

     
    1919 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    2020 */
    2121
    22 #include "config.h"
    23 
    2422#include <stdio.h>
    2523#include <stdlib.h>
    2624#include <fcntl.h>
    2725#include <unistd.h>
    2826
     27#include "config.h"
    2928#include "dvdread/dvd_reader.h"
    3029#include "dvd_input.h"
    3130
     
    170169  }
    171170
    172171  /* Open the device */
    173 #ifndef WIN32
     172#if !defined(WIN32) && !defined(__OS2__)
    174173  dev->fd = open(target, O_RDONLY);
    175174#else
    176175  dev->fd = open(target, O_RDONLY | O_BINARY);