You are here

public function TranscoderAbstractionFactoryFfmpeg::setInput in Video 7.2

Set Input file to add input file in to settings variable

Overrides TranscoderAbstractionFactory::setInput

File

transcoders/TranscoderAbstractionFactoryFfmpeg.inc, line 29
File containing class TranscoderAbstractionFactoryFfmpeg

Class

TranscoderAbstractionFactoryFfmpeg
Class that handles FFmpeg transcoding.

Code

public function setInput(array $file) {
  parent::setInput($file);
  $srcuri = $this->settings['input']['uri'];
  $srcpath = drupal_realpath($srcuri);
  if (empty($srcpath)) {

    // If stored on a remote file system, such as S3, download the video to a temporary file.
    $srcpath = video_utility::createTemporaryLocalCopy($srcuri);
    if (empty($srcpath)) {
      watchdog('transcoder', 'Could not download @uri to a temporary file for transcoding.', array(
        '@uri' => $srcuri,
      ), WATCHDOG_ERROR);
      return FALSE;
    }
  }
  $result = $this->transcoder
    ->setInputFile($srcpath);
  if ($result !== PHPVideoToolkit::RESULT_OK) {
    watchdog('transcoder', 'Error set options @message', array(
      '@message' => $this->transcoder
        ->getLastError(),
    ), WATCHDOG_ERROR);
    $this->errors['input'] = $this->transcoder
      ->getLastError();
    $this->transcoder
      ->reset();
    return FALSE;
  }
  return TRUE;
}