You are here

public static function PHPVideoToolkit::getAvailableFormats in Video 7

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

* Returns the available formats. * @access public *

Parameters

mixed $method The mux method to check for, either 'muxing', 'demuxing' or 'both' (formats that can both mux and demux), otherwise false will return a complete list.: * @return array An array of formats available to ffmpeg.

File

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

Class

PHPVideoToolkit

Code

public static function getAvailableFormats($method = false) {

  // 			check to see if this is a static call
  if (isset($this) === false) {
    $toolkit = new PHPVideoToolkit();
    $info = $toolkit
      ->getFFmpegInfo(true);
  }
  else {
    $info = $this
      ->getFFmpegInfo(true);
  }

  // 			are we checking for particluar method?
  $return_vals = array();
  switch ($method) {
    case false:
      return array_keys($info['formats']);
    case 'both':
      foreach ($info['formats'] as $id => $data) {
        if ($data['muxing'] === true && $data['demuxing'] === true) {
          array_push($return_vals, $id);
        }
      }
      break;
    case 'muxing':
      foreach ($info['formats'] as $id => $data) {
        if ($data['muxing'] === true) {
          array_push($return_vals, $id);
        }
      }
      break;
    case 'demuxing':
      foreach ($info['formats'] as $id => $data) {
        if ($data['demuxing'] === true) {
          array_push($return_vals, $id);
        }
      }
      break;
  }
  return $return_vals;
}