/**
  * @param flavorAsset $originalFlavorAsset
  * @param entry $entry
  * @param BatchJob $convertProfileJob
  * @return BatchJob
  */
 public static function bypassConversion(flavorAsset $originalFlavorAsset, entry $entry, BatchJob $convertProfileJob)
 {
     if (!$originalFlavorAsset->hasTag(flavorParams::TAG_MBR)) {
         $mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($originalFlavorAsset->getId());
         if ($mediaInfo) {
             $tagsArray = $originalFlavorAsset->getTagsArray();
             $finalTagsArray = KDLWrap::CDLMediaInfo2Tags($mediaInfo, $tagsArray);
             $originalFlavorAsset->setTagsArray($finalTagsArray);
         }
     }
     if (!$entry->getCreateThumb()) {
         // mark the asset as ready
         $originalFlavorAsset->setStatusLocalReady();
         $originalFlavorAsset->save();
         kFlowHelper::generateThumbnailsFromFlavor($entry->getId(), null, $originalFlavorAsset->getFlavorParamsId());
         kBusinessPostConvertDL::handleConvertFinished(null, $originalFlavorAsset);
         return null;
     }
     $offset = $entry->getThumbOffset();
     // entry getThumbOffset now takes the partner DefThumbOffset into consideration
     $srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $srcFileSyncLocalPath = kFileSyncUtils::getLocalFilePathForKey($srcSyncKey);
     $srcFileSyncWamsAssetId = kFileSyncUtils::getWamsAssetIdForKey($srcSyncKey);
     $postConvertAssetType = BatchJob::POSTCONVERT_ASSET_TYPE_BYPASS;
     return kJobsManager::addPostConvertJob($convertProfileJob, $postConvertAssetType, $srcFileSyncLocalPath, $originalFlavorAsset->getId(), null, true, $offset, null, $srcFileSyncWamsAssetId);
 }
コード例 #2
0
 /**
  * @param flavorAsset $originalFlavorAsset
  * @param entry $entry
  * @param BatchJob $convertProfileJob
  * @return BatchJob
  */
 public static function bypassConversion(flavorAsset $originalFlavorAsset, entry $entry, BatchJob $convertProfileJob)
 {
     if (!$originalFlavorAsset->hasTag(flavorParams::TAG_MBR)) {
         $mediaInfo = mediaInfoPeer::retrieveByFlavorAssetId($originalFlavorAsset->getId());
         if ($mediaInfo) {
             $tagsArray = $originalFlavorAsset->getTagsArray();
             $finalTagsArray = KDLWrap::CDLMediaInfo2Tags($mediaInfo, $tagsArray);
             $originalFlavorAsset->setTagsArray($finalTagsArray);
         }
     }
     $offset = $entry->getThumbOffset();
     // entry getThumbOffset now takes the partner DefThumbOffset into consideration
     $srcSyncKey = $originalFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     $srcFileSyncLocalPath = kFileSyncUtils::getLocalFilePathForKey($srcSyncKey);
     $jobSubType = BatchJob::BATCHJOB_SUB_TYPE_POSTCONVERT_BYPASS;
     return kJobsManager::addPostConvertJob($convertProfileJob, $jobSubType, $srcFileSyncLocalPath, $originalFlavorAsset->getId(), null, true, $offset);
 }
コード例 #3
0
ファイル: kFlowHelper.php プロジェクト: GElkayam/server
 private static function handleOperatorsProcessingFinished(flavorAsset $flavorAsset, flavorParamsOutput $flavorParamsOutput, entry $entry, BatchJob $dbBatchJob, kConvertJobData $data, $rootBatchJob = null)
 {
     $offset = $entry->getThumbOffset();
     // entry getThumbOffset now takes the partner DefThumbOffset into consideration
     $createThumb = $entry->getCreateThumb();
     $extractMedia = true;
     if ($entry->getType() != entryType::MEDIA_CLIP) {
         // e.g. document
         $extractMedia = false;
     }
     if (!kFileSyncUtils::fileSync_exists($flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET))) {
         $extractMedia = false;
         $createThumb = false;
     }
     $rootBatchJob = $dbBatchJob->getRootJob();
     if ($extractMedia && $rootBatchJob && $rootBatchJob->getJobType() == BatchJobType::CONVERT_PROFILE) {
         $rootBatchJobData = $rootBatchJob->getData();
         if ($rootBatchJobData instanceof kConvertProfileJobData) {
             $extractMedia = $rootBatchJobData->getExtractMedia();
         }
     }
     // For apple http flavors do not attempt to get thumbs and media info,
     // It is up to the operator to provide that kind of data, rather than hardcoded check
     // To-fix
     if ($flavorParamsOutput->getFormat() == assetParams::CONTAINER_FORMAT_APPLEHTTP) {
         $createThumb = false;
         $extractMedia = false;
     }
     if ($flavorParamsOutput->getFormat() == assetParams::CONTAINER_FORMAT_WIDEVINE) {
         $createThumb = false;
     }
     if ($createThumb && in_array($flavorParamsOutput->getVideoCodec(), self::$thumbUnSupportVideoCodecs)) {
         $createThumb = false;
     }
     if ($createThumb || $extractMedia) {
         $postConvertAssetType = BatchJob::POSTCONVERT_ASSET_TYPE_FLAVOR;
         if ($flavorAsset->getIsOriginal()) {
             $postConvertAssetType = BatchJob::POSTCONVERT_ASSET_TYPE_SOURCE;
         }
         kJobsManager::addPostConvertJob($dbBatchJob, $postConvertAssetType, $data->getDestFileSyncLocalPath(), $data->getFlavorAssetId(), $flavorParamsOutput->getId(), $createThumb, $offset);
     } else {
         $flavorAsset = kBusinessPostConvertDL::handleFlavorReady($dbBatchJob, $data->getFlavorAssetId());
         if ($flavorAsset) {
             if ($flavorAsset->hasTag(flavorParams::TAG_SOURCE)) {
                 kBusinessPreConvertDL::continueProfileConvert($dbBatchJob);
             }
             if ($flavorAsset->getType() == assetType::FLAVOR) {
                 $flavorAsset->setBitrate($flavorParamsOutput->getVideoBitrate() + $flavorParamsOutput->getAudioBitrate());
                 $flavorAsset->setWidth($flavorParamsOutput->getWidth());
                 $flavorAsset->setHeight($flavorParamsOutput->getHeight());
                 $flavorAsset->setFrameRate($flavorParamsOutput->getFrameRate());
                 $flavorAsset->setIsOriginal(0);
                 $flavorAsset->save();
             }
             kBusinessPostConvertDL::handleConvertFinished($dbBatchJob, $flavorAsset);
         }
     }
 }