• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/integration/voximplant/audio.php
  • Класс: Bitrix\Sender\Integration\VoxImplant\Audio
  • Вызов: Audio::getId3v2TagLength
private function getId3v2TagLength($header)
{
	if ("ID3" == mb_substr($header, 0, 3, 'latin1'))
	{
		$hasExtendedHeader = (ord($header[5]) & 0x10) ? 1 : 0;
		$lengthByte1 = ord($header[6]);
		$lengthByte2 = ord($header[7]);
		$lengthByte3 = ord($header[8]);
		$lengthByte4 = ord($header[9]);
		if (!($lengthByte1 & 0x80) && !($lengthByte2 & 0x80) && !($lengthByte3 & 0x80) && !($lengthByte4 & 0x80))
		{
			$tagHeaderLength = 10 + ($hasExtendedHeader ? 10 : 0);
			$tagContentLength =
				(($lengthByte1 & 0x7f) << 21) +
				(($lengthByte2 & 0x7f) << 14) +
				(($lengthByte3 & 0x7f) << 7) +
				($lengthByte4 & 0x7f);

			return $tagHeaderLength + $tagContentLength;
		}
	}
	return 0;
}