38 $info = &$this->getid3->info;
40 $info[
'fileformat'] =
'iso';
42 for ($i = 16; $i <= 19; $i++) {
43 fseek($this->getid3->fp, 2048 * $i, SEEK_SET);
44 $ISOheader =
fread($this->getid3->fp, 2048);
45 if (substr($ISOheader, 1, 5) ==
'CD001') {
46 switch (ord($ISOheader{0})) {
48 $info[
'iso'][
'primary_volume_descriptor'][
'offset'] = 2048 * $i;
53 $info[
'iso'][
'supplementary_volume_descriptor'][
'offset'] = 2048 * $i;
67 foreach (
$info[
'iso'][
'path_table'][
'directories'] as $directorynum => $directorydata) {
85 $info = &$this->getid3->info;
86 $info[
'iso'][
'primary_volume_descriptor'][
'raw'] =
array();
87 $thisfile_iso_primaryVD = &
$info[
'iso'][
'primary_volume_descriptor'];
88 $thisfile_iso_primaryVD_raw = &$thisfile_iso_primaryVD[
'raw'];
91 $thisfile_iso_primaryVD_raw[
'standard_identifier'] = substr($ISOheader, 1, 5);
92 if ($thisfile_iso_primaryVD_raw[
'standard_identifier'] !=
'CD001') {
93 $info[
'error'][] =
'Expected "CD001" at offset ('.($thisfile_iso_primaryVD[
'offset'] + 1).
'), found "'.$thisfile_iso_primaryVD_raw[
'standard_identifier'].
'" instead';
94 unset(
$info[
'fileformat']);
102 $thisfile_iso_primaryVD_raw[
'system_identifier'] = substr($ISOheader, 8, 32);
103 $thisfile_iso_primaryVD_raw[
'volume_identifier'] = substr($ISOheader, 40, 32);
115 $thisfile_iso_primaryVD_raw[
'root_directory_record'] = substr($ISOheader, 156, 34);
116 $thisfile_iso_primaryVD_raw[
'volume_set_identifier'] = substr($ISOheader, 190, 128);
117 $thisfile_iso_primaryVD_raw[
'publisher_identifier'] = substr($ISOheader, 318, 128);
118 $thisfile_iso_primaryVD_raw[
'data_preparer_identifier'] = substr($ISOheader, 446, 128);
119 $thisfile_iso_primaryVD_raw[
'application_identifier'] = substr($ISOheader, 574, 128);
120 $thisfile_iso_primaryVD_raw[
'copyright_file_identifier'] = substr($ISOheader, 702, 37);
121 $thisfile_iso_primaryVD_raw[
'abstract_file_identifier'] = substr($ISOheader, 739, 37);
122 $thisfile_iso_primaryVD_raw[
'bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
123 $thisfile_iso_primaryVD_raw[
'volume_creation_date_time'] = substr($ISOheader, 813, 17);
124 $thisfile_iso_primaryVD_raw[
'volume_modification_date_time'] = substr($ISOheader, 830, 17);
125 $thisfile_iso_primaryVD_raw[
'volume_expiration_date_time'] = substr($ISOheader, 847, 17);
126 $thisfile_iso_primaryVD_raw[
'volume_effective_date_time'] = substr($ISOheader, 864, 17);
129 $thisfile_iso_primaryVD_raw[
'application_data'] = substr($ISOheader, 883, 512);
132 $thisfile_iso_primaryVD[
'system_identifier'] = trim($thisfile_iso_primaryVD_raw[
'system_identifier']);
133 $thisfile_iso_primaryVD[
'volume_identifier'] = trim($thisfile_iso_primaryVD_raw[
'volume_identifier']);
134 $thisfile_iso_primaryVD[
'volume_set_identifier'] = trim($thisfile_iso_primaryVD_raw[
'volume_set_identifier']);
135 $thisfile_iso_primaryVD[
'publisher_identifier'] = trim($thisfile_iso_primaryVD_raw[
'publisher_identifier']);
136 $thisfile_iso_primaryVD[
'data_preparer_identifier'] = trim($thisfile_iso_primaryVD_raw[
'data_preparer_identifier']);
137 $thisfile_iso_primaryVD[
'application_identifier'] = trim($thisfile_iso_primaryVD_raw[
'application_identifier']);
138 $thisfile_iso_primaryVD[
'copyright_file_identifier'] = trim($thisfile_iso_primaryVD_raw[
'copyright_file_identifier']);
139 $thisfile_iso_primaryVD[
'abstract_file_identifier'] = trim($thisfile_iso_primaryVD_raw[
'abstract_file_identifier']);
140 $thisfile_iso_primaryVD[
'bibliographic_file_identifier'] = trim($thisfile_iso_primaryVD_raw[
'bibliographic_file_identifier']);
141 $thisfile_iso_primaryVD[
'volume_creation_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw[
'volume_creation_date_time']);
142 $thisfile_iso_primaryVD[
'volume_modification_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw[
'volume_modification_date_time']);
143 $thisfile_iso_primaryVD[
'volume_expiration_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw[
'volume_expiration_date_time']);
144 $thisfile_iso_primaryVD[
'volume_effective_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw[
'volume_effective_date_time']);
146 if (($thisfile_iso_primaryVD_raw[
'volume_space_size'] * 2048) >
$info[
'filesize']) {
147 $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?)';
164 $info = &$this->getid3->info;
165 $info[
'iso'][
'supplementary_volume_descriptor'][
'raw'] =
array();
166 $thisfile_iso_supplementaryVD = &
$info[
'iso'][
'supplementary_volume_descriptor'];
167 $thisfile_iso_supplementaryVD_raw = &$thisfile_iso_supplementaryVD[
'raw'];
170 $thisfile_iso_supplementaryVD_raw[
'standard_identifier'] = substr($ISOheader, 1, 5);
171 if ($thisfile_iso_supplementaryVD_raw[
'standard_identifier'] !=
'CD001') {
172 $info[
'error'][] =
'Expected "CD001" at offset ('.($thisfile_iso_supplementaryVD[
'offset'] + 1).
'), found "'.$thisfile_iso_supplementaryVD_raw[
'standard_identifier'].
'" instead';
173 unset(
$info[
'fileformat']);
179 $thisfile_iso_supplementaryVD_raw[
'volume_descriptor_version'] =
Helper::LittleEndian2Int(substr($ISOheader, 6, 1));
181 $thisfile_iso_supplementaryVD_raw[
'system_identifier'] = substr($ISOheader, 8, 32);
182 $thisfile_iso_supplementaryVD_raw[
'volume_identifier'] = substr($ISOheader, 40, 32);
185 if ($thisfile_iso_supplementaryVD_raw[
'volume_space_size'] == 0) {
197 $thisfile_iso_supplementaryVD_raw[
'path_table_l_opt_location'] =
Helper::LittleEndian2Int(substr($ISOheader, 144, 2));
199 $thisfile_iso_supplementaryVD_raw[
'path_table_m_opt_location'] =
Helper::LittleEndian2Int(substr($ISOheader, 152, 2));
200 $thisfile_iso_supplementaryVD_raw[
'root_directory_record'] = substr($ISOheader, 156, 34);
201 $thisfile_iso_supplementaryVD_raw[
'volume_set_identifier'] = substr($ISOheader, 190, 128);
202 $thisfile_iso_supplementaryVD_raw[
'publisher_identifier'] = substr($ISOheader, 318, 128);
203 $thisfile_iso_supplementaryVD_raw[
'data_preparer_identifier'] = substr($ISOheader, 446, 128);
204 $thisfile_iso_supplementaryVD_raw[
'application_identifier'] = substr($ISOheader, 574, 128);
205 $thisfile_iso_supplementaryVD_raw[
'copyright_file_identifier'] = substr($ISOheader, 702, 37);
206 $thisfile_iso_supplementaryVD_raw[
'abstract_file_identifier'] = substr($ISOheader, 739, 37);
207 $thisfile_iso_supplementaryVD_raw[
'bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
208 $thisfile_iso_supplementaryVD_raw[
'volume_creation_date_time'] = substr($ISOheader, 813, 17);
209 $thisfile_iso_supplementaryVD_raw[
'volume_modification_date_time'] = substr($ISOheader, 830, 17);
210 $thisfile_iso_supplementaryVD_raw[
'volume_expiration_date_time'] = substr($ISOheader, 847, 17);
211 $thisfile_iso_supplementaryVD_raw[
'volume_effective_date_time'] = substr($ISOheader, 864, 17);
214 $thisfile_iso_supplementaryVD_raw[
'application_data'] = substr($ISOheader, 883, 512);
217 $thisfile_iso_supplementaryVD[
'system_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'system_identifier']);
218 $thisfile_iso_supplementaryVD[
'volume_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'volume_identifier']);
219 $thisfile_iso_supplementaryVD[
'volume_set_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'volume_set_identifier']);
220 $thisfile_iso_supplementaryVD[
'publisher_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'publisher_identifier']);
221 $thisfile_iso_supplementaryVD[
'data_preparer_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'data_preparer_identifier']);
222 $thisfile_iso_supplementaryVD[
'application_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'application_identifier']);
223 $thisfile_iso_supplementaryVD[
'copyright_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'copyright_file_identifier']);
224 $thisfile_iso_supplementaryVD[
'abstract_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'abstract_file_identifier']);
225 $thisfile_iso_supplementaryVD[
'bibliographic_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw[
'bibliographic_file_identifier']);
226 $thisfile_iso_supplementaryVD[
'volume_creation_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw[
'volume_creation_date_time']);
227 $thisfile_iso_supplementaryVD[
'volume_modification_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw[
'volume_modification_date_time']);
228 $thisfile_iso_supplementaryVD[
'volume_expiration_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw[
'volume_expiration_date_time']);
229 $thisfile_iso_supplementaryVD[
'volume_effective_date_time'] = $this->
ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw[
'volume_effective_date_time']);
231 if (($thisfile_iso_supplementaryVD_raw[
'volume_space_size'] * $thisfile_iso_supplementaryVD_raw[
'logical_block_size']) >
$info[
'filesize']) {
232 $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?)';
244 $info = &$this->getid3->info;
245 if (!isset(
$info[
'iso'][
'supplementary_volume_descriptor'][
'raw'][
'path_table_l_location']) && !isset(
$info[
'iso'][
'primary_volume_descriptor'][
'raw'][
'path_table_l_location'])) {
248 if (isset(
$info[
'iso'][
'supplementary_volume_descriptor'][
'raw'][
'path_table_l_location'])) {
249 $PathTableLocation =
$info[
'iso'][
'supplementary_volume_descriptor'][
'raw'][
'path_table_l_location'];
250 $PathTableSize =
$info[
'iso'][
'supplementary_volume_descriptor'][
'raw'][
'path_table_size'];
251 $TextEncoding =
'UTF-16BE';
253 $PathTableLocation =
$info[
'iso'][
'primary_volume_descriptor'][
'raw'][
'path_table_l_location'];
254 $PathTableSize =
$info[
'iso'][
'primary_volume_descriptor'][
'raw'][
'path_table_size'];
255 $TextEncoding =
'ISO-8859-1';
258 if (($PathTableLocation * 2048) >
$info[
'filesize']) {
259 $info[
'error'][] =
'Path Table Location specifies an offset ('.($PathTableLocation * 2048).
') beyond the end-of-file ('.
$info[
'filesize'].
')';
264 $info[
'iso'][
'path_table'][
'offset'] = $PathTableLocation * 2048;
265 fseek($this->getid3->fp,
$info[
'iso'][
'path_table'][
'offset'], SEEK_SET);
266 $info[
'iso'][
'path_table'][
'raw'] =
fread($this->getid3->fp, $PathTableSize);
270 while ($offset < $PathTableSize) {
272 $info[
'iso'][
'path_table'][
'directories'][$pathcounter] =
array();
273 $thisfile_iso_pathtable_directories_current = &
$info[
'iso'][
'path_table'][
'directories'][$pathcounter];
277 $thisfile_iso_pathtable_directories_current[
'extended_length'] =
Helper::LittleEndian2Int(substr(
$info[
'iso'][
'path_table'][
'raw'], $offset, 1));
279 $thisfile_iso_pathtable_directories_current[
'location_logical'] =
Helper::LittleEndian2Int(substr(
$info[
'iso'][
'path_table'][
'raw'], $offset, 4));
281 $thisfile_iso_pathtable_directories_current[
'parent_directory'] =
Helper::LittleEndian2Int(substr(
$info[
'iso'][
'path_table'][
'raw'], $offset, 2));
283 $thisfile_iso_pathtable_directories_current[
'name'] = substr(
$info[
'iso'][
'path_table'][
'raw'], $offset, $thisfile_iso_pathtable_directories_current[
'length']);
284 $offset += $thisfile_iso_pathtable_directories_current[
'length'] + ($thisfile_iso_pathtable_directories_current[
'length'] % 2);
286 $thisfile_iso_pathtable_directories_current[
'name_ascii'] =
Helper::iconv_fallback($TextEncoding,
$info[
'encoding'], $thisfile_iso_pathtable_directories_current[
'name']);
288 $thisfile_iso_pathtable_directories_current[
'location_bytes'] = $thisfile_iso_pathtable_directories_current[
'location_logical'] * 2048;
289 if ($pathcounter == 1) {
290 $thisfile_iso_pathtable_directories_current[
'full_path'] =
'/';
292 $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'].
'/';
294 $FullPathArray[] = $thisfile_iso_pathtable_directories_current[
'full_path'];
309 $info = &$this->getid3->info;
310 if (isset(
$info[
'iso'][
'supplementary_volume_descriptor'])) {
311 $TextEncoding =
'UTF-16BE';
313 $TextEncoding =
'ISO-8859-1';
316 fseek($this->getid3->fp, $directorydata[
'location_bytes'], SEEK_SET);
317 $DirectoryRecordData =
fread($this->getid3->fp, 1);
319 while (ord($DirectoryRecordData{0}) > 33) {
321 $DirectoryRecordData .=
fread($this->getid3->fp, ord($DirectoryRecordData{0}) - 1);
324 $ThisDirectoryRecord[
'raw'][
'extended_attribute_length'] =
Helper::LittleEndian2Int(substr($DirectoryRecordData, 1, 1));
327 $ThisDirectoryRecord[
'raw'][
'recording_date_time'] = substr($DirectoryRecordData, 18, 7);
331 $ThisDirectoryRecord[
'raw'][
'volume_sequence_number'] =
Helper::LittleEndian2Int(substr($DirectoryRecordData, 28, 2));
332 $ThisDirectoryRecord[
'raw'][
'file_identifier_length'] =
Helper::LittleEndian2Int(substr($DirectoryRecordData, 32, 1));
333 $ThisDirectoryRecord[
'raw'][
'file_identifier'] = substr($DirectoryRecordData, 33, $ThisDirectoryRecord[
'raw'][
'file_identifier_length']);
335 $ThisDirectoryRecord[
'file_identifier_ascii'] =
Helper::iconv_fallback($TextEncoding,
$info[
'encoding'], $ThisDirectoryRecord[
'raw'][
'file_identifier']);
337 $ThisDirectoryRecord[
'filesize'] = $ThisDirectoryRecord[
'raw'][
'filesize'];
338 $ThisDirectoryRecord[
'offset_bytes'] = $ThisDirectoryRecord[
'raw'][
'offset_logical'] * 2048;
339 $ThisDirectoryRecord[
'file_flags'][
'hidden'] = (bool) ($ThisDirectoryRecord[
'raw'][
'file_flags'] & 0x01);
340 $ThisDirectoryRecord[
'file_flags'][
'directory'] = (bool) ($ThisDirectoryRecord[
'raw'][
'file_flags'] & 0x02);
341 $ThisDirectoryRecord[
'file_flags'][
'associated'] = (bool) ($ThisDirectoryRecord[
'raw'][
'file_flags'] & 0x04);
342 $ThisDirectoryRecord[
'file_flags'][
'extended'] = (bool) ($ThisDirectoryRecord[
'raw'][
'file_flags'] & 0x08);
343 $ThisDirectoryRecord[
'file_flags'][
'permissions'] = (bool) ($ThisDirectoryRecord[
'raw'][
'file_flags'] & 0x10);
344 $ThisDirectoryRecord[
'file_flags'][
'multiple'] = (bool) ($ThisDirectoryRecord[
'raw'][
'file_flags'] & 0x80);
345 $ThisDirectoryRecord[
'recording_timestamp'] = $this->
ISOtime2UNIXtime($ThisDirectoryRecord[
'raw'][
'recording_date_time']);
347 if ($ThisDirectoryRecord[
'file_flags'][
'directory']) {
348 $ThisDirectoryRecord[
'filename'] = $directorydata[
'full_path'];
350 $ThisDirectoryRecord[
'filename'] = $directorydata[
'full_path'].$this->ISOstripFilenameVersion($ThisDirectoryRecord[
'file_identifier_ascii']);
354 $DirectoryRecord[] = $ThisDirectoryRecord;
355 $DirectoryRecordData =
fread($this->getid3->fp, 1);
358 return $DirectoryRecord;
369 if (!strstr($ISOfilename,
';')) {
372 return substr($ISOfilename, 0, strpos($ISOfilename,
';'));
383 $UNIXyear = (int) substr($ISOtime, 0, 4);
384 $UNIXmonth = (int) substr($ISOtime, 4, 2);
385 $UNIXday = (int) substr($ISOtime, 6, 2);
386 $UNIXhour = (int) substr($ISOtime, 8, 2);
387 $UNIXminute = (int) substr($ISOtime, 10, 2);
388 $UNIXsecond = (int) substr($ISOtime, 12, 2);
394 return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
413 $UNIXyear = ord($ISOtime{0}) + 1900;
414 $UNIXmonth = ord($ISOtime{1});
415 $UNIXday = ord($ISOtime{2});
416 $UNIXhour = ord($ISOtime{3});
417 $UNIXminute = ord($ISOtime{4});
418 $UNIXsecond = ord($ISOtime{5});
421 return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
438 if ($BinaryValue & 0x80) {
441 return (0 - ((~$BinaryValue & 0xFF) + 1));
ISOtimeText2UNIXtime($ISOtime)
static CreateDeepArray($ArrayPath, $Separator, $Value)
ISOtime2UNIXtime($ISOtime)
ParseDirectoryRecord($directorydata)
ParseSupplementaryVolumeDescriptor(&$ISOheader)
GetId3() by James Heinrich info@getid3.org //.
GetId3() by James Heinrich info@getid3.org //.
TwosCompliment2Decimal($BinaryValue)
fseek($bytes, $whence=SEEK_SET)
ParsePrimaryVolumeDescriptor(&$ISOheader)
Create styles array
The data for the language used.
static array_merge_clobber($array1, $array2)
static LittleEndian2Int($byteword, $signed=false)
ISOstripFilenameVersion($ISOfilename)
static iconv_fallback($in_charset, $out_charset, $string)
array $ConversionFunctionList