Ticket #5370: dvd-movie-protect.patch

File dvd-movie-protect.patch, 2.7 KB (added by Donald R. Huettl <drhuettl@…>, 12 years ago)
  • libs/libmythdvdnav/dvd_reader.c

    diff -urN mythtv.bak/libs/libmythdvdnav/dvd_reader.c mythtv.new/libs/libmythdvdnav/dvd_reader.c
    old new  
    10211021    return offset;
    10221022}
    10231023
     1024int DVDFileSeekForce( dvd_file_t *dvd_file, int offset, int force_size )
     1025{
     1026    /* Check arguments. */
     1027    if( dvd_file == NULL || offset < 0 )
     1028        return -1;
     1029
     1030    if( dvd_file->dvd->isImageFile ) {
     1031        if( force_size < 0 )
     1032            force_size = (offset - 1) / DVD_VIDEO_LB_LEN + 1;
     1033        if( dvd_file->filesize < force_size ) {
     1034            dvd_file->filesize = force_size;
     1035            fprintf(stderr, "libdvdread: Ignored UDF provided size of file.\n");
     1036        }
     1037    }
     1038
     1039    if( offset > dvd_file->filesize * DVD_VIDEO_LB_LEN ) {
     1040        return -1;
     1041    }
     1042    dvd_file->seek_pos = (uint32_t) offset;
     1043    return offset;
     1044}
     1045
    10241046ssize_t DVDReadBytes( dvd_file_t *dvd_file, void *data, size_t byte_size )
    10251047{
    10261048    unsigned char *secbuf_base, *secbuf;
     
    10611083    memcpy( data, &(secbuf[ seek_byte ]), byte_size );
    10621084    free( secbuf_base );
    10631085
    1064     dvd_file->seek_pos += byte_size;
     1086    DVDFileSeekForce(dvd_file, dvd_file->seek_pos + byte_size, -1);
    10651087    return byte_size;
    10661088}
    10671089
  • libs/libmythdvdnav/dvd_reader.h

    diff -urN mythtv.bak/libs/libmythdvdnav/dvd_reader.h mythtv.new/libs/libmythdvdnav/dvd_reader.h
    old new  
    229229int DVDUDFVolumeInfo( dvd_reader_t *, char *, unsigned int,
    230230                      unsigned char *, unsigned int );
    231231
     232int DVDFileSeekForce( dvd_file_t *, int, int );
     233
    232234/**
    233235 * Get the ISO9660 VolumeIdentifier and VolumeSetIdentifier
    234236 *
  • libs/libmythdvdnav/ifo_read.c

    diff -urN mythtv.bak/libs/libmythdvdnav/ifo_read.c mythtv.new/libs/libmythdvdnav/ifo_read.c
    old new  
    9393  return (DVDFileSeek(dvd_file, (int)offset) == (int)offset);
    9494}
    9595
     96static inline int DVDFileSeekForce_( dvd_file_t *dvd_file, uint32_t offset, int force_size ) {
     97  return (DVDFileSeekForce(dvd_file, (int)offset, force_size) == (int)offset);
     98}
     99
    96100
    97101ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
    98102  ifo_handle_t *ifofile;
     
    15031507  unsigned int i;
    15041508  int info_length;
    15051509
    1506   if(!DVDFileSeek_(ifofile->file, sector * DVD_BLOCK_LEN))
     1510  if(!DVDFileSeekForce_(ifofile->file, sector * DVD_BLOCK_LEN, sector))
    15071511    return 0;
    15081512
    15091513  if(!(DVDReadBytes(ifofile->file, vobu_admap, VOBU_ADMAP_SIZE)))