You are here

public function PHPVideoToolkit::setInputFile in Video 7

Same name and namespace in other branches
  1. 7.2 libraries/phpvideotoolkit/phpvideotoolkit.php5.php \PHPVideoToolkit::setInputFile()

* Sets the input file that is going to be manipulated. * * @access public *

Parameters

string $file The absolute path of the file that is required to be manipulated.: * @param mixed $input_frame_rate If 0 (default) then no input frame rate is set, if false it is automatically retrieved, otherwise * any other integer will be set as the incoming frame rate. * @return boolean false on error encountered, true otherwise

1 call to PHPVideoToolkit::setInputFile()
PHPVideoToolkit::prepareImagesForConversionToVideo in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
* Compiles an array of images into a video. This sets the input file (setInputFile) so you do not need to set it. * The images should be a full absolute path to the actual image file. * NOTE 1; This copies and renames all the supplied images…

File

libraries/phpvideotoolkit/phpvideotoolkit.php5.php, line 1129

Class

PHPVideoToolkit

Code

public function setInputFile($file, $input_frame_rate = 0, $validate_decode_codecs = true) {
  $files_length = count($file);

  // 			if the total number of files entered is 1 then only one file is being processed
  if ($files_length == 1) {

    //				check the input file, if there is a %d in there or a similar %03d then the file inputted is a sequence, if neither of those is found
    //				then qheck to see if the file exists
    if (!preg_match('/\\%([0-9]+)d/', $file) && strpos($file, '%d') === false && !is_file($file)) {

      //					input file not valid
      return $this
        ->_raiseError('setInputFile_file_existence', array(
        'file' => $file,
      ));

      //<-				exits
    }
    $escaped_name = $file;

    // 				$escaped_name = escapeshellarg($files[0]);
    $this->_input_file = $escaped_name;
    $this->_input_file_id = md5($escaped_name);

    // 				the -inputr is a hack for -r to come before the input
    if ($input_frame_rate !== 0) {
      $info = $this
        ->getFileInfo();
      if (isset($info['video']) === true) {
        if ($input_frame_rate === false) {
          $input_frame_rate = $info['video']['frame_rate'];
        }

        // 						input frame rate is a command hack
        $this
          ->addCommand('-inputr', $input_frame_rate);
      }
    }
  }
  else {

    // 				more than one video is being added as input so we must join them all
    call_user_func_array(array(
      &$this,
      'addVideo',
    ), array(
      $file,
      $input_frame_rate,
    ));
  }
  return true;
}