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