Пример #1
0
 /**
  * Writes the object data.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 public function write($writer)
 {
     require_once 'HausDesign/Io/StringWriter.php';
     $buffer = new HausDesign_Io_StringWriter();
     $buffer->writeUInt32LE(strlen($this->_secretData))->write($this->_secretData)->writeUInt32LE($len = strlen($this->_protectionType) + 1)->writeString8($this->_protectionType, $len)->writeUInt32LE($len = strlen($this->_keyId) + 1)->writeString8($this->_keyId, $len)->writeUInt32LE($len = strlen($this->_licenseUrl) + 1)->writeString8($this->_licenseUrl, $len);
     $this->setSize(24 + $buffer->getSize());
     $writer->writeGuid($this->getIdentifier())->writeInt64LE($this->getSize())->write($buffer->toString());
 }
Пример #2
0
 /**
  * Writes the object data.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 public function write($writer)
 {
     require_once 'HausDesign/Io/StringWriter.php';
     $typeSpecificData = new HausDesign_Io_StringWriter();
     switch ($this->_streamType) {
         case self::AUDIO_MEDIA:
             $typeSpecificData->writeUInt16LE($this->_typeSpecificData['codecId'])->writeUInt16LE($this->_typeSpecificData['numberOfChannels'])->writeUInt32LE($this->_typeSpecificData['samplesPerSecond'])->writeUInt32LE($this->_typeSpecificData['avgNumBytesPerSecond'])->writeUInt16LE($this->_typeSpecificData['blockAlignment'])->writeUInt16LE($this->_typeSpecificData['bitsPerSample'])->writeUInt16LE(strlen($this->_typeSpecificData['codecSpecificData']))->write($this->_typeSpecificData['codecSpecificData']);
             break;
         case self::VIDEO_MEDIA:
             $typeSpecificData->writeUInt32LE($this->_typeSpecificData['encodedImageWidth'])->writeUInt32LE($this->_typeSpecificData['encodedImageHeight'])->writeInt8($this->_typeSpecificData['reservedFlags'])->writeUInt16LE(0)->writeUInt32LE(38 + strlen($this->_typeSpecificData['codecSpecificData']))->writeUInt32LE($this->_typeSpecificData['imageWidth'])->writeUInt32LE($this->_typeSpecificData['imageHeight'])->writeUInt16LE($this->_typeSpecificData['reserved'])->writeUInt16LE($this->_typeSpecificData['bitsPerPixelCount'])->writeUInt32LE($this->_typeSpecificData['compressionId'])->writeUInt32LE($this->_typeSpecificData['imageSize'])->writeUInt32LE($this->_typeSpecificData['horizontalPixelsPerMeter'])->writeUInt32LE($this->_typeSpecificData['verticalPixelsPerMeter'])->writeUInt32LE($this->_typeSpecificData['colorsUsedCount'])->writeUInt32LE($this->_typeSpecificData['importantColorsCount'])->write($this->_typeSpecificData['codecSpecificData']);
             break;
         case self::JFIF_MEDIA:
             $typeSpecificData->writeUInt32LE($this->_typeSpecificData['imageWidth'])->writeUInt32LE($this->_typeSpecificData['imageHeight'])->writeUInt32LE(0);
             break;
         case self::DEGRADABLE_JPEG_MEDIA:
             $typeSpecificData->writeUInt32LE($this->_typeSpecificData['imageWidth'])->writeUInt32LE($this->_typeSpecificData['imageHeight'])->writeUInt16LE(0)->writeUInt16LE(0)->writeUInt16LE(0);
             $interchangeDataSize = strlen($this->_typeSpecificData['interchangeData']);
             if ($interchangeDataSize == 1) {
                 $interchangeDataSize = 0;
             }
             $typeSpecificData->writeUInt16LE($interchangeDataSize)->write($this->_typeSpecificData['interchangeData']);
             break;
         case self::FILE_TRANSFER_MEDIA:
             // break intentionally omitted
         // break intentionally omitted
         case self::BINARY_MEDIA:
             $typeSpecificData->writeGuid($this->_typeSpecificData['majorMediaType'])->writeGuid($this->_typeSpecificData['mediaSubtype'])->writeUInt32LE($this->_typeSpecificData['fixedSizeSamples'])->writeUInt32LE($this->_typeSpecificData['temporalCompression'])->writeUInt32LE($this->_typeSpecificData['sampleSize'])->writeGuid($this->_typeSpecificData['formatType'])->writeUInt32LE(strlen($this->_typeSpecificData['formatData']))->write($this->_typeSpecificData['formatData']);
             break;
         case self::COMMAND_MEDIA:
             // break intentionally omitted
         // break intentionally omitted
         default:
             break;
     }
     $errorCorrectionData = new HausDesign_Io_StringWriter();
     switch ($this->_errorCorrectionType) {
         case self::AUDIO_SPREAD:
             $errorCorrectionData->writeInt8($this->_errorCorrectionData['span'])->writeUInt16LE($this->_errorCorrectionData['virtualPacketLength'])->writeUInt16LE($this->_errorCorrectionData['virtualChunkLength'])->writeUInt16LE(strlen($this->_errorCorrectionData['silenceData']))->write($this->_errorCorrectionData['silenceData']);
             break;
         case self::NO_ERROR_CORRECTION:
             // break intentionally omitted
         // break intentionally omitted
         default:
             break;
     }
     $this->setSize(24 + 54 + $typeSpecificData->getSize() + $errorCorrectionData->getSize());
     $writer->writeGuid($this->getIdentifier())->writeInt64LE($this->getSize())->writeGuid($this->_streamType)->writeGuid($this->_errorCorrectionType)->writeInt64LE($this->_timeOffset)->writeUInt32LE($typeSpecificData->getSize())->writeUInt32LE($errorCorrectionData->getSize())->writeUInt16LE($this->_flags)->writeUInt32LE($this->_reserved)->write($typeSpecificData->toString())->write($errorCorrectionData->toString());
 }
Пример #3
0
 /**
  * Writes the object data.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 public function write($writer)
 {
     require_once 'HausDesign/Io/StringWriter.php';
     $commandTypes = array();
     foreach ($this->_commands as $command) {
         if (!in_array($command['type'], $commandTypes)) {
             $commandTypes[] = $command['type'];
         }
     }
     $commandTypesCount = count($commandTypes);
     $commandTypesWriter = new HausDesign_Io_StringWriter();
     for ($i = 0; $i < $commandTypesCount; $i++) {
         $commandTypesWriter->writeUInt16LE(strlen($commandType = iconv($this->getOption('encoding'), 'utf-16le', $commandTypes[$i])) / 2)->write($commandType);
     }
     $commandsCount = count($this->_commands);
     $commandsWriter = new HausDesign_Io_StringWriter();
     for ($i = 0; $i < $commandsCount; $i++) {
         $commandsWriter->writeUInt32LE($this->_commands[$i]['presentationTime'])->writeUInt16LE(array_search($this->_commands[$i]['type'], $commandTypes))->writeUInt16LE(strlen($command = iconv($this->getOption('encoding'), 'utf-16le', $this->_commands[$i]['name'])) / 2)->write($command);
     }
     $this->setSize(24 + 20 + $commandTypesWriter->getSize() + $commandsWriter->getSize());
     $writer->writeGuid($this->getIdentifier())->writeInt64LE($this->getSize())->writeGuid($this->_reserved)->writeUInt16LE($commandsCount)->writeUInt16LE($commandTypesCount)->write($commandTypesWriter->toString())->write($commandsWriter->toString());
 }
 /**
  * Writes the object data.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 public function write($writer)
 {
     require_once 'HausDesign/Io/StringWriter.php';
     $contentEncryptionRecordsCount = count($this->_contentEncryptionRecords);
     $contentEncryptionRecordsWriter = new HausDesign_Io_StringWriter();
     for ($i = 0; $i < $contentEncryptionRecordsCount; $i++) {
         $contentEncryptionRecordsWriter->writeGuid($this->_contentEncryptionRecords['systemId'])->writeUInt32LE($this->_contentEncryptionRecords['systemVersion'])->writeUInt16LE($encryptedObjectRecordCount = $this->_contentEncryptionRecords['streamNumbers']);
         for ($j = 0; $j < $encryptedObjectRecordCount; $j++) {
             $contentEncryptionRecordsWriter->writeUInt16LE(1)->writeUInt16LE(2)->writeUInt16LE($this->_contentEncryptionRecords['streamNumbers'][$j]);
         }
         $contentEncryptionRecordsWriter->writeUInt32LE(strlen($this->_contentEncryptionRecords['data']))->write($this->_contentEncryptionRecords['data']);
     }
     $this->setSize(24 + 2 + $contentEncryptionRecordsWriter->getSize());
     $writer->writeGuid($this->getIdentifier())->writeInt64LE($this->getSize())->writeUInt16LE($contentEncryptionRecordsCount)->write($contentEncryptionRecordsWriter->toString());
 }
Пример #5
0
 /**
  * Writes the object data.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 public function write($writer)
 {
     require_once 'HausDesign/Io/StringWriter.php';
     $buffer = new HausDesign_Io_StringWriter();
     $buffer->writeUInt32LE($this->_bannerImageType)->writeUInt32LE(count($this->_bannerImageData))->write($this->_bannerImageData)->writeUInt32LE(count($this->_bannerImageUrl))->write($this->_bannerImageUrl)->writeUInt32LE(count($this->_copyrightUrl))->write($this->_copyrightUrl);
     $this->setSize(24 + $buffer->getSize());
     $writer->writeGuid($this->getIdentifier())->writeInt64LE($this->getSize())->write($buffer->toString());
 }