You are here

protected function PHPVideoToolkit::_combineCommands in Video 7.2

Same name and namespace in other branches
  1. 7 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.

File

libraries/phpvideotoolkit/phpvideotoolkit.php5.php, line 3542
Libary to access FFmpeg

Class

PHPVideoToolkit

Code

protected function _combineCommands() {
  $before_input = array();
  $after_input = array();
  $input = NULL;
  foreach ($this->_commands as $is_before_input => $commands) {
    foreach ($commands as $command => $argument) {
      $command_string = trim($command . (!empty($argument) ? ' ' . $argument : ''));
      if ($command === '-i') {
        $input = $command_string;
      }
      else {
        if ($is_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;
}