protected function getRenderer($flavors) { $class = null; if ($this->params->getResponseFormat()) { $formatMapping = array('f4m' => 'kF4MManifestRenderer', 'f4mv2' => 'kF4Mv2ManifestRenderer', 'smil' => 'kSmilManifestRenderer', 'm3u8' => 'kM3U8ManifestRenderer', 'jsonp' => 'kJSONPManifestRenderer', 'redirect' => 'kRedirectManifestRenderer'); if (isset($formatMapping[$this->params->getResponseFormat()])) { $class = $formatMapping[$this->params->getResponseFormat()]; } } if (!$class) { $class = $this->getRendererClass(); } $renderer = new $class($flavors, $this->params->getEntryId()); return $renderer; }
public static function getVodPackagerUrl($flavors, $urlPrefix, $urlSuffix, DeliveryProfileDynamicAttributes $params) { $entry = entryPeer::retrieveByPK($params->getEntryId()); $url = self::generateMultiUrl($flavors, $entry); $url .= $urlSuffix; // move any folders on the url prefix to the url part, so that the protocol folder will always be first $urlPrefixWithProtocol = $urlPrefix; if (strpos($urlPrefix, '://') === false) { $urlPrefixWithProtocol = 'http://' . $urlPrefix; } $urlPrefixPath = parse_url($urlPrefixWithProtocol, PHP_URL_PATH); if ($urlPrefixPath && substr($urlPrefix, -strlen($urlPrefixPath)) == $urlPrefixPath) { $urlPrefix = substr($urlPrefix, 0, -strlen($urlPrefixPath)); $url = rtrim($urlPrefixPath, '/') . '/' . ltrim($url, '/'); } $urlPrefix = trim(preg_replace('#https?://#', '', $urlPrefix), '/'); $urlPrefix = $params->getMediaProtocol() . '://' . $urlPrefix; return array('url' => $url, 'urlPrefix' => $urlPrefix); }
/** * Returns the delivery profile by host name (or returns one of the defaults) * @param string $cdnHost The host we're looking for * @param string $entryId The entry for which we search for the delivery profile * @param PlaybackProtocol $streamerType - The protocol * @param string $mediaProtocol - rtmp/rtmpe/https... * @return DeliveryProfile */ public static function getLiveDeliveryProfileByHostName($cdnHost, DeliveryProfileDynamicAttributes $deliveryAttributes) { $entryId = $deliveryAttributes->getEntryId(); $entry = entryPeer::retrieveByPK($entryId); if (!$entry) { KalturaLog::err('Failed to retrieve entryId: ' . $entryId); return null; } $partnerId = $entry->getPartnerId(); $streamerType = $deliveryAttributes->getFormat(); $c = new Criteria(); $c->add(DeliveryProfilePeer::PARTNER_ID, array(PartnerPeer::GLOBAL_PARTNER, $partnerId), Criteria::IN); $c->add(DeliveryProfilePeer::TYPE, self::getAllLiveDeliveryProfileTypes(), Criteria::IN); $hostCond = $c->getNewCriterion(DeliveryProfilePeer::HOST_NAME, $cdnHost); $hostCond->addOr($c->getNewCriterion(DeliveryProfilePeer::HOST_NAME, null, Criteria::ISNULL)); $c->addAnd($hostCond); $c->add(DeliveryProfilePeer::STREAMER_TYPE, $streamerType); self::filterDeliveryProfilesCriteria($c, $deliveryAttributes); $c->addDescendingOrderByColumn('(' . DeliveryProfilePeer::HOST_NAME . ' is not null)'); $orderBy = "(" . DeliveryProfilePeer::PARTNER_ID . "<>{$partnerId})"; $c->addAscendingOrderByColumn($orderBy); $deliveries = self::doSelect($c); $delivery = self::selectByDeliveryAttributes($deliveries, $deliveryAttributes); if ($delivery) { KalturaLog::info("Delivery ID for Host Name: [{$cdnHost}] and streamer type: [{$streamerType}] is [" . $delivery->getId()); $delivery->setEntryId($entryId); } else { KalturaLog::err("Delivery ID can't be determined for Host Name [{$cdnHost}] and streamer type [{$streamerType}]"); } return $delivery; }
public function cloneAttributes(DeliveryProfileDynamicAttributes $newObj) { $this->deliveryProfileIds = $newObj->getDeliveryProfileIds(); $this->isDeliveryProfilesBlockedList = $newObj->getIsDeliveryProfilesBlockedList(); $this->format = $newObj->getFormat(); $this->extension = $newObj->getFileExtension(); $this->containerFormat = $newObj->getContainerFormat(); $this->seekFromTime = $newObj->getSeekFromTime(); $this->clipTo = $newObj->getClipTo(); $this->playbackRate = $newObj->getPlaybackRate(); $this->storageId = $newObj->getStorageId(); $this->entryId = $newObj->getEntryId(); $this->tags = $newObj->getTags(); $this->flavorAssets = $newObj->getFlavorAssets(); $this->remoteFileSyncs = $newObj->getRemoteFileSyncs(); $this->manifestFileSync = $newObj->getManifestFileSync(); $this->preferredBitrate = $newObj->getPreferredBitrate(); $this->responseFormat = $newObj->getResponseFormat(); $this->mediaProtocol = $newObj->getMediaProtocol(); $this->usePlayServer = $newObj->getUsePlayServer(); $this->playerConfig = $newObj->getPlayerConfig(); $this->uiConfId = $newObj->getUiConfId(); $this->edgeServerIds = $newObj->getEdgeServerIds(); }