protected function writeContent()
 {
     pWriteInt8($this->mp4->writeP, $this->version);
     pWriteInt24($this->mp4->writeP, $this->flags);
     if ($this->version == 0) {
         pWriteInt32($this->mp4->writeP, $this->creationTime);
         pWriteInt32($this->mp4->writeP, $this->modificationTime);
         pWriteInt32($this->mp4->writeP, $this->trackId);
         pWriteInt32($this->mp4->writeP, $this->reserved1);
         pWriteInt32($this->mp4->writeP, $this->duration);
     } else {
         pWriteInt64($this->mp4->writeP, $this->creationTime);
         pWriteInt32($this->mp4->writeP, $this->modificationTime);
         pWriteInt32($this->mp4->writeP, $this->trackId);
         pWriteInt32($this->mp4->writeP, $this->reserved1);
         pWriteInt64($this->mp4->writeP, $this->duration);
     }
     pWriteInt32($this->mp4->writeP, $this->reserved2);
     pWriteInt32($this->mp4->writeP, $this->reserved3);
     pWriteInt16($this->mp4->writeP, $this->layer);
     pWriteInt16($this->mp4->writeP, $this->predefined);
     pWriteSI16($this->mp4->writeP, $this->volume);
     pWriteInt16($this->mp4->writeP, $this->reserved4);
     for ($i = 0; $i < 9; $i++) {
         pWriteInt32($this->mp4->writeP, $this->matrix[$i]);
     }
     pWriteSI32($this->mp4->writeP, $this->width);
     pWriteSI32($this->mp4->writeP, $this->height);
 }
 protected function writeContent()
 {
     pWriteInt8($this->mp4->writeP, $this->version);
     pWriteInt24($this->mp4->writeP, $this->flags);
     if ($this->version == 0) {
         pWriteInt32($this->mp4->writeP, $this->creationTime);
         pWriteInt32($this->mp4->writeP, $this->modificationTime);
         pWriteInt32($this->mp4->writeP, $this->timeScale);
         pWriteInt32($this->mp4->writeP, $this->duration);
     } else {
         pWriteInt64($this->mp4->writeP, $this->creationTime);
         pWriteInt32($this->mp4->writeP, $this->modificationTime);
         pWriteInt64($this->mp4->writeP, $this->timeScale);
         pWriteInt64($this->mp4->writeP, $this->duration);
     }
     pWriteSI32($this->mp4->writeP, $this->rate);
     pWriteSI16($this->mp4->writeP, $this->volume);
     pWriteInt16($this->mp4->writeP, $this->reserved1);
     pWriteInt32($this->mp4->writeP, $this->reserved2);
     pWriteInt32($this->mp4->writeP, $this->reserved3);
     for ($i = 0; $i < 9; $i++) {
         pWriteInt32($this->mp4->writeP, $this->matrix[$i]);
     }
     for ($i = 0; $i < 6; $i++) {
         pWriteInt32($this->mp4->writeP, $this->predefined[$i]);
     }
     pWriteInt32($this->mp4->writeP, $this->nextTrackId);
 }
 protected function writeContent()
 {
     pWriteInt8($this->mp4->writeP, $this->version);
     pWriteInt24($this->mp4->writeP, $this->flags);
     pWriteInt32($this->mp4->writeP, $this->count);
     for ($i = 0; $i < $this->count; $i++) {
         pWriteInt32($this->mp4->writeP, $this->sampleNumbers[$i]);
     }
 }
 protected function writeContent()
 {
     pWriteInt8($this->mp4->writeP, $this->version);
     pWriteInt24($this->mp4->writeP, $this->flags);
     pWriteInt32($this->mp4->writeP, $this->count);
     for ($i = 0; $i < $this->count; $i++) {
         pWriteInt32($this->mp4->writeP, $this->entries[$i]->len + 8);
         pWriteInt32($this->mp4->writeP, $this->entries[$i]->fourCC);
         fwrite($this->mp4->writeP, $this->entries[$i]->buf, $this->entries[$i]->len);
     }
 }
 protected function writeContent()
 {
     pWriteInt8($this->mp4->writeP, $this->version);
     pWriteInt24($this->mp4->writeP, $this->flags);
     pWriteInt32($this->mp4->writeP, $this->count);
     for ($i = 0; $i < $this->count; $i++) {
         if ($this->boxInfo->type == "co64") {
             pWriteInt64($this->mp4->writeP, $this->entries[$i]);
         } else {
             pWriteInt32($this->mp4->writeP, $this->entries[$i]);
         }
     }
 }
 protected function writeContent()
 {
     pWriteInt8($this->mp4->writeP, $this->version);
     pWriteInt24($this->mp4->writeP, $this->flags);
     if ($this->version == 0) {
         pWriteInt32($this->mp4->writeP, $this->creationTime);
         pWriteInt32($this->mp4->writeP, $this->modificationTime);
         pWriteInt32($this->mp4->writeP, $this->timeScale);
         pWriteInt32($this->mp4->writeP, $this->duration);
     } else {
         pWriteInt64($this->mp4->writeP, $this->creationTime);
         pWriteInt32($this->mp4->writeP, $this->modificationTime);
         pWriteInt64($this->mp4->writeP, $this->timeScale);
         pWriteInt64($this->mp4->writeP, $this->duration);
     }
     pWriteInt16($this->mp4->writeP, $this->language);
     pWriteInt16($this->mp4->writeP, $this->predefined);
 }
Example #7
0
function pWriteSI32(&$tmp_p, $tmp_value)
{
    pWriteInt32($tmp_p, $tmp_value << 16);
}
 public function write()
 {
     $this->boxInfo->position = ftell($this->mp4->writeP);
     if ($this->boxInfo->type == "ROOT") {
         foreach ($this->children as $child) {
             $child->write();
         }
     } else {
         if ($this->boxInfo->type == "co64") {
             $this->boxInfo->type = "stco";
             $this->boxInfo->headerLength = 8;
         }
         //.write header
         if ($this->boxInfo->headerLength == 8) {
             pWriteInt32($this->mp4->writeP, $this->boxInfo->size);
             fwrite($this->mp4->writeP, $this->boxInfo->type, 4);
         } else {
             pWriteInt32($this->mp4->writeP, 1);
             fwrite($this->mp4->writeP, $this->boxInfo->type, 4);
             pWriteInt64($this->mp4->writeP, $this->boxInfo->size);
         }
         if ($this->isContainer()) {
             foreach ($this->children as $child) {
                 $child->write();
             }
         } else {
             //.write content
             $this->writeContent();
         }
         //.write size again
         $this->boxInfo->size = ftell($this->mp4->writeP) - $this->boxInfo->position;
         fseek($this->mp4->writeP, $this->boxInfo->position);
         if ($this->boxInfo->headerLength == 8) {
             pWriteInt32($this->mp4->writeP, $this->boxInfo->size);
         } else {
             fseek($this->mp4->writeP, 8, SEEK_CUR);
             pWriteInt64($this->mp4->writeP, $this->boxInfo->size);
         }
         fseek($this->mp4->writeP, $this->boxInfo->position + $this->boxInfo->size);
     }
 }