当前位置: 首页>>代码示例>>PHP>>正文


PHP assetPeer::retrieveHighestBitrateByEntryId方法代码示例

本文整理汇总了PHP中assetPeer::retrieveHighestBitrateByEntryId方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveHighestBitrateByEntryId方法的具体用法?PHP assetPeer::retrieveHighestBitrateByEntryId怎么用?PHP assetPeer::retrieveHighestBitrateByEntryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在assetPeer的用法示例。


在下文中一共展示了assetPeer::retrieveHighestBitrateByEntryId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSourceAssetForGenerateThumbnail

 /**
  * 
  * Decide from which asset grab the thumbnail.
  * @param string $sourceAssetId
  * @param string $sourceParamsId
  * @param string $entryId
  * @return flavorAsset
  */
 public static function getSourceAssetForGenerateThumbnail($sourceAssetId, $sourceParamsId, $entryId)
 {
     if ($sourceAssetId) {
         $srcAsset = assetPeer::retrieveById($sourceAssetId);
         if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
             return $srcAsset;
         }
     }
     if ($sourceParamsId) {
         KalturaLog::debug("Look for flavor params [{$sourceParamsId}]");
         $srcAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $sourceParamsId);
         if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
             return $srcAsset;
         }
     }
     KalturaLog::debug("Look for original flavor of entry [{$entryId}]");
     $srcAsset = assetPeer::retrieveOriginalByEntryId($entryId);
     if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
         return $srcAsset;
     }
     KalturaLog::debug("Look for highest bitrate flavor of entry [{$entryId}]");
     $srcAsset = assetPeer::retrieveHighestBitrateByEntryId($entryId);
     if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
         return $srcAsset;
     }
     return null;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:35,代码来源:kBusinessPreConvertDL.php

示例2: getSourceAssetForGenerateThumbnail

 /**
  *
  * Decide from which asset grab the thumbnail.
  * @param string $sourceAssetId
  * @param string $sourceParamsId
  * @param string $entryId
  * @return flavorAsset
  */
 public static function getSourceAssetForGenerateThumbnail($sourceAssetId, $sourceParamsId, $entryId)
 {
     if ($sourceAssetId) {
         $srcAsset = assetPeer::retrieveById($sourceAssetId);
         if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
             return $srcAsset;
         }
     }
     if ($sourceParamsId) {
         KalturaLog::info("Look for flavor params [{$sourceParamsId}]");
         $srcAsset = assetPeer::retrieveByEntryIdAndParams($entryId, $sourceParamsId);
         if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
             return $srcAsset;
         }
     }
     KalturaLog::info("Look for a flavor tagged with thumbsource of entry [{$entryId}]");
     $srcAsset = assetPeer::retrieveHighestBitrateByEntryId($entryId, flavorParams::TAG_THUMBSOURCE);
     if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
         return $srcAsset;
     }
     KalturaLog::info("Look for original flavor of entry [{$entryId}]");
     $srcAsset = assetPeer::retrieveOriginalByEntryId($entryId);
     if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
         return $srcAsset;
     }
     KalturaLog::info("Look for highest bitrate flavor with web tag on entry [{$entryId}]");
     $srcAsset = assetPeer::retrieveHighestBitrateByEntryId($entryId, flavorParams::TAG_WEB);
     if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
         return $srcAsset;
     }
     KalturaLog::info("Look for highest bitrate flavor of entry [{$entryId}]");
     $srcAsset = assetPeer::retrieveHighestBitrateByEntryId($entryId);
     if ($srcAsset && $srcAsset->isLocalReadyStatus()) {
         return $srcAsset;
     }
     return null;
 }
开发者ID:DBezemer,项目名称:server,代码行数:45,代码来源:kBusinessPreConvertDL.php

示例3: updateVideoDimensions

 public function updateVideoDimensions()
 {
     $asset = assetPeer::retrieveHighestBitrateByEntryId($this->getId());
     if (!$asset) {
         return array($this->getFromCustomData('width'), $this->getFromCustomData('height'));
     }
     $syncKey = $asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $dataPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     list($width, $height) = $arr = myFileConverter::getVideoDimensions($dataPath);
     if ($width) {
         $this->putInCustomData("height", $height);
         $this->putInCustomData("width", $width);
     }
     return $arr;
 }
开发者ID:AdiTal,项目名称:server,代码行数:15,代码来源:entry.php

示例4: resizeEntryImage

 public static function resizeEntryImage(entry $entry, $version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $orig_image_path = null, $density = 0, $stripProfiles = false, $thumbParams = null, $format = null)
 {
     if (is_null($thumbParams) || !$thumbParams instanceof kThumbnailParameters) {
         $thumbParams = new kThumbnailParameters();
     }
     $contentPath = myContentStorage::getFSContentRootPath();
     $entry_status = $entry->getStatus();
     $thumbName = $entry->getId() . "_{$width}_{$height}_{$type}_{$crop_provider}_{$bgcolor}_{$quality}_{$src_x}_{$src_y}_{$src_w}_{$src_h}_{$vid_sec}_{$vid_slice}_{$vid_slices}_{$entry_status}";
     if ($orig_image_path) {
         $thumbName .= '_oip_' . basename($orig_image_path);
     }
     if ($density) {
         $thumbName .= "_dns_{$density}";
     }
     if ($stripProfiles) {
         $thumbName .= "_stp_{$stripProfiles}";
     }
     $entryThumbFilename = $entry->getThumbnail() ? $entry->getThumbnail() : "0.jpg";
     if ($entry->getStatus() != entryStatus::READY || @$entryThumbFilename[0] == '&') {
         $thumbName .= "_NOCACHE_";
     }
     // we remove the & from the template thumb otherwise getGeneralEntityPath will drop $tempThumbName from the final path
     $entryThumbFilename = str_replace("&", "", $entryThumbFilename);
     //create final path for thumbnail created
     $finalBasePath = myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $thumbName, $entryThumbFilename, $version);
     $finalThumbPath = $contentPath . $finalBasePath;
     //Add unique id to the proccesing file path to avoid file being overwritten when several identical (with same parameters) calls are made before the final thumbnail is created
     $thumbName .= "_" . uniqid() . "_";
     //create path for processing thumbnail request
     $processingBasePath = myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $thumbName, $entryThumbFilename, $version);
     $processingThumbPath = $contentPath . $processingBasePath;
     if (!is_null($format)) {
         $finalThumbPath = kFile::replaceExt($finalThumbPath, $format);
         $processingThumbPath = kFile::replaceExt($processingThumbPath, $format);
     }
     if (file_exists($finalThumbPath) && @filesize($finalThumbPath)) {
         header("X-Kaltura:cached-thumb-exists," . md5($finalThumbPath));
         return $finalThumbPath;
     }
     if ($orig_image_path === null || !file_exists($orig_image_path)) {
         $orig_image_path = self::getLocalImageFilePathByEntry($entry, $version);
     }
     // remark added so ffmpeg will try to load the thumbnail from the original source
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE && !file_exists($orig_image_path)) {
         throw new kFileSyncException('no ready filesync on current DC', kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC);
     }
     // check a request for animated thumbs without a concrete vid_slice
     // in which case we'll create all the frames as one wide image
     $multi = $vid_slice == -1 && $vid_slices != -1;
     $count = $multi ? $vid_slices : 1;
     $im = null;
     if ($multi) {
         $vid_slice = 0;
     }
     while ($count--) {
         if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO && ($vid_sec != -1 || $vid_slices != -1) || !file_exists($orig_image_path)) {
             if ($vid_sec != -1) {
                 $calc_vid_sec = min($vid_sec, floor($entry->getLengthInMsecs() / 1000));
             } else {
                 if ($vid_slices != -1) {
                     $calc_vid_sec = floor($entry->getLengthInMsecs() / $vid_slices * min($vid_slice, $vid_slices) / 1000);
                 } else {
                     if ($entry->getStatus() != entryStatus::READY && $entry->getLengthInMsecs() == 0) {
                         $calc_vid_sec = $entry->getPartner() && $entry->getPartner()->getDefThumbOffset() ? $entry->getPartner()->getDefThumbOffset() : 3;
                     } else {
                         $calc_vid_sec = $entry->getBestThumbOffset();
                     }
                 }
             }
             $capturedThumbName = $entry->getId() . "_sec_{$calc_vid_sec}";
             $capturedThumbPath = $contentPath . myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $capturedThumbName, $entry->getThumbnail(), $version);
             $orig_image_path = $capturedThumbPath . "temp_1.jpg";
             // if we already captured the frame at that second, dont recapture, just use the existing file
             if (!file_exists($orig_image_path)) {
                 // limit creation of more than XX ffmpeg image extraction processes
                 if (kConf::hasParam("resize_thumb_max_processes_ffmpeg") && trim(exec("ps -e -ocmd|awk '{print \$1}'|grep -c " . kConf::get("bin_path_ffmpeg"))) > kConf::get("resize_thumb_max_processes_ffmpeg")) {
                     KExternalErrors::dieError(KExternalErrors::TOO_MANY_PROCESSES);
                 }
                 // creating the thumbnail is a very heavy operation
                 // prevent calling it in parallel for the same thubmnail for 5 minutes
                 $cache = new myCache("thumb-processing", 5 * 60);
                 // 5 minutes
                 $processing = $cache->get($orig_image_path);
                 if ($processing) {
                     KExternalErrors::dieError(KExternalErrors::PROCESSING_CAPTURE_THUMBNAIL);
                 }
                 $cache->put($orig_image_path, true);
                 $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), flavorParams::TAG_THUMBSOURCE);
                 if (is_null($flavorAsset)) {
                     $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($entry->getId());
                     if ($flavorAsset) {
                         $flavorSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                         list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($flavorSyncKey, false, false);
                         if (!$fileSync) {
                             $flavorAsset = null;
                         }
                     }
                     if (is_null($flavorAsset) || !($flavorAsset->hasTag(flavorParams::TAG_MBR) || $flavorAsset->hasTag(flavorParams::TAG_WEB))) {
                         // try the best playable
                         $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), null, flavorParams::TAG_SAVE_SOURCE);
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例5: generateThumbnailsFromFlavor

 /**
  * @param BatchJob $parentJob
  * @param int $srcParamsId
  */
 public static function generateThumbnailsFromFlavor($entryId, BatchJob $parentJob = null, $srcParamsId = null)
 {
     $entry = entryPeer::retrieveByPK($entryId);
     if (!$entry) {
         KalturaLog::notice("Entry id [{$entryId}] not found");
         return;
     }
     if ($entry->getType() != entryType::MEDIA_CLIP || $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO) {
         KalturaLog::notice("Cupture thumbnail is not supported for entry [{$entryId}] of type [" . $entry->getType() . "] and media type [" . $entry->getMediaType() . "]");
         return;
     }
     $profile = null;
     try {
         $profile = myPartnerUtils::getConversionProfile2ForEntry($entryId);
     } catch (Exception $e) {
         KalturaLog::err('getConversionProfile2ForEntry Error: ' . $e->getMessage());
     }
     if (!$profile) {
         KalturaLog::notice("Profile not found for entry id [{$entryId}]");
         return;
     }
     $assetParamsIds = flavorParamsConversionProfilePeer::getFlavorIdsByProfileId($profile->getId());
     if (!count($assetParamsIds)) {
         KalturaLog::notice("No asset params objects found for profile id [" . $profile->getId() . "]");
         return;
     }
     // the alternative is the source or the highest bitrate if source not defined
     $alternateFlavorParamsId = null;
     if (is_null($srcParamsId)) {
         $flavorParamsObjects = assetParamsPeer::retrieveFlavorsByPKs($assetParamsIds);
         foreach ($flavorParamsObjects as $flavorParams) {
             if ($flavorParams->hasTag(flavorParams::TAG_SOURCE)) {
                 $alternateFlavorParamsId = $flavorParams->getId();
             }
         }
         if (is_null($alternateFlavorParamsId)) {
             $srcFlavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entryId);
             if ($srcFlavorAsset) {
                 $alternateFlavorParamsId = $srcFlavorAsset->getFlavorParamsId();
             }
         }
         if (is_null($alternateFlavorParamsId)) {
             KalturaLog::notice("No source flavor params object found for entry id [{$entryId}]");
             return;
         }
     }
     // create list of created thumbnails
     $thumbAssetsList = array();
     $thumbAssets = assetPeer::retrieveThumbnailsByEntryId($entryId);
     if (count($thumbAssets)) {
         foreach ($thumbAssets as $thumbAsset) {
             if (!is_null($thumbAsset->getFlavorParamsId())) {
                 $thumbAssetsList[$thumbAsset->getFlavorParamsId()] = $thumbAsset;
             }
         }
     }
     $thumbParamsObjects = assetParamsPeer::retrieveThumbnailsByPKs($assetParamsIds);
     foreach ($thumbParamsObjects as $thumbParams) {
         if (isset($thumbAssetsList[$thumbParams->getId()])) {
             KalturaLog::log("Thumbnail asset already created [" . $thumbAssetsList[$thumbParams->getId()]->getId() . "]");
             continue;
         }
         if (is_null($srcParamsId) && is_null($thumbParams->getSourceParamsId())) {
             // alternative should be used
             $thumbParams->setSourceParamsId($alternateFlavorParamsId);
         } elseif ($thumbParams->getSourceParamsId() != $srcParamsId) {
             KalturaLog::log("Only thumbnails that uses source params [{$srcParamsId}] should be generated for now");
             continue;
         }
         kBusinessPreConvertDL::decideThumbGenerate($entry, $thumbParams, $parentJob);
     }
 }
开发者ID:GElkayam,项目名称:server,代码行数:76,代码来源:kFlowHelper.php

示例6: resizeEntryImage

 public static function resizeEntryImage(entry $entry, $version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $orig_image_path = null, $density = 0, $stripProfiles = false, $thumbParams = null)
 {
     if (is_null($thumbParams) || !$thumbParams instanceof kThumbnailParameters) {
         $thumbParams = new kThumbnailParameters();
     }
     $contentPath = myContentStorage::getFSContentRootPath();
     $entry_status = $entry->getStatus();
     $tempThumbName = $entry->getId() . "_{$width}_{$height}_{$type}_{$crop_provider}_{$bgcolor}_{$quality}_{$src_x}_{$src_y}_{$src_w}_{$src_h}_{$vid_sec}_{$vid_slice}_{$vid_slices}_{$entry_status}";
     if ($orig_image_path) {
         $tempThumbName .= '_oip_' . basename($orig_image_path);
     }
     if ($density) {
         $tempThumbName .= "_dns_{$density}";
     }
     if ($stripProfiles) {
         $tempThumbName .= "_stp_{$stripProfiles}";
     }
     $entryThumbFilename = $entry->getThumbnail() ? $entry->getThumbnail() : "0.jpg";
     if ($entry->getStatus() != entryStatus::READY || @$entryThumbFilename[0] == '&') {
         $tempThumbName .= "_NOCACHE_";
     }
     // we remove the & from the template thumb otherwise getGeneralEntityPath will drop $tempThumbName from the final path
     $entryThumbFilename = str_replace("&", "", $entryThumbFilename);
     $basePath = myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $tempThumbName, $entryThumbFilename, $version);
     $tempThumbPath = $contentPath . $basePath;
     if (file_exists($tempThumbPath) && @filesize($tempThumbPath)) {
         header("X-Kaltura:cached-thumb-exists," . md5($tempThumbPath));
         return $tempThumbPath;
     }
     if ($orig_image_path === null || !file_exists($orig_image_path)) {
         $sub_type = $entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE ? entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA : entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB;
         $orig_image_key = $entry->getSyncKey($sub_type, $version);
         $orig_image_path = kFileSyncUtils::getReadyLocalFilePathForKey($orig_image_key);
     }
     // remark added so ffmpeg will try to load the thumbnail from the original source
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE && !file_exists($orig_image_path)) {
         throw new kFileSyncException('no ready filesync on current DC', kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC);
     }
     // check a request for animated thumbs without a concrete vid_slice
     // in which case we'll create all the frames as one wide image
     $multi = $vid_slice == -1 && $vid_slices != -1;
     $count = $multi ? $vid_slices : 1;
     $im = null;
     if ($multi) {
         $vid_slice = 0;
     }
     while ($count--) {
         if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO && ($vid_sec != -1 || $vid_slices != -1) || !file_exists($orig_image_path)) {
             if ($vid_sec != -1) {
                 $calc_vid_sec = min($vid_sec, floor($entry->getLengthInMsecs() / 1000));
             } else {
                 if ($vid_slices != -1) {
                     $calc_vid_sec = floor($entry->getLengthInMsecs() / $vid_slices * min($vid_slice, $vid_slices) / 1000);
                 } else {
                     if ($entry->getStatus() != entryStatus::READY && $entry->getLengthInMsecs() == 0) {
                         $calc_vid_sec = $entry->getPartner() && $entry->getPartner()->getDefThumbOffset() ? $entry->getPartner()->getDefThumbOffset() : 3;
                     } else {
                         $calc_vid_sec = $entry->getBestThumbOffset();
                     }
                 }
             }
             $capturedThumbName = $entry->getId() . "_sec_{$calc_vid_sec}";
             $capturedThumbPath = $contentPath . myContentStorage::getGeneralEntityPath("entry/tempthumb", $entry->getIntId(), $capturedThumbName, $entry->getThumbnail(), $version);
             $orig_image_path = $capturedThumbPath . "temp_1.jpg";
             // if we already captured the frame at that second, dont recapture, just use the existing file
             if (!file_exists($orig_image_path)) {
                 // creating the thumbnail is a very heavy operation
                 // prevent calling it in parallel for the same thubmnail for 5 minutes
                 $cache = new myCache("thumb-processing", 5 * 60);
                 // 5 minutes
                 $processing = $cache->get($orig_image_path);
                 if ($processing) {
                     KExternalErrors::dieError(KExternalErrors::PROCESSING_CAPTURE_THUMBNAIL);
                 }
                 $cache->put($orig_image_path, true);
                 $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId(), flavorParams::TAG_THUMBSOURCE);
                 if (is_null($flavorAsset)) {
                     $flavorAsset = assetPeer::retrieveOriginalReadyByEntryId($entry->getId());
                     if (is_null($flavorAsset) || !($flavorAsset->hasTag(flavorParams::TAG_MBR) || $flavorAsset->hasTag(flavorParams::TAG_WEB))) {
                         // try the best playable
                         $flavorAsset = assetPeer::retrieveHighestBitrateByEntryId($entry->getId());
                     }
                     if (is_null($flavorAsset)) {
                         // if no READY ORIGINAL entry is available, try to retrieve a non-READY ORIGINAL entry
                         $flavorAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
                     }
                 }
                 if (is_null($flavorAsset)) {
                     // if no READY ORIGINAL entry is available, try to retrieve a non-READY ORIGINAL entry
                     $flavorAsset = assetPeer::retrieveOriginalByEntryId($entry->getId());
                 }
                 if (is_null($flavorAsset)) {
                     KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
                 }
                 $flavorSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
                 $entry_data_path = kFileSyncUtils::getReadyLocalFilePathForKey($flavorSyncKey);
                 $entry_data_wams_asset_id = kFileSyncUtils::getWamsAssetIdForKey($flavorSyncKey);
                 if (!$entry_data_path) {
                     // since this is not really being processed on this server, and will probably cause redirect in thumbnailAction
                     // remove from cache so later requests will still get redirected and will not fail on PROCESSING_CAPTURE_THUMBNAIL
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:myEntryUtils.class.php


注:本文中的assetPeer::retrieveHighestBitrateByEntryId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。