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 007public abstract class ImageSink extends VideoSink { 008 protected ImageSink(int handle) { 009 super(handle); 010 } 011 012 /** 013 * Set sink description. 014 * 015 * @param description Description 016 */ 017 public void setDescription(String description) { 018 CameraServerJNI.setSinkDescription(m_handle, description); 019 } 020 021 /** 022 * Get error string. Call this if WaitForFrame() returns 0 to determine what the error is. 023 * 024 * @return Error string. 025 */ 026 public String getError() { 027 return CameraServerJNI.getSinkError(m_handle); 028 } 029 030 /** 031 * Enable or disable getting new frames. Disabling will cause processFrame (for callback-based 032 * CvSinks) to not be called and WaitForFrame() to not return. This can be used to save processor 033 * resources when frames are not needed. 034 * 035 * @param enabled Enable to get new frames. 036 */ 037 public void setEnabled(boolean enabled) { 038 CameraServerJNI.setSinkEnabled(m_handle, enabled); 039 } 040}