- Timestamp:
- 10/04/2022 02:06:29 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.audio-video.quicktime.php
r52254 r54376 62 62 $AtomHeader = $this->fread(8); 63 63 64 // https://github.com/JamesHeinrich/getID3/issues/382 65 // Atom sizes are stored as 32-bit number in most cases, but sometimes (notably for "mdat") 66 // a 64-bit value is required, in which case the normal 32-bit size field is set to 0x00000001 67 // and the 64-bit "real" size value is the next 8 bytes. 68 $atom_size_extended_bytes = 0; 64 69 $atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4)); 65 70 $atomname = substr($AtomHeader, 4, 4); 66 67 // 64-bit MOV patch by jlegateØktnc*com68 71 if ($atomsize == 1) { 69 $atomsize = getid3_lib::BigEndian2Int($this->fread(8)); 72 $atom_size_extended_bytes = 8; 73 $atomsize = getid3_lib::BigEndian2Int($this->fread($atom_size_extended_bytes)); 70 74 } 71 75 … … 86 90 break; 87 91 } 88 89 92 $atomHierarchy = array(); 90 $parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize , $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);93 $parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize - $atom_size_extended_bytes, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms); 91 94 $parsedAtomData['name'] = $atomname; 92 95 $parsedAtomData['size'] = $atomsize; 93 96 $parsedAtomData['offset'] = $offset; 97 if ($atom_size_extended_bytes) { 98 $parsedAtomData['xsize_bytes'] = $atom_size_extended_bytes; 99 } 94 100 if (in_array($atomname, array('uuid'))) { 95 101 @$info['quicktime'][$atomname][] = $parsedAtomData; … … 109 115 } 110 116 111 if ( !empty($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) {117 if (isset($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) { 112 118 $durations = $this->quicktime_time_to_sample_table($info); 113 119 for ($i = 0; $i < count($info['quicktime']['comments']['chapters']); $i++) { … … 260 266 switch ($atomname) { 261 267 case 'moov': // MOVie container atom 268 case 'moof': // MOvie Fragment box 262 269 case 'trak': // TRAcK container atom 270 case 'traf': // TRAck Fragment box 263 271 case 'clip': // CLIPping container atom 264 272 case 'matt': // track MATTe container atom … … 844 852 case 'gif ': 845 853 case 'h263': 854 case 'hvc1': 846 855 case 'jpeg': 847 856 case 'kpcd': … … 1542 1551 break; 1543 1552 1553 case 'ID32': // ID3v2 1554 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); 1555 1556 $getid3_temp = new getID3(); 1557 $getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp); 1558 $getid3_id3v2 = new getid3_id3v2($getid3_temp); 1559 $getid3_id3v2->StartingOffset = $atom_structure['offset'] + 14; // framelength(4)+framename(4)+flags(4)+??(2) 1560 if ($atom_structure['valid'] = $getid3_id3v2->Analyze()) { 1561 $atom_structure['id3v2'] = $getid3_temp->info['id3v2']; 1562 } else { 1563 $this->warning('ID32 frame at offset '.$atom_structure['offset'].' did not parse'); 1564 } 1565 unset($getid3_temp, $getid3_id3v2); 1566 break; 1567 1544 1568 case 'free': // FREE space atom 1545 1569 case 'skip': // SKIP atom … … 1701 1725 $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); 1702 1726 $atom_structure['data'] = substr($atom_data, 4 + 4); 1703 $atom_structure['key_name'] = @$info['quicktime']['temp_meta_key_names'][$metaDATAkey++]; 1727 $atom_structure['key_name'] = (isset($info['quicktime']['temp_meta_key_names'][$metaDATAkey]) ? $info['quicktime']['temp_meta_key_names'][$metaDATAkey] : ''); 1728 $metaDATAkey++; 1704 1729 1705 1730 if ($atom_structure['key_name'] && $atom_structure['data']) { … … 2076 2101 break; 2077 2102 2103 2104 // AVIF-related - https://docs.rs/avif-parse/0.13.2/src/avif_parse/boxes.rs.html 2105 case 'pitm': // Primary ITeM 2106 case 'iloc': // Item LOCation 2107 case 'iinf': // Item INFo 2108 case 'iref': // Image REFerence 2109 case 'iprp': // Image PRoPerties 2110 $this->error('AVIF files not currently supported'); 2111 $atom_structure['data'] = $atom_data; 2112 break; 2113 2114 case 'tfdt': // Track Fragment base media Decode Time box 2115 case 'tfhd': // Track Fragment HeaDer box 2116 case 'mfhd': // Movie Fragment HeaDer box 2117 case 'trun': // Track fragment RUN box 2118 $this->error('fragmented mp4 files not currently supported'); 2119 $atom_structure['data'] = $atom_data; 2120 break; 2121 2122 case 'mvex': // MoVie EXtends box 2123 case 'pssh': // Protection System Specific Header box 2124 case 'sidx': // Segment InDeX box 2078 2125 default: 2079 2126 $this->warning('Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).'), '.$atomsize.' bytes at offset '.$baseoffset); … … 2324 2371 $QuicktimeVideoCodecLookup['h261'] = 'H261'; 2325 2372 $QuicktimeVideoCodecLookup['h263'] = 'H263'; 2373 $QuicktimeVideoCodecLookup['hvc1'] = 'H.265/HEVC'; 2326 2374 $QuicktimeVideoCodecLookup['IV41'] = 'Indeo4'; 2327 2375 $QuicktimeVideoCodecLookup['jpeg'] = 'JPEG';
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)