22                $info = &$this->getid3->info;
 
   24                $info[
'fileformat'] = 
'iso';
 
   26                for (
$i = 16; 
$i <= 19; 
$i++) {
 
   28                        $ISOheader = $this->
fread(2048);
 
   29                        if (substr($ISOheader, 1, 5) == 
'CD001') {
 
   30                                switch (ord($ISOheader{0})) {
 
   32                                                $info[
'iso'][
'primary_volume_descriptor'][
'offset'] = 2048 * 
$i;
 
   37                                                $info[
'iso'][
'supplementary_volume_descriptor'][
'offset'] = 2048 * 
$i;
 
   50                $info[
'iso'][
'files'] = array();
 
   51                foreach (
$info[
'iso'][
'path_table'][
'directories'] as $directorynum => $directorydata) {
 
   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'];
 
   70                $thisfile_iso_primaryVD_raw[
'standard_identifier']            =                  substr($ISOheader,    1, 5);
 
   71                if ($thisfile_iso_primaryVD_raw[
'standard_identifier'] != 
'CD001') {
 
   72                        $this->
error(
'Expected "CD001" at offset ('.($thisfile_iso_primaryVD[
'offset'] + 1).
'), found "'.$thisfile_iso_primaryVD_raw[
'standard_identifier'].
'" instead');
 
   73                        unset(
$info[
'fileformat']);
 
   81                $thisfile_iso_primaryVD_raw[
'system_identifier']             =                              substr($ISOheader,    8, 32);
 
   82                $thisfile_iso_primaryVD_raw[
'volume_identifier']             =                              substr($ISOheader,   40, 32);
 
   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);
 
  108                $thisfile_iso_primaryVD_raw[
'application_data']              =                              substr($ISOheader,  883, 512);
 
  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']);
 
  125                if (($thisfile_iso_primaryVD_raw[
'volume_space_size'] * 2048) > 
$info[
'filesize']) {
 
  126                        $this->
error(
'Volume Space Size ('.($thisfile_iso_primaryVD_raw[
'volume_space_size'] * 2048).
' bytes) is larger than the file size ('.
$info[
'filesize'].
' bytes) (truncated file?)');
 
  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'];
 
  144                $thisfile_iso_supplementaryVD_raw[
'standard_identifier']    =                  substr($ISOheader,    1, 5);
 
  145                if ($thisfile_iso_supplementaryVD_raw[
'standard_identifier'] != 
'CD001') {
 
  146                        $this->
error(
'Expected "CD001" at offset ('.($thisfile_iso_supplementaryVD[
'offset'] + 1).
'), found "'.$thisfile_iso_supplementaryVD_raw[
'standard_identifier'].
'" instead');
 
  147                        unset(
$info[
'fileformat']);
 
  154                $thisfile_iso_supplementaryVD_raw[
'system_identifier']         =                              substr($ISOheader,    8, 32);
 
  155                $thisfile_iso_supplementaryVD_raw[
'volume_identifier']         =                              substr($ISOheader,   40, 32);
 
  158                if ($thisfile_iso_supplementaryVD_raw[
'volume_space_size'] == 0) {
 
  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);
 
  187                $thisfile_iso_supplementaryVD_raw[
'application_data']               =                              substr($ISOheader,  883, 512);
 
  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']);
 
  204                if (($thisfile_iso_supplementaryVD_raw[
'volume_space_size'] * $thisfile_iso_supplementaryVD_raw[
'logical_block_size']) > 
$info[
'filesize']) {
 
  205                        $this->
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?)');
 
  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'])) {
 
  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'; 
 
  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'; 
 
  227                if (($PathTableLocation * 2048) > 
$info[
'filesize']) {
 
  228                        $this->
error(
'Path Table Location specifies an offset ('.($PathTableLocation * 2048).
') beyond the end-of-file ('.
$info[
'filesize'].
')');
 
  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);
 
  238                while ($offset < $PathTableSize) {
 
  240                        $info[
'iso'][
'path_table'][
'directories'][$pathcounter] = array();
 
  241                        $thisfile_iso_pathtable_directories_current = &
$info[
'iso'][
'path_table'][
'directories'][$pathcounter];
 
  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);
 
  254                        $thisfile_iso_pathtable_directories_current[
'name_ascii']       = 
getid3_lib::iconv_fallback($TextEncoding, 
$info[
'encoding'], $thisfile_iso_pathtable_directories_current[
'name']);
 
  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'] = 
'/';
 
  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'].
'/';
 
  262                        $FullPathArray[] = $thisfile_iso_pathtable_directories_current[
'full_path'];
 
  272                $info = &$this->getid3->info;
 
  273                if (isset(
$info[
'iso'][
'supplementary_volume_descriptor'])) {
 
  274                        $TextEncoding = 
'UTF-16BE';   
 
  276                        $TextEncoding = 
'ISO-8859-1'; 
 
  279                $this->
fseek($directorydata[
'location_bytes']);
 
  280                $DirectoryRecordData = $this->
fread(1);
 
  282                while (ord($DirectoryRecordData{0}) > 33) {
 
  284                        $DirectoryRecordData .= $this->
fread(ord($DirectoryRecordData{0}) - 1);
 
  290                        $ThisDirectoryRecord[
'raw'][
'recording_date_time']       =                  substr($DirectoryRecordData, 18, 7);
 
  296                        $ThisDirectoryRecord[
'raw'][
'file_identifier']           =                  substr($DirectoryRecordData, 33, $ThisDirectoryRecord[
'raw'][
'file_identifier_length']);
 
  298                        $ThisDirectoryRecord[
'file_identifier_ascii']            = 
getid3_lib::iconv_fallback($TextEncoding, 
$info[
'encoding'], $ThisDirectoryRecord[
'raw'][
'file_identifier']);
 
  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']);
 
  310                        if ($ThisDirectoryRecord[
'file_flags'][
'directory']) {
 
  311                                $ThisDirectoryRecord[
'filename'] = $directorydata[
'full_path'];
 
  313                                $ThisDirectoryRecord[
'filename'] = $directorydata[
'full_path'].$this->ISOstripFilenameVersion($ThisDirectoryRecord[
'file_identifier_ascii']);
 
  317                        $DirectoryRecord[] = $ThisDirectoryRecord;
 
  318                        $DirectoryRecordData = $this->
fread(1);
 
  321                return $DirectoryRecord;
 
  326                if (!strstr($ISOfilename, 
';')) {
 
  329                        return substr($ISOfilename, 0, strpos($ISOfilename, 
';'));
 
  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);
 
  345                return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
 
  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});
 
  366                return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
 
  377                if ($BinaryValue & 0x80) {
 
  380                        return (0 - ((~$BinaryValue & 0xFF) + 1));
 
An exception for terminatinating execution or to throw for unit testing.
fseek($bytes, $whence=SEEK_SET)
getID3() by James Heinrich info@getid3.org //
ParsePrimaryVolumeDescriptor(&$ISOheader)
ParseSupplementaryVolumeDescriptor(&$ISOheader)
ParseDirectoryRecord($directorydata)
TwosCompliment2Decimal($BinaryValue)
ISOtimeText2UNIXtime($ISOtime)
ISOtime2UNIXtime($ISOtime)
ISOstripFilenameVersion($ISOfilename)
static CreateDeepArray($ArrayPath, $Separator, $Value)
static LittleEndian2Int($byteword, $signed=false)
static iconv_fallback($in_charset, $out_charset, $string)
static array_merge_clobber($array1, $array2)