/** * Constructor * * @author Tommy Lacroix <*****@*****.**> * @param int $totalSize * @param int $boxType * @param file|string $data * @param MP4Info_Box $parent * @return MP4Info_Box_Container * @access public * @throws MP4Info_Exception */ public function __construct($totalSize, $boxType, $data, $parent) { if (!self::isCompatible($boxType, $parent)) { throw new MP4Info_Exception('This box isn\'t a container', MP4Info_Exception::CODE_INCOMPATIBLE, $boxType); } // Call ancestor parent::__construct($totalSize, $boxType, false, $parent); // Unpack if (is_string($data)) { while ($data != '') { try { $box = MP4Info_Box::fromString($data, $this); if (!$box instanceof MP4Info_Box) { break; } } catch (Exception $e) { break; } } } else { do { try { $box = MP4Info_Box::fromStream($data, $this); if (!$box instanceof MP4Info_Box) { break; } } catch (Exception $e) { break; } } while ($box !== false); } }