protected function removeInProc($in_proc) { kConversionHelper::removeInProc($in_proc); }
private function updateConvertedEntry($ok, $entry, kConversionResult $conv_res) { $file_before_conversion = $conv_res->conv_cmd->source_file; $file_after_conversion = $conv_res->conv_cmd->target_file; // TODO -get all targets if ($ok == true) { // TODO - write all targets not only primary one KalturaLog::debug("File [{$file_before_conversion}] converted OK to [{$file_after_conversion}]"); try { // TODO - do we need to create the helpers eagerly ?? // $this->createFlvWrappersForTargets( $conv_res ); } catch (Exception $ex) { KalturaLog::debug("Error while creating helper files for [{$file_after_conversion}]"); } $entry->setStatusReady(); } else { KalturaLog::debug("Problem converting file [{$file_before_conversion}]"); $entry->setStatus(entryStatus::ERROR_CONVERTING); } $this->updateConversionInDb($entry, $conv_res); // loop until the file is really ready - sometimes the size of the file or the mtime is wrong for ($i = 0; $i < 15; $i++) { clearstatcache(); if (!file_exists($file_after_conversion) || filesize($file_after_conversion) == 0) { // KalturaLog::debug ( "Entry id [" . $entry->getId() . "] printing file stats: " . print_r( stat ($file_after_conversion ) , true ) ); KalturaLog::debug("Entry id [" . $entry->getId() . "]. no such file [{$file_after_conversion}]. Sleeping for 1 second for the [{$i}] time."); sleep(2); } else { break; } } KalturaLog::debug("Entry id [" . $entry->getId() . "] setting duration"); $entry->setLengthInMsecs(kConversionHelper::getFlvDuration($file_after_conversion)); KalturaLog::debug("Entry id [" . $entry->getId() . "] duration [" . $entry->getLengthInMsecs() . "]"); // how could it be otherwise ?? if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_VIDEO) { // TODO - move out of this function if the partner is required for more configurations $partner = PartnerPeer::retrieveByPK($entry->getPartnerId()); // TODO - make sure the width & height of the target are part of the kConversionReulst // if ( $conversion_info ) $entry->setDimensions ( $conversion_info->video_width , $conversion_info->video_height ); $offset = $entry->getBestThumbOffset($partner->getDefThumbOffset()); KalturaLog::debug("Entry id [" . $entry->getId() . "] Thumb offset: [{$offset}]"); // first create the thumb for the entry myEntryUtils::createThumbnailFromEntry($entry, $entry, $offset); // then make sure it will propage to the roughcut if needed myEntryUtils::createRoughcutThumbnailFromEntry($entry, false); $entry->updateVideoDimensions(); KalturaLog::debug("Entry id [" . $entry->getId() . "] dimensions: [" . $entry->getWidth() . "x" . $entry->getHeight() . "]"); } // send notification - regardless its status myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE, $entry); $entry->save(); }
protected static function fixConvParams(kConversionCommand $conv_cmd) { $conv_params_list = $conv_cmd->conversion_params_list; foreach ($conv_params_list as $conv_params) { TRACE("Before fix: " . print_r($conv_params, true)); kConversionHelper::fillConversionParams($conv_cmd->source_file, $conv_params); TRACE("After fix: " . print_r($conv_params, true)); } }