protected function parseOutput($output)
 {
     $tokenizer = new KStringTokenizer($output, "\t\n");
     $mediaInfo = new KalturaMediaInfo();
     $mediaInfo->rawData = $output;
     $fieldCnt = 0;
     $section = "general";
     $sectionID = 0;
     while ($tokenizer->hasMoreTokens()) {
         $tok = strtolower(trim($tokenizer->nextToken()));
         if (strrpos($tok, ":") == false) {
             $sectionID = strchr($tok, "#");
             if ($sectionID) {
                 $sectionID = trim($sectionID, "#");
             } else {
                 $sectionID = 0;
             }
             if (strstr($tok, "general") == true) {
                 $section = "general";
             } else {
                 if (strstr($tok, "video") == true) {
                     $section = "video";
                 } else {
                     if (strstr($tok, "audio") == true) {
                         $section = "audio";
                     } else {
                         $section = $tok;
                     }
                 }
             }
         } else {
             if ($sectionID <= 1) {
                 $key = trim(substr($tok, 0, strpos($tok, ":")));
                 $val = trim(substr(strstr($tok, ":"), 1));
                 switch ($section) {
                     case "general":
                         $this->loadContainerSet($mediaInfo, $key, $val);
                         break;
                     case "video":
                         $this->loadVideoSet($mediaInfo, $key, $val);
                         break;
                     case "audio":
                         $this->loadAudioSet($mediaInfo, $key, $val);
                         break;
                 }
                 $fieldCnt++;
             }
         }
     }
     // On no-content return null
     if ($fieldCnt < 5) {
         return null;
     } else {
         return $mediaInfo;
     }
 }
 protected function parseOutput($output)
 {
     $output = kXml::stripXMLInvalidChars($output);
     $tokenizer = new KStringTokenizer($output, "\t\n");
     $mediaInfo = new KalturaMediaInfo();
     $mediaInfo->rawData = $output;
     $fieldCnt = 0;
     $section = self::SrteamGeneral;
     $sectionID = 0;
     $mediaInfo->streamArray = array();
     $streamMediaInfo = null;
     while ($tokenizer->hasMoreTokens()) {
         $tok = strtolower(trim($tokenizer->nextToken()));
         if (strrpos($tok, ":") == false) {
             if (isset($streamMediaInfo)) {
                 $mediaInfo->streamArray[$section][] = $streamMediaInfo;
             }
             $streamMediaInfo = new KalturaMediaInfo();
             $sectionID = strchr($tok, "#");
             if ($sectionID) {
                 $sectionID = trim($sectionID, "#");
             } else {
                 $sectionID = 0;
             }
             if (strstr($tok, self::SrteamGeneral) == true) {
                 $section = self::SrteamGeneral;
             } else {
                 if (strstr($tok, self::SrteamVideo) == true) {
                     $section = self::SrteamVideo;
                 } else {
                     if (strstr($tok, self::SrteamAudio) == true) {
                         $section = self::SrteamAudio;
                     } else {
                         $section = $tok;
                     }
                 }
             }
         } else {
             if ($sectionID <= 1) {
                 self::loadStreamMedia($mediaInfo, $section, $tok);
                 $fieldCnt++;
             }
         }
         self::loadStreamMedia($streamMediaInfo, $section, $tok);
     }
     if (isset($streamMediaInfo)) {
         $mediaInfo->streamArray[$section][] = $streamMediaInfo;
     }
     return $mediaInfo;
 }
示例#3
0
 protected function parseOutput($output)
 {
     $output = kXml::stripXMLInvalidChars($output);
     $tokenizer = new KStringTokenizer($output, "\t\n");
     $mediaInfo = new KalturaMediaInfo();
     $mediaInfo->rawData = $output;
     $fieldCnt = 0;
     $section = self::SrteamGeneral;
     $sectionID = 0;
     $mediaInfo->streamArray = array();
     $streamMediaInfo = null;
     while ($tokenizer->hasMoreTokens()) {
         $tok = strtolower(trim($tokenizer->nextToken()));
         if (strrpos($tok, ":") == false) {
             if (isset($streamMediaInfo)) {
                 $mediaInfo->streamArray[$section][] = $streamMediaInfo;
             }
             $streamMediaInfo = new KalturaMediaInfo();
             $sectionID = strchr($tok, "#");
             if ($sectionID) {
                 $sectionID = trim($sectionID, "#");
             } else {
                 $sectionID = 0;
             }
             if (strstr($tok, self::SrteamGeneral) == true) {
                 $section = self::SrteamGeneral;
             } else {
                 if (strstr($tok, self::SrteamVideo) == true) {
                     $section = self::SrteamVideo;
                 } else {
                     if (strstr($tok, self::SrteamAudio) == true) {
                         $section = self::SrteamAudio;
                     } else {
                         $section = $tok;
                     }
                 }
             }
         } else {
             if ($sectionID <= 1) {
                 self::loadStreamMedia($mediaInfo, $section, $tok);
                 $fieldCnt++;
             }
         }
         self::loadStreamMedia($streamMediaInfo, $section, $tok);
     }
     if (isset($streamMediaInfo)) {
         $mediaInfo->streamArray[$section][] = $streamMediaInfo;
     }
     /*
      * For ARF (webex) files - simulate container ID and format.
      * ARF format considered to be a file that has ARF ext 
      * and DOES NOT have both video and audio setting.
      * On no-content return null
      */
     if (strstr($this->filePath, ".arf")) {
         if ((isset($mediaInfo->audioFormat) || isset($mediaInfo->audioCodecId)) && (isset($mediaInfo->videoFormat) || isset($mediaInfo->videoCodecId))) {
             return $mediaInfo;
         } else {
             $m = new KalturaMediaInfo();
             $m->rawData = $mediaInfo->rawData;
             $m->fileSize = $mediaInfo->fileSize;
             $m->containerFormat = "arf";
             $m->containerId = "arf";
             return $m;
         }
     } else {
         if ($fieldCnt >= 5) {
             return $mediaInfo;
         } else {
             return null;
         }
     }
 }