[libdvdnav-devel] [PATCH 2/2] Read the first File Set Descriptor Sequence from the LVD

Jean-Baptiste Kempf jb at videolan.org
Thu Jul 31 04:35:05 CEST 2014


A bit of context here:

I arrived on the patch here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663512

I didn't understand all of it, at the beginning, but I've rebased it and 
changed a few stuff:

1) I've removed fsd_t and UDFFSD(), because the spec TR_071 (2.6.7, 
table 12) says it should be a long_ad (defined in ECMA 167), and we 
already have the AD structure and the UDFLongAD() that should work, 
using a 248 offset.

2) I've removed FSD_Length from the partition because it's write only, 
and therefore useless.


However, I'm still uncomfortable merging this patch yet:
  - I want your feedback,
  - I cannot test correctly,
  - I'd like to remove the FSD_Location from the partition struct.

Indeed, adding FSD_Location would deviate the structure from the 
"Partition Descriptor" (ECMA 167 3/10.5, figure 11).

Do you have any good idea about how we can/should do that?


Le 30/07/2014 19:17, Jean-Baptiste Kempf a écrit :
> See ECMA TR-071 and ECMA-167
>
> libdvdread is very likely to fail on discs/images that store their File
> Set Descriptor at the end of the disc/image rather than at the
> beginning. This is due to the "strategy" libdvdread uses to find it:
> libdvdread scans sequentially from the beginning of the disc/image for
> the File Set Descriptor and identifies it by a single byte tag.
>
> Aside from wasting lots of time on discs/images that store their File
> Set Descriptor at the end there is quite a good chance to stumble
> across a random data block that accidentally starts with this tag (and
> failing on it) before finding the real File Set Descriptor.
>
> As far as I can see, at least CDBurnerXP seems to (be able to) create
> such images - at least if my interpretation of the Implementation
> Identifier "NMS DVDProLib" is correct.
>
> Original patch by Mario 'BitKoenig' Holbe
> ---
>   src/dvd_udf.c | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/src/dvd_udf.c b/src/dvd_udf.c
> index 7302b55..82885a2 100644
> --- a/src/dvd_udf.c
> +++ b/src/dvd_udf.c
> @@ -82,6 +82,7 @@ struct Partition {
>     uint32_t AccessType;
>     uint32_t Start;
>     uint32_t Length;
> +  uint32_t FSD_Location;
>   };
>
>   struct AD {
> @@ -773,8 +774,16 @@ static int UDFFindPartition( dvd_reader_t *device, int partnum,
>           /* Logical Volume Descriptor */
>           if( UDFLogVolume( LogBlock, part->VolumeDesc ) ) {
>             /* TODO: sector size wrong! */
> -        } else
> -          volvalid = 1;
> +        } else {
> +          struct AD ad;
> +          UDFLongAD( LogBlock + 248, &ad);
> +          if(part->Number == ad.Partition) {
> +            part->FSD_Location = ad.Location;
> +            volvalid = 1;
> +          } else {
> +            /* TODO: Oups, how to handle this? */
> +          }
> +        }
>         }
>
>       } while( ( lbnum <= MVDS_location + ( MVDS_length - 1 )
> @@ -817,7 +826,10 @@ uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
>       SetUDFCache(device, PartitionCache, 0, &partition);
>
>       /* Find root dir ICB */
> -    lbnum = partition.Start;
> +    lbnum = partition.Start + partition.FSD_Location;
> +    /*
> +    fprintf(stderr, "Looking for FSD at 0x%x\n", lbnum);
> +    */
>       do {
>         if( DVDReadLBUDF( device, lbnum++, 1, LogBlock, 0 ) <= 0 )
>           TagID = 0;
>


-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the libdvdnav-devel mailing list