code: @SuppressWarnings("null")
    private <T> T visitMediaFormats(MediaArgs mediaArgs, MediaFormatVisitor<T> mediaFormatVisitor) {
      MediaFormat[] mediaFormats = mediaArgs.getMediaFormats();
      if (mediaFormats != null) {
        for (MediaFormat mediaFormat : mediaFormats) {
          T returnValue = mediaFormatVisitor.visit(mediaFormat);
          if (returnValue != null) {
            return returnValue;
          }
        }
      }
      return null;
    }
docs: Iterate over all media formats defined in media args. Ignores invalid media formats.
  If the media format visitor returns a value that is not null, iteration is stopped and the value is returned from
  this method.
  @param mediaArgs Media args
  @param mediaFormatVisitor Media format visitor
  @return Return value form media format visitor, if any returned a value that is not null