Exemplo n.º 1
0
 static function mergeTranscoderObjArr(array $trPrmArr, $transParse, $extraParse = null, array $transDictionary = null)
 {
     foreach ($transParse as $key => $trId) {
         if ($trId == null) {
             continue;
         }
         if ($extraParse && array_key_exists($key, $extraParse)) {
             $trEx = $extraParse[$key];
         } else {
             $trEx = null;
         }
         if (is_array($trId)) {
             $auxArr = array();
             $trPrmArr[$key] = KDLUtils::mergeTranscoderObjArr($auxArr, $trId, $trEx, $transDictionary);
         } else {
             $trId = KDLUtils::trima($trId);
             if (!is_null($transDictionary) && array_key_exists($trId, $transDictionary)) {
                 $trId = $transDictionary[$trId];
             }
             $trPrm = new KDLOperationParams($trId, $trEx);
             $trPrmArr[$key] = $trPrm;
         }
     }
     return $trPrmArr;
 }
function transcoderSetFuncWrap($oprObj, $transDictionary, $param2)
{
    $trId = KDLUtils::trima($oprObj->_id);
    if (!is_null($transDictionary) && array_key_exists($trId, $transDictionary)) {
        $oprObj->_id = $transDictionary[$trId];
    }
    //	$oprObj->_engine = KDLWrap::GetEngineObject($oprObj->_id);
    $id = $oprObj->_id;
    KalturaLog::log(":operators id={$id} :");
    $engine = null;
    if (isset($oprObj->_className) && class_exists($oprObj->_className)) {
        try {
            $engine = new $oprObj->_className($id);
        } catch (Exception $e) {
            $engine = null;
        }
    }
    if (isset($engine)) {
        KalturaLog::log(__METHOD__ . ": the engine was successfully overloaded with {$oprObj->_className}");
    } else {
        switch ($id) {
            case KDLTranscoders::KALTURA:
            case KDLTranscoders::ON2:
            case KDLTranscoders::FFMPEG:
            case KDLTranscoders::MENCODER:
            case KDLTranscoders::ENCODING_COM:
            case KDLTranscoders::FFMPEG_AUX:
            case KDLTranscoders::FFMPEG_VP8:
            case KDLTranscoders::EE3:
            case KDLTranscoders::WAMS:
                $engine = new KDLOperatorWrapper($id);
                break;
            case KDLTranscoders::QUICK_TIME_PLAYER_TOOLS:
                $engine = KalturaPluginManager::loadObject('KDLOperatorBase', "quickTimeTools.QuickTimeTools");
                break;
            default:
                //		KalturaLog::log("in default :operators id=$id :");
                $engine = KalturaPluginManager::loadObject('KDLOperatorBase', $id);
                break;
        }
    }
    if (is_null($engine)) {
        KalturaLog::log(__METHOD__ . ":ERROR - plugin manager returned with null");
    } else {
        $oprObj->_engine = $engine;
        KalturaLog::log(__METHOD__ . "Engine object from plugin mgr==>\n" . print_r($oprObj->_engine, true));
    }
    return;
}
Exemplo n.º 3
0
 private function loadBaseSet(&$baseData, $key, $val)
 {
     switch ($key) {
         case "codec id":
             $baseData->_id = $val;
             break;
         case "format":
             $baseData->_format = $val;
             break;
         case "duration":
             $baseData->_duration = KDLUtils::convertDuration2msec($val);
             break;
         case "bit rate":
             $baseData->_bitRate = KDLUtils::convertValue2kbits(KDLUtils::trima($val));
             break;
         default:
             //echo "<br>". "key=". $key . " val=" . $val . "<br>";
             $baseData->_params[$key] = $val;
             break;
     }
 }
Exemplo n.º 4
0
function transcoderSetFuncWrap($oprObj, $transDictionary, $param2)
{
    $trId = KDLUtils::trima($oprObj->_id);
    if (!is_null($transDictionary) && array_key_exists($trId, $transDictionary)) {
        $oprObj->_id = $transDictionary[$trId];
    }
    //	$oprObj->_engine = KDLWrap::GetEngineObject($oprObj->_id);
    $id = $oprObj->_id;
    KalturaLog::log(__METHOD__ . ":operators id={$id} :");
    switch ($id) {
        case KDLTranscoders::KALTURA:
        case KDLTranscoders::ON2:
        case KDLTranscoders::FFMPEG:
        case KDLTranscoders::MENCODER:
        case KDLTranscoders::ENCODING_COM:
        case KDLTranscoders::FFMPEG_AUX:
        case KDLTranscoders::FFMPEG_VP8:
        case KDLTranscoders::EE3:
            $oprObj->_engine = new KDLOperatorWrapper($id);
            return;
        case KDLTranscoders::QUICK_TIME_PLAYER_TOOLS:
            $oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', "quickTimeTools.QuickTimeTools");
            break;
        default:
            //		KalturaLog::log("in default :operators id=$id :");
            $oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', $id);
            break;
    }
    /*
    	if($id==KDLTranscoders::QUICK_TIME_PLAYER_TOOLS) {
    		$oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', "quickTimeTools.QuickTimeTools");
    	}
    	else if($id=="fastStart.FastStart") {
    		$oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', $id);
    	}
    //	else if($id==KDLTranscoders::EXPRESSION_ENCODER) {
    //		$oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', "expressionEncoder.ExpressionEncoder");
    //	}
    //	else if($id==KDLTranscoders::QT_FASTSTART) {
    //		$oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', "fastStart.FastStart");
    //	}
    //	else if($id==KDLTranscoders::AVIDEMUX) {
    //		$oprObj->_engine = KalturaPluginManager::loadObject(KalturaPluginManager::OBJECT_TYPE_KDL_ENGINE, "avidemux.Avidemux");
    //	}
    //	else if($id==KDLTranscoders::PDF_CREATOR) {
    //		$oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', conversionEngineType::PDF_CREATOR);
    //	}
    //	else if($id==KDLTranscoders::PDF2SWF) {
    //		$oprObj->_engine = KalturaPluginManager::loadObject('KDLOperatorBase', conversionEngineType::PDF2SWF);
    //	}
    	else {
    		$oprObj->_engine = new KDLOperatorWrapper($id);
    		return;
    	}
    */
    if (is_null($oprObj->_engine)) {
        KalturaLog::log(__METHOD__ . ":ERROR - plugin manager returned with null");
    } else {
        KalturaLog::log(__METHOD__ . "Engine object from plugin mgr==>\n" . print_r($oprObj->_engine, true));
    }
    return;
}
function transcoderSetFuncTest($oprObj, $transDictionary, $param2)
{
    $trId = KDLUtils::trima($oprObj->_id);
    if (!is_null($transDictionary) && array_key_exists($trId, $transDictionary)) {
        $oprObj->_id = $transDictionary[$trId];
    }
    if ($oprObj->_id == KDLTranscoders::QUICK_TIME_PLAYER_TOOLS) {
        $engineClassName = "KDLTranscoderQTPTools";
    } else {
        if ($oprObj->_id == KDLTranscoders::QT_FASTSTART) {
            $engineClassName = "KDLOperatorQTFastStart";
        } else {
            if ($oprObj->_id == KDLTranscoders::AVIDEMUX) {
                $engineClassName = "KDLOperatorAvidemux";
            } else {
                if ($oprObj->_id == KDLTranscoders::EXPRESSION_ENCODER) {
                    $engineClassName = "KDLOperatorExpressionEncoder";
                } else {
                    if ($oprObj->_id == KDLTranscoders::PDF_CREATOR) {
                        $engineClassName = "KDLTranscoderPdfCreator";
                    } else {
                        if ($oprObj->_id == KDLTranscoders::PDF2SWF) {
                            $engineClassName = "KDLTranscoderPdf2Swf";
                        } else {
                            $engineClassName = "KDLOperatorWrapper";
                        }
                    }
                }
            }
        }
    }
    $oprObj->_engine = new $engineClassName($oprObj->_id, "");
}