ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
getid3_iso Class Reference

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g // More...

+ Inheritance diagram for getid3_iso:
+ Collaboration diagram for getid3_iso:

Public Member Functions

 getid3_iso ($fd, &$ThisFileInfo)
 
 ParsePrimaryVolumeDescriptor (&$ISOheader, &$ThisFileInfo)
 
 ParseSupplementaryVolumeDescriptor (&$ISOheader, &$ThisFileInfo)
 
 ParsePathTable ($fd, &$ThisFileInfo)
 
 ParseDirectoryRecord (&$fd, $directorydata, &$ThisFileInfo)
 
 ISOstripFilenameVersion ($ISOfilename)
 
 ISOtimeText2UNIXtime ($ISOtime)
 
 ISOtime2UNIXtime ($ISOtime)
 
 TwosCompliment2Decimal ($BinaryValue)
 
 Analyze ()
 
 ParsePrimaryVolumeDescriptor (&$ISOheader)
 
 ParseSupplementaryVolumeDescriptor (&$ISOheader)
 
 ParsePathTable ()
 
 ParseDirectoryRecord ($directorydata)
 
 ISOstripFilenameVersion ($ISOfilename)
 
 ISOtimeText2UNIXtime ($ISOtime)
 
 ISOtime2UNIXtime ($ISOtime)
 
 TwosCompliment2Decimal ($BinaryValue)
 
- Public Member Functions inherited from getid3_handler
 __construct (getID3 $getid3, $call_module=null)
 
 Analyze ()
 
 AnalyzeString ($string)
 
 setStringMode ($string)
 
 saveAttachment ($name, $offset, $length, $image_mime=null)
 

Additional Inherited Members

- Protected Member Functions inherited from getid3_handler
 ftell ()
 
 fread ($bytes)
 
 fseek ($bytes, $whence=SEEK_SET)
 
 feof ()
 
 isDependencyFor ($module)
 
 error ($text)
 
 warning ($text)
 
 notice ($text)
 
- Protected Attributes inherited from getid3_handler
 $getid3
 
 $data_string_flag = false
 
 $data_string = ''
 
 $data_string_position = 0
 
 $data_string_length = 0
 

Detailed Description

getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //

Definition at line 17 of file module.misc.iso.php.

Member Function Documentation

◆ Analyze()

getid3_iso::Analyze ( )

Definition at line 21 of file module.misc.iso.php.

References $info, getid3_handler\fread(), getid3_handler\fseek(), ParseDirectoryRecord(), ParsePathTable(), ParsePrimaryVolumeDescriptor(), and ParseSupplementaryVolumeDescriptor().

21  {
22  $info = &$this->getid3->info;
23 
24  $info['fileformat'] = 'iso';
25 
26  for ($i = 16; $i <= 19; $i++) {
27  $this->fseek(2048 * $i);
28  $ISOheader = $this->fread(2048);
29  if (substr($ISOheader, 1, 5) == 'CD001') {
30  switch (ord($ISOheader{0})) {
31  case 1:
32  $info['iso']['primary_volume_descriptor']['offset'] = 2048 * $i;
33  $this->ParsePrimaryVolumeDescriptor($ISOheader);
34  break;
35 
36  case 2:
37  $info['iso']['supplementary_volume_descriptor']['offset'] = 2048 * $i;
38  $this->ParseSupplementaryVolumeDescriptor($ISOheader);
39  break;
40 
41  default:
42  // skip
43  break;
44  }
45  }
46  }
47 
48  $this->ParsePathTable();
49 
50  $info['iso']['files'] = array();
51  foreach ($info['iso']['path_table']['directories'] as $directorynum => $directorydata) {
52  $info['iso']['directories'][$directorynum] = $this->ParseDirectoryRecord($directorydata);
53  }
54 
55  return true;
56  }
$info
Definition: example_052.php:80
fread($bytes)
Definition: getid3.php:1685
ParsePrimaryVolumeDescriptor(&$ISOheader, &$ThisFileInfo)
ParseDirectoryRecord(&$fd, $directorydata, &$ThisFileInfo)
ParseSupplementaryVolumeDescriptor(&$ISOheader, &$ThisFileInfo)
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:

◆ getid3_iso()

getid3_iso::getid3_iso (   $fd,
$ThisFileInfo 
)

Definition at line 20 of file module.misc.iso.php.

References getid3_handler\fread(), getid3_handler\fseek(), ParseDirectoryRecord(), ParsePathTable(), ParsePrimaryVolumeDescriptor(), and ParseSupplementaryVolumeDescriptor().

20  {
21  $ThisFileInfo['fileformat'] = 'iso';
22 
23  for ($i = 16; $i <= 19; $i++) {
24  fseek($fd, 2048 * $i, SEEK_SET);
25  $ISOheader = fread($fd, 2048);
26  if (substr($ISOheader, 1, 5) == 'CD001') {
27  switch (ord($ISOheader{0})) {
28  case 1:
29  $ThisFileInfo['iso']['primary_volume_descriptor']['offset'] = 2048 * $i;
30  $this->ParsePrimaryVolumeDescriptor($ISOheader, $ThisFileInfo);
31  break;
32 
33  case 2:
34  $ThisFileInfo['iso']['supplementary_volume_descriptor']['offset'] = 2048 * $i;
35  $this->ParseSupplementaryVolumeDescriptor($ISOheader, $ThisFileInfo);
36  break;
37 
38  default:
39  // skip
40  break;
41  }
42  }
43  }
44 
45  $this->ParsePathTable($fd, $ThisFileInfo);
46 
47  $ThisFileInfo['iso']['files'] = array();
48  foreach ($ThisFileInfo['iso']['path_table']['directories'] as $directorynum => $directorydata) {
49 
50  $ThisFileInfo['iso']['directories'][$directorynum] = $this->ParseDirectoryRecord($fd, $directorydata, $ThisFileInfo);
51 
52  }
53 
54  return true;
55 
56  }
fread($bytes)
Definition: getid3.php:1685
ParsePrimaryVolumeDescriptor(&$ISOheader, &$ThisFileInfo)
ParseDirectoryRecord(&$fd, $directorydata, &$ThisFileInfo)
ParseSupplementaryVolumeDescriptor(&$ISOheader, &$ThisFileInfo)
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:

◆ ISOstripFilenameVersion() [1/2]

getid3_iso::ISOstripFilenameVersion (   $ISOfilename)

Definition at line 320 of file module.misc.iso.php.

320  {
321  // convert 'filename.ext;1' to 'filename.ext'
322  if (!strstr($ISOfilename, ';')) {
323  return $ISOfilename;
324  } else {
325  return substr($ISOfilename, 0, strpos($ISOfilename, ';'));
326  }
327  }

◆ ISOstripFilenameVersion() [2/2]

getid3_iso::ISOstripFilenameVersion (   $ISOfilename)

Definition at line 324 of file module.misc.iso.php.

324  {
325  // convert 'filename.ext;1' to 'filename.ext'
326  if (!strstr($ISOfilename, ';')) {
327  return $ISOfilename;
328  } else {
329  return substr($ISOfilename, 0, strpos($ISOfilename, ';'));
330  }
331  }

◆ ISOtime2UNIXtime() [1/2]

getid3_iso::ISOtime2UNIXtime (   $ISOtime)

Definition at line 344 of file module.misc.iso.php.

References TwosCompliment2Decimal().

Referenced by ParseDirectoryRecord().

344  {
345  // Represented by seven bytes:
346  // 1: Number of years since 1900
347  // 2: Month of the year from 1 to 12
348  // 3: Day of the Month from 1 to 31
349  // 4: Hour of the day from 0 to 23
350  // 5: Minute of the hour from 0 to 59
351  // 6: second of the minute from 0 to 59
352  // 7: Offset from Greenwich Mean Time in number of 15 minute intervals from -48 (West) to +52 (East)
353 
354  $UNIXyear = ord($ISOtime{0}) + 1900;
355  $UNIXmonth = ord($ISOtime{1});
356  $UNIXday = ord($ISOtime{2});
357  $UNIXhour = ord($ISOtime{3});
358  $UNIXminute = ord($ISOtime{4});
359  $UNIXsecond = ord($ISOtime{5});
360  $GMToffset = $this->TwosCompliment2Decimal(ord($ISOtime{5}));
361 
362  return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
363  }
TwosCompliment2Decimal($BinaryValue)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ISOtime2UNIXtime() [2/2]

getid3_iso::ISOtime2UNIXtime (   $ISOtime)

Definition at line 348 of file module.misc.iso.php.

References TwosCompliment2Decimal().

348  {
349  // Represented by seven bytes:
350  // 1: Number of years since 1900
351  // 2: Month of the year from 1 to 12
352  // 3: Day of the Month from 1 to 31
353  // 4: Hour of the day from 0 to 23
354  // 5: Minute of the hour from 0 to 59
355  // 6: second of the minute from 0 to 59
356  // 7: Offset from Greenwich Mean Time in number of 15 minute intervals from -48 (West) to +52 (East)
357 
358  $UNIXyear = ord($ISOtime{0}) + 1900;
359  $UNIXmonth = ord($ISOtime{1});
360  $UNIXday = ord($ISOtime{2});
361  $UNIXhour = ord($ISOtime{3});
362  $UNIXminute = ord($ISOtime{4});
363  $UNIXsecond = ord($ISOtime{5});
364  $GMToffset = $this->TwosCompliment2Decimal(ord($ISOtime{5}));
365 
366  return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
367  }
TwosCompliment2Decimal($BinaryValue)
+ Here is the call graph for this function:

◆ ISOtimeText2UNIXtime() [1/2]

getid3_iso::ISOtimeText2UNIXtime (   $ISOtime)

Definition at line 329 of file module.misc.iso.php.

Referenced by ParsePrimaryVolumeDescriptor(), and ParseSupplementaryVolumeDescriptor().

329  {
330 
331  $UNIXyear = (int) substr($ISOtime, 0, 4);
332  $UNIXmonth = (int) substr($ISOtime, 4, 2);
333  $UNIXday = (int) substr($ISOtime, 6, 2);
334  $UNIXhour = (int) substr($ISOtime, 8, 2);
335  $UNIXminute = (int) substr($ISOtime, 10, 2);
336  $UNIXsecond = (int) substr($ISOtime, 12, 2);
337 
338  if (!$UNIXyear) {
339  return false;
340  }
341  return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
342  }
+ Here is the caller graph for this function:

◆ ISOtimeText2UNIXtime() [2/2]

getid3_iso::ISOtimeText2UNIXtime (   $ISOtime)

Definition at line 333 of file module.misc.iso.php.

333  {
334 
335  $UNIXyear = (int) substr($ISOtime, 0, 4);
336  $UNIXmonth = (int) substr($ISOtime, 4, 2);
337  $UNIXday = (int) substr($ISOtime, 6, 2);
338  $UNIXhour = (int) substr($ISOtime, 8, 2);
339  $UNIXminute = (int) substr($ISOtime, 10, 2);
340  $UNIXsecond = (int) substr($ISOtime, 12, 2);
341 
342  if (!$UNIXyear) {
343  return false;
344  }
345  return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
346  }

◆ ParseDirectoryRecord() [1/2]

getid3_iso::ParseDirectoryRecord ( $fd,
  $directorydata,
$ThisFileInfo 
)

Definition at line 268 of file module.misc.iso.php.

References getid3_lib\array_merge_clobber(), getid3_lib\CreateDeepArray(), getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\iconv_fallback(), ISOtime2UNIXtime(), and getid3_lib\LittleEndian2Int().

Referenced by Analyze(), and getid3_iso().

268  {
269  if (isset($ThisFileInfo['iso']['supplementary_volume_descriptor'])) {
270  $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode
271  } else {
272  $TextEncoding = 'ISO-8859-1'; // Latin-1
273  }
274 
275  fseek($fd, $directorydata['location_bytes'], SEEK_SET);
276  $DirectoryRecordData = fread($fd, 1);
277 
278  while (ord($DirectoryRecordData{0}) > 33) {
279 
280  $DirectoryRecordData .= fread($fd, ord($DirectoryRecordData{0}) - 1);
281 
282  $ThisDirectoryRecord['raw']['length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 0, 1));
283  $ThisDirectoryRecord['raw']['extended_attribute_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 1, 1));
284  $ThisDirectoryRecord['raw']['offset_logical'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 2, 4));
285  $ThisDirectoryRecord['raw']['filesize'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 10, 4));
286  $ThisDirectoryRecord['raw']['recording_date_time'] = substr($DirectoryRecordData, 18, 7);
287  $ThisDirectoryRecord['raw']['file_flags'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 25, 1));
288  $ThisDirectoryRecord['raw']['file_unit_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 26, 1));
289  $ThisDirectoryRecord['raw']['interleave_gap_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 27, 1));
290  $ThisDirectoryRecord['raw']['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 28, 2));
291  $ThisDirectoryRecord['raw']['file_identifier_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 32, 1));
292  $ThisDirectoryRecord['raw']['file_identifier'] = substr($DirectoryRecordData, 33, $ThisDirectoryRecord['raw']['file_identifier_length']);
293 
294  $ThisDirectoryRecord['file_identifier_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $ThisFileInfo['encoding'], $ThisDirectoryRecord['raw']['file_identifier']);
295 
296  $ThisDirectoryRecord['filesize'] = $ThisDirectoryRecord['raw']['filesize'];
297  $ThisDirectoryRecord['offset_bytes'] = $ThisDirectoryRecord['raw']['offset_logical'] * 2048;
298  $ThisDirectoryRecord['file_flags']['hidden'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x01);
299  $ThisDirectoryRecord['file_flags']['directory'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x02);
300  $ThisDirectoryRecord['file_flags']['associated'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x04);
301  $ThisDirectoryRecord['file_flags']['extended'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x08);
302  $ThisDirectoryRecord['file_flags']['permissions'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x10);
303  $ThisDirectoryRecord['file_flags']['multiple'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x80);
304  $ThisDirectoryRecord['recording_timestamp'] = $this->ISOtime2UNIXtime($ThisDirectoryRecord['raw']['recording_date_time']);
305 
306  if ($ThisDirectoryRecord['file_flags']['directory']) {
307  $ThisDirectoryRecord['filename'] = $directorydata['full_path'];
308  } else {
309  $ThisDirectoryRecord['filename'] = $directorydata['full_path'].$this->ISOstripFilenameVersion($ThisDirectoryRecord['file_identifier_ascii']);
310  $ThisFileInfo['iso']['files'] = getid3_lib::array_merge_clobber($ThisFileInfo['iso']['files'], getid3_lib::CreateDeepArray($ThisDirectoryRecord['filename'], '/', $ThisDirectoryRecord['filesize']));
311  }
312 
313  $DirectoryRecord[] = $ThisDirectoryRecord;
314  $DirectoryRecordData = fread($fd, 1);
315  }
316 
317  return $DirectoryRecord;
318  }
array_merge_clobber($array1, $array2)
Definition: getid3.lib.php:358
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
ISOtime2UNIXtime($ISOtime)
iconv_fallback($in_charset, $out_charset, $string)
Definition: getid3.lib.php:951
fread($bytes)
Definition: getid3.php:1685
CreateDeepArray($ArrayPath, $Separator, $Value)
Definition: getid3.lib.php:465
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParseDirectoryRecord() [2/2]

getid3_iso::ParseDirectoryRecord (   $directorydata)

Definition at line 271 of file module.misc.iso.php.

References $info, getid3_lib\array_merge_clobber(), getid3_lib\CreateDeepArray(), getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\iconv_fallback(), ISOtime2UNIXtime(), and getid3_lib\LittleEndian2Int().

271  {
272  $info = &$this->getid3->info;
273  if (isset($info['iso']['supplementary_volume_descriptor'])) {
274  $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode
275  } else {
276  $TextEncoding = 'ISO-8859-1'; // Latin-1
277  }
278 
279  $this->fseek($directorydata['location_bytes']);
280  $DirectoryRecordData = $this->fread(1);
281 
282  while (ord($DirectoryRecordData{0}) > 33) {
283 
284  $DirectoryRecordData .= $this->fread(ord($DirectoryRecordData{0}) - 1);
285 
286  $ThisDirectoryRecord['raw']['length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 0, 1));
287  $ThisDirectoryRecord['raw']['extended_attribute_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 1, 1));
288  $ThisDirectoryRecord['raw']['offset_logical'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 2, 4));
289  $ThisDirectoryRecord['raw']['filesize'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 10, 4));
290  $ThisDirectoryRecord['raw']['recording_date_time'] = substr($DirectoryRecordData, 18, 7);
291  $ThisDirectoryRecord['raw']['file_flags'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 25, 1));
292  $ThisDirectoryRecord['raw']['file_unit_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 26, 1));
293  $ThisDirectoryRecord['raw']['interleave_gap_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 27, 1));
294  $ThisDirectoryRecord['raw']['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 28, 2));
295  $ThisDirectoryRecord['raw']['file_identifier_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 32, 1));
296  $ThisDirectoryRecord['raw']['file_identifier'] = substr($DirectoryRecordData, 33, $ThisDirectoryRecord['raw']['file_identifier_length']);
297 
298  $ThisDirectoryRecord['file_identifier_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $info['encoding'], $ThisDirectoryRecord['raw']['file_identifier']);
299 
300  $ThisDirectoryRecord['filesize'] = $ThisDirectoryRecord['raw']['filesize'];
301  $ThisDirectoryRecord['offset_bytes'] = $ThisDirectoryRecord['raw']['offset_logical'] * 2048;
302  $ThisDirectoryRecord['file_flags']['hidden'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x01);
303  $ThisDirectoryRecord['file_flags']['directory'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x02);
304  $ThisDirectoryRecord['file_flags']['associated'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x04);
305  $ThisDirectoryRecord['file_flags']['extended'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x08);
306  $ThisDirectoryRecord['file_flags']['permissions'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x10);
307  $ThisDirectoryRecord['file_flags']['multiple'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x80);
308  $ThisDirectoryRecord['recording_timestamp'] = $this->ISOtime2UNIXtime($ThisDirectoryRecord['raw']['recording_date_time']);
309 
310  if ($ThisDirectoryRecord['file_flags']['directory']) {
311  $ThisDirectoryRecord['filename'] = $directorydata['full_path'];
312  } else {
313  $ThisDirectoryRecord['filename'] = $directorydata['full_path'].$this->ISOstripFilenameVersion($ThisDirectoryRecord['file_identifier_ascii']);
314  $info['iso']['files'] = getid3_lib::array_merge_clobber($info['iso']['files'], getid3_lib::CreateDeepArray($ThisDirectoryRecord['filename'], '/', $ThisDirectoryRecord['filesize']));
315  }
316 
317  $DirectoryRecord[] = $ThisDirectoryRecord;
318  $DirectoryRecordData = $this->fread(1);
319  }
320 
321  return $DirectoryRecord;
322  }
array_merge_clobber($array1, $array2)
Definition: getid3.lib.php:358
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
ISOtime2UNIXtime($ISOtime)
$info
Definition: example_052.php:80
iconv_fallback($in_charset, $out_charset, $string)
Definition: getid3.lib.php:951
fread($bytes)
Definition: getid3.php:1685
CreateDeepArray($ArrayPath, $Separator, $Value)
Definition: getid3.lib.php:465
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:

◆ ParsePathTable() [1/2]

getid3_iso::ParsePathTable (   $fd,
$ThisFileInfo 
)

Definition at line 210 of file module.misc.iso.php.

References getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\iconv_fallback(), and getid3_lib\LittleEndian2Int().

210  {
211  if (!isset($ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']) && !isset($ThisFileInfo['iso']['primary_volume_descriptor']['raw']['path_table_l_location'])) {
212  return false;
213  }
214  if (isset($ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'])) {
215  $PathTableLocation = $ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'];
216  $PathTableSize = $ThisFileInfo['iso']['supplementary_volume_descriptor']['raw']['path_table_size'];
217  $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode
218  } else {
219  $PathTableLocation = $ThisFileInfo['iso']['primary_volume_descriptor']['raw']['path_table_l_location'];
220  $PathTableSize = $ThisFileInfo['iso']['primary_volume_descriptor']['raw']['path_table_size'];
221  $TextEncoding = 'ISO-8859-1'; // Latin-1
222  }
223 
224  if (($PathTableLocation * 2048) > $ThisFileInfo['filesize']) {
225  $ThisFileInfo['error'][] = 'Path Table Location specifies an offset ('.($PathTableLocation * 2048).') beyond the end-of-file ('.$ThisFileInfo['filesize'].')';
226  return false;
227  }
228 
229  $ThisFileInfo['iso']['path_table']['offset'] = $PathTableLocation * 2048;
230  fseek($fd, $ThisFileInfo['iso']['path_table']['offset'], SEEK_SET);
231  $ThisFileInfo['iso']['path_table']['raw'] = fread($fd, $PathTableSize);
232 
233  $offset = 0;
234  $pathcounter = 1;
235  while ($offset < $PathTableSize) {
236  // shortcut
237  $ThisFileInfo['iso']['path_table']['directories'][$pathcounter] = array();
238  $thisfile_iso_pathtable_directories_current = &$ThisFileInfo['iso']['path_table']['directories'][$pathcounter];
239 
240  $thisfile_iso_pathtable_directories_current['length'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 1));
241  $offset += 1;
242  $thisfile_iso_pathtable_directories_current['extended_length'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 1));
243  $offset += 1;
244  $thisfile_iso_pathtable_directories_current['location_logical'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 4));
245  $offset += 4;
246  $thisfile_iso_pathtable_directories_current['parent_directory'] = getid3_lib::LittleEndian2Int(substr($ThisFileInfo['iso']['path_table']['raw'], $offset, 2));
247  $offset += 2;
248  $thisfile_iso_pathtable_directories_current['name'] = substr($ThisFileInfo['iso']['path_table']['raw'], $offset, $thisfile_iso_pathtable_directories_current['length']);
249  $offset += $thisfile_iso_pathtable_directories_current['length'] + ($thisfile_iso_pathtable_directories_current['length'] % 2);
250 
251  $thisfile_iso_pathtable_directories_current['name_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $ThisFileInfo['encoding'], $thisfile_iso_pathtable_directories_current['name']);
252 
253  $thisfile_iso_pathtable_directories_current['location_bytes'] = $thisfile_iso_pathtable_directories_current['location_logical'] * 2048;
254  if ($pathcounter == 1) {
255  $thisfile_iso_pathtable_directories_current['full_path'] = '/';
256  } else {
257  $thisfile_iso_pathtable_directories_current['full_path'] = $ThisFileInfo['iso']['path_table']['directories'][$thisfile_iso_pathtable_directories_current['parent_directory']]['full_path'].$thisfile_iso_pathtable_directories_current['name_ascii'].'/';
258  }
259  $FullPathArray[] = $thisfile_iso_pathtable_directories_current['full_path'];
260 
261  $pathcounter++;
262  }
263 
264  return true;
265  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
iconv_fallback($in_charset, $out_charset, $string)
Definition: getid3.lib.php:951
fread($bytes)
Definition: getid3.php:1685
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:

◆ ParsePathTable() [2/2]

getid3_iso::ParsePathTable ( )

Definition at line 212 of file module.misc.iso.php.

References $info, getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\iconv_fallback(), and getid3_lib\LittleEndian2Int().

Referenced by Analyze(), and getid3_iso().

212  {
213  $info = &$this->getid3->info;
214  if (!isset($info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']) && !isset($info['iso']['primary_volume_descriptor']['raw']['path_table_l_location'])) {
215  return false;
216  }
217  if (isset($info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'])) {
218  $PathTableLocation = $info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'];
219  $PathTableSize = $info['iso']['supplementary_volume_descriptor']['raw']['path_table_size'];
220  $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode
221  } else {
222  $PathTableLocation = $info['iso']['primary_volume_descriptor']['raw']['path_table_l_location'];
223  $PathTableSize = $info['iso']['primary_volume_descriptor']['raw']['path_table_size'];
224  $TextEncoding = 'ISO-8859-1'; // Latin-1
225  }
226 
227  if (($PathTableLocation * 2048) > $info['filesize']) {
228  $info['error'][] = 'Path Table Location specifies an offset ('.($PathTableLocation * 2048).') beyond the end-of-file ('.$info['filesize'].')';
229  return false;
230  }
231 
232  $info['iso']['path_table']['offset'] = $PathTableLocation * 2048;
233  $this->fseek($info['iso']['path_table']['offset']);
234  $info['iso']['path_table']['raw'] = $this->fread($PathTableSize);
235 
236  $offset = 0;
237  $pathcounter = 1;
238  while ($offset < $PathTableSize) {
239  // shortcut
240  $info['iso']['path_table']['directories'][$pathcounter] = array();
241  $thisfile_iso_pathtable_directories_current = &$info['iso']['path_table']['directories'][$pathcounter];
242 
243  $thisfile_iso_pathtable_directories_current['length'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 1));
244  $offset += 1;
245  $thisfile_iso_pathtable_directories_current['extended_length'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 1));
246  $offset += 1;
247  $thisfile_iso_pathtable_directories_current['location_logical'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 4));
248  $offset += 4;
249  $thisfile_iso_pathtable_directories_current['parent_directory'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 2));
250  $offset += 2;
251  $thisfile_iso_pathtable_directories_current['name'] = substr($info['iso']['path_table']['raw'], $offset, $thisfile_iso_pathtable_directories_current['length']);
252  $offset += $thisfile_iso_pathtable_directories_current['length'] + ($thisfile_iso_pathtable_directories_current['length'] % 2);
253 
254  $thisfile_iso_pathtable_directories_current['name_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $info['encoding'], $thisfile_iso_pathtable_directories_current['name']);
255 
256  $thisfile_iso_pathtable_directories_current['location_bytes'] = $thisfile_iso_pathtable_directories_current['location_logical'] * 2048;
257  if ($pathcounter == 1) {
258  $thisfile_iso_pathtable_directories_current['full_path'] = '/';
259  } else {
260  $thisfile_iso_pathtable_directories_current['full_path'] = $info['iso']['path_table']['directories'][$thisfile_iso_pathtable_directories_current['parent_directory']]['full_path'].$thisfile_iso_pathtable_directories_current['name_ascii'].'/';
261  }
262  $FullPathArray[] = $thisfile_iso_pathtable_directories_current['full_path'];
263 
264  $pathcounter++;
265  }
266 
267  return true;
268  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
$info
Definition: example_052.php:80
iconv_fallback($in_charset, $out_charset, $string)
Definition: getid3.lib.php:951
fread($bytes)
Definition: getid3.php:1685
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParsePrimaryVolumeDescriptor() [1/2]

getid3_iso::ParsePrimaryVolumeDescriptor ( $ISOheader,
$ThisFileInfo 
)

Definition at line 59 of file module.misc.iso.php.

References ISOtimeText2UNIXtime(), and getid3_lib\LittleEndian2Int().

Referenced by Analyze(), and getid3_iso().

59  {
60  // ISO integer values are stored *BOTH* Little-Endian AND Big-Endian format!!
61  // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field
62 
63  // shortcuts
64  $ThisFileInfo['iso']['primary_volume_descriptor']['raw'] = array();
65  $thisfile_iso_primaryVD = &$ThisFileInfo['iso']['primary_volume_descriptor'];
66  $thisfile_iso_primaryVD_raw = &$thisfile_iso_primaryVD['raw'];
67 
68  $thisfile_iso_primaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1));
69  $thisfile_iso_primaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5);
70  if ($thisfile_iso_primaryVD_raw['standard_identifier'] != 'CD001') {
71  $ThisFileInfo['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_primaryVD['offset'] + 1).'), found "'.$thisfile_iso_primaryVD_raw['standard_identifier'].'" instead';
72  unset($ThisFileInfo['fileformat']);
73  unset($ThisFileInfo['iso']);
74  return false;
75  }
76 
77 
78  $thisfile_iso_primaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1));
79  //$thisfile_iso_primaryVD_raw['unused_1'] = substr($ISOheader, 7, 1);
80  $thisfile_iso_primaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32);
81  $thisfile_iso_primaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32);
82  //$thisfile_iso_primaryVD_raw['unused_2'] = substr($ISOheader, 72, 8);
83  $thisfile_iso_primaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4));
84  //$thisfile_iso_primaryVD_raw['unused_3'] = substr($ISOheader, 88, 32);
85  $thisfile_iso_primaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2));
86  $thisfile_iso_primaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2));
87  $thisfile_iso_primaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2));
88  $thisfile_iso_primaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4));
89  $thisfile_iso_primaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2));
90  $thisfile_iso_primaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2));
91  $thisfile_iso_primaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2));
92  $thisfile_iso_primaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2));
93  $thisfile_iso_primaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34);
94  $thisfile_iso_primaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128);
95  $thisfile_iso_primaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128);
96  $thisfile_iso_primaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128);
97  $thisfile_iso_primaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128);
98  $thisfile_iso_primaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37);
99  $thisfile_iso_primaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37);
100  $thisfile_iso_primaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
101  $thisfile_iso_primaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17);
102  $thisfile_iso_primaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17);
103  $thisfile_iso_primaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17);
104  $thisfile_iso_primaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17);
105  $thisfile_iso_primaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1));
106  //$thisfile_iso_primaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1));
107  $thisfile_iso_primaryVD_raw['application_data'] = substr($ISOheader, 883, 512);
108  //$thisfile_iso_primaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653);
109 
110  $thisfile_iso_primaryVD['system_identifier'] = trim($thisfile_iso_primaryVD_raw['system_identifier']);
111  $thisfile_iso_primaryVD['volume_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_identifier']);
112  $thisfile_iso_primaryVD['volume_set_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_set_identifier']);
113  $thisfile_iso_primaryVD['publisher_identifier'] = trim($thisfile_iso_primaryVD_raw['publisher_identifier']);
114  $thisfile_iso_primaryVD['data_preparer_identifier'] = trim($thisfile_iso_primaryVD_raw['data_preparer_identifier']);
115  $thisfile_iso_primaryVD['application_identifier'] = trim($thisfile_iso_primaryVD_raw['application_identifier']);
116  $thisfile_iso_primaryVD['copyright_file_identifier'] = trim($thisfile_iso_primaryVD_raw['copyright_file_identifier']);
117  $thisfile_iso_primaryVD['abstract_file_identifier'] = trim($thisfile_iso_primaryVD_raw['abstract_file_identifier']);
118  $thisfile_iso_primaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_primaryVD_raw['bibliographic_file_identifier']);
119  $thisfile_iso_primaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_creation_date_time']);
120  $thisfile_iso_primaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_modification_date_time']);
121  $thisfile_iso_primaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_expiration_date_time']);
122  $thisfile_iso_primaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_effective_date_time']);
123 
124  if (($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048) > $ThisFileInfo['filesize']) {
125  $ThisFileInfo['error'][] = 'Volume Space Size ('.($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048).' bytes) is larger than the file size ('.$ThisFileInfo['filesize'].' bytes) (truncated file?)';
126  }
127 
128  return true;
129  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
ISOtimeText2UNIXtime($ISOtime)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParsePrimaryVolumeDescriptor() [2/2]

getid3_iso::ParsePrimaryVolumeDescriptor ( $ISOheader)

Definition at line 59 of file module.misc.iso.php.

References $info, ISOtimeText2UNIXtime(), and getid3_lib\LittleEndian2Int().

59  {
60  // ISO integer values are stored *BOTH* Little-Endian AND Big-Endian format!!
61  // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field
62 
63  // shortcuts
64  $info = &$this->getid3->info;
65  $info['iso']['primary_volume_descriptor']['raw'] = array();
66  $thisfile_iso_primaryVD = &$info['iso']['primary_volume_descriptor'];
67  $thisfile_iso_primaryVD_raw = &$thisfile_iso_primaryVD['raw'];
68 
69  $thisfile_iso_primaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1));
70  $thisfile_iso_primaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5);
71  if ($thisfile_iso_primaryVD_raw['standard_identifier'] != 'CD001') {
72  $info['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_primaryVD['offset'] + 1).'), found "'.$thisfile_iso_primaryVD_raw['standard_identifier'].'" instead';
73  unset($info['fileformat']);
74  unset($info['iso']);
75  return false;
76  }
77 
78 
79  $thisfile_iso_primaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1));
80  //$thisfile_iso_primaryVD_raw['unused_1'] = substr($ISOheader, 7, 1);
81  $thisfile_iso_primaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32);
82  $thisfile_iso_primaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32);
83  //$thisfile_iso_primaryVD_raw['unused_2'] = substr($ISOheader, 72, 8);
84  $thisfile_iso_primaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4));
85  //$thisfile_iso_primaryVD_raw['unused_3'] = substr($ISOheader, 88, 32);
86  $thisfile_iso_primaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2));
87  $thisfile_iso_primaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2));
88  $thisfile_iso_primaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2));
89  $thisfile_iso_primaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4));
90  $thisfile_iso_primaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2));
91  $thisfile_iso_primaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2));
92  $thisfile_iso_primaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2));
93  $thisfile_iso_primaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2));
94  $thisfile_iso_primaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34);
95  $thisfile_iso_primaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128);
96  $thisfile_iso_primaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128);
97  $thisfile_iso_primaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128);
98  $thisfile_iso_primaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128);
99  $thisfile_iso_primaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37);
100  $thisfile_iso_primaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37);
101  $thisfile_iso_primaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
102  $thisfile_iso_primaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17);
103  $thisfile_iso_primaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17);
104  $thisfile_iso_primaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17);
105  $thisfile_iso_primaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17);
106  $thisfile_iso_primaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1));
107  //$thisfile_iso_primaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1));
108  $thisfile_iso_primaryVD_raw['application_data'] = substr($ISOheader, 883, 512);
109  //$thisfile_iso_primaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653);
110 
111  $thisfile_iso_primaryVD['system_identifier'] = trim($thisfile_iso_primaryVD_raw['system_identifier']);
112  $thisfile_iso_primaryVD['volume_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_identifier']);
113  $thisfile_iso_primaryVD['volume_set_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_set_identifier']);
114  $thisfile_iso_primaryVD['publisher_identifier'] = trim($thisfile_iso_primaryVD_raw['publisher_identifier']);
115  $thisfile_iso_primaryVD['data_preparer_identifier'] = trim($thisfile_iso_primaryVD_raw['data_preparer_identifier']);
116  $thisfile_iso_primaryVD['application_identifier'] = trim($thisfile_iso_primaryVD_raw['application_identifier']);
117  $thisfile_iso_primaryVD['copyright_file_identifier'] = trim($thisfile_iso_primaryVD_raw['copyright_file_identifier']);
118  $thisfile_iso_primaryVD['abstract_file_identifier'] = trim($thisfile_iso_primaryVD_raw['abstract_file_identifier']);
119  $thisfile_iso_primaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_primaryVD_raw['bibliographic_file_identifier']);
120  $thisfile_iso_primaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_creation_date_time']);
121  $thisfile_iso_primaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_modification_date_time']);
122  $thisfile_iso_primaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_expiration_date_time']);
123  $thisfile_iso_primaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_effective_date_time']);
124 
125  if (($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048) > $info['filesize']) {
126  $info['error'][] = 'Volume Space Size ('.($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048).' bytes) is larger than the file size ('.$info['filesize'].' bytes) (truncated file?)';
127  }
128 
129  return true;
130  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
ISOtimeText2UNIXtime($ISOtime)
$info
Definition: example_052.php:80
+ Here is the call graph for this function:

◆ ParseSupplementaryVolumeDescriptor() [1/2]

getid3_iso::ParseSupplementaryVolumeDescriptor ( $ISOheader,
$ThisFileInfo 
)

Definition at line 132 of file module.misc.iso.php.

References ISOtimeText2UNIXtime(), and getid3_lib\LittleEndian2Int().

Referenced by Analyze(), and getid3_iso().

132  {
133  // ISO integer values are stored Both-Endian format!!
134  // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field
135 
136  // shortcuts
137  $ThisFileInfo['iso']['supplementary_volume_descriptor']['raw'] = array();
138  $thisfile_iso_supplementaryVD = &$ThisFileInfo['iso']['supplementary_volume_descriptor'];
139  $thisfile_iso_supplementaryVD_raw = &$thisfile_iso_supplementaryVD['raw'];
140 
141  $thisfile_iso_supplementaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1));
142  $thisfile_iso_supplementaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5);
143  if ($thisfile_iso_supplementaryVD_raw['standard_identifier'] != 'CD001') {
144  $ThisFileInfo['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_supplementaryVD['offset'] + 1).'), found "'.$thisfile_iso_supplementaryVD_raw['standard_identifier'].'" instead';
145  unset($ThisFileInfo['fileformat']);
146  unset($ThisFileInfo['iso']);
147  return false;
148  }
149 
150  $thisfile_iso_supplementaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1));
151  //$thisfile_iso_supplementaryVD_raw['unused_1'] = substr($ISOheader, 7, 1);
152  $thisfile_iso_supplementaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32);
153  $thisfile_iso_supplementaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32);
154  //$thisfile_iso_supplementaryVD_raw['unused_2'] = substr($ISOheader, 72, 8);
155  $thisfile_iso_supplementaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4));
156  if ($thisfile_iso_supplementaryVD_raw['volume_space_size'] == 0) {
157  // Supplementary Volume Descriptor not used
158  //unset($thisfile_iso_supplementaryVD);
159  //return false;
160  }
161 
162  //$thisfile_iso_supplementaryVD_raw['unused_3'] = substr($ISOheader, 88, 32);
163  $thisfile_iso_supplementaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2));
164  $thisfile_iso_supplementaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2));
165  $thisfile_iso_supplementaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2));
166  $thisfile_iso_supplementaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4));
167  $thisfile_iso_supplementaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2));
168  $thisfile_iso_supplementaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2));
169  $thisfile_iso_supplementaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2));
170  $thisfile_iso_supplementaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2));
171  $thisfile_iso_supplementaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34);
172  $thisfile_iso_supplementaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128);
173  $thisfile_iso_supplementaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128);
174  $thisfile_iso_supplementaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128);
175  $thisfile_iso_supplementaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128);
176  $thisfile_iso_supplementaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37);
177  $thisfile_iso_supplementaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37);
178  $thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
179  $thisfile_iso_supplementaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17);
180  $thisfile_iso_supplementaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17);
181  $thisfile_iso_supplementaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17);
182  $thisfile_iso_supplementaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17);
183  $thisfile_iso_supplementaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1));
184  //$thisfile_iso_supplementaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1));
185  $thisfile_iso_supplementaryVD_raw['application_data'] = substr($ISOheader, 883, 512);
186  //$thisfile_iso_supplementaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653);
187 
188  $thisfile_iso_supplementaryVD['system_identifier'] = trim($thisfile_iso_supplementaryVD_raw['system_identifier']);
189  $thisfile_iso_supplementaryVD['volume_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_identifier']);
190  $thisfile_iso_supplementaryVD['volume_set_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_set_identifier']);
191  $thisfile_iso_supplementaryVD['publisher_identifier'] = trim($thisfile_iso_supplementaryVD_raw['publisher_identifier']);
192  $thisfile_iso_supplementaryVD['data_preparer_identifier'] = trim($thisfile_iso_supplementaryVD_raw['data_preparer_identifier']);
193  $thisfile_iso_supplementaryVD['application_identifier'] = trim($thisfile_iso_supplementaryVD_raw['application_identifier']);
194  $thisfile_iso_supplementaryVD['copyright_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['copyright_file_identifier']);
195  $thisfile_iso_supplementaryVD['abstract_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['abstract_file_identifier']);
196  $thisfile_iso_supplementaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier']);
197  $thisfile_iso_supplementaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_creation_date_time']);
198  $thisfile_iso_supplementaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_modification_date_time']);
199  $thisfile_iso_supplementaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_expiration_date_time']);
200  $thisfile_iso_supplementaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_effective_date_time']);
201 
202  if (($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']) > $ThisFileInfo['filesize']) {
203  $ThisFileInfo['error'][] = 'Volume Space Size ('.($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']).' bytes) is larger than the file size ('.$ThisFileInfo['filesize'].' bytes) (truncated file?)';
204  }
205 
206  return true;
207  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
ISOtimeText2UNIXtime($ISOtime)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParseSupplementaryVolumeDescriptor() [2/2]

getid3_iso::ParseSupplementaryVolumeDescriptor ( $ISOheader)

Definition at line 133 of file module.misc.iso.php.

References $info, ISOtimeText2UNIXtime(), and getid3_lib\LittleEndian2Int().

133  {
134  // ISO integer values are stored Both-Endian format!!
135  // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field
136 
137  // shortcuts
138  $info = &$this->getid3->info;
139  $info['iso']['supplementary_volume_descriptor']['raw'] = array();
140  $thisfile_iso_supplementaryVD = &$info['iso']['supplementary_volume_descriptor'];
141  $thisfile_iso_supplementaryVD_raw = &$thisfile_iso_supplementaryVD['raw'];
142 
143  $thisfile_iso_supplementaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1));
144  $thisfile_iso_supplementaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5);
145  if ($thisfile_iso_supplementaryVD_raw['standard_identifier'] != 'CD001') {
146  $info['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_supplementaryVD['offset'] + 1).'), found "'.$thisfile_iso_supplementaryVD_raw['standard_identifier'].'" instead';
147  unset($info['fileformat']);
148  unset($info['iso']);
149  return false;
150  }
151 
152  $thisfile_iso_supplementaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1));
153  //$thisfile_iso_supplementaryVD_raw['unused_1'] = substr($ISOheader, 7, 1);
154  $thisfile_iso_supplementaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32);
155  $thisfile_iso_supplementaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32);
156  //$thisfile_iso_supplementaryVD_raw['unused_2'] = substr($ISOheader, 72, 8);
157  $thisfile_iso_supplementaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4));
158  if ($thisfile_iso_supplementaryVD_raw['volume_space_size'] == 0) {
159  // Supplementary Volume Descriptor not used
160  //unset($thisfile_iso_supplementaryVD);
161  //return false;
162  }
163 
164  //$thisfile_iso_supplementaryVD_raw['unused_3'] = substr($ISOheader, 88, 32);
165  $thisfile_iso_supplementaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2));
166  $thisfile_iso_supplementaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2));
167  $thisfile_iso_supplementaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2));
168  $thisfile_iso_supplementaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4));
169  $thisfile_iso_supplementaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2));
170  $thisfile_iso_supplementaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2));
171  $thisfile_iso_supplementaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2));
172  $thisfile_iso_supplementaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2));
173  $thisfile_iso_supplementaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34);
174  $thisfile_iso_supplementaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128);
175  $thisfile_iso_supplementaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128);
176  $thisfile_iso_supplementaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128);
177  $thisfile_iso_supplementaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128);
178  $thisfile_iso_supplementaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37);
179  $thisfile_iso_supplementaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37);
180  $thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
181  $thisfile_iso_supplementaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17);
182  $thisfile_iso_supplementaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17);
183  $thisfile_iso_supplementaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17);
184  $thisfile_iso_supplementaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17);
185  $thisfile_iso_supplementaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1));
186  //$thisfile_iso_supplementaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1));
187  $thisfile_iso_supplementaryVD_raw['application_data'] = substr($ISOheader, 883, 512);
188  //$thisfile_iso_supplementaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653);
189 
190  $thisfile_iso_supplementaryVD['system_identifier'] = trim($thisfile_iso_supplementaryVD_raw['system_identifier']);
191  $thisfile_iso_supplementaryVD['volume_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_identifier']);
192  $thisfile_iso_supplementaryVD['volume_set_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_set_identifier']);
193  $thisfile_iso_supplementaryVD['publisher_identifier'] = trim($thisfile_iso_supplementaryVD_raw['publisher_identifier']);
194  $thisfile_iso_supplementaryVD['data_preparer_identifier'] = trim($thisfile_iso_supplementaryVD_raw['data_preparer_identifier']);
195  $thisfile_iso_supplementaryVD['application_identifier'] = trim($thisfile_iso_supplementaryVD_raw['application_identifier']);
196  $thisfile_iso_supplementaryVD['copyright_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['copyright_file_identifier']);
197  $thisfile_iso_supplementaryVD['abstract_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['abstract_file_identifier']);
198  $thisfile_iso_supplementaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier']);
199  $thisfile_iso_supplementaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_creation_date_time']);
200  $thisfile_iso_supplementaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_modification_date_time']);
201  $thisfile_iso_supplementaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_expiration_date_time']);
202  $thisfile_iso_supplementaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_effective_date_time']);
203 
204  if (($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']) > $info['filesize']) {
205  $info['error'][] = 'Volume Space Size ('.($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']).' bytes) is larger than the file size ('.$info['filesize'].' bytes) (truncated file?)';
206  }
207 
208  return true;
209  }
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
ISOtimeText2UNIXtime($ISOtime)
$info
Definition: example_052.php:80
+ Here is the call graph for this function:

◆ TwosCompliment2Decimal() [1/2]

getid3_iso::TwosCompliment2Decimal (   $BinaryValue)

Definition at line 365 of file module.misc.iso.php.

Referenced by ISOtime2UNIXtime().

365  {
366  // http://sandbox.mc.edu/~bennet/cs110/tc/tctod.html
367  // First check if the number is negative or positive by looking at the sign bit.
368  // If it is positive, simply convert it to decimal.
369  // If it is negative, make it positive by inverting the bits and adding one.
370  // Then, convert the result to decimal.
371  // The negative of this number is the value of the original binary.
372 
373  if ($BinaryValue & 0x80) {
374 
375  // negative number
376  return (0 - ((~$BinaryValue & 0xFF) + 1));
377  } else {
378  // positive number
379  return $BinaryValue;
380  }
381  }
+ Here is the caller graph for this function:

◆ TwosCompliment2Decimal() [2/2]

getid3_iso::TwosCompliment2Decimal (   $BinaryValue)

Definition at line 369 of file module.misc.iso.php.

369  {
370  // http://sandbox.mc.edu/~bennet/cs110/tc/tctod.html
371  // First check if the number is negative or positive by looking at the sign bit.
372  // If it is positive, simply convert it to decimal.
373  // If it is negative, make it positive by inverting the bits and adding one.
374  // Then, convert the result to decimal.
375  // The negative of this number is the value of the original binary.
376 
377  if ($BinaryValue & 0x80) {
378 
379  // negative number
380  return (0 - ((~$BinaryValue & 0xFF) + 1));
381  } else {
382  // positive number
383  return $BinaryValue;
384  }
385  }

The documentation for this class was generated from the following file: