settings['input'] = $file; } else drupal_set_message(t('Video file not found.'), 'error'); } /** * Set options is to set transcoding settings before send to the transcoder. */ public function setOptions(array $options) { foreach ($options as $key => $value) { $this->settings[$key] = $value; } } /** * Set output file for transcoding, this would be the result file. */ public function setOutput($output_directory, $output_name, $overwrite_mode = FILE_EXISTS_REPLACE) { // @TODO : do some validation to check the file exists if ($output_directory) $this->settings['base_url'] = $output_directory; if ($output_name) $this->settings['filename'] = $output_name; else $this->errors['output'] = 'Output file not found.'; } /** * Get the installed transcoder version. */ public function getVersion() { return '1.0'; } /** * Get file informations * @return * Associative array with file informations like duration, dimensions */ public function getFileInfo() { return NULL; } public function getDimensions() { $i = $this->getFileInfo(); if (empty($i) || empty($i['video']['dimensions']['width']) || empty($i['video']['dimensions']['height'])) { return NULL; } return array( 'width' => intval($i['video']['dimensions']['width']), 'height' => intval($i['video']['dimensions']['height']), ); } /** * Get errors */ public function getErrors() { return $this->errors; } /** * Check for errors if any */ public function checkErrors() { return !empty($this->errors); } /** * Process postback jobs */ public function processPostback() { return MENU_NOT_FOUND; } /** * Reset internal variables to their initial state. */ public function reset($keepinput = FALSE) { if (!$keepinput) { unset($this->settings['input']); } unset($this->settings['options']); unset($this->settings['output']); $this->errors = array(); } }