Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @author 	Tommy Lacroix <*****@*****.**>
  * @param	int					$totalSize
  * @param	int					$boxType
  * @param	file|string			$data
  * @param	MP4Info_Box			$parent
  * @return 	MP4Info_Box_hdlr
  * @access 	public
  * @throws 	MP4Info_Exception
  */
 public function __construct($totalSize, $boxType, $data, $parent)
 {
     if (!self::isCompatible($boxType, $parent)) {
         throw new Exception('This box isn\'t "iods"');
     }
     // Get timezone
     if (self::$timezone === false) {
         self::$timezone = date('Z');
     }
     // Call ancestor
     parent::__construct($totalSize, $boxType, '', $parent);
     // Get data
     $data = self::getDataFrom3rd($data, $totalSize);
     // Unpack
     $ar = unpack('Cversion/C3flags', $data);
     $ar2 = unpack('CiodTag/Nlength/nODID/CODProfileLevel/CsceneProfileLevel/CaudioProfileLevel/CvideoProfileLevel/CgraphicsProfileLevel', substr($data, 4));
     // Save
     $this->version = $ar['version'];
     $this->flags = $ar['flags1'] * 65536 + $ar['flags1'] * 256 + $ar['flags1'] * 1;
     print_r($ar2);
     die;
 }
Ejemplo n.º 2
0
 /**
  * Create an MP4Info_Box object from data
  *
  * @author 	Tommy Lacroix <*****@*****.**>
  * @param	int					$totalSize
  * @param	int					$boxType
  * @param	file|string			$f
  * @param	MP4Info_Box|false	$parent
  * @return	MP4Info_Box
  * @access 	public
  * @static
  */
 public static function factory($totalSize, $boxType, $f, $parent = false)
 {
     if (MP4Info_Box_Container::isCompatible($boxType, $parent)) {
         $box = new MP4Info_Box_Container($totalSize, $boxType, $f, $parent);
     } else {
         if (MP4Info_Box_ftyp::isCompatible($boxType, $parent)) {
             $box = new MP4Info_Box_ftyp($totalSize, $boxType, $f, $parent);
         } else {
             if (MP4Info_Box_uuid::isCompatible($boxType, $parent)) {
                 $box = new MP4Info_Box_uuid($totalSize, $boxType, $f, $parent);
             } else {
                 if (MP4Info_Box_hdlr::isCompatible($boxType, $parent)) {
                     $box = new MP4Info_Box_hdlr($totalSize, $boxType, $f, $parent);
                 } else {
                     if (MP4Info_Box_mvhd::isCompatible($boxType, $parent)) {
                         $box = new MP4Info_Box_mvhd($totalSize, $boxType, $f, $parent);
                     } else {
                         if (MP4Info_Box_tkhd::isCompatible($boxType, $parent)) {
                             $box = new MP4Info_Box_tkhd($totalSize, $boxType, $f, $parent);
                         } else {
                             if (MP4Info_Box_mdhd::isCompatible($boxType, $parent)) {
                                 $box = new MP4Info_Box_mdhd($totalSize, $boxType, $f, $parent);
                             } else {
                                 if (MP4Info_Box_meta::isCompatible($boxType, $parent)) {
                                     $box = new MP4Info_Box_meta($totalSize, $boxType, $f, $parent);
                                 } else {
                                     if (MP4Info_Box_stsd::isCompatible($boxType, $parent)) {
                                         $box = new MP4Info_Box_stsd($totalSize, $boxType, $f, $parent);
                                     } else {
                                         if (MP4Info_Box_iods::isCompatible($boxType, $parent)) {
                                             $box = new MP4Info_Box_iods($totalSize, $boxType, $f, $parent);
                                         } else {
                                             if (MP4Info_Box_ilst::isCompatible($boxType, $parent)) {
                                                 $box = new MP4Info_Box_ilst($totalSize, $boxType, $f, $parent);
                                             } else {
                                                 if (MP4Info_Box_ilst_sub::isCompatible($boxType, $parent)) {
                                                     $box = new MP4Info_Box_ilst_sub($totalSize, $boxType, $f, $parent);
                                                 } else {
                                                     // Debug...
                                                     if (MP4Info::$debugMode) {
                                                         print '0x' . dechex($boxType) . '-' . pack('N', $boxType);
                                                         if ($parent !== false) {
                                                             print ' in ' . $parent->getBoxTypeStr();
                                                         } else {
                                                             print ' in root';
                                                         }
                                                         die;
                                                     }
                                                     $box = new MP4Info_Box($totalSize, $boxType, $f, $parent);
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // Return box
     return $box;
 }