You are here

public function TranscoderAbstractionFactoryZencoder::setOutput in Video 7.2

Set output file for transcoding, this would be the result file.

Overrides TranscoderAbstractionFactory::setOutput

File

transcoders/TranscoderAbstractionFactoryZencoder.inc, line 138
File containing class TranscoderAbstractionFactoryZencoder

Class

TranscoderAbstractionFactoryZencoder
Class that handles Zencoder transcoding.

Code

public function setOutput($output_directory, $output_name, $overwrite_mode = FILE_EXISTS_REPLACE) {
  parent::setOutput($output_directory, $output_name, $overwrite_mode);
  $this->options['output']['label'] = 'video-' . $this->settings['input']['fid'];
  $this->options['output']['filename'] = $this->settings['filename'];
  $this->options['output']['public'] = !variable_get('video_zencoder_private', FALSE);
  $baseurl = NULL;
  if ($this->outputdestination == 's3') {
    $bucket = variable_get('amazons3_bucket');

    // For now, silently ignore the "Use Amazon S3 module" setting when the bucket is not found
    if ($bucket !== NULL) {
      $baseurl = 's3://' . $bucket . '/';
    }
  }
  elseif ($this->outputdestination == 'rcf') {
    $username = variable_get('rackspace_cloud_username');
    $key = variable_get('rackspace_cloud_api_key');
    $container = variable_get('rackspace_cloud_container');
    $authurl = variable_get('rackspace_cloud_auth_url');

    // For now, silently ignore the "Use Rackspace Cloud Files module" setting when the cloudfiles module isn't setup
    if ($username !== NULL && $key !== NULL && $container !== NULL && $authurl !== NULL) {
      $scheme = $authurl == 'https://lon.auth.api.rackspacecloud.com' ? 'cf+uk' : 'cf';
      $baseurl = $scheme . '://' . rawurlencode($username) . ':' . rawurlencode($key) . '@' . $container . '/';
    }
  }
  if ($baseurl != NULL) {
    $this->options['output']['base_url'] = $baseurl . file_uri_target($output_directory) . '/';
    if (isset($this->options['output']['thumbnails'])) {
      $this->options['output']['thumbnails']['base_url'] = $baseurl . variable_get('video_thumbnail_path', 'videos/thumbnails') . '/' . $this->settings['input']['fid'] . '/';
    }
  }
}