You are here

public function TranscoderAbstractionFactoryFfmpeg::setOutput in Video 7.2

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

Overrides TranscoderAbstractionFactory::setOutput

File

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

Class

TranscoderAbstractionFactoryFfmpeg
Class that handles FFmpeg transcoding.

Code

public function setOutput($output_directory, $output_name, $overwrite_mode = FILE_EXISTS_REPLACE) {
  $this->realoutputdir = $output_directory;
  $this->realoutputname = $output_name;
  $tmpoutput = video_utility::createTempFile(video_utility::getExtension($output_name));
  $tmpoutputdir = dirname($tmpoutput);
  $tmpoutputname = basename($tmpoutput);
  parent::setOutput($tmpoutputdir, $tmpoutputname, $overwrite_mode);

  // Overwrite is necessary to have two-pass encoding for WebM and Ogg Theora
  $result = $this->transcoder
    ->setOutput($tmpoutputdir . '/', $tmpoutputname, PHPVideoToolkit::OVERWRITE_EXISTING);
  if ($result !== PHPVideoToolkit::RESULT_OK) {
    watchdog('transcoder', 'Error set options @message', array(
      '@message' => $this->transcoder
        ->getLastError(),
    ), WATCHDOG_ERROR);
    $this->errors['output'] = $this->transcoder
      ->getLastError();
    $this->transcoder
      ->reset(true);
    return FALSE;
  }
  return TRUE;
}