original_string: protected function createConverter($targetFormat, $profileName) {
      $profile = $this->getProfile($profileName);
  
      $videoContainers = $this->config['videoContainers'];
      if (!isset($videoContainers[$targetFormat])) {
        throw new \Exception("Unsupported target video container");
      }
      $targetConfig = $videoContainers[$targetFormat];
      if (!isset($targetConfig['videoEncoder']) || !isset($targetConfig['audioEncoder'])) {
        throw new \Exception("Video or audio encoder are missing for target format $targetFormat");
      }
  
      $videoEncoder = $this->searchEncoder($targetConfig['videoEncoder']);
      if (!$videoEncoder) {
        throw new \Exception("Video encoder not found for video codec {$targetConfig['videoEncoder']} for $targetFormat");
      }
      $audioEncoder = $this->searchEncoder($targetConfig['audioEncoder']);
      if (!$audioEncoder) {
        throw new \Exception("Audio encoder not found for audio codec {$targetConfig['audioEncoder']} for $targetFormat");
      }
  
      if ($targetFormat == 'mp4') {
        return new Converter\Mp4Converter($this->Process, $this->getDriver(), $this->config, $profile, $videoEncoder, $audioEncoder);
      }
      return new Converter\GenericConverter($this->Process, $this->getDriver(), $this->config, $profile, $videoEncoder, $audioEncoder);
    }
code: protected function createConverter($targetFormat, $profileName) {
      $profile = $this->getProfile($profileName);
  
      $videoContainers = $this->config['videoContainers'];
      if (!isset($videoContainers[$targetFormat])) {
        throw new \Exception("Unsupported target video container");
      }
      $targetConfig = $videoContainers[$targetFormat];
      if (!isset($targetConfig['videoEncoder']) || !isset($targetConfig['audioEncoder'])) {
        throw new \Exception("Video or audio encoder are missing for target format $targetFormat");
      }
  
      $videoEncoder = $this->searchEncoder($targetConfig['videoEncoder']);
      if (!$videoEncoder) {
        throw new \Exception("Video encoder not found for video codec {$targetConfig['videoEncoder']} for $targetFormat");
      }
      $audioEncoder = $this->searchEncoder($targetConfig['audioEncoder']);
      if (!$audioEncoder) {
        throw new \Exception("Audio encoder not found for audio codec {$targetConfig['audioEncoder']} for $targetFormat");
      }
  
      if ($targetFormat == 'mp4') {
        return new Converter\Mp4Converter($this->Process, $this->getDriver(), $this->config, $profile, $videoEncoder, $audioEncoder);
      }
      return new Converter\GenericConverter($this->Process, $this->getDriver(), $this->config, $profile, $videoEncoder, $audioEncoder);
    }
code_tokens: protected function createConverter ( $ targetFormat , $ profileName ) { $ profile = $ this -> getProfile ( $ profileName ) ; $ videoContainers = $ this -> config [ 'videoContainers' ] ; if ( ! isset ( $ videoContainers [ $ targetFormat ] ) ) { throw new \ Exception ( "Unsupported target video container" ) ; } $ targetConfig = $ videoContainers [ $ targetFormat ] ; if ( ! isset ( $ targetConfig [ 'videoEncoder' ] ) || ! isset ( $ targetConfig [ 'audioEncoder' ] ) ) { throw new \ Exception ( "Video or audio encoder are missing for target format $targetFormat" ) ; } $ videoEncoder = $ this -> searchEncoder ( $ targetConfig [ 'videoEncoder' ] ) ; if ( ! $ videoEncoder ) { throw new \ Exception ( "Video encoder not found for video codec {$targetConfig['videoEncoder']} for $targetFormat" ) ; } $ audioEncoder = $ this -> searchEncoder ( $ targetConfig [ 'audioEncoder' ] ) ; if ( ! $ audioEncoder ) { throw new \ Exception ( "Audio encoder not found for audio codec {$targetConfig['audioEncoder']} for $targetFormat" ) ; } if ( $ targetFormat == 'mp4' ) { return new Converter \ Mp4Converter ( $ this -> Process , $ this -> getDriver ( ) , $ this -> config , $ profile , $ videoEncoder , $ audioEncoder ) ; } return new Converter \ GenericConverter ( $ this -> Process , $ this -> getDriver ( ) , $ this -> config , $ profile , $ videoEncoder , $ audioEncoder ) ; }
docstring: Create a video convert for given profile and target container
  
  @param string $targetFormat Target container format
  @param string $profileName Profile name
  @return \Html5Video\Converter\Mp4Converter|\Html5Video\Converter\GenericConverter
  @throws \Exception
docstring_tokens: Create a video convert for given profile and target container