001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.cscore;
006
007/** A source that represents an Axis IP camera. */
008public class AxisCamera extends HttpCamera {
009  private static String hostToUrl(String host) {
010    return "http://" + host + "/mjpg/video.mjpg";
011  }
012
013  private static String[] hostToUrl(String[] hosts) {
014    String[] urls = new String[hosts.length];
015    for (int i = 0; i < hosts.length; i++) {
016      urls[i] = hostToUrl(hosts[i]);
017    }
018    return urls;
019  }
020
021  /**
022   * Create a source for an Axis IP camera.
023   *
024   * @param name Source name (arbitrary unique identifier)
025   * @param host Camera host IP or DNS name (e.g. "10.x.y.11")
026   */
027  public AxisCamera(String name, String host) {
028    super(name, hostToUrl(host), HttpCameraKind.kAxis);
029  }
030
031  /**
032   * Create a source for an Axis IP camera.
033   *
034   * @param name Source name (arbitrary unique identifier)
035   * @param hosts Array of Camera host IPs/DNS names
036   */
037  public AxisCamera(String name, String[] hosts) {
038    super(name, hostToUrl(hosts), HttpCameraKind.kAxis);
039  }
040}