/**
  * @return int
  */
 public function encodeModeStructure()
 {
     try {
         $bs = new BitStream();
         $bs->appendNum(4, 0x3);
         $bs->appendNum(4, ord($this->data[1]) - 1);
         $bs->appendNum(4, ord($this->data[0]) - 1);
         $bs->appendNum(8, ord($this->data[2]));
         $this->bStream = $bs;
     } catch (\Exception $e) {
         return -1;
     }
     return 0;
 }
示例#2
0
 /**
  * @return BitStream|null
  */
 public function mergeBitStream()
 {
     if ($this->convertData() < 0) {
         return null;
     }
     $bStream = new BitStream();
     foreach ($this->items as $item) {
         $ret = $bStream->append($item->bStream);
         if ($ret < 0) {
             return null;
         }
     }
     return $bStream;
 }