Beispiel #1
0
 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);
         }
     }
 }