You are here

public function TranscoderAbstractionFactoryFfmpeg::getCodecs in Video 7.2

Get enabled and supporting codecs by the transcoder.

Overrides TranscoderFactoryInterface::getCodecs

File

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

Class

TranscoderAbstractionFactoryFfmpeg
Class that handles FFmpeg transcoding.

Code

public function getCodecs() {
  $info = $this
    ->getCachedFFmpegInfo();
  $codecs = array(
    'decode' => array(
      'audio' => array(),
      'video' => array(),
    ),
    'encode' => array(
      'audio' => array(),
      'video' => array(),
    ),
  );
  if (!empty($info['codecs'])) {
    foreach ($info['codecs'] as $key => $value) {
      $codecs['encode'][$key] = array();
      $codecs['decode'][$key] = array();
      foreach ($value as $codec_key => $codec) {
        if ($codec['encode']) {
          $codecs['encode'][$key][$codec_key] = $codec['fullname'];
        }
        if ($codec['decode']) {
          $codecs['decode'][$key][$codec_key] = $codec['fullname'];
        }
      }
      uasort($codecs['encode'][$key], 'strnatcasecmp');
      uasort($codecs['encode'][$key], 'strnatcasecmp');
    }
  }
  return $codecs;
}