@@ -1700,18 +1700,38 @@ public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset
17001700 break ;
17011701
17021702 case 'loci ' :// 3GP location (El Loco)
1703- $ info ['quicktime ' ]['comments ' ]['gps_flags ' ] = getid3_lib::BigEndian2Int (substr ($ atom_data , 0 , 4 ));
1704- $ info ['quicktime ' ]['comments ' ]['gps_lang ' ] = getid3_lib::BigEndian2Int (substr ($ atom_data , 4 , 2 ));
1705- $ loffset = 0 ;
1706- $ info ['quicktime ' ]['comments ' ]['gps_location ' ] = $ this ->LociString (substr ($ atom_data , 6 ), $ loffset );
1707- $ loci_data =substr ($ atom_data , 6 + $ loffset );
1708- $ info ['quicktime ' ]['comments ' ]['gps_role ' ] = getid3_lib::BigEndian2Int (substr ($ loci_data , 0 , 1 ));
1709- $ info ['quicktime ' ]['comments ' ]['gps_longitude ' ] = getid3_lib::FixedPoint16_16 (substr ($ loci_data , 1 , 4 ));
1710- $ info ['quicktime ' ]['comments ' ]['gps_latitude ' ] = getid3_lib::FixedPoint16_16 (substr ($ loci_data , 5 , 4 ));
1711- $ info ['quicktime ' ]['comments ' ]['gps_altitude ' ] = getid3_lib::FixedPoint16_16 (substr ($ loci_data , 9 , 4 ));
1712- $ info ['quicktime ' ]['comments ' ]['gps_body ' ] = $ this ->LociString (substr ($ loci_data , 13 ), $ loffset );
1713- $ info ['quicktime ' ]['comments ' ]['gps_notes ' ] = $ this ->LociString (substr ($ loci_data , 13 + $ loffset ), $ loffset );
1714- break ;
1703+ $ loffset = 0 ;
1704+ $ info ['quicktime ' ]['comments ' ]['gps_flags ' ] = getid3_lib::BigEndian2Int (substr ($ atom_data , 0 , 4 ));
1705+ $ info ['quicktime ' ]['comments ' ]['gps_lang ' ] = getid3_lib::BigEndian2Int (substr ($ atom_data , 4 , 2 ));
1706+ $ info ['quicktime ' ]['comments ' ]['gps_location ' ] = $ this ->LociString (substr ($ atom_data , 6 ), $ loffset );
1707+ $ loci_data = substr ($ atom_data , 6 + $ loffset );
1708+ $ info ['quicktime ' ]['comments ' ]['gps_role ' ] = getid3_lib::BigEndian2Int (substr ($ loci_data , 0 , 1 ));
1709+ $ info ['quicktime ' ]['comments ' ]['gps_longitude ' ] = getid3_lib::FixedPoint16_16 (substr ($ loci_data , 1 , 4 ));
1710+ $ info ['quicktime ' ]['comments ' ]['gps_latitude ' ] = getid3_lib::FixedPoint16_16 (substr ($ loci_data , 5 , 4 ));
1711+ $ info ['quicktime ' ]['comments ' ]['gps_altitude ' ] = getid3_lib::FixedPoint16_16 (substr ($ loci_data , 9 , 4 ));
1712+ $ info ['quicktime ' ]['comments ' ]['gps_body ' ] = $ this ->LociString (substr ($ loci_data , 13 ), $ loffset );
1713+ $ info ['quicktime ' ]['comments ' ]['gps_notes ' ] = $ this ->LociString (substr ($ loci_data , 13 + $ loffset ), $ loffset );
1714+ break ;
1715+
1716+ case 'chpl ' : // CHaPter List
1717+ // https://www.adobe.com/content/dam/Adobe/en/devnet/flv/pdfs/video_file_format_spec_v10.pdf
1718+ $ chpl_version = getid3_lib::BigEndian2Int (substr ($ atom_data , 4 , 1 )); // Expected to be 0
1719+ $ chpl_flags = getid3_lib::BigEndian2Int (substr ($ atom_data , 5 , 3 )); // Reserved, set to 0
1720+ $ chpl_count = getid3_lib::BigEndian2Int (substr ($ atom_data , 8 , 1 ));
1721+ $ chpl_offset = 9 ;
1722+ for ($ i = 0 ; $ i < $ chpl_count ; $ i ++) {
1723+ if (($ chpl_offset + 9 ) >= strlen ($ atom_data )) {
1724+ $ this ->warning ('QuickTime chapter ' .$ i .' extends beyond end of "chpl" atom ' );
1725+ break ;
1726+ }
1727+ $ info ['quicktime ' ]['chapters ' ][$ i ]['timestamp ' ] = getid3_lib::BigEndian2Int (substr ($ atom_data , $ chpl_offset , 8 )) / 10000000 ; // timestamps are stored as 100-nanosecond units
1728+ $ chpl_offset += 8 ;
1729+ $ chpl_title_size = getid3_lib::BigEndian2Int (substr ($ atom_data , $ chpl_offset , 1 ));
1730+ $ chpl_offset += 1 ;
1731+ $ info ['quicktime ' ]['chapters ' ][$ i ]['title ' ] = substr ($ atom_data , $ chpl_offset , $ chpl_title_size );
1732+ $ chpl_offset += $ chpl_title_size ;
1733+ }
1734+ break ;
17151735
17161736 default :
17171737 $ this ->warning ('Unknown QuickTime atom type: " ' .preg_replace ('#[^a-zA-Z0-9 _ \\-]# ' , '? ' , $ atomname ).'" ( ' .trim (getid3_lib::PrintHexBytes ($ atomname )).') at offset ' .$ baseoffset );
0 commit comments