本文整理汇总了PHP中entry::setConversionProfileId方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::setConversionProfileId方法的具体用法?PHP entry::setConversionProfileId怎么用?PHP entry::setConversionProfileId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::setConversionProfileId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createRecordedEntry
/**
* @param LiveEntry $dbEntry
* @return entry
*/
private function createRecordedEntry(LiveEntry $dbEntry, $mediaServerIndex)
{
$lock = kLock::create("live_record_" . $dbEntry->getId());
if ($lock && !$lock->lock(self::KLOCK_CREATE_RECORDED_ENTRY_GRAB_TIMEOUT, self::KLOCK_CREATE_RECORDED_ENTRY_HOLD_TIMEOUT)) {
return;
}
// If while we were waiting for the lock, someone has updated the recorded entry id - we should use it.
$dbEntry->reload();
if ($dbEntry->getRecordStatus() != RecordStatus::PER_SESSION && $dbEntry->getRecordedEntryId()) {
$lock->unlock();
$recordedEntry = entryPeer::retrieveByPK($dbEntry->getRecordedEntryId());
return $recordedEntry;
}
$recordedEntry = null;
try {
$recordedEntryName = $dbEntry->getName();
if ($dbEntry->getRecordStatus() == RecordStatus::PER_SESSION) {
$recordedEntryName .= ' ' . ($dbEntry->getRecordedEntryIndex() + 1);
}
$recordedEntry = new entry();
$recordedEntry->setType(entryType::MEDIA_CLIP);
$recordedEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_VIDEO);
$recordedEntry->setRootEntryId($dbEntry->getId());
$recordedEntry->setName($recordedEntryName);
$recordedEntry->setDescription($dbEntry->getDescription());
$recordedEntry->setSourceType(EntrySourceType::RECORDED_LIVE);
$recordedEntry->setAccessControlId($dbEntry->getAccessControlId());
$recordedEntry->setConversionProfileId($dbEntry->getConversionProfileId());
$recordedEntry->setKuserId($dbEntry->getKuserId());
$recordedEntry->setPartnerId($dbEntry->getPartnerId());
$recordedEntry->setModerationStatus($dbEntry->getModerationStatus());
$recordedEntry->setIsRecordedEntry(true);
$recordedEntry->setTags($dbEntry->getTags());
$recordedEntry->save();
$dbEntry->setRecordedEntryId($recordedEntry->getId());
$dbEntry->save();
$assets = assetPeer::retrieveByEntryId($dbEntry->getId(), array(assetType::LIVE));
foreach ($assets as $asset) {
/* @var $asset liveAsset */
$asset->incLiveSegmentVersion($mediaServerIndex);
$asset->save();
}
} catch (Exception $e) {
$lock->unlock();
throw $e;
}
$lock->unlock();
return $recordedEntry;
}
示例2: createReplacigEntry
private static function createReplacigEntry($recordedEntry)
{
$advancedOptions = new kEntryReplacementOptions();
$advancedOptions->setKeepManualThumbnails(true);
$recordedEntry->setReplacementOptions($advancedOptions);
$replacingEntry = new entry();
$replacingEntry->setType(entryType::MEDIA_CLIP);
$replacingEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_VIDEO);
$replacingEntry->setConversionProfileId($recordedEntry->getConversionProfileId());
$replacingEntry->setName($recordedEntry->getPartnerId() . '_' . time());
$replacingEntry->setKuserId($recordedEntry->getKuserId());
$replacingEntry->setAccessControlId($recordedEntry->getAccessControlId());
$replacingEntry->setPartnerId($recordedEntry->getPartnerId());
$replacingEntry->setSubpId($recordedEntry->getPartnerId() * 100);
$replacingEntry->setDefaultModerationStatus();
$replacingEntry->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
$replacingEntry->setReplacedEntryId($recordedEntry->getId());
$replacingEntry->save();
$recordedEntry->setReplacingEntryId($replacingEntry->getId());
$recordedEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY);
$affectedRows = $recordedEntry->save();
return $replacingEntry;
}
示例3: getReplacingEntry
protected static function getReplacingEntry($recordedEntry, $asset, $retries = 1)
{
$replacingEntryId = $recordedEntry->getReplacingEntryId();
$replacingEntry = null;
// in replacement
if ($replacingEntryId) {
$replacingEntry = entryPeer::retrieveByPKNoFilter($replacingEntryId);
// check if asset already ingested
$replacingAsset = assetPeer::retrieveByEntryIdAndParams($replacingEntryId, $asset->getFlavorParamsId());
if ($replacingAsset) {
KalturaLog::err('Asset with params [' . $asset->getFlavorParamsId() . '] already replaced');
return null;
}
} else {
$advancedOptions = new kEntryReplacementOptions();
$advancedOptions->setKeepManualThumbnails(true);
$recordedEntry->setReplacementOptions($advancedOptions);
$replacingEntry = new entry();
$replacingEntry->setType(entryType::MEDIA_CLIP);
$replacingEntry->setMediaType(entry::ENTRY_MEDIA_TYPE_VIDEO);
$replacingEntry->setConversionProfileId($recordedEntry->getConversionProfileId());
$replacingEntry->setName($recordedEntry->getPartnerId() . '_' . time());
$replacingEntry->setKuserId($recordedEntry->getKuserId());
$replacingEntry->setAccessControlId($recordedEntry->getAccessControlId());
$replacingEntry->setPartnerId($recordedEntry->getPartnerId());
$replacingEntry->setSubpId($recordedEntry->getPartnerId() * 100);
$replacingEntry->setDefaultModerationStatus();
$replacingEntry->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_SYSTEM);
$replacingEntry->setReplacedEntryId($recordedEntry->getId());
$replacingEntry->save();
$recordedEntry->setReplacingEntryId($replacingEntry->getId());
$recordedEntry->setReplacementStatus(entryReplacementStatus::APPROVED_BUT_NOT_READY);
$affectedRows = $recordedEntry->save();
if (!$affectedRows) {
$replacingEntry->delete();
$replacingEntry = null;
if ($retries) {
sleep(10);
$recordedEntry = entryPeer::retrieveByPKNoFilter($recordedEntry->getId());
return kFlowHelper::getReplacingEntry($recordedEntry, $asset, 0);
} else {
KalturaLog::err("Failed to update replacing entry");
return null;
}
}
}
return $replacingEntry;
}
示例4: replaceEntry
//.........这里部分代码省略.........
//If doesn't exist - create a new array for the current asset's type.
if (!isset($newAssets[$newAsset->getType()])) {
$newAssets[$newAsset->getType()] = array();
}
if ($newAsset->getFlavorParamsId() || $newAsset instanceof flavorAsset) {
$newAssets[$newAsset->getType()][$newAsset->getFlavorParamsId()] = $newAsset;
KalturaLog::debug("Added new asset [" . $newAsset->getId() . "] for asset params [" . $newAsset->getFlavorParamsId() . "]");
} else {
$newAssets[$newAsset->getType()]['asset_' . count($newAssets[$newAsset->getType()])] = $newAsset;
KalturaLog::debug("Added new asset [" . $newAsset->getId() . "] with no asset params");
}
}
$saveEntry = false;
$defaultThumbAssetNew = null;
foreach ($oldAssets as $oldAsset) {
/* @var $oldAsset asset */
kFileSyncUtils::clearWAMSDataForKey($oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET));
//If the newAssets map contains an asset of the same type and paramsId as the current old asset,
// re-link the old asset to the new asset.
if (isset($newAssets[$oldAsset->getType()]) && isset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()])) {
$newAsset = $newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()];
/* @var $newAsset asset */
KalturaLog::debug("Create link from new asset [" . $newAsset->getId() . "] to old asset [" . $oldAsset->getId() . "] for flavor [" . $oldAsset->getFlavorParamsId() . "]");
if ($oldAsset instanceof flavorAsset) {
$oldAsset->setBitrate($newAsset->getBitrate());
$oldAsset->setFrameRate($newAsset->getFrameRate());
$oldAsset->setVideoCodecId($newAsset->getVideoCodecId());
}
$oldAsset->setWidth($newAsset->getWidth());
$oldAsset->setHeight($newAsset->getHeight());
$oldAsset->setContainerFormat($newAsset->getContainerFormat());
$oldAsset->setSize($newAsset->getSize());
$oldAsset->setFileExt($newAsset->getFileExt());
$oldAsset->setTags($newAsset->getTags());
$oldAsset->setDescription($newAsset->getDescription());
$oldAsset->incrementVersion();
$oldAsset->setStatusLocalReady();
$oldAsset->save();
$oldFileSync = $oldAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$newFileSync = $newAsset->getSyncKey(asset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::createSyncFileLinkForKey($oldFileSync, $newFileSync);
$newFlavorMediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($newAsset->getId());
if ($newFlavorMediaInfo) {
$oldFlavorNewMediaInfo = $newFlavorMediaInfo->copy();
$oldFlavorNewMediaInfo->setFlavorAssetId($oldAsset->getId());
$oldFlavorNewMediaInfo->setFlavorAssetVersion($oldAsset->getVersion());
$oldFlavorNewMediaInfo->save();
}
unset($newAssets[$oldAsset->getType()][$oldAsset->getFlavorParamsId()]);
if ($oldAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $oldAsset;
KalturaLog::debug("Nominating ThumbAsset [" . $oldAsset->getId() . "] as the default ThumbAsset after replacent");
}
} elseif ($oldAsset instanceof flavorAsset || $oldAsset instanceof thumbAsset) {
KalturaLog::debug("Delete old asset [" . $oldAsset->getId() . "] for paramsId [" . $oldAsset->getFlavorParamsId() . "]");
$oldAsset->setStatus(flavorAsset::ASSET_STATUS_DELETED);
$oldAsset->setDeletedAt(time());
$oldAsset->save();
$entry->removeFlavorParamsId($oldAsset->getFlavorParamsId());
$saveEntry = true;
}
}
foreach ($newAssets as $newAssetsByTypes) {
foreach ($newAssetsByTypes as $newAsset) {
$createdAsset = $newAsset->copyToEntry($entry->getId(), $entry->getPartnerId());
KalturaLog::debug("Copied from new asset [" . $newAsset->getId() . "] to copied asset [" . $createdAsset->getId() . "] for flavor [" . $newAsset->getFlavorParamsId() . "]");
if ($createdAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$defaultThumbAssetNew = $newAsset;
KalturaLog::debug("Nominating ThumbAsset [" . $newAsset->getId() . "] as the default ThumbAsset after replacent");
}
}
}
if ($defaultThumbAssetNew) {
kBusinessConvertDL::setAsDefaultThumbAsset($defaultThumbAssetNew);
kalturalog::debug("Setting ThumbAsset [" . $defaultThumbAssetNew->getId() . "] as the default ThumbAsset");
} else {
kalturalog::debug("No default ThumbAsset found for replacing entry [" . $tempEntry->getId() . "]");
$entry->setThumbnail(".jpg");
// thumbnailversion++
$entry->save();
$tempEntrySyncKey = $tempEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
$realEntrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
kFileSyncUtils::createSyncFileLinkForKey($realEntrySyncKey, $tempEntrySyncKey);
}
$entry->setDimensions($tempEntry->getWidth(), $tempEntry->getHeight());
$entry->setLengthInMsecs($tempEntry->getLengthInMsecs());
$entry->setConversionProfileId($tempEntry->getConversionProfileId());
$entry->setConversionQuality($tempEntry->getConversionQuality());
$entry->setReplacingEntryId(null);
$entry->setReplacementStatus(entryReplacementStatus::NONE);
$entry->setStatus($tempEntry->getStatus());
$entry->save();
myEntryUtils::deleteEntry($tempEntry, null, true);
$te = new TrackEntry();
$te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_REPLACED_ENTRY);
$te->setEntryId($entry->getId());
$te->setParam1Str($tempEntry->getId());
$te->setDescription(__METHOD__ . "[" . __LINE__ . "]");
TrackEntry::addTrackEntry($te);
}