public function do_activity($task) { $this->cpeLogger->log_out("INFO", basename(__FILE__), "Preparing Asset validation ...", $this->activityLogKey); // Call parent do_activity: // It download the input file we will process. parent::do_activity($task); // Load the right transcoder base on input_type // Get asset detailed info switch ($this->input->{'input_asset'}->{'type'}) { case self::VIDEO: require_once __DIR__ . '/transcoders/VideoTranscoder.php'; // Initiate transcoder obj $videoTranscoder = new VideoTranscoder($this, $task); // Get input video information $assetInfo = $videoTranscoder->get_asset_info($this->pathToInputFile); return $assetInfo; case self::IMAGE: break; case self::AUDIO: break; case self::DOC: break; default: throw new CpeSdk\CpeException("Unknown input asset 'type'! Abording ...", self::UNKOWN_INPUT_TYPE); } }
public function do_activity($task) { // Save output object $this->output = $this->input->{'output_asset'}; // Custom validation for transcoding. Set $this->output $this->validate_input(); $this->cpeLogger->log_out("INFO", basename(__FILE__), "Preparing Asset transcoding ...", $this->activityLogKey); // Call parent do_activity: // It download the input file we will process. parent::do_activity($task); // Set output path to store result files $this->set_output_path($task); // Result output $result = null; // Load the right transcoder base on input_type // Get asset detailed info switch ($this->input->{'input_asset'}->{'type'}) { case self::VIDEO: require_once __DIR__ . '/transcoders/VideoTranscoder.php'; // Instanciate transcoder to output Videos $videoTranscoder = new VideoTranscoder($this, $task); // Check preset file, read its content and add its data to output object if ($this->output->{'type'} == self::VIDEO && isset($this->output->{'preset'})) { // Validate output preset $videoTranscoder->validate_preset($this->output); // Set preset value $this->output->{'preset_values'} = $videoTranscoder->get_preset_values($this->output); } // Perform transcoding $result = $videoTranscoder->transcode_asset($this->tmpPathInput, $this->pathToInputFile, $this->pathToOutputFiles, $this->input->{'input_asset_metadata'}, $this->output); break; case self::IMAGE: break; case self::AUDIO: break; case self::DOC: break; default: throw new CpeSdk\CpeException("Unknown input asset 'type'! Abording ...", self::UNKOWN_INPUT_TYPE); } // Upload resulting file $this->upload_result_files($task); return $result; }