Beispiel #1
0
 /**
  * 
  * Test the KDL - WrapCDLGenerateTargetFlavors() method
  * @dataProvider providerCDLGenerateTargetFlavors
  */
 public function testKDLWrapCDLGenerateTargetFlavors(flavorParams $flavorList, mediaInfo $mediaInfo, flavorParamsOutput $flavorParamsOutput)
 {
     //returns KDLWrap
     $result = KDLWrap::CDLGenerateTargetFlavors($mediaInfo, array($flavorList));
     $validErrorFields = array("CreatedAt", "UpdatedAt", "Id", "PartnerId", "EntryId", "FlavorAssetId", "DeletedAt", "ReadyBehavior", "FlavorAssetVersion", "FlavorParamsVersion", "AudioResolution");
     $newErrors = $this->comparePropelObjectsByFields($flavorParamsOutput, reset($result->_targetList), $validErrorFields);
 }
 /**
  * validateFlavorAndMediaInfo validate and manipulate a flavor according to the given media info
  * 
  * @param flavorParams $flavor
  * @param mediaInfo $mediaInfo
  * @param string $errDescription
  * @return flavorParamsOutputWrap or null for fail
  */
 protected static function validateFlavorAndMediaInfo(assetParams $flavor, mediaInfo $mediaInfo = null, &$errDescription)
 {
     $cdl = KDLWrap::CDLGenerateTargetFlavors($mediaInfo, array($flavor));
     $errDescription = '';
     if (count($cdl->_errors)) {
         $errDesc = '';
         foreach ($cdl->_errors as $section => $errors) {
             $errDesc .= "{$section} errors: " . join(";", $errors) . "\n";
         }
         KalturaLog::log("Decision layer input error: {$errDesc}");
         $errDescription .= "\nMedia err: {$errDesc}";
     }
     if (count($cdl->_warnings)) {
         $errDesc = '';
         foreach ($cdl->_warnings as $section => $errors) {
             $errDesc .= "{$section} warnings: " . join(";", $errors) . "\n";
         }
         KalturaLog::log("Decision layer input warning: {$errDesc}");
         $errDescription .= "\nMedia warn: {$errDesc}";
     }
     if (!$cdl->_rv) {
         return null;
     }
     return reset($cdl->_targetList);
 }
function runWrapperTest($contentDir, $patern)
{
    echo "<br>\n";
    $kdlSrcMedSet = getMediasetFromFile("{$contentDir}\\{$patern}");
    $cdlSrcMedInf = new mediaInfo();
    $cdlSrcMedInf->LoadFromMediaset($kdlSrcMedSet);
    $cdlFlavors[] = new flavorParams();
    $cdlFlavors[0]->simulate(KDLContainerTarget::MP4, KDLVideoTarget::H264B, 0, 352, 2500, KDLAudioTarget::AAC, 96, 22050, "2,3");
    $cdlTargets;
    $cdlTargets = KDLWrap::CDLGenerateTargetFlavors($cdlSrcMedInf, $cdlFlavors);
    $cmdLine = KDLWrap::CDLProceessFlavorsForCollection($cdlTargets->_targetList);
    if ($cdlTargets->_targetList[0]->engine_version == 0) {
        $cmdLine = $cdlTargets->_targetList[0]->command_lines;
    } else {
        $cmdLine = $cdlTargets->_targetList[0]->operators;
        $oprSets = new kOperatorSets();
        //		$operators = stripslashes($operators);
        //kLog::log(__METHOD__."\ncdlOperators(stripslsh)==>\n".print_r($operators,true));
        $oprSets->setSerialized($cdlTargets->_targetList[0]->operators);
        $oprArr = $oprSets->getSets();
        $cmdLine = $oprArr[0][0]->command;
    }
    $outFile = "aaa111.mpg";
    $exec_cmd = str_replace(array(KDLCmdlinePlaceholders::InFileName, KDLCmdlinePlaceholders::OutFileName, KDLCmdlinePlaceholders::ConfigFileName), array("{$contentDir}\\{$patern}", $outFile, "mko"), $cmdLine);
    /*
    $xmlFileName = "k:\\pre.xml";
    		$fHd = fopen($xmlFileName, "w");
    		fwrite($fHd,$exec_cmd);
    		fclose($fHd);
    		//c:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -file C:\opt\kaltura\app\batch\batches\Convert\scripts\runee3.ps1 C:\expressionencoder\ExpressionEncoder.dll W:\/content/entry/data/29/399/0_0bybp8ez_0_t75dk08i_1.mov C:\opt\kaltura\tmp\convert\convert_0_0bybp8ez_4c24801bbb92f.xml >> "C:\opt\kaltura\tmp\convert\0_0bybp8ez_0_2.log" 2>&1
    		$fHd = fopen("k:\\run.bat", "w");
    		fwrite($fHd,"c:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe -file K:\\opt\\kaltura\\app\\batch\\batches\\Convert\\scripts\\runee3.ps1 C:\\expressionencoder\\ExpressionEncoder.dll $contentDir\\$patern $xmlFileName\npause");
    		fclose($fHd);
    */
    echo "1<br>\n";
    echo $exec_cmd;
    //		exec("ffmpeg ".$exec_cmd);
    if (!file_exists($outFile) || kFile::fileSize($outFile) == 0) {
        kLog::log("\nFailed");
    } else {
        kLog::log("\nSucceeded, Filesize:" . kFile::fileSize($outFile));
    }
    //		$cdlAsset = new flavorAsset;
    //		KDLWrap::ConvertMediainfoCdl2FlavorAsset($cdlMedInf, $cdlAsset);
    $cdlMedInf = new mediaInfo();
    $kdlMedSet = getMediasetFromFile("{$outFile}");
    $cdlMedInf->LoadFromMediaset($kdlMedSet);
    kLog::log("\npre CDLValidateProduct\n");
    KDLWrap::CDLValidateProduct($cdlSrclMedInf, $cdlTargets->_targetList[0], $cdlMedInf);
    //		print_r($kdlFlavor);
    return;
}