Fix Mpeg frame sync detection

This commit is contained in:
Markus Birth 2024-05-27 23:44:22 +01:00
parent c387953040
commit 5b8e15a1e0

View File

@ -360,7 +360,7 @@ class Mp3Info
$headerBytes .= $this->fileObj->getBytes(1); // load next Byte $headerBytes .= $this->fileObj->getBytes(1); // load next Byte
$headerBytes = substr($headerBytes, -4); // limit to 4 Bytes $headerBytes = substr($headerBytes, -4); // limit to 4 Bytes
if (unpack('n', $headerBytes)[1] & self::FRAME_SYNC === self::FRAME_SYNC) { if ((unpack('n', $headerBytes)[1] & self::FRAME_SYNC) === self::FRAME_SYNC) {
$pos = $this->fileObj->getFilePos() - 4; $pos = $this->fileObj->getFilePos() - 4;
break; break;
} }
@ -1070,7 +1070,7 @@ class Mp3Info
// id3v2 tag // id3v2 tag
return true; return true;
} }
if (unpack('n', $raw)[1] & self::FRAME_SYNC === self::FRAME_SYNC) { if ((unpack('n', $raw)[1] & self::FRAME_SYNC) === self::FRAME_SYNC) {
// mpeg header tag // mpeg header tag
return true; return true;
} }