Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jan 2001 20:08:50 -0700
From:      "Long, Scott" <scott_long@btc.adaptec.com>
To:        "'freebsd-multimedia@freebsd.org'" <freebsd-multimedia@freebsd.org>
Subject:   So ya want to play unlocked and unencryted pr0n DVDs...
Message-ID:  <E0BFB46945D5D411BB590000D11ABE920333AE@btcexc01.btc.adaptec.com>

next in thread | raw e-mail | index | archive | help
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C08420.A4E19140
Content-Type: text/plain


Ok, here ya go.  These patches to the xine's UDF reader have made it so that
I can play DVDs without having to pass in a .vob file, i.e. read the TOC and
play chapter-by-chapter.  This by no means fixes all of the bugs in xine....
manually advancing the chapter while the movie is playing causes a crash
that I haven't been able to track down, and some DVDs that I own just don't
want to play at all.  These patches do not touch the much rumored 'magical
DVD decryption plugin' that may or may not actually exist, they merely
provide fixes to the UDF reader.  Have fun.

Scott

FreeBSD - The power to watch unencrypted pr0n


------_=_NextPart_000_01C08420.A4E19140
Content-Type: application/octet-stream;
	name="xine.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="xine.diff"

diff -c xine-0.3.5/input/dvd_udf.c xine-0.3.5.new/input/dvd_udf.c=0A=
*** xine-0.3.5/input/dvd_udf.c	Fri Jan 12 16:38:15 2001=0A=
--- xine-0.3.5.new/input/dvd_udf.c	Sun Jan 21 18:33:07 2001=0A=
***************=0A=
*** 25,30 ****=0A=
--- 25,31 ----=0A=
   =0A=
  =0A=
  #include <stdio.h>=0A=
+ #include <stdlib.h>=0A=
  #include <unistd.h>=0A=
  #include <string.h>=0A=
  #include <fcntl.h>=0A=
***************=0A=
*** 275,284 ****=0A=
  =0A=
  int UDFMapICB (int fd, struct AD ICB, uint8_t *FileType, struct AD =
*File)=0A=
  {=0A=
!   uint8_t LogBlock[DVD_VIDEO_LB_LEN];=0A=
    uint32_t lbnum;=0A=
    uint16_t TagID;=0A=
  =0A=
    lbnum=3Dpartition.Start+ICB.Location;=0A=
  =0A=
    do {=0A=
--- 276,290 ----=0A=
  =0A=
  int UDFMapICB (int fd, struct AD ICB, uint8_t *FileType, struct AD =
*File)=0A=
  {=0A=
!   uint8_t *LogBlock;=0A=
    uint32_t lbnum;=0A=
    uint16_t TagID;=0A=
  =0A=
+   if ((LogBlock =3D (uint8_t*)malloc(DVD_VIDEO_LB_LEN)) =3D=3D NULL) =
{=0A=
+     fprintf(stderr, "%s: malloc failed\n", __FUNCTION__);=0A=
+     return 0;=0A=
+   }=0A=
+ =0A=
    lbnum=3Dpartition.Start+ICB.Location;=0A=
  =0A=
    do {=0A=
***************=0A=
*** 287,296 ****=0A=
--- 293,304 ----=0A=
  =0A=
      if (TagID=3D=3D261) {=0A=
        UDFFileEntry(LogBlock,FileType,File);=0A=
+       free(LogBlock);=0A=
        return 1;=0A=
      };=0A=
    } while =
((lbnum<=3Dpartition.Start+ICB.Location+(ICB.Length-1)/DVD_VIDEO_LB_LEN)=
 && (TagID!=3D261));=0A=
  =0A=
+   free(LogBlock);=0A=
    return 0;=0A=
  }=0A=
  =0A=
***************=0A=
*** 303,315 ****=0A=
  =0A=
  int UDFScanDir (int fd, struct AD Dir, char *FileName, struct AD =
*FileICB)=0A=
  {=0A=
!   uint8_t    LogBlock[DVD_VIDEO_LB_LEN*30];=0A=
    uint32_t   lbnum, lb_dir_end, offset;=0A=
    uint16_t   TagID;=0A=
    uint8_t    filechar;=0A=
!   char       filename[MAX_FILE_LEN];=0A=
!   int        p;=0A=
    =0A=
  =0A=
    /*=0A=
     * read complete directory=0A=
--- 311,329 ----=0A=
  =0A=
  int UDFScanDir (int fd, struct AD Dir, char *FileName, struct AD =
*FileICB)=0A=
  {=0A=
!   uint8_t   *LogBlock;=0A=
    uint32_t   lbnum, lb_dir_end, offset;=0A=
    uint16_t   TagID;=0A=
    uint8_t    filechar;=0A=
!   char      *filename;=0A=
!   int        p, retval =3D 0;=0A=
    =0A=
+   LogBlock =3D (uint8_t*)malloc(DVD_VIDEO_LB_LEN * 30);=0A=
+   filename =3D (char*)malloc(MAX_FILE_LEN);=0A=
+   if ((LogBlock =3D=3D NULL) || (filename =3D=3D NULL)) {=0A=
+     fprintf(stderr, "%s: malloc failed\n", __FUNCTION__);=0A=
+     goto bail;=0A=
+   }=0A=
  =0A=
    /*=0A=
     * read complete directory=0A=
***************=0A=
*** 335,347 ****=0A=
  =0A=
      if (TagID=3D=3D257) {=0A=
        p +=3D =
UDFFileIdentifier(&LogBlock[p],&filechar,filename,FileICB);=0A=
!       if (!strcasecmp (FileName,filename))=0A=
! 	return 1;=0A=
      } else=0A=
  	  p=3Doffset;=0A=
    }=0A=
  =0A=
!   return 0;=0A=
  }=0A=
  =0A=
  =0A=
--- 349,368 ----=0A=
  =0A=
      if (TagID=3D=3D257) {=0A=
        p +=3D =
UDFFileIdentifier(&LogBlock[p],&filechar,filename,FileICB);=0A=
!       if (!strcasecmp (FileName,filename)) {=0A=
!         retval =3D 1;=0A=
! 	goto bail;=0A=
!       }=0A=
      } else=0A=
  	  p=3Doffset;=0A=
    }=0A=
  =0A=
!   retval =3D 0;=0A=
! =0A=
! bail:=0A=
!   free(LogBlock);=0A=
!   free(filename);=0A=
!   return retval;=0A=
  }=0A=
  =0A=
  =0A=
***************=0A=
*** 354,365 ****=0A=
  =0A=
  int UDFFindPartition (int fd, int partnum, struct Partition *part)=0A=
  {=0A=
!   uint8_t LogBlock[DVD_VIDEO_LB_LEN],Anchor[DVD_VIDEO_LB_LEN];=0A=
    uint32_t lbnum,MVDS_location,MVDS_length;=0A=
    uint16_t TagID;=0A=
    uint32_t lastsector;=0A=
!   int i,terminate,volvalid;=0A=
  =0A=
  =0A=
    /* find anchor */=0A=
    lastsector=3D0;=0A=
--- 375,392 ----=0A=
  =0A=
  int UDFFindPartition (int fd, int partnum, struct Partition *part)=0A=
  {=0A=
!   uint8_t *LogBlock,*Anchor;=0A=
    uint32_t lbnum,MVDS_location,MVDS_length;=0A=
    uint16_t TagID;=0A=
    uint32_t lastsector;=0A=
!   int i,terminate,volvalid,retval =3D 0;=0A=
  =0A=
+   LogBlock =3D (uint8_t*)malloc(DVD_VIDEO_LB_LEN);=0A=
+   Anchor =3D (uint8_t*)malloc(DVD_VIDEO_LB_LEN);=0A=
+   if ((LogBlock =3D=3D NULL) || (Anchor =3D=3D NULL)) {=0A=
+     fprintf(stderr, "%s: malloc failed\n", __FUNCTION__);=0A=
+     goto bail;=0A=
+   }=0A=
  =0A=
    /* find anchor */=0A=
    lastsector=3D0;=0A=
***************=0A=
*** 373,386 ****=0A=
        TagID=3D0;=0A=
      =0A=
      if (TagID!=3D2) { /* not an anchor? */=0A=
!       if (terminate) return 0;	/* final try failed */=0A=
        if (lastsector) {		/* we already found the last sector    */=0A=
  	lbnum=3Dlastsector;	/* try #3, alternative backup anchor   */=0A=
  	terminate=3D1;		/* but thats just about enough, then!  */=0A=
        } else {=0A=
  	/* TODO: find last sector of the disc (this is optional)       */=0A=
  	if (lastsector) lbnum=3Dlastsector-256; /* try #2, backup anchor =
*/=0A=
! 	else return 0;          /* unable to find last sector          */=0A=
        }=0A=
      } else break;               /* it is an anchor! continue...       =
 */=0A=
    }=0A=
--- 400,413 ----=0A=
        TagID=3D0;=0A=
      =0A=
      if (TagID!=3D2) { /* not an anchor? */=0A=
!       if (terminate) goto bail;	/* final try failed */=0A=
        if (lastsector) {		/* we already found the last sector    */=0A=
  	lbnum=3Dlastsector;	/* try #3, alternative backup anchor   */=0A=
  	terminate=3D1;		/* but thats just about enough, then!  */=0A=
        } else {=0A=
  	/* TODO: find last sector of the disc (this is optional)       */=0A=
  	if (lastsector) lbnum=3Dlastsector-256; /* try #2, backup anchor =
*/=0A=
! 	else goto bail;          /* unable to find last sector          =
*/=0A=
        }=0A=
      } else break;               /* it is an anchor! continue...       =
 */=0A=
    }=0A=
***************=0A=
*** 413,419 ****=0A=
      if ((!part->valid) || (!volvalid)) =
UDFExtentAD(&Anchor[24],&MVDS_length,&MVDS_location);  /* backup volume =
descriptor */=0A=
    } while (i-- && ((!part->valid) || (!volvalid)));=0A=
    =0A=
!   return (part->valid);  /* we only care for the partition, not the =
volume */=0A=
  }=0A=
  =0A=
  =0A=
--- 440,451 ----=0A=
      if ((!part->valid) || (!volvalid)) =
UDFExtentAD(&Anchor[24],&MVDS_length,&MVDS_location);  /* backup volume =
descriptor */=0A=
    } while (i-- && ((!part->valid) || (!volvalid)));=0A=
    =0A=
!   retval =3D part->valid;  /* we only care for the partition, not the =
volume */=0A=
! =0A=
! bail:=0A=
!   free(LogBlock);=0A=
!   free(Anchor);=0A=
!   return retval;=0A=
  }=0A=
  =0A=
  =0A=
***************=0A=
*** 426,447 ****=0A=
  =0A=
  uint32_t UDFFindFile (int fd, char *filename, off_t *size)=0A=
  {=0A=
!   uint8_t LogBlock[DVD_VIDEO_LB_LEN];=0A=
    uint8_t filetype;=0A=
!   uint32_t lbnum;=0A=
    uint16_t TagID;=0A=
    struct AD RootICB,File,ICB;=0A=
!   char tokenline[MAX_FILE_LEN] =3D "";=0A=
    char *token;=0A=
    off_t lb_number;=0A=
- =0A=
    int Partition=3D0;  /* this is the standard location for DVD Video =
*/=0A=
    =0A=
!   strcat (tokenline,filename);=0A=
    =0A=
    /* Find partition */=0A=
    if (!UDFFindPartition(fd, Partition,&partition))=0A=
!     return 0;=0A=
    =0A=
    /* Find root dir ICB */=0A=
    lbnum=3Dpartition.Start;=0A=
--- 458,486 ----=0A=
  =0A=
  uint32_t UDFFindFile (int fd, char *filename, off_t *size)=0A=
  {=0A=
!   uint8_t *LogBlock;=0A=
    uint8_t filetype;=0A=
!   uint32_t lbnum, retval =3D 0;=0A=
    uint16_t TagID;=0A=
    struct AD RootICB,File,ICB;=0A=
!   char *tokenline;=0A=
    char *token;=0A=
    off_t lb_number;=0A=
    int Partition=3D0;  /* this is the standard location for DVD Video =
*/=0A=
+ =0A=
+   LogBlock =3D (uint8_t*)malloc(DVD_VIDEO_LB_LEN);=0A=
+   tokenline =3D (char*)malloc(MAX_FILE_LEN);=0A=
+   if ((LogBlock =3D=3D NULL) || (tokenline =3D=3D NULL)) {=0A=
+     fprintf(stderr, "%s: malloc failed\n", __FUNCTION__);=0A=
+     goto bail;=0A=
+   }=0A=
+   memset(tokenline, 0, MAX_FILE_LEN);=0A=
    =0A=
!   strncat (tokenline,filename,MAX_FILE_LEN);=0A=
    =0A=
    /* Find partition */=0A=
    if (!UDFFindPartition(fd, Partition,&partition))=0A=
!     goto bail;=0A=
    =0A=
    /* Find root dir ICB */=0A=
    lbnum=3Dpartition.Start;=0A=
***************=0A=
*** 456,478 ****=0A=
        UDFAD(&LogBlock[400],&RootICB,UDFADlong);=0A=
    } while ((lbnum<partition.Start+partition.Length) && (TagID!=3D8) =
&& (TagID!=3D256));=0A=
    if (TagID!=3D256)=0A=
!     return 0;=0A=
    if (RootICB.Partition!=3DPartition)=0A=
!     return 0;=0A=
    =0A=
    /* Find root dir */=0A=
    if (!UDFMapICB(fd, RootICB,&filetype,&File))=0A=
!     return 0;=0A=
    if (filetype!=3D4)		/* root dir should be dir */=0A=
!     return 0;=0A=
    =0A=
    /* Tokenize filepath */=0A=
    token=3Dstrtok(tokenline,"/");=0A=
    while (token) {=0A=
      if (!UDFScanDir(fd, File,token,&ICB))=0A=
!       return 0;=0A=
      if (!UDFMapICB(fd, ICB,&filetype,&File))=0A=
!       return 0;=0A=
      token=3Dstrtok(NULL,"/");=0A=
    }=0A=
    =0A=
--- 495,517 ----=0A=
        UDFAD(&LogBlock[400],&RootICB,UDFADlong);=0A=
    } while ((lbnum<partition.Start+partition.Length) && (TagID!=3D8) =
&& (TagID!=3D256));=0A=
    if (TagID!=3D256)=0A=
!     goto bail;=0A=
    if (RootICB.Partition!=3DPartition)=0A=
!     goto bail;=0A=
    =0A=
    /* Find root dir */=0A=
    if (!UDFMapICB(fd, RootICB,&filetype,&File))=0A=
!     goto bail;=0A=
    if (filetype!=3D4)		/* root dir should be dir */=0A=
!     goto bail;=0A=
    =0A=
    /* Tokenize filepath */=0A=
    token=3Dstrtok(tokenline,"/");=0A=
    while (token) {=0A=
      if (!UDFScanDir(fd, File,token,&ICB))=0A=
!       goto bail;=0A=
      if (!UDFMapICB(fd, ICB,&filetype,&File))=0A=
!       goto bail;=0A=
      token=3Dstrtok(NULL,"/");=0A=
    }=0A=
    =0A=
***************=0A=
*** 480,486 ****=0A=
  =0A=
    lb_number =3D partition.Start+File.Location ;=0A=
  =0A=
!   return lb_number;=0A=
  }=0A=
  =0A=
  =0A=
--- 519,530 ----=0A=
  =0A=
    lb_number =3D partition.Start+File.Location ;=0A=
  =0A=
!   retval =3D lb_number;=0A=
! =0A=
! bail:=0A=
!   free(LogBlock);=0A=
!   free(tokenline);=0A=
!   return retval;=0A=
  }=0A=
  =0A=
  =0A=
***************=0A=
*** 489,516 ****=0A=
   */=0A=
  =0A=
  void UDFListDir(int fd, char *dirname, int nMaxFiles, char =
**file_list, int *nFiles) {=0A=
!   uint8_t    LogBlock[30*DVD_VIDEO_LB_LEN];=0A=
    uint32_t   lbnum;=0A=
    uint16_t   TagID;=0A=
    struct AD  RootICB,Dir,ICB;=0A=
!   char       tokenline[MAX_FILE_LEN];=0A=
    char      *token, *ntoken;=0A=
    uint8_t    filetype;=0A=
!   char       filename[MAX_FILE_LEN];=0A=
    int        p;=0A=
    uint8_t    filechar;=0A=
    char      *dest;=0A=
    int        Partition=3D0;  /* this is the standard location for DVD =
Video */=0A=
    =0A=
    *nFiles =3D 0;=0A=
    tokenline[0]=3D'\0';=0A=
!   strcat(tokenline,dirname);=0A=
  =0A=
    /* Find partition */=0A=
    if (!UDFFindPartition(fd, Partition,&partition)) {=0A=
      /* no partition found (no disc ??) */=0A=
      *nFiles =3D -1;=0A=
!     return;=0A=
    }=0A=
  =0A=
    /* Find root dir ICB */=0A=
--- 533,568 ----=0A=
   */=0A=
  =0A=
  void UDFListDir(int fd, char *dirname, int nMaxFiles, char =
**file_list, int *nFiles) {=0A=
!   uint8_t   *LogBlock;=0A=
    uint32_t   lbnum;=0A=
    uint16_t   TagID;=0A=
    struct AD  RootICB,Dir,ICB;=0A=
!   char      *tokenline;=0A=
    char      *token, *ntoken;=0A=
    uint8_t    filetype;=0A=
!   char      *filename;=0A=
    int        p;=0A=
    uint8_t    filechar;=0A=
    char      *dest;=0A=
    int        Partition=3D0;  /* this is the standard location for DVD =
Video */=0A=
    =0A=
+   LogBlock =3D (uint8_t*)malloc(DVD_VIDEO_LB_LEN * 30);=0A=
+   tokenline =3D (char*)malloc(MAX_FILE_LEN);=0A=
+   filename =3D (char*)malloc(MAX_FILE_LEN);=0A=
+   if ((LogBlock =3D=3D NULL) || (tokenline =3D=3D NULL) || (filename =
=3D=3D NULL)) {=0A=
+     fprintf(stderr, "%s: malloc failed\n", __FUNCTION__);=0A=
+     goto bail;=0A=
+   }=0A=
+ =0A=
    *nFiles =3D 0;=0A=
    tokenline[0]=3D'\0';=0A=
!   strncat(tokenline,dirname,MAX_FILE_LEN);=0A=
  =0A=
    /* Find partition */=0A=
    if (!UDFFindPartition(fd, Partition,&partition)) {=0A=
      /* no partition found (no disc ??) */=0A=
      *nFiles =3D -1;=0A=
!     goto bail;=0A=
    }=0A=
  =0A=
    /* Find root dir ICB */=0A=
***************=0A=
*** 528,542 ****=0A=
  	   && (TagID!=3D8) && (TagID!=3D256));=0A=
  =0A=
    if (TagID!=3D256) =0A=
!     return ;=0A=
    if (RootICB.Partition!=3DPartition) =0A=
!     return ;=0A=
    =0A=
    /* Find root dir */=0A=
    if (!UDFMapICB(fd, RootICB,&filetype,&Dir)) =0A=
!     return ;=0A=
    if (filetype!=3D4) =0A=
!     return ;  /* root dir should be dir */=0A=
  =0A=
    =0A=
  =0A=
--- 580,594 ----=0A=
  	   && (TagID!=3D8) && (TagID!=3D256));=0A=
  =0A=
    if (TagID!=3D256) =0A=
!     goto bail;=0A=
    if (RootICB.Partition!=3DPartition) =0A=
!     goto bail;=0A=
    =0A=
    /* Find root dir */=0A=
    if (!UDFMapICB(fd, RootICB,&filetype,&Dir)) =0A=
!     goto bail;=0A=
    if (filetype!=3D4) =0A=
!     goto bail;  /* root dir should be dir */=0A=
  =0A=
    =0A=
  =0A=
***************=0A=
*** 546,554 ****=0A=
    while (token !=3D NULL) {=0A=
  =0A=
      if (!UDFScanDir(fd, Dir,token,&ICB)) =0A=
!       return ;=0A=
      if (!UDFMapICB(fd, ICB,&filetype,&Dir)) =0A=
!       return ;=0A=
  =0A=
      if (ntoken =3D=3D NULL) {=0A=
        uint32_t lb_dir_end, offset;=0A=
--- 598,606 ----=0A=
    while (token !=3D NULL) {=0A=
  =0A=
      if (!UDFScanDir(fd, Dir,token,&ICB)) =0A=
!       goto bail;=0A=
      if (!UDFMapICB(fd, ICB,&filetype,&Dir)) =0A=
!       goto bail;=0A=
  =0A=
      if (ntoken =3D=3D NULL) {=0A=
        uint32_t lb_dir_end, offset;=0A=
***************=0A=
*** 582,592 ****=0A=
  	  if (strcmp (filename,"")) {=0A=
  =0A=
  	    dest =3D file_list[*nFiles];=0A=
! 	    strcpy (dest,filename);=0A=
  	    (*nFiles)++;=0A=
  	    =0A=
  	    if ((*nFiles)>=3DnMaxFiles)=0A=
! 	      return;=0A=
  	    =0A=
  	  }=0A=
  =0A=
--- 634,644 ----=0A=
  	  if (strcmp (filename,"")) {=0A=
  =0A=
  	    dest =3D file_list[*nFiles];=0A=
! 	    strncpy (dest,filename,256);=0A=
  	    (*nFiles)++;=0A=
  	    =0A=
  	    if ((*nFiles)>=3DnMaxFiles)=0A=
! 	      goto bail;=0A=
  	    =0A=
  	  }=0A=
  =0A=
***************=0A=
*** 600,604 ****=0A=
--- 652,662 ----=0A=
      token=3Dntoken;=0A=
      ntoken=3Dstrtok(NULL,"/");=0A=
    }=0A=
+ =0A=
+ bail:=0A=
+   free(LogBlock);=0A=
+   free(tokenline);=0A=
+   free(filename);=0A=
+   return;=0A=
  }=0A=
  =0A=

------_=_NextPart_000_01C08420.A4E19140--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E0BFB46945D5D411BB590000D11ABE920333AE>