You are here

protected function PHPVideoToolkit::_combineCommands in Video 7

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

* Combines the commands stored into a string * * @access protected *

Return value

string

1 call to PHPVideoToolkit::_combineCommands()
PHPVideoToolkit::execute in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
* Commits all the commands and executes the ffmpeg procedure. This will also attempt to validate any outputted files in order to provide * some level of stop and check system. * * @access public *

File

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

Class

PHPVideoToolkit

Code

protected function _combineCommands() {
  $before_input = array();
  $after_input = array();
  $input = null;
  foreach ($this->_commands as $command => $argument) {
    $command_string = trim($command . (!empty($argument) ? ' ' . $argument : ''));

    //				check for specific none combinable commands as they have specific places they have to go in the string
    switch ($command) {
      case '-i':
        $input = $command_string;
        break;
      case '-inputr':
        $command_string = trim('-r' . ($argument ? ' ' . $argument : ''));
      default:
        if (in_array($command, $this->_cmds_before_input)) {
          array_push($before_input, $command_string);
        }
        else {
          array_push($after_input, $command_string);
        }
    }
  }
  $before_input = count($before_input) ? implode(' ', $before_input) . ' ' : '';
  $after_input_string = ' ';
  if (count($after_input)) {
    $input .= ' ';
    $after_input_string = implode(' ', $after_input) . ' ';
  }
  return $before_input . $input . $after_input_string;
}