Handle 64bit atoms

This commit is contained in:
Deon George 2024-09-20 13:02:21 +10:00
parent 286746019f
commit 06b8542de6

View File

@ -23,31 +23,36 @@ trait FindQuicktimeAtoms
$result = collect();
$prelude = 8;
while ($rp < $size) {
$read = $atom ? substr($atom,$rp,8) : fread($fh,8);
$read = $atom ? substr($atom,$rp,$prelude) : fread($fh,$prelude);
$header = unpack('Nsize/a4atom',$read);
$rp += strlen($read);
$header = unpack('Nsize/a4atom',$read);
// For mdat atoms, if size = 1, the true size is in the 64 bit extended header, in the next 8 bytes
if (($header['atom'] === 'mdat') && ($header['size'] === 1)) {
$eheader = unpack('Jsize',fread($fh,8));
$rp += 8;
$prelude = 16;
// For mdat atoms, if size = 1, the true size is in the 64 bit extended header
if (($header['atom'] === 'mdat') && ($header['size'] === 1))
throw new \Exception(sprintf('%s:! We havent handed large QT files yet.',self::LOGKEY));
$header['size'] = $eheader['size'];
}
// Load our class for this supplier
$class = $class_prefix.$header['atom'];
$data = $atom
? substr($atom,$rp,$header['size']-8)
: ($header['size']-8 && ($header['size']-8 <= static::record_size) ? fread($fh,$header['size']-8) : NULL);
? substr($atom,$rp,$header['size']-$prelude)
: ($header['size']-$prelude && ($header['size']-$prelude <= self::record_size) ? fread($fh,$header['size']-$prelude) : NULL);
if ($header['size'] >= 8) {
if ($header['size'] >= $prelude) {
$o = class_exists($class)
? new $class($offset+$rp,$header['size']-8,$this->filename,$data,$passthru)
: new $unknown($offset+$rp,$header['size']-8,$this->filename,$header['atom'],$data);
? new $class($offset+$rp,$header['size']-$prelude,$this->filename,$data,$passthru)
: new $unknown($offset+$rp,$header['size']-$prelude,$this->filename,$header['atom'],$data);
$result->push($o);
$rp += $header['size']-8;
$rp += $header['size']-$prelude;
// Only need to seek if we didnt read all the data
if ((! $atom) && ($header['size']-8 > static::record_size))