Exemplo n.º 1
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $entryCount = $this->_reader->readUInt32BE();
   for ($i = 0; $i < $entryCount; $i++) {
     $entry = array();
     $entry["sampleDelta"] = $this->_reader->readUInt32BE();
     $entry["subsamples"] = array();
     if (($subsampleCount = $this->_reader->readUInt16BE()) > 0) {
       for ($j = 0; $j < $subsampleCount; $j++) {
         $subsample = array();
         if ($this->getVersion() == 1)
           $subsample["subsampleSize"] = $this->_reader->readUInt32BE();
         else
           $subsample["subsampleSize"] = $this->_reader->readUInt16BE();
         $subsample["subsamplePriority"] = $this->_reader->readInt8();
         $subsample["discardable"] = $this->_reader->readInt8();
         $this->_reader->skip(4);
         $entry["subsamples"][] = $subsample;
       }
       $this->_subSampleTable[] = $entry;
     }
   }
 }
Exemplo n.º 2
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_data = $this->_reader->read
     ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
 }
Exemplo n.º 3
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   while ($this->_reader->getOffset() < $this->getOffset() + $this->getSize())
     $this->_values[] = array("priority" => $this->_reader->readUInt16BE());
 }
Exemplo n.º 4
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_trackId = $this->_reader->readUInt32BE();
   
   $trafNumberSize = (($tmp = $this->_reader->readUInt32BE()) >> 4) & 0x3;
   $trunNumberSize = ($tmp >> 2) & 0x3;
   $sampleNumberSize = $tmp & 0x3;
   $entryCount = $this->_reader->readUInt32BE();
   for ($i = 1; $i <= $entryCount; $i++) {
     $entry = array();
     if ($this->getVersion() == 1) {
       $entry["time"] = $this->_reader->readInt64BE();
       $entry["moofOffset"] = $this->_reader->readInt64BE();
     } else {
       $entry["time"] = $this->_reader->readUInt32BE();
       $entry["moofOffset"] = $this->_reader->readUInt32BE();
     }
     $entry["trafNumber"] =
       ($trafNumberSize == 4 ? $this->_reader->readUInt32BE() :
        ($trafNumberSize == 8 ? $this->_reader->readInt64BE() : 0));
     $entry["trunNumber"] =
       ($trunNumberSize == 4 ? $this->_reader->readUInt32BE() :
        ($trunNumberSize == 8 ? $this->_reader->readInt64BE() : 0));
     $entry["sampleNumber"] =
       ($sampleNumberSize == 4 ? $this->_reader->readUInt32BE() :
        ($sampleNumberSize == 8 ? $this->_reader->readInt64BE() : 0));
     $this->_degradationPriorityTable[$i] = $entry;
   }
 }
Exemplo n.º 5
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_reader->skip(3);
   $fieldSize = $this->_reader->readInt8();
   $sampleCount = $this->_reader->readUInt32BE();
   $data = $this->_reader->read
     ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
   for ($i = 1; $i <= $sampleCount; $i++) {
     switch ($fieldSize) {
     case 4:
       $this->_sampleSizeTable[$i] =
         (($tmp = Transform::fromInt8($data[$i - 1])) >> 4) & 0xf;
       if ($i + 1 < $sampleCount)
         $this->_sampleSizeTable[$i++] = $tmp & 0xf;
       break;
     case 8:
       $this->_sampleSizeTable[$i] = Transform::fromInt8($data[$i - 1]);
       break;
     case 16:
       $this->_sampleSizeTable[$i] =
         Transform::fromUInt16BE(substr($data, ($i - 1) * 2, 2));
       break;
     }
   }
 }
Exemplo n.º 6
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   list ($this->_name, $this->_location) = preg_split
     ("/\\x00/", $this->_reader->read
      ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()));
 }
Exemplo n.º 7
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   while ($this->_reader->getOffset() < $this->getOffset() + $this->getSize())
     $this->_progressiveDownloadInfo[] = array
       ("rate" => $this->_reader->readUInt32BE(),
        "initialDelay" => $this->_reader->readUInt32BE());
 }
Exemplo n.º 8
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   if ($this->getVersion() == 1)
     $this->_fragmentDuration = $this->_reader->readInt64BE();
   else
     $this->_fragmentDuration = $this->_reader->readUInt32BE();
 }
Exemplo n.º 9
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_maxPDUSize = $this->_reader->readUInt16BE();
   $this->_avgPDUSize = $this->_reader->readUInt16BE();
   $this->_maxBitrate = $this->_reader->readUInt32BE();
   $this->_avgBitrate = $this->_reader->readUInt32BE();
 }
Exemplo n.º 10
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  * @todo The sample flags could be parsed further
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_trackId = $this->_reader->readUInt32BE();
   $this->_defaultSampleDescriptionIndex = $this->_reader->readUInt32BE();
   $this->_defaultSampleDuration = $this->_reader->readUInt32BE();
   $this->_defaultSampleSize = $this->_reader->readUInt32BE();
   $this->_defaultSampleFlags = $this->_reader->readUInt32BE();
 }
Exemplo n.º 11
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  * @todo Distinguish UTF-16?
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_language =
     chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) .
     chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60);
   $this->_notice = $this->_reader->read
     ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
 }
Exemplo n.º 12
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader = null, &$options = array())
 {
   parent::__construct($reader, $options);
   $this->setContainer(true);
   
   if ($reader === null)
     return;
   
   $this->constructBoxes();
 }
Exemplo n.º 13
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $entryCount = $this->_reader->readUInt32BE();
   $data = $this->_reader->read
     ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
   for ($i = 1; $i <= $entryCount; $i++)
     $this->_syncSampleTable[$i] =
       Transform::fromUInt32BE(substr($data, ($i - 1) * 4, 4));
 }
Exemplo n.º 14
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_itemId = $this->_reader->readUInt16BE();
   $this->_itemProtectionIndex = $this->_reader->readUInt16BE();
   list($this->_itemName, $this->_contentType, $this->_contentEncoding) =
     preg_split
       ("/\\x00/", $this->_reader->read
        ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()));
 }
Exemplo n.º 15
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_schemeType = $this->_reader->read(4);
   $this->_schemeVersion = $this->_reader->readUInt32BE();
   if ($this->hasFlag(1))
     $this->_schemeUri = preg_split
       ("/\\x00/", $this->_reader->read
        ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()));
 }
Exemplo n.º 16
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $entryCount = $this->_reader->readUInt32BE();
   $data = $this->_reader->read
     ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
   for ($i = 1; $i <= $entryCount; $i++)
     $this->_timeToSampleTable[$i] = array
       ("sampleCount" =>
          Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)),
        "sampleDelta" =>
          Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4)));
 }
Exemplo n.º 17
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $entryCount = $this->_reader->readUInt32BE();
   $data = $this->_reader->read
     ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
   for ($i = 1; $i <= $entryCount; $i++)
     $this->_sampleToChunkTable[$i] = array
       ("firstChunk" =>
          Transform::fromUInt32BE(substr($data, ($i - 1) * 12, 4)),
        "samplesPerChunk" =>
          Transform::fromUInt32BE(substr($data, $i * 12 - 8, 4)),
        "sampleDescriptionIndex" =>
          Transform::fromUInt32BE(substr($data, $i * 12 - 4, 4)));
 }
Exemplo n.º 18
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   if ($this->getVersion() == 1) {
     $this->_creationTime = $this->_reader->readInt64BE();
     $this->_modificationTime = $this->_reader->readInt64BE();
     $this->_timescale = $this->_reader->readUInt32BE();
     $this->_duration = $this->_reader->readInt64BE();
   } else {
     $this->_creationTime = $this->_reader->readUInt32BE();
     $this->_modificationTime = $this->_reader->readUInt32BE();
     $this->_timescale = $this->_reader->readUInt32BE();
     $this->_duration = $this->_reader->readUInt32BE();
   }
   $this->_language =
     chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) .
     chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60);
 }
Exemplo n.º 19
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $entryCount = $this->_reader->readUInt32BE();
   for ($i = 1; $i <= $entryCount; $i++) {
     $entry = array();
     if ($this->getVersion() == 1) {
       $entry["segmentDuration"] = $this->_reader->readInt64BE();
       $entry["mediaTime"] = $this->_reader->readInt64BE();
     } else {
       $entry["segmentDuration"] = $this->_reader->readUInt32BE();
       $entry["mediaTime"] = $this->_reader->readInt32BE();
     }
     $entry["mediaRate"] = $this->_reader->readInt16BE() +
       $this->_reader->readInt16BE() / 10;
     $this->_entries[] = $entry;
   }
 }
Exemplo n.º 20
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   if ($this->getVersion() == 1) {
     $this->_creationTime = $this->_reader->readInt64BE();
     $this->_modificationTime = $this->_reader->readInt64BE();
     $this->_timescale = $this->_reader->readUInt32BE();
     $this->_duration = $this->_reader->readInt64BE();
   } else {
     $this->_creationTime = $this->_reader->readUInt32BE();
     $this->_modificationTime = $this->_reader->readUInt32BE();
     $this->_timescale = $this->_reader->readUInt32BE();
     $this->_duration = $this->_reader->readUInt32BE();
   }
   $this->_rate =
     ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) +
     ($tmp & 0xffff) / 10;
   $this->_volume = ((($tmp = $this->_reader->readUInt16BE()) >> 8) & 0xff) +
     ($tmp & 0xff) / 10;
   $this->_reader->skip(70);
   $this->_nextTrackId = $this->_reader->readUInt32BE();
 }
Exemplo n.º 21
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_itemId = $this->_reader->readUInt16BE();
 }
Exemplo n.º 22
0
 /**
  * Returns the box raw data.
  *
  * @return string
  */
 public function __toString($data = "")
 {
   return parent::__toString
     (Transform::toUInt16BE
      (((ord($this->_language[0]) - 0x60) << 10) |
       ((ord($this->_language[1]) - 0x60) << 5) |
         ord($this->_language[2]) - 0x60) . $this->_tag);
 }
Exemplo n.º 23
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_sequenceNumber = $this->_reader->readUInt32BE();
 }
Exemplo n.º 24
0
 /**
  * Returns the box raw data.
  *
  * @return string
  */
 public function __toString($data = "")
 {
   return parent::__toString(Transform::toUInt32BE(count($this->_boxes)));
 }
Exemplo n.º 25
0
 /**
  * Returns the box raw data.
  *
  * @return string
  */
 public function __toString($data = "")
 {
   $data = Transform::toUInt32BE(count($this->_chunkOffsetTable));
   foreach ($this->_chunkOffsetTable as $chunkOffset)
     $data .= Transform::toInt64BE($chunkOffset);
   return parent::__toString($data);
 }
Exemplo n.º 26
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $this->_parentSize = $this->_reader->readUInt32BE();
 }
Exemplo n.º 27
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   $flags = $this->_flags;
   $sampleCount = $this->_reader->readUInt32BE();
   
   if ($this->hasFlag(self::DATA_OFFSET))
     $this->_dataOffset = $this->_reader->readInt32BE();
   if ($this->hasFlag(self::FIRST_SAMPLE_FLAGS))
     $this->_flags = $this->_reader->readUInt32BE();
   
   for ($i = 0; $i < $sampleCount; $i++) {
     $sample = array();
     if ($this->hasFlag(self::SAMPLE_DURATION))
       $sample["duration"] = $this->_reader->readUInt32BE();
     if ($this->hasFlag(self::SAMPLE_SIZE))
       $sample["size"] = $this->_reader->readUInt32BE();
     if ($this->hasFlag(self::SAMPLE_FLAGS))
       $sample["flags"] = $this->_reader->readUInt32BE();
     if ($this->hasFlag(self::SAMPLE_COMPOSITION_TIME_OFFSET))
       $sample["compositionTimeOffset"] = $this->_reader->readUInt32BE();
     $this->_samples[] = $sample;
     $this->_flags = $flags;
   }
 }
Exemplo n.º 28
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
   
   if ($this->getVersion() == 1) {
     $this->_creationTime = $this->_reader->readInt64BE();
     $this->_modificationTime = $this->_reader->readInt64BE();
     $this->_trackId = $this->_reader->readUInt32BE();
     $this->_reader->skip(4);
     $this->_duration = $this->_reader->readInt64BE();
   } else {
     $this->_creationTime = $this->_reader->readUInt32BE();
     $this->_modificationTime = $this->_reader->readUInt32BE();
     $this->_trackId = $this->_reader->readUInt32BE();
     $this->_reader->skip(4);
     $this->_duration = $this->_reader->readUInt32BE();
   }
   $this->_reader->skip(52);
   $this->_width =
     ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) +
     ($tmp & 0xffff) / 10;
   $this->_height =
     ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) +
     ($tmp & 0xffff) / 10;
 }
Exemplo n.º 29
0
 /**
  * Constructs the class with given parameters and reads box related data from
  * the ISO Base Media file.
  *
  * @param Reader  $reader The reader object.
  */
 public function __construct($reader, &$options = array())
 {
   parent::__construct($reader, $options);
 }
Exemplo n.º 30
0
 /**
  * Returns the box raw data.
  *
  * @return string
  */
 public function __toString($data = "")
 {
   return parent::__toString
     ("appl" . $this->_handlerType . Transform::toUInt32BE(0) .
      Transform::toUInt32BE(0) . Transform::toUInt32BE(0) . $this->_name .
      "\0");
 }