Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

udf: compatibility with UDF 1.02 (standard DVD Video) ISOs

  • Loading branch information...
commit dc5cd8b5d3ce8e37a7c79f40acb526afb25c8ef1 1 parent 445e95a
@Voyager1 Voyager1 authored
Showing with 8 additions and 1 deletion.
  1. +6 −1 xbmc/filesystem/udf25.cpp
  2. +2 −0  xbmc/filesystem/udf25.h
View
7 xbmc/filesystem/udf25.cpp
@@ -718,6 +718,7 @@ int udf25::UDFFindPartition( int partnum, struct Partition *part )
/* Partition Descriptor */
UDFPartition( LogBlock, &part->Flags, &part->Number,
part->Contents, &part->Start, &part->Length );
+ part->Start_Correction = 0;
part->valid = ( partnum == part->Number );
} else if( ( TagID == 6 ) && ( !volvalid ) ) {
/* Logical Volume Descriptor */
@@ -762,6 +763,8 @@ int udf25::UDFFindPartition( int partnum, struct Partition *part )
UDFExtFileEntry( LogBlock, &File );
if (File.Type == 250) {
part->Start += File.AD_chain[0].Location;
+ // we need to remember this correction because read positions are relative to the non-indirected partition start
+ part->Start_Correction = File.AD_chain[0].Location;
part->Length = File.AD_chain[0].Length;
break;
}
@@ -792,6 +795,7 @@ int udf25::UDFMapICB( struct AD ICB, struct Partition *partition, struct FileAD
memset(File, 0, sizeof(*File));
File->Partition = partition->Number;
File->Partition_Start = partition->Start;
+ File->Partition_Start_Correction = partition->Start_Correction;
do {
if( DVDReadLBUDF( lbnum++, 1, LogBlock, 0 ) <= 0 )
@@ -1109,7 +1113,8 @@ long udf25::ReadFile(HANDLE hFile, unsigned char *pBuffer, long lSize)
if(len == 0)
break;
- pos -= 32 * DVD_VIDEO_LB_LEN; /* why? */
+ // correct for partition indirection if applicable
+ pos -= bdfile->file->Partition_Start_Correction * DVD_VIDEO_LB_LEN;
if((uint32_t)lSize < len)
len = lSize;
View
2  xbmc/filesystem/udf25.h
@@ -46,6 +46,7 @@ struct Partition {
uint32_t AccessType;
uint32_t Start;
uint32_t Length;
+ uint32_t Start_Correction;
};
struct AD {
@@ -75,6 +76,7 @@ struct FileAD {
uint32_t num_AD;
uint16_t Partition;
uint32_t Partition_Start;
+ uint32_t Partition_Start_Correction;
uint8_t Type;
uint16_t Flags;
struct AD AD_chain[UDF_MAX_AD_CHAINS];
Please sign in to comment.
Something went wrong with that request. Please try again.