// Path: library/src/main/java/com/jwoolston/android/uvc/interfaces/VideoClassInterface.java
// public abstract class VideoClassInterface extends UvcInterface {
// 
//     VideoClassInterface(UsbInterface usbInterface, byte[] descriptor) {
//         super(usbInterface, descriptor);
//     }
// 
//     public static enum VC_INF_SUBTYPE {
//         VC_DESCRIPTOR_UNDEFINED(0x00),
//         VC_HEADER(0x01),
//         VC_INPUT_TERMINAL(0x02),
//         VC_OUTPUT_TERMINAL(0x03),
//         VC_SELECTOR_UNIT(0x04),
//         VC_PROCESSING_UNIT(0x05),
//         VC_EXTENSION_UNIT(0x06),
//         VC_ENCODING_UNIT(0x07);
// 
//         public final byte subtype;
// 
//         private VC_INF_SUBTYPE(int subtype) {
//             this.subtype = (byte) (subtype & 0xFF);
//         }
// 
//         public static VC_INF_SUBTYPE getSubtype(byte subtype) {
//             for (VC_INF_SUBTYPE s : VC_INF_SUBTYPE.values()) {
//                 if (s.subtype == subtype) {
//                     return s;
//                 }
//             }
//             return null;
//         }
//     }
// }


import com.jwoolston.android.uvc.interfaces.VideoClassInterface;
import java.util.Set;
import timber.log.Timber;
package com.jwoolston.android.uvc.interfaces.units;


/**
 * The Processing Unit (PU) controls image attributes of the video being streamed through it. It has a single input
 * and output pin. It provides support for the following features:
 * <br><br><b>User Controls</b>
 * <br>- Brightness
 * <br>- Hue
 * <br>- Saturation
 * <br>- Sharpness
 * <br>- Gamma
 * <br>- Digital Multiplier (Zoom)
 * <br><br><b>Auto Controls</b>
 * <br>-White Balance Temperature
 * <br>-White Balance Component
 * <br>-Backlight Compensation
 * <br>-Contrast
 * <br><br><b>Other</b>
 * <br>-Gain
 * <br>-Power Line Frequency
 * <br>-Analog Video Standard
 * <br>-Analog Video Lock Status
 *
 * Support for any particular control is optional. In particular, if the device supports the White Balance function,
 * it shall implement either the White Balance Temperature control or the White Balance Component control, but not
 * both. The User Controls indicate properties that are governed by user preference and not subject to any automatic
 * adjustment by the device. The Auto Controls will provide support for an auto setting (with an on/off state). If
 * the auto setting for a particular control is supported and set to the on state, the device will provide automatic
 * adjustment of the control, and read requests to the related control will reflect the automatically set value.
 * Attempts to programmatically set the Focus control when in auto mode shall result in protocol STALL with an error
 * code of <b>bRequestErrorCode</b> = “Wrong State”. When leaving an auto mode, the related control shall remain at the
 * value that was in effect just before the transition.
 *
 * @author Jared Woolston (Jared.Woolston@gmail.com)
 * @see <a href=http://www.usb.org/developers/docs/devclass_docs/USB_Video_Class_1_5.zip>UVC 1.5 Class
 * Specification §2.3.5</a>
 */
public class VideoProcessingUnit extends VideoUnit {

    private static final int LENGTH = 11; //TODO: Spec says 13?

    private static final int bSourceID        = 4;
    private static final int wMaxMultiplier   = 5;
// Path: library/src/main/java/com/jwoolston/android/uvc/interfaces/VideoClassInterface.java
// public abstract class VideoClassInterface extends UvcInterface {
// 
//     VideoClassInterface(UsbInterface usbInterface, byte[] descriptor) {
//         super(usbInterface, descriptor);
//     }
// 
//     public static enum VC_INF_SUBTYPE {
//         VC_DESCRIPTOR_UNDEFINED(0x00),
//         VC_HEADER(0x01),
//         VC_INPUT_TERMINAL(0x02),
//         VC_OUTPUT_TERMINAL(0x03),
//         VC_SELECTOR_UNIT(0x04),
//         VC_PROCESSING_UNIT(0x05),
//         VC_EXTENSION_UNIT(0x06),
//         VC_ENCODING_UNIT(0x07);
// 
//         public final byte subtype;
// 
//         private VC_INF_SUBTYPE(int subtype) {
//             this.subtype = (byte) (subtype & 0xFF);
//         }
// 
//         public static VC_INF_SUBTYPE getSubtype(byte subtype) {
//             for (VC_INF_SUBTYPE s : VC_INF_SUBTYPE.values()) {
//                 if (s.subtype == subtype) {
//                     return s;
//                 }
//             }
//             return null;
//         }
//     }
// }


// Path: library/src/main/java/com/jwoolston/android/uvc/interfaces/units/VideoProcessingUnit.java
import com.jwoolston.android.uvc.interfaces.VideoClassInterface;
import java.util.Set;
import timber.log.Timber;

package com.jwoolston.android.uvc.interfaces.units;


/**
 * The Processing Unit (PU) controls image attributes of the video being streamed through it. It has a single input
 * and output pin. It provides support for the following features:
 * <br><br><b>User Controls</b>
 * <br>- Brightness
 * <br>- Hue
 * <br>- Saturation
 * <br>- Sharpness
 * <br>- Gamma
 * <br>- Digital Multiplier (Zoom)
 * <br><br><b>Auto Controls</b>
 * <br>-White Balance Temperature
 * <br>-White Balance Component
 * <br>-Backlight Compensation
 * <br>-Contrast
 * <br><br><b>Other</b>
 * <br>-Gain
 * <br>-Power Line Frequency
 * <br>-Analog Video Standard
 * <br>-Analog Video Lock Status
 *
 * Support for any particular control is optional. In particular, if the device supports the White Balance function,
 * it shall implement either the White Balance Temperature control or the White Balance Component control, but not
 * both. The User Controls indicate properties that are governed by user preference and not subject to any automatic
 * adjustment by the device. The Auto Controls will provide support for an auto setting (with an on/off state). If
 * the auto setting for a particular control is supported and set to the on state, the device will provide automatic
 * adjustment of the control, and read requests to the related control will reflect the automatically set value.
 * Attempts to programmatically set the Focus control when in auto mode shall result in protocol STALL with an error
 * code of <b>bRequestErrorCode</b> = “Wrong State”. When leaving an auto mode, the related control shall remain at the
 * value that was in effect just before the transition.
 *
 * @author Jared Woolston (Jared.Woolston@gmail.com)
 * @see <a href=http://www.usb.org/developers/docs/devclass_docs/USB_Video_Class_1_5.zip>UVC 1.5 Class
 * Specification §2.3.5</a>
 */
public class VideoProcessingUnit extends VideoUnit {

    private static final int LENGTH = 11; //TODO: Spec says 13?

    private static final int bSourceID        = 4;
    private static final int wMaxMultiplier   = 5;
    private static final int bmControls       = 8;