You are here

public function TranscoderAbstractionFactoryFfmpeg::getAvailableFormats in Video 7.2

Get available output file formats from the transcoder.

Overrides TranscoderFactoryInterface::getAvailableFormats

File

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

Class

TranscoderAbstractionFactoryFfmpeg
Class that handles FFmpeg transcoding.

Code

public function getAvailableFormats($type = FALSE) {
  $info = $this
    ->getCachedFFmpegInfo();
  if (empty($info['formats'])) {
    return array();
  }
  $formats = array();
  switch ($type) {
    case FALSE:
      return array_keys($info['formats']);
    case 'both':
      foreach ($info['formats'] as $id => $data) {
        if ($data['mux'] === TRUE && $data['demux'] === TRUE) {
          $formats[$id] = $data['fullname'];
        }
      }
      break;
    case 'muxing':
      foreach ($info['formats'] as $id => $data) {
        if ($data['mux'] === TRUE) {
          $formats[$id] = $data['fullname'];
        }
      }
      break;
    case 'demuxing':
      foreach ($info['formats'] as $id => $data) {
        if ($data['demux'] === TRUE) {
          $formats[$id] = $data['fullname'];
        }
      }
      break;
  }
  if (isset($formats['ogg']) && !isset($formats['ogv'])) {
    $formats['ogv'] = $formats['ogg'];
    unset($formats['ogg']);
    asort($formats);
  }
  return $formats;
}