本文整理汇总了PHP中assetParamsPeer::retrieveByProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP assetParamsPeer::retrieveByProfile方法的具体用法?PHP assetParamsPeer::retrieveByProfile怎么用?PHP assetParamsPeer::retrieveByProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetParamsPeer
的用法示例。
在下文中一共展示了assetParamsPeer::retrieveByProfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildRtmpLiveStreamFlavorsArray
/**
* @param string $baseUrl
* @return array
*/
protected function buildRtmpLiveStreamFlavorsArray()
{
$entry = entryPeer::retrieveByPK($this->params->getEntryId());
if (in_array($entry->getSource(), LiveEntry::$kalturaLiveSourceTypes)) {
/* @var $entry LiveEntry */
$flavors = array(0 => $this->getFlavorAssetInfo($entry->getStreamName()));
$conversionProfileId = $entry->getConversionProfileId();
if ($conversionProfileId) {
$liveParams = assetParamsPeer::retrieveByProfile($conversionProfileId);
if (count($liveParams)) {
$flavors = array();
foreach ($liveParams as $index => $liveParamsItem) {
/* @var $liveParamsItem liveParams */
if ($entry->getLiveStreamConfigurationByProtocol(PlaybackProtocol::RTMP, 'rtmp')) {
$configuration = $entry->getLiveStreamConfigurationByProtocol(PlaybackProtocol::RTMP, 'rtmp');
$flavors[$index] = $this->getFlavorAssetInfo(str_replace("%i", $liveParamsItem->getId(), $configuration->getStreamName()), '', $liveParamsItem);
continue;
}
$flavors[$index] = $this->getFlavorAssetInfo($entry->getStreamName() . '_' . $liveParamsItem->getId(), '', $liveParamsItem);
}
}
}
return $flavors;
}
$tmpFlavors = $entry->getStreamBitrates();
if (count($tmpFlavors)) {
$flavors = array();
foreach ($tmpFlavors as $index => $flavor) {
$brIndex = $index + 1;
$flavors[$index] = $this->getFlavorAssetInfo(str_replace('%i', $brIndex, $entry->getStreamName()));
$flavors[$index] = array_merge($flavors[$index], $flavor);
}
} else {
$flavors[0] = $this->getFlavorAssetInfo(str_replace('%i', '1', $entry->getStreamName()));
}
return $flavors;
}
示例2: getStreamBitrates
public function getStreamBitrates()
{
$streamBitrates = $this->getFromCustomData("streamBitrates");
if (is_array($streamBitrates) && count($streamBitrates)) {
return $streamBitrates;
}
if (in_array($this->getSource(), array(EntrySourceType::LIVE_STREAM, EntrySourceType::LIVE_STREAM_ONTEXTDATA_CAPTIONS))) {
$liveParams = assetParamsPeer::retrieveByProfile($this->getConversionProfileId());
$streamBitrates = array();
foreach ($liveParams as $liveParamsItem) {
/* @var $liveParamsItem liveParams */
$streamBitrate = array('bitrate' => $liveParamsItem->getVideoBitrate(), 'width' => $liveParamsItem->getWidth(), 'height' => $liveParamsItem->getHeight(), 'tags' => $liveParamsItem->getTags());
$streamBitrates[] = $streamBitrate;
}
return $streamBitrates;
}
return array(array('bitrate' => 300, 'width' => 320, 'height' => 240));
}
示例3: convert
/**
* Convert entry
*
* @param string $entryId Media entry id
* @param int $conversionProfileId
* @param KalturaConversionAttributeArray $dynamicConversionAttributes
* @return bigint job id
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
* @throws KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND
* @throws KalturaErrors::FLAVOR_PARAMS_NOT_FOUND
*/
protected function convert($entryId, $conversionProfileId = null, KalturaConversionAttributeArray $dynamicConversionAttributes = null)
{
$entry = entryPeer::retrieveByPK($entryId);
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($entryId);
if (!$srcFlavorAsset) {
throw new KalturaAPIException(KalturaErrors::ORIGINAL_FLAVOR_ASSET_IS_MISSING);
}
if (is_null($conversionProfileId) || $conversionProfileId <= 0) {
$conversionProfile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
if (!$conversionProfile) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
}
$conversionProfileId = $conversionProfile->getId();
} else {
//The search is with the entry's partnerId. so if conversion profile wasn't found it means that the
//conversionId is not exist or the conversion profileId does'nt belong to this partner.
$conversionProfile = conversionProfile2Peer::retrieveByPK($conversionProfileId);
if (is_null($conversionProfile)) {
throw new KalturaAPIException(KalturaErrors::CONVERSION_PROFILE_ID_NOT_FOUND, $conversionProfileId);
}
}
$srcSyncKey = $srcFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
// if the file sync isn't local (wasn't synced yet) proxy request to other datacenter
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($srcSyncKey, true, false);
if (!$fileSync) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
} else {
if (!$local) {
kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrl($fileSync));
}
}
// even if it null
$entry->setConversionQuality($conversionProfileId);
$entry->save();
if ($dynamicConversionAttributes) {
$flavors = assetParamsPeer::retrieveByProfile($conversionProfileId);
if (!count($flavors)) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_PARAMS_NOT_FOUND);
}
$srcFlavorParamsId = null;
$flavorParams = $entry->getDynamicFlavorAttributes();
foreach ($flavors as $flavor) {
if ($flavor->hasTag(flavorParams::TAG_SOURCE)) {
$srcFlavorParamsId = $flavor->getId();
}
$flavorParams[$flavor->getId()] = $flavor;
}
$dynamicAttributes = array();
foreach ($dynamicConversionAttributes as $dynamicConversionAttribute) {
if (is_null($dynamicConversionAttribute->flavorParamsId)) {
$dynamicConversionAttribute->flavorParamsId = $srcFlavorParamsId;
}
if (is_null($dynamicConversionAttribute->flavorParamsId)) {
continue;
}
$dynamicAttributes[$dynamicConversionAttribute->flavorParamsId][trim($dynamicConversionAttribute->name)] = trim($dynamicConversionAttribute->value);
}
if (count($dynamicAttributes)) {
$entry->setDynamicFlavorAttributes($dynamicAttributes);
$entry->save();
}
}
$srcFilePath = kFileSyncUtils::getLocalFilePathForKey($srcSyncKey);
$job = kJobsManager::addConvertProfileJob(null, $entry, $srcFlavorAsset->getId(), $srcFilePath);
if (!$job) {
return null;
}
return $job->getId();
}
示例4: serveAction
/**
* Serve XML rendition of the Kaltura Live Transcoding Profile usable by the Wowza transcoding add-on
*
* @action serve
* @param string $streamName the id of the live entry with it's stream suffix
* @param string $hostname the media server host name
* @return file
*
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
* @throws WowzaErrors::INVALID_STREAM_NAME
*/
public function serveAction($streamName, $hostname = null)
{
$matches = null;
if (!preg_match('/^(\\d_.{8})_(\\d+)$/', $streamName, $matches)) {
throw new KalturaAPIException(WowzaErrors::INVALID_STREAM_NAME, $streamName);
}
$entryId = $matches[1];
$suffix = $matches[2];
$entry = null;
if (!kCurrentContext::$ks) {
kEntitlementUtils::initEntitlementEnforcement(null, false);
$entry = kCurrentContext::initPartnerByEntryId($entryId);
if (!$entry || $entry->getStatus() == entryStatus::DELETED) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
// enforce entitlement
$this->setPartnerFilters(kCurrentContext::getCurrentPartnerId());
} else {
$entry = entryPeer::retrieveByPK($entryId);
}
if (!$entry || $entry->getType() != KalturaEntryType::LIVE_STREAM || !in_array($entry->getSource(), array(KalturaSourceType::LIVE_STREAM, KalturaSourceType::LIVE_STREAM_ONTEXTDATA_CAPTIONS))) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$mediaServer = null;
if ($hostname) {
$mediaServer = MediaServerPeer::retrieveByHostname($hostname);
}
$conversionProfileId = $entry->getConversionProfileId();
$liveParams = assetParamsPeer::retrieveByProfile($conversionProfileId);
$liveParamsInput = null;
$disableIngested = true;
foreach ($liveParams as $liveParamsItem) {
/* @var $liveParamsItem liveParams */
if ($liveParamsItem->getStreamSuffix() == $suffix) {
$liveParamsInput = $liveParamsItem;
if (!$liveParamsInput->hasTag(assetParams::TAG_SOURCE)) {
$liveParams = array($liveParamsInput);
$disableIngested = false;
}
break;
}
}
$ignoreLiveParamsIds = array();
if ($disableIngested) {
$conversionProfileAssetParams = flavorParamsConversionProfilePeer::retrieveByConversionProfile($conversionProfileId);
foreach ($conversionProfileAssetParams as $conversionProfileAssetParamsItem) {
/* @var $conversionProfileAssetParamsItem flavorParamsConversionProfile */
if ($conversionProfileAssetParamsItem->getOrigin() == assetParamsOrigin::INGEST) {
$ignoreLiveParamsIds[] = $conversionProfileAssetParamsItem->getFlavorParamsId();
}
}
}
// translate the $liveParams to XML according to doc: http://www.wowza.com/forums/content.php?304#configTemplate
$root = new SimpleXMLElement('<Root/>');
$transcode = $root->addChild('Transcode');
$encodes = $transcode->addChild('Encodes');
$groups = array();
foreach ($liveParams as $liveParamsItem) {
/* @var $liveParamsItem liveParams */
if (!$liveParamsItem->hasTag(assetParams::TAG_SOURCE) && in_array($liveParamsItem->getId(), $ignoreLiveParamsIds)) {
continue;
}
$this->appendLiveParams($entry, $mediaServer, $encodes, $liveParamsItem);
$tags = $liveParamsItem->getTagsArray();
$tags[] = 'all';
foreach ($tags as $tag) {
if (!isset($groups[$tag])) {
$groups[$tag] = array();
}
$systemName = $liveParamsItem->getSystemName() ? $liveParamsItem->getSystemName() : $liveParamsItem->getId();
$groups[$tag][] = $systemName;
}
}
$decode = $transcode->addChild('Decode');
$video = $decode->addChild('Video');
$video->addChild('Deinterlace', 'false');
$streamNameGroups = $transcode->addChild('StreamNameGroups');
foreach ($groups as $groupName => $groupMembers) {
$streamNameGroup = $streamNameGroups->addChild('StreamNameGroup');
$streamNameGroup->addChild('Name', $groupName);
$streamNameGroup->addChild('StreamName', '${SourceStreamName}_' . $groupName);
$members = $streamNameGroup->addChild('Members');
foreach ($groupMembers as $groupMember) {
$member = $members->addChild('Member');
$member->addChild('EncodeName', $groupMember);
}
}
$properties = $transcode->addChild('Properties');
$dom = new DOMDocument("1.0");
//.........这里部分代码省略.........