static int UDFFileEntry( uint8_t *data, uint8_t *FileType, struct Partition *partition, struct AD *ad ) { uint16_t flags; uint32_t L_EA, L_AD; unsigned int p; UDFICB( &data[ 16 ], FileType, &flags ); /* Init ad for an empty file (i.e. there isn't a AD, L_AD == 0 ) */ ad->Length = GETN4( 60 ); /* Really 8 bytes a 56 */ ad->Flags = 0; ad->Location = 0; /* what should we put here? */ ad->Partition = partition->Number; /* use number of current partition */ L_EA = GETN4( 168 ); L_AD = GETN4( 172 ); if (176 + L_EA + L_AD > DVD_VIDEO_LB_LEN) return 0; p = 176 + L_EA; while( p < 176 + L_EA + L_AD ) { switch( flags & 0x0007 ) { case 0: UDFShortAD( &data[ p ], ad, partition ); p += 8; break; case 1: UDFLongAD( &data[ p ], ad ); p += 16; break; case 2: UDFExtAD( &data[ p ], ad ); p += 20; break; case 3: switch( L_AD ) { case 8: UDFShortAD( &data[ p ], ad, partition ); break; case 16: UDFLongAD( &data[ p ], ad ); break; case 20: UDFExtAD( &data[ p ], ad ); break; } p += L_AD; break; default: p += L_AD; break; } } return 0; }
static int UDFExtFileEntry(uint8_t *data, struct Partition *partition, struct AD *ad) { int nRet = -1; uint8_t FileType; uint16_t TagID; uint16_t flags; uint32_t L_EA, L_AD; unsigned int p; UDFDescriptor( data, &TagID ); if (TagID != 266) { //printf("Not ExtFileEntry!!!\n"); return nRet; } UDFICB( &data[ 16 ], &FileType, &flags ); ad->Length = GETN4( 60 ); /* Really 8 bytes a 56 */ ad->Flags = 0; ad->Location = 0; /* what should we put here? */ ad->Partition = partition->Number; /* use number of current partition */ L_EA = GETN4( 208 ); L_AD = GETN4( 212 ); if (216 + L_EA + L_AD > DVD_VIDEO_LB_LEN) return nRet; p = 216 + L_EA; while( p < 216 + L_EA + L_AD ) { switch( flags & 0x0007 ) { case 0: UDFShortAD( &data[ p ], ad, partition ); p += 8; break; case 1: UDFLongAD( &data[ p ], ad ); p += 16; break; default: p += L_AD; break; } } return nRet; }
static int UDFExtFileEntry( quint8 *data, struct FileAD *fad ) { quint32 L_EA, L_AD; unsigned int p; UDFICB( &data[ 16 ], &fad->Type, &fad->Flags ); /* Init ad for an empty file (i.e. there isn't a AD, L_AD == 0 ) */ fad->Length = GETN8(56); // 64-bit. L_EA = GETN4( 208); L_AD = GETN4( 212); p = 216 + L_EA; fad->num_AD = 0; while( p < 216 + L_EA + L_AD ) { p += UDFAD( &data[ p ], L_AD, fad ); } return 0; }
static int UDFFileEntry( quint8 *data, struct FileAD *fad ) { quint32 L_EA, L_AD; unsigned int p; UDFICB( &data[ 16 ], &fad->Type, &fad->Flags ); fad->Length = GETN8( 56 ); /* Was 4 bytes at 60, changed for 64bit. */ L_EA = GETN4( 168 ); L_AD = GETN4( 172 ); if (176 + L_EA + L_AD > DVD_VIDEO_LB_LEN) return 0; p = 176 + L_EA; fad->num_AD = 0; while( p < 176 + L_EA + L_AD ) { p += UDFAD( &data[ p ], L_AD, fad ); } return 0; }
static int UDFExtFileEntry( uint8_t *data, uint8_t *FileType, struct Partition *partition, struct AD *ad ) { uint16_t flags; uint32_t L_EA, L_AD; unsigned int p; struct AD temp_ad; int is_init = 0; memset((void *)&temp_ad, 0, sizeof(struct AD)); UDFICB( &data[ 16 ], FileType, &flags ); /* Init ad for an empty file (i.e. there isn't a AD, L_AD == 0 ) */ //ad->Length = GETN4( 60 ); /* Really 8 bytes a 56 */ ad->Length = 0; ad->Flags = 0; ad->Location = 0; /* what should we put here? */ ad->Partition = partition->Number; /* use number of current partition */ L_EA = GETN4( 208 ); L_AD = GETN4( 212 ); if (216 + L_EA + L_AD > DVD_VIDEO_LB_LEN) return 0; p = 216 + L_EA; while( p < 216 + L_EA + L_AD ) { switch( flags & 0x0007 ) { case 0: UDFShortAD( &data[ p ], &temp_ad, partition ); p += 8; break; case 1: UDFLongAD( &data[ p ], &temp_ad ); p += 16; break; case 2: UDFExtAD( &data[ p ], &temp_ad ); p += 20; break; case 3: switch( L_AD ) { case 8: UDFShortAD( &data[ p ], &temp_ad, partition ); break; case 16: UDFLongAD( &data[ p ], &temp_ad ); break; case 20: UDFExtAD( &data[ p ], &temp_ad ); break; } p += L_AD; break; default: p += L_AD; break; } if (is_init == 0) { memcpy((void *)ad, (void *)&temp_ad, sizeof(struct AD)); is_init = 1; } else { // only update file size ad->Length += temp_ad.Length; } } return 0; }