You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ph...@apache.org on 2017/11/08 20:32:56 UTC

[1/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Repository: nifi-minifi-cpp
Updated Branches:
  refs/heads/master 0bdc00e67 -> 2d9e57190


http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/frame.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/frame.c b/thirdparty/libuvc-0.0.6/src/frame.c
new file mode 100644
index 0000000..35dfce4
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/frame.c
@@ -0,0 +1,449 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+/**
+ * @defgroup frame Frame processing
+ * @brief Tools for managing frame buffers and converting between image formats
+ */
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+
+/** @internal */
+uvc_error_t uvc_ensure_frame_size(uvc_frame_t *frame, size_t need_bytes) {
+  if (frame->library_owns_data) {
+    if (!frame->data || frame->data_bytes != need_bytes) {
+      frame->data_bytes = need_bytes;
+      frame->data = realloc(frame->data, frame->data_bytes);
+    }
+    if (!frame->data)
+      return UVC_ERROR_NO_MEM;
+    return UVC_SUCCESS;
+  } else {
+    if (!frame->data || frame->data_bytes < need_bytes)
+      return UVC_ERROR_NO_MEM;
+    return UVC_SUCCESS;
+  }
+}
+
+/** @brief Allocate a frame structure
+ * @ingroup frame
+ *
+ * @param data_bytes Number of bytes to allocate, or zero
+ * @return New frame, or NULL on error
+ */
+uvc_frame_t *uvc_allocate_frame(size_t data_bytes) {
+  uvc_frame_t *frame = malloc(sizeof(*frame));
+
+  if (!frame)
+    return NULL;
+
+  memset(frame, 0, sizeof(*frame));
+
+  frame->library_owns_data = 1;
+
+  if (data_bytes > 0) {
+    frame->data_bytes = data_bytes;
+    frame->data = malloc(data_bytes);
+
+    if (!frame->data) {
+      free(frame);
+      return NULL;
+    }
+  }
+
+  return frame;
+}
+
+/** @brief Free a frame structure
+ * @ingroup frame
+ *
+ * @param frame Frame to destroy
+ */
+void uvc_free_frame(uvc_frame_t *frame) {
+  if (frame->data_bytes > 0 && frame->library_owns_data)
+    free(frame->data);
+
+  free(frame);
+}
+
+static inline unsigned char sat(int i) {
+  return (unsigned char)( i >= 255 ? 255 : (i < 0 ? 0 : i));
+}
+
+/** @brief Duplicate a frame, preserving color format
+ * @ingroup frame
+ *
+ * @param in Original frame
+ * @param out Duplicate frame
+ */
+uvc_error_t uvc_duplicate_frame(uvc_frame_t *in, uvc_frame_t *out) {
+  if (uvc_ensure_frame_size(out, in->data_bytes) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = in->frame_format;
+  out->step = in->step;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  memcpy(out->data, in->data, in->data_bytes);
+
+  return UVC_SUCCESS;
+}
+
+#define YUYV2RGB_2(pyuv, prgb) { \
+    float r = 1.402f * ((pyuv)[3]-128); \
+    float g = -0.34414f * ((pyuv)[1]-128) - 0.71414f * ((pyuv)[3]-128); \
+    float b = 1.772f * ((pyuv)[1]-128); \
+    (prgb)[0] = sat(pyuv[0] + r); \
+    (prgb)[1] = sat(pyuv[0] + g); \
+    (prgb)[2] = sat(pyuv[0] + b); \
+    (prgb)[3] = sat(pyuv[2] + r); \
+    (prgb)[4] = sat(pyuv[2] + g); \
+    (prgb)[5] = sat(pyuv[2] + b); \
+    }
+#define IYUYV2RGB_2(pyuv, prgb) { \
+    int r = (22987 * ((pyuv)[3] - 128)) >> 14; \
+    int g = (-5636 * ((pyuv)[1] - 128) - 11698 * ((pyuv)[3] - 128)) >> 14; \
+    int b = (29049 * ((pyuv)[1] - 128)) >> 14; \
+    (prgb)[0] = sat(*(pyuv) + r); \
+    (prgb)[1] = sat(*(pyuv) + g); \
+    (prgb)[2] = sat(*(pyuv) + b); \
+    (prgb)[3] = sat((pyuv)[2] + r); \
+    (prgb)[4] = sat((pyuv)[2] + g); \
+    (prgb)[5] = sat((pyuv)[2] + b); \
+    }
+#define IYUYV2RGB_16(pyuv, prgb) IYUYV2RGB_8(pyuv, prgb); IYUYV2RGB_8(pyuv + 16, prgb + 24);
+#define IYUYV2RGB_8(pyuv, prgb) IYUYV2RGB_4(pyuv, prgb); IYUYV2RGB_4(pyuv + 8, prgb + 12);
+#define IYUYV2RGB_4(pyuv, prgb) IYUYV2RGB_2(pyuv, prgb); IYUYV2RGB_2(pyuv + 4, prgb + 6);
+
+/** @brief Convert a frame from YUYV to RGB
+ * @ingroup frame
+ *
+ * @param in YUYV frame
+ * @param out RGB frame
+ */
+uvc_error_t uvc_yuyv2rgb(uvc_frame_t *in, uvc_frame_t *out) {
+  if (in->frame_format != UVC_FRAME_FORMAT_YUYV)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (uvc_ensure_frame_size(out, in->width * in->height * 3) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = UVC_FRAME_FORMAT_RGB;
+  out->step = in->width * 3;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  uint8_t *pyuv = in->data;
+  uint8_t *prgb = out->data;
+  uint8_t *prgb_end = prgb + out->data_bytes;
+
+  while (prgb < prgb_end) {
+    IYUYV2RGB_8(pyuv, prgb);
+
+    prgb += 3 * 8;
+    pyuv += 2 * 8;
+  }
+
+  return UVC_SUCCESS;
+}
+
+#define IYUYV2BGR_2(pyuv, pbgr) { \
+    int r = (22987 * ((pyuv)[3] - 128)) >> 14; \
+    int g = (-5636 * ((pyuv)[1] - 128) - 11698 * ((pyuv)[3] - 128)) >> 14; \
+    int b = (29049 * ((pyuv)[1] - 128)) >> 14; \
+    (pbgr)[0] = sat(*(pyuv) + b); \
+    (pbgr)[1] = sat(*(pyuv) + g); \
+    (pbgr)[2] = sat(*(pyuv) + r); \
+    (pbgr)[3] = sat((pyuv)[2] + b); \
+    (pbgr)[4] = sat((pyuv)[2] + g); \
+    (pbgr)[5] = sat((pyuv)[2] + r); \
+    }
+#define IYUYV2BGR_16(pyuv, pbgr) IYUYV2BGR_8(pyuv, pbgr); IYUYV2BGR_8(pyuv + 16, pbgr + 24);
+#define IYUYV2BGR_8(pyuv, pbgr) IYUYV2BGR_4(pyuv, pbgr); IYUYV2BGR_4(pyuv + 8, pbgr + 12);
+#define IYUYV2BGR_4(pyuv, pbgr) IYUYV2BGR_2(pyuv, pbgr); IYUYV2BGR_2(pyuv + 4, pbgr + 6);
+
+/** @brief Convert a frame from YUYV to BGR
+ * @ingroup frame
+ *
+ * @param in YUYV frame
+ * @param out BGR frame
+ */
+uvc_error_t uvc_yuyv2bgr(uvc_frame_t *in, uvc_frame_t *out) {
+  if (in->frame_format != UVC_FRAME_FORMAT_YUYV)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (uvc_ensure_frame_size(out, in->width * in->height * 3) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = UVC_FRAME_FORMAT_BGR;
+  out->step = in->width * 3;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  uint8_t *pyuv = in->data;
+  uint8_t *pbgr = out->data;
+  uint8_t *pbgr_end = pbgr + out->data_bytes;
+
+  while (pbgr < pbgr_end) {
+    IYUYV2BGR_8(pyuv, pbgr);
+
+    pbgr += 3 * 8;
+    pyuv += 2 * 8;
+  }
+
+  return UVC_SUCCESS;
+}
+
+#define IYUYV2Y(pyuv, py) { \
+    (py)[0] = (pyuv[0]); \
+    }
+
+/** @brief Convert a frame from YUYV to Y (GRAY8)
+ * @ingroup frame
+ *
+ * @param in YUYV frame
+ * @param out GRAY8 frame
+ */
+uvc_error_t uvc_yuyv2y(uvc_frame_t *in, uvc_frame_t *out) {
+  if (in->frame_format != UVC_FRAME_FORMAT_YUYV)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (uvc_ensure_frame_size(out, in->width * in->height) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = UVC_FRAME_FORMAT_GRAY8;
+  out->step = in->width;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  uint8_t *pyuv = in->data;
+  uint8_t *py = out->data;
+  uint8_t *py_end = py + out->data_bytes;
+
+  while (py < py_end) {
+    IYUYV2Y(pyuv, py);
+
+    py += 1;
+    pyuv += 2;
+  }
+
+  return UVC_SUCCESS;
+}
+
+#define IYUYV2UV(pyuv, puv) { \
+    (puv)[0] = (pyuv[1]); \
+    }
+
+/** @brief Convert a frame from YUYV to UV (GRAY8)
+ * @ingroup frame
+ *
+ * @param in YUYV frame
+ * @param out GRAY8 frame
+ */
+uvc_error_t uvc_yuyv2uv(uvc_frame_t *in, uvc_frame_t *out) {
+  if (in->frame_format != UVC_FRAME_FORMAT_YUYV)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (uvc_ensure_frame_size(out, in->width * in->height) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = UVC_FRAME_FORMAT_GRAY8;
+  out->step = in->width;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  uint8_t *pyuv = in->data;
+  uint8_t *puv = out->data;
+  uint8_t *puv_end = puv + out->data_bytes;
+
+  while (puv < puv_end) {
+    IYUYV2UV(pyuv, puv);
+
+    puv += 1;
+    pyuv += 2;
+  }
+
+  return UVC_SUCCESS;
+}
+
+#define IUYVY2RGB_2(pyuv, prgb) { \
+    int r = (22987 * ((pyuv)[2] - 128)) >> 14; \
+    int g = (-5636 * ((pyuv)[0] - 128) - 11698 * ((pyuv)[2] - 128)) >> 14; \
+    int b = (29049 * ((pyuv)[0] - 128)) >> 14; \
+    (prgb)[0] = sat((pyuv)[1] + r); \
+    (prgb)[1] = sat((pyuv)[1] + g); \
+    (prgb)[2] = sat((pyuv)[1] + b); \
+    (prgb)[3] = sat((pyuv)[3] + r); \
+    (prgb)[4] = sat((pyuv)[3] + g); \
+    (prgb)[5] = sat((pyuv)[3] + b); \
+    }
+#define IUYVY2RGB_16(pyuv, prgb) IUYVY2RGB_8(pyuv, prgb); IUYVY2RGB_8(pyuv + 16, prgb + 24);
+#define IUYVY2RGB_8(pyuv, prgb) IUYVY2RGB_4(pyuv, prgb); IUYVY2RGB_4(pyuv + 8, prgb + 12);
+#define IUYVY2RGB_4(pyuv, prgb) IUYVY2RGB_2(pyuv, prgb); IUYVY2RGB_2(pyuv + 4, prgb + 6);
+
+/** @brief Convert a frame from UYVY to RGB
+ * @ingroup frame
+ * @param ini UYVY frame
+ * @param out RGB frame
+ */
+uvc_error_t uvc_uyvy2rgb(uvc_frame_t *in, uvc_frame_t *out) {
+  if (in->frame_format != UVC_FRAME_FORMAT_UYVY)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (uvc_ensure_frame_size(out, in->width * in->height * 3) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = UVC_FRAME_FORMAT_RGB;
+  out->step = in->width *3;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  uint8_t *pyuv = in->data;
+  uint8_t *prgb = out->data;
+  uint8_t *prgb_end = prgb + out->data_bytes;
+
+  while (prgb < prgb_end) {
+    IUYVY2RGB_8(pyuv, prgb);
+
+    prgb += 3 * 8;
+    pyuv += 2 * 8;
+  }
+
+  return UVC_SUCCESS;
+}
+
+#define IUYVY2BGR_2(pyuv, pbgr) { \
+    int r = (22987 * ((pyuv)[2] - 128)) >> 14; \
+    int g = (-5636 * ((pyuv)[0] - 128) - 11698 * ((pyuv)[2] - 128)) >> 14; \
+    int b = (29049 * ((pyuv)[0] - 128)) >> 14; \
+    (pbgr)[0] = sat((pyuv)[1] + b); \
+    (pbgr)[1] = sat((pyuv)[1] + g); \
+    (pbgr)[2] = sat((pyuv)[1] + r); \
+    (pbgr)[3] = sat((pyuv)[3] + b); \
+    (pbgr)[4] = sat((pyuv)[3] + g); \
+    (pbgr)[5] = sat((pyuv)[3] + r); \
+    }
+#define IUYVY2BGR_16(pyuv, pbgr) IUYVY2BGR_8(pyuv, pbgr); IUYVY2BGR_8(pyuv + 16, pbgr + 24);
+#define IUYVY2BGR_8(pyuv, pbgr) IUYVY2BGR_4(pyuv, pbgr); IUYVY2BGR_4(pyuv + 8, pbgr + 12);
+#define IUYVY2BGR_4(pyuv, pbgr) IUYVY2BGR_2(pyuv, pbgr); IUYVY2BGR_2(pyuv + 4, pbgr + 6);
+
+/** @brief Convert a frame from UYVY to BGR
+ * @ingroup frame
+ * @param ini UYVY frame
+ * @param out BGR frame
+ */
+uvc_error_t uvc_uyvy2bgr(uvc_frame_t *in, uvc_frame_t *out) {
+  if (in->frame_format != UVC_FRAME_FORMAT_UYVY)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (uvc_ensure_frame_size(out, in->width * in->height * 3) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = UVC_FRAME_FORMAT_BGR;
+  out->step = in->width *3;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  uint8_t *pyuv = in->data;
+  uint8_t *pbgr = out->data;
+  uint8_t *pbgr_end = pbgr + out->data_bytes;
+
+  while (pbgr < pbgr_end) {
+    IUYVY2BGR_8(pyuv, pbgr);
+
+    pbgr += 3 * 8;
+    pyuv += 2 * 8;
+  }
+
+  return UVC_SUCCESS;
+}
+
+/** @brief Convert a frame to RGB
+ * @ingroup frame
+ *
+ * @param in non-RGB frame
+ * @param out RGB frame
+ */
+uvc_error_t uvc_any2rgb(uvc_frame_t *in, uvc_frame_t *out) {
+  switch (in->frame_format) {
+    case UVC_FRAME_FORMAT_YUYV:
+      return uvc_yuyv2rgb(in, out);
+    case UVC_FRAME_FORMAT_UYVY:
+      return uvc_uyvy2rgb(in, out);
+    case UVC_FRAME_FORMAT_RGB:
+      return uvc_duplicate_frame(in, out);
+    default:
+      return UVC_ERROR_NOT_SUPPORTED;
+  }
+}
+
+/** @brief Convert a frame to BGR
+ * @ingroup frame
+ *
+ * @param in non-BGR frame
+ * @param out BGR frame
+ */
+uvc_error_t uvc_any2bgr(uvc_frame_t *in, uvc_frame_t *out) {
+  switch (in->frame_format) {
+    case UVC_FRAME_FORMAT_YUYV:
+      return uvc_yuyv2bgr(in, out);
+    case UVC_FRAME_FORMAT_UYVY:
+      return uvc_uyvy2bgr(in, out);
+    case UVC_FRAME_FORMAT_BGR:
+      return uvc_duplicate_frame(in, out);
+    default:
+      return UVC_ERROR_NOT_SUPPORTED;
+  }
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/init.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/init.c b/thirdparty/libuvc-0.0.6/src/init.c
new file mode 100644
index 0000000..041fe58
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/init.c
@@ -0,0 +1,163 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+/**
+\mainpage libuvc: a cross-platform library for USB video devices
+
+\b libuvc is a library that supports enumeration, control and streaming
+for USB Video Class (UVC) devices, such as consumer webcams.
+
+\section features Features
+\li UVC device \ref device "discovery and management" API
+\li \ref streaming "Video streaming" (device to host) with asynchronous/callback and synchronous/polling modes
+\li Read/write access to standard \ref ctrl "device settings"
+\li \ref frame "Conversion" between various formats: RGB, YUV, JPEG, etc.
+\li Tested on Mac and Linux, portable to Windows and some BSDs
+
+\section roadmap Roadmap
+\li Bulk-mode image capture
+\li One-shot image capture
+\li Improved support for standard settings
+\li Support for "extended" (vendor-defined) settings
+
+\section misc Misc.
+\p The source code can be found at https://github.com/ktossell/libuvc. To build
+the library, install <a href="http://libusb.org/">libusb</a> 1.0+ and run:
+
+\code
+$ git clone https://github.com/ktossell/libuvc.git
+$ cd libuvc
+$ mkdir build
+$ cd build
+$ cmake -DCMAKE_BUILD_TYPE=Release ..
+$ make && make install
+\endcode
+
+\section Example
+In this example, libuvc is used to acquire images in a 30 fps, 640x480
+YUV stream from a UVC device such as a standard webcam.
+
+\include example.c
+
+*/
+
+/**
+ * @defgroup init Library initialization/deinitialization
+ * @brief Setup routines used to construct UVC access contexts
+ */
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+
+/** @internal
+ * @brief Event handler thread
+ * There's one of these per UVC context.
+ * @todo We shouldn't run this if we don't own the USB context
+ */
+void *_uvc_handle_events(void *arg) {
+  uvc_context_t *ctx = (uvc_context_t *) arg;
+
+  while (!ctx->kill_handler_thread)
+    libusb_handle_events_completed(ctx->usb_ctx, &ctx->kill_handler_thread);
+  return NULL;
+}
+
+/** @brief Initializes the UVC context
+ * @ingroup init
+ *
+ * @note If you provide your own USB context, you must handle
+ * libusb event processing using a function such as libusb_handle_events.
+ *
+ * @param[out] pctx The location where the context reference should be stored.
+ * @param[in]  usb_ctx Optional USB context to use
+ * @return Error opening context or UVC_SUCCESS
+ */
+uvc_error_t uvc_init(uvc_context_t **pctx, struct libusb_context *usb_ctx) {
+  uvc_error_t ret = UVC_SUCCESS;
+  uvc_context_t *ctx = calloc(1, sizeof(*ctx));
+
+  if (usb_ctx == NULL) {
+    ret = libusb_init(&ctx->usb_ctx);
+    ctx->own_usb_ctx = 1;
+    if (ret != UVC_SUCCESS) {
+      free(ctx);
+      ctx = NULL;
+    }
+  } else {
+    ctx->own_usb_ctx = 0;
+    ctx->usb_ctx = usb_ctx;
+  }
+
+  if (ctx != NULL)
+    *pctx = ctx;
+
+  return ret;
+}
+
+/**
+ * @brief Closes the UVC context, shutting down any active cameras.
+ * @ingroup init
+ *
+ * @note This function invalides any existing references to the context's
+ * cameras.
+ *
+ * If no USB context was provided to #uvc_init, the UVC-specific USB
+ * context will be destroyed.
+ *
+ * @param ctx UVC context to shut down
+ */
+void uvc_exit(uvc_context_t *ctx) {
+  uvc_device_handle_t *devh;
+
+  DL_FOREACH(ctx->open_devices, devh) {
+    uvc_close(devh);
+  }
+
+  if (ctx->own_usb_ctx)
+    libusb_exit(ctx->usb_ctx);
+
+  free(ctx);
+}
+
+/**
+ * @internal
+ * @brief Spawns a handler thread for the context
+ * @ingroup init
+ *
+ * This should be called at the end of a successful uvc_open if no devices
+ * are already open (and being handled).
+ */
+void uvc_start_handler_thread(uvc_context_t *ctx) {
+  if (ctx->own_usb_ctx)
+    pthread_create(&ctx->handler_thread, NULL, _uvc_handle_events, (void*) ctx);
+}
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/misc.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/misc.c b/thirdparty/libuvc-0.0.6/src/misc.c
new file mode 100644
index 0000000..8ce850f
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/misc.c
@@ -0,0 +1,58 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+#include <string.h>
+#include <stdlib.h>
+
+#if __APPLE__
+char *strndup(const char *s, size_t n) {
+  size_t src_n = 0;
+  const char *sp = s;
+  char *d;
+
+  while (*sp++)
+    src_n++;
+
+  if (src_n < n)
+    n = src_n;
+
+  d = malloc(n + 1);
+
+  memcpy(d, s, n);
+  
+  d[n] = '\0';
+
+  return d;
+}
+#endif
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/stream.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/stream.c b/thirdparty/libuvc-0.0.6/src/stream.c
new file mode 100644
index 0000000..d309628
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/stream.c
@@ -0,0 +1,1288 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+/**
+ * @defgroup streaming Streaming control functions
+ * @brief Tools for creating, managing and consuming video streams
+ */
+
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+#include "errno.h"
+
+#ifdef _MSC_VER
+
+#define DELTA_EPOCH_IN_MICROSECS  116444736000000000Ui64
+
+// gettimeofday - get time of day for Windows;
+// A gettimeofday implementation for Microsoft Windows;
+// Public domain code, author "ponnada";
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+    FILETIME ft;
+    unsigned __int64 tmpres = 0;
+    static int tzflag = 0;
+    if (NULL != tv)
+    {
+        GetSystemTimeAsFileTime(&ft);
+        tmpres |= ft.dwHighDateTime;
+        tmpres <<= 32;
+        tmpres |= ft.dwLowDateTime;
+        tmpres /= 10;
+        tmpres -= DELTA_EPOCH_IN_MICROSECS;
+        tv->tv_sec = (long)(tmpres / 1000000UL);
+        tv->tv_usec = (long)(tmpres % 1000000UL);
+    }
+    return 0;
+}
+#endif // _MSC_VER
+uvc_frame_desc_t *uvc_find_frame_desc_stream(uvc_stream_handle_t *strmh,
+    uint16_t format_id, uint16_t frame_id);
+uvc_frame_desc_t *uvc_find_frame_desc(uvc_device_handle_t *devh,
+    uint16_t format_id, uint16_t frame_id);
+void *_uvc_user_caller(void *arg);
+void _uvc_populate_frame(uvc_stream_handle_t *strmh);
+
+struct format_table_entry {
+  enum uvc_frame_format format;
+  uint8_t abstract_fmt;
+  uint8_t guid[16];
+  int children_count;
+  enum uvc_frame_format *children;
+};
+
+struct format_table_entry *_get_format_entry(enum uvc_frame_format format) {
+  #define ABS_FMT(_fmt, _num, ...) \
+    case _fmt: { \
+    static enum uvc_frame_format _fmt##_children[] = __VA_ARGS__; \
+    static struct format_table_entry _fmt##_entry = { \
+      _fmt, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, _num, _fmt##_children }; \
+    return &_fmt##_entry; }
+
+  #define FMT(_fmt, ...) \
+    case _fmt: { \
+    static struct format_table_entry _fmt##_entry = { \
+      _fmt, 0, __VA_ARGS__, 0, NULL }; \
+    return &_fmt##_entry; }
+
+  switch(format) {
+    /* Define new formats here */
+    ABS_FMT(UVC_FRAME_FORMAT_ANY, 2,
+      {UVC_FRAME_FORMAT_UNCOMPRESSED, UVC_FRAME_FORMAT_COMPRESSED})
+
+    ABS_FMT(UVC_FRAME_FORMAT_UNCOMPRESSED, 4,
+      {UVC_FRAME_FORMAT_YUYV, UVC_FRAME_FORMAT_UYVY, UVC_FRAME_FORMAT_GRAY8,
+      UVC_FRAME_FORMAT_GRAY16})
+    FMT(UVC_FRAME_FORMAT_YUYV,
+      {'Y',  'U',  'Y',  '2', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_UYVY,
+      {'U',  'Y',  'V',  'Y', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_GRAY8,
+      {'Y',  '8',  '0',  '0', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_GRAY16,
+      {'Y',  '1',  '6',  ' ', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_BY8,
+      {'B',  'Y',  '8',  ' ', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_BA81,
+      {'B',  'A',  '8',  '1', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_SGRBG8,
+      {'G',  'R',  'B',  'G', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_SGBRG8,
+      {'G',  'B',  'R',  'G', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_SRGGB8,
+      {'R',  'G',  'G',  'B', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    FMT(UVC_FRAME_FORMAT_SBGGR8,
+      {'B',  'G',  'G',  'R', 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71})
+    ABS_FMT(UVC_FRAME_FORMAT_COMPRESSED, 1,
+      {UVC_FRAME_FORMAT_MJPEG})
+    FMT(UVC_FRAME_FORMAT_MJPEG,
+      {'M',  'J',  'P',  'G'})
+
+    default:
+      return NULL;
+  }
+
+  #undef ABS_FMT
+  #undef FMT
+}
+
+static uint8_t _uvc_frame_format_matches_guid(enum uvc_frame_format fmt, uint8_t guid[16]) {
+  struct format_table_entry *format;
+  int child_idx;
+
+  format = _get_format_entry(fmt);
+  if (!format)
+    return 0;
+
+  if (!format->abstract_fmt && !memcmp(guid, format->guid, 16))
+    return 1;
+
+  for (child_idx = 0; child_idx < format->children_count; child_idx++) {
+    if (_uvc_frame_format_matches_guid(format->children[child_idx], guid))
+      return 1;
+  }
+
+  return 0;
+}
+
+static enum uvc_frame_format uvc_frame_format_for_guid(uint8_t guid[16]) {
+  struct format_table_entry *format;
+  enum uvc_frame_format fmt;
+
+  for (fmt = 0; fmt < UVC_FRAME_FORMAT_COUNT; ++fmt) {
+    format = _get_format_entry(fmt);
+    if (!format || format->abstract_fmt)
+      continue;
+    if (!memcmp(format->guid, guid, 16))
+      return format->format;
+  }
+
+  return UVC_FRAME_FORMAT_UNKNOWN;
+}
+
+/** @internal
+ * Run a streaming control query
+ * @param[in] devh UVC device
+ * @param[in,out] ctrl Control block
+ * @param[in] probe Whether this is a probe query or a commit query
+ * @param[in] req Query type
+ */
+uvc_error_t uvc_query_stream_ctrl(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    uint8_t probe,
+    enum uvc_req_code req) {
+  uint8_t buf[34];
+  size_t len;
+  uvc_error_t err;
+
+  memset(buf, 0, sizeof(buf));
+
+  if (devh->info->ctrl_if.bcdUVC >= 0x0110)
+    len = 34;
+  else
+    len = 26;
+
+  /* prepare for a SET transfer */
+  if (req == UVC_SET_CUR) {
+    SHORT_TO_SW(ctrl->bmHint, buf);
+    buf[2] = ctrl->bFormatIndex;
+    buf[3] = ctrl->bFrameIndex;
+    INT_TO_DW(ctrl->dwFrameInterval, buf + 4);
+    SHORT_TO_SW(ctrl->wKeyFrameRate, buf + 8);
+    SHORT_TO_SW(ctrl->wPFrameRate, buf + 10);
+    SHORT_TO_SW(ctrl->wCompQuality, buf + 12);
+    SHORT_TO_SW(ctrl->wCompWindowSize, buf + 14);
+    SHORT_TO_SW(ctrl->wDelay, buf + 16);
+    INT_TO_DW(ctrl->dwMaxVideoFrameSize, buf + 18);
+    INT_TO_DW(ctrl->dwMaxPayloadTransferSize, buf + 22);
+
+    if (len == 34) {
+      INT_TO_DW ( ctrl->dwClockFrequency, buf + 26 );
+      buf[30] = ctrl->bmFramingInfo;
+      buf[31] = ctrl->bPreferredVersion;
+      buf[32] = ctrl->bMinVersion;
+      buf[33] = ctrl->bMaxVersion;
+      /** @todo support UVC 1.1 */
+    }
+  }
+
+  /* do the transfer */
+  err = libusb_control_transfer(
+      devh->usb_devh,
+      req == UVC_SET_CUR ? 0x21 : 0xA1,
+      req,
+      probe ? (UVC_VS_PROBE_CONTROL << 8) : (UVC_VS_COMMIT_CONTROL << 8),
+      ctrl->bInterfaceNumber,
+      buf, len, 0
+  );
+
+  if (err <= 0) {
+    return err;
+  }
+
+  /* now decode following a GET transfer */
+  if (req != UVC_SET_CUR) {
+    ctrl->bmHint = SW_TO_SHORT(buf);
+    ctrl->bFormatIndex = buf[2];
+    ctrl->bFrameIndex = buf[3];
+    ctrl->dwFrameInterval = DW_TO_INT(buf + 4);
+    ctrl->wKeyFrameRate = SW_TO_SHORT(buf + 8);
+    ctrl->wPFrameRate = SW_TO_SHORT(buf + 10);
+    ctrl->wCompQuality = SW_TO_SHORT(buf + 12);
+    ctrl->wCompWindowSize = SW_TO_SHORT(buf + 14);
+    ctrl->wDelay = SW_TO_SHORT(buf + 16);
+    ctrl->dwMaxVideoFrameSize = DW_TO_INT(buf + 18);
+    ctrl->dwMaxPayloadTransferSize = DW_TO_INT(buf + 22);
+
+    if (len == 34) {
+      ctrl->dwClockFrequency = DW_TO_INT ( buf + 26 );
+      ctrl->bmFramingInfo = buf[30];
+      ctrl->bPreferredVersion = buf[31];
+      ctrl->bMinVersion = buf[32];
+      ctrl->bMaxVersion = buf[33];
+      /** @todo support UVC 1.1 */
+    }
+    else
+      ctrl->dwClockFrequency = devh->info->ctrl_if.dwClockFrequency;
+
+    /* fix up block for cameras that fail to set dwMax* */
+    if (ctrl->dwMaxVideoFrameSize == 0) {
+      uvc_frame_desc_t *frame = uvc_find_frame_desc(devh, ctrl->bFormatIndex, ctrl->bFrameIndex);
+
+      if (frame) {
+        ctrl->dwMaxVideoFrameSize = frame->dwMaxVideoFrameBufferSize;
+      }
+    }
+  }
+
+  return UVC_SUCCESS;
+}
+
+/** @brief Reconfigure stream with a new stream format.
+ * @ingroup streaming
+ *
+ * This may be executed whether or not the stream is running.
+ *
+ * @param[in] strmh Stream handle
+ * @param[in] ctrl Control block, processed using {uvc_probe_stream_ctrl} or
+ *             {uvc_get_stream_ctrl_format_size}
+ */
+uvc_error_t uvc_stream_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl) {
+  uvc_error_t ret;
+
+  if (strmh->stream_if->bInterfaceNumber != ctrl->bInterfaceNumber)
+    return UVC_ERROR_INVALID_PARAM;
+
+  /* @todo Allow the stream to be modified without restarting the stream */
+  if (strmh->running)
+    return UVC_ERROR_BUSY;
+
+  ret = uvc_query_stream_ctrl(strmh->devh, ctrl, 0, UVC_SET_CUR);
+  if (ret != UVC_SUCCESS)
+    return ret;
+
+  strmh->cur_ctrl = *ctrl;
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Find the descriptor for a specific frame configuration
+ * @param stream_if Stream interface
+ * @param format_id Index of format class descriptor
+ * @param frame_id Index of frame descriptor
+ */
+static uvc_frame_desc_t *_uvc_find_frame_desc_stream_if(uvc_streaming_interface_t *stream_if,
+    uint16_t format_id, uint16_t frame_id) {
+ 
+  uvc_format_desc_t *format = NULL;
+  uvc_frame_desc_t *frame = NULL;
+
+  DL_FOREACH(stream_if->format_descs, format) {
+    if (format->bFormatIndex == format_id) {
+      DL_FOREACH(format->frame_descs, frame) {
+        if (frame->bFrameIndex == frame_id)
+          return frame;
+      }
+    }
+  }
+
+  return NULL;
+}
+
+uvc_frame_desc_t *uvc_find_frame_desc_stream(uvc_stream_handle_t *strmh,
+    uint16_t format_id, uint16_t frame_id) {
+  return _uvc_find_frame_desc_stream_if(strmh->stream_if, format_id, frame_id);
+}
+
+/** @internal
+ * @brief Find the descriptor for a specific frame configuration
+ * @param devh UVC device
+ * @param format_id Index of format class descriptor
+ * @param frame_id Index of frame descriptor
+ */
+uvc_frame_desc_t *uvc_find_frame_desc(uvc_device_handle_t *devh,
+    uint16_t format_id, uint16_t frame_id) {
+ 
+  uvc_streaming_interface_t *stream_if;
+  uvc_frame_desc_t *frame;
+
+  DL_FOREACH(devh->info->stream_ifs, stream_if) {
+    frame = _uvc_find_frame_desc_stream_if(stream_if, format_id, frame_id);
+    if (frame)
+      return frame;
+  }
+
+  return NULL;
+}
+
+/** Get a negotiated streaming control block for some common parameters.
+ * @ingroup streaming
+ *
+ * @param[in] devh Device handle
+ * @param[in,out] ctrl Control block
+ * @param[in] format_class Type of streaming format
+ * @param[in] width Desired frame width
+ * @param[in] height Desired frame height
+ * @param[in] fps Frame rate, frames per second
+ */
+uvc_error_t uvc_get_stream_ctrl_format_size(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    enum uvc_frame_format cf,
+    int width, int height,
+    int fps) {
+  uvc_streaming_interface_t *stream_if;
+
+  /* find a matching frame descriptor and interval */
+  DL_FOREACH(devh->info->stream_ifs, stream_if) {
+    uvc_format_desc_t *format;
+
+    DL_FOREACH(stream_if->format_descs, format) {
+      uvc_frame_desc_t *frame;
+
+      if (!_uvc_frame_format_matches_guid(cf, format->guidFormat))
+        continue;
+
+      DL_FOREACH(format->frame_descs, frame) {
+        if (frame->wWidth != width || frame->wHeight != height)
+          continue;
+
+        uint32_t *interval;
+
+        ctrl->bInterfaceNumber = stream_if->bInterfaceNumber;
+        UVC_DEBUG("claiming streaming interface %d", stream_if->bInterfaceNumber );
+        uvc_claim_if(devh, ctrl->bInterfaceNumber);
+        /* get the max values */
+        uvc_query_stream_ctrl( devh, ctrl, 1, UVC_GET_MAX);
+
+        if (frame->intervals) {
+          for (interval = frame->intervals; *interval; ++interval) {
+            // allow a fps rate of zero to mean "accept first rate available"
+            if (10000000 / *interval == (unsigned int) fps || fps == 0) {
+
+              ctrl->bmHint = (1 << 0); /* don't negotiate interval */
+              ctrl->bFormatIndex = format->bFormatIndex;
+              ctrl->bFrameIndex = frame->bFrameIndex;
+              ctrl->dwFrameInterval = *interval;
+
+              goto found;
+            }
+          }
+        } else {
+          uint32_t interval_100ns = 10000000 / fps;
+          uint32_t interval_offset = interval_100ns - frame->dwMinFrameInterval;
+
+          if (interval_100ns >= frame->dwMinFrameInterval
+              && interval_100ns <= frame->dwMaxFrameInterval
+              && !(interval_offset
+                   && (interval_offset % frame->dwFrameIntervalStep))) {
+
+            ctrl->bmHint = (1 << 0);
+            ctrl->bFormatIndex = format->bFormatIndex;
+            ctrl->bFrameIndex = frame->bFrameIndex;
+            ctrl->dwFrameInterval = interval_100ns;
+
+            goto found;
+          }
+        }
+      }
+    }
+  }
+
+  return UVC_ERROR_INVALID_MODE;
+
+found:
+  return uvc_probe_stream_ctrl(devh, ctrl);
+}
+
+/** @internal
+ * Negotiate streaming parameters with the device
+ *
+ * @param[in] devh UVC device
+ * @param[in,out] ctrl Control block
+ */
+uvc_error_t uvc_probe_stream_ctrl(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl) {
+ 
+  uvc_query_stream_ctrl(
+      devh, ctrl, 1, UVC_SET_CUR
+  );
+
+  uvc_query_stream_ctrl(
+      devh, ctrl, 1, UVC_GET_CUR
+  );
+
+  /** @todo make sure that worked */
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Swap the working buffer with the presented buffer and notify consumers
+ */
+void _uvc_swap_buffers(uvc_stream_handle_t *strmh) {
+  uint8_t *tmp_buf;
+
+  pthread_mutex_lock(&strmh->cb_mutex);
+
+  /* swap the buffers */
+  tmp_buf = strmh->holdbuf;
+  strmh->hold_bytes = strmh->got_bytes;
+  strmh->holdbuf = strmh->outbuf;
+  strmh->outbuf = tmp_buf;
+  strmh->hold_last_scr = strmh->last_scr;
+  strmh->hold_pts = strmh->pts;
+  strmh->hold_seq = strmh->seq;
+
+  pthread_cond_broadcast(&strmh->cb_cond);
+  pthread_mutex_unlock(&strmh->cb_mutex);
+
+  strmh->seq++;
+  strmh->got_bytes = 0;
+  strmh->last_scr = 0;
+  strmh->pts = 0;
+}
+
+/** @internal
+ * @brief Process a payload transfer
+ * 
+ * Processes stream, places frames into buffer, signals listeners
+ * (such as user callback thread and any polling thread) on new frame
+ *
+ * @param payload Contents of the payload transfer, either a packet (isochronous) or a full
+ * transfer (bulk mode)
+ * @param payload_len Length of the payload transfer
+ */
+void _uvc_process_payload(uvc_stream_handle_t *strmh, uint8_t *payload, size_t payload_len) {
+  size_t header_len;
+  uint8_t header_info;
+  size_t data_len;
+
+  /* magic numbers for identifying header packets from some iSight cameras */
+  static uint8_t isight_tag[] = {
+    0x11, 0x22, 0x33, 0x44,
+    0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xfa, 0xce
+  };
+
+  /* ignore empty payload transfers */
+  if (payload_len == 0)
+    return;
+
+  /* Certain iSight cameras have strange behavior: They send header
+   * information in a packet with no image data, and then the following
+   * packets have only image data, with no more headers until the next frame.
+   *
+   * The iSight header: len(1), flags(1 or 2), 0x11223344(4),
+   * 0xdeadbeefdeadface(8), ??(16)
+   */
+
+  if (strmh->devh->is_isight &&
+      (payload_len < 14 || memcmp(isight_tag, payload + 2, sizeof(isight_tag))) &&
+      (payload_len < 15 || memcmp(isight_tag, payload + 3, sizeof(isight_tag)))) {
+    /* The payload transfer doesn't have any iSight magic, so it's all image data */
+    header_len = 0;
+    data_len = payload_len;
+  } else {
+    header_len = payload[0];
+
+    if (header_len > payload_len) {
+      UVC_DEBUG("bogus packet: actual_len=%zd, header_len=%zd\n", payload_len, header_len);
+      return;
+    }
+
+    if (strmh->devh->is_isight)
+      data_len = 0;
+    else
+      data_len = payload_len - header_len;
+  }
+
+  if (header_len < 2) {
+    header_info = 0;
+  } else {
+    /** @todo we should be checking the end-of-header bit */
+    size_t variable_offset = 2;
+
+    header_info = payload[1];
+
+    if (header_info & 0x40) {
+      UVC_DEBUG("bad packet: error bit set");
+      return;
+    }
+
+    if (strmh->fid != (header_info & 1) && strmh->got_bytes != 0) {
+      /* The frame ID bit was flipped, but we have image data sitting
+         around from prior transfers. This means the camera didn't send
+         an EOF for the last transfer of the previous frame. */
+      _uvc_swap_buffers(strmh);
+    }
+
+    strmh->fid = header_info & 1;
+
+    if (header_info & (1 << 2)) {
+      strmh->pts = DW_TO_INT(payload + variable_offset);
+      variable_offset += 4;
+    }
+
+    if (header_info & (1 << 3)) {
+      /** @todo read the SOF token counter */
+      strmh->last_scr = DW_TO_INT(payload + variable_offset);
+      variable_offset += 6;
+    }
+  }
+
+  if (data_len > 0) {
+    memcpy(strmh->outbuf + strmh->got_bytes, payload + header_len, data_len);
+    strmh->got_bytes += data_len;
+
+    if (header_info & (1 << 1)) {
+      /* The EOF bit is set, so publish the complete frame */
+      _uvc_swap_buffers(strmh);
+    }
+  }
+}
+
+/** @internal
+ * @brief Stream transfer callback
+ *
+ * Processes stream, places frames into buffer, signals listeners
+ * (such as user callback thread and any polling thread) on new frame
+ *
+ * @param transfer Active transfer
+ */
+void LIBUSB_CALL _uvc_stream_callback(struct libusb_transfer *transfer) {
+  uvc_stream_handle_t *strmh = transfer->user_data;
+
+  int resubmit = 1;
+
+  switch (transfer->status) {
+  case LIBUSB_TRANSFER_COMPLETED:
+    if (transfer->num_iso_packets == 0) {
+      /* This is a bulk mode transfer, so it just has one payload transfer */
+      _uvc_process_payload(strmh, transfer->buffer, transfer->actual_length);
+    } else {
+      /* This is an isochronous mode transfer, so each packet has a payload transfer */
+      int packet_id;
+
+      for (packet_id = 0; packet_id < transfer->num_iso_packets; ++packet_id) {
+        uint8_t *pktbuf;
+        struct libusb_iso_packet_descriptor *pkt;
+
+        pkt = transfer->iso_packet_desc + packet_id;
+
+        if (pkt->status != 0) {
+          UVC_DEBUG("bad packet (isochronous transfer); status: %d", pkt->status);
+          continue;
+        }
+
+        pktbuf = libusb_get_iso_packet_buffer_simple(transfer, packet_id);
+
+        _uvc_process_payload(strmh, pktbuf, pkt->actual_length);
+
+      }
+    }
+    break;
+  case LIBUSB_TRANSFER_CANCELLED: 
+  case LIBUSB_TRANSFER_ERROR:
+  case LIBUSB_TRANSFER_NO_DEVICE: {
+    int i;
+    UVC_DEBUG("not retrying transfer, status = %d", transfer->status);
+    pthread_mutex_lock(&strmh->cb_mutex);
+
+    /* Mark transfer as deleted. */
+    for(i=0; i < LIBUVC_NUM_TRANSFER_BUFS; i++) {
+      if(strmh->transfers[i] == transfer) {
+        UVC_DEBUG("Freeing transfer %d (%p)", i, transfer);
+        free(transfer->buffer);
+        libusb_free_transfer(transfer);
+        strmh->transfers[i] = NULL;
+        break;
+      }
+    }
+    if(i == LIBUVC_NUM_TRANSFER_BUFS ) {
+      UVC_DEBUG("transfer %p not found; not freeing!", transfer);
+    }
+
+    resubmit = 0;
+
+    pthread_cond_broadcast(&strmh->cb_cond);
+    pthread_mutex_unlock(&strmh->cb_mutex);
+
+    break;
+  }
+  case LIBUSB_TRANSFER_TIMED_OUT:
+  case LIBUSB_TRANSFER_STALL:
+  case LIBUSB_TRANSFER_OVERFLOW:
+    UVC_DEBUG("retrying transfer, status = %d", transfer->status);
+    break;
+  }
+  
+  if ( resubmit ) {
+    if ( strmh->running ) {
+      libusb_submit_transfer(transfer);
+    } else {
+      int i;
+      pthread_mutex_lock(&strmh->cb_mutex);
+
+      /* Mark transfer as deleted. */
+      for(i=0; i < LIBUVC_NUM_TRANSFER_BUFS; i++) {
+        if(strmh->transfers[i] == transfer) {
+          UVC_DEBUG("Freeing orphan transfer %d (%p)", i, transfer);
+          free(transfer->buffer);
+          libusb_free_transfer(transfer);
+          strmh->transfers[i] = NULL;
+        }
+      }
+      if(i == LIBUVC_NUM_TRANSFER_BUFS ) {
+        UVC_DEBUG("orphan transfer %p not found; not freeing!", transfer);
+      }
+
+      pthread_cond_broadcast(&strmh->cb_cond);
+      pthread_mutex_unlock(&strmh->cb_mutex);
+    }
+  }
+}
+
+/** Begin streaming video from the camera into the callback function.
+ * @ingroup streaming
+ *
+ * @param devh UVC device
+ * @param ctrl Control block, processed using {uvc_probe_stream_ctrl} or
+ *             {uvc_get_stream_ctrl_format_size}
+ * @param cb   User callback function. See {uvc_frame_callback_t} for restrictions.
+ * @param flags Stream setup flags, currently undefined. Set this to zero. The lower bit
+ * is reserved for backward compatibility.
+ */
+uvc_error_t uvc_start_streaming(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    uvc_frame_callback_t *cb,
+    void *user_ptr,
+    uint8_t flags
+) {
+  uvc_error_t ret;
+  uvc_stream_handle_t *strmh;
+
+  ret = uvc_stream_open_ctrl(devh, &strmh, ctrl);
+  if (ret != UVC_SUCCESS)
+    return ret;
+
+  ret = uvc_stream_start(strmh, cb, user_ptr, flags);
+  if (ret != UVC_SUCCESS) {
+    uvc_stream_close(strmh);
+    return ret;
+  }
+
+  return UVC_SUCCESS;
+}
+
+/** Begin streaming video from the camera into the callback function.
+ * @ingroup streaming
+ *
+ * @deprecated The stream type (bulk vs. isochronous) will be determined by the
+ * type of interface associated with the uvc_stream_ctrl_t parameter, regardless
+ * of whether the caller requests isochronous streaming. Please switch to
+ * uvc_start_streaming().
+ *
+ * @param devh UVC device
+ * @param ctrl Control block, processed using {uvc_probe_stream_ctrl} or
+ *             {uvc_get_stream_ctrl_format_size}
+ * @param cb   User callback function. See {uvc_frame_callback_t} for restrictions.
+ */
+uvc_error_t uvc_start_iso_streaming(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    uvc_frame_callback_t *cb,
+    void *user_ptr
+) {
+  return uvc_start_streaming(devh, ctrl, cb, user_ptr, 0);
+}
+
+static uvc_stream_handle_t *_uvc_get_stream_by_interface(uvc_device_handle_t *devh, int interface_idx) {
+  uvc_stream_handle_t *strmh;
+
+  DL_FOREACH(devh->streams, strmh) {
+    if (strmh->stream_if->bInterfaceNumber == interface_idx)
+      return strmh;
+  }
+
+  return NULL;
+}
+
+static uvc_streaming_interface_t *_uvc_get_stream_if(uvc_device_handle_t *devh, int interface_idx) {
+  uvc_streaming_interface_t *stream_if;
+
+  DL_FOREACH(devh->info->stream_ifs, stream_if) {
+    if (stream_if->bInterfaceNumber == interface_idx)
+      return stream_if;
+  }
+  
+  return NULL;
+}
+
+/** Open a new video stream.
+ * @ingroup streaming
+ *
+ * @param devh UVC device
+ * @param ctrl Control block, processed using {uvc_probe_stream_ctrl} or
+ *             {uvc_get_stream_ctrl_format_size}
+ */
+uvc_error_t uvc_stream_open_ctrl(uvc_device_handle_t *devh, uvc_stream_handle_t **strmhp, uvc_stream_ctrl_t *ctrl) {
+  /* Chosen frame and format descriptors */
+  uvc_stream_handle_t *strmh = NULL;
+  uvc_streaming_interface_t *stream_if;
+  uvc_error_t ret;
+
+  UVC_ENTER();
+
+  if (_uvc_get_stream_by_interface(devh, ctrl->bInterfaceNumber) != NULL) {
+    ret = UVC_ERROR_BUSY; /* Stream is already opened */
+    goto fail;
+  }
+
+  stream_if = _uvc_get_stream_if(devh, ctrl->bInterfaceNumber);
+  if (!stream_if) {
+    ret = UVC_ERROR_INVALID_PARAM;
+    goto fail;
+  }
+
+  strmh = calloc(1, sizeof(*strmh));
+  if (!strmh) {
+    ret = UVC_ERROR_NO_MEM;
+    goto fail;
+  }
+  strmh->devh = devh;
+  strmh->stream_if = stream_if;
+  strmh->frame.library_owns_data = 1;
+
+  ret = uvc_claim_if(strmh->devh, strmh->stream_if->bInterfaceNumber);
+  if (ret != UVC_SUCCESS)
+    goto fail;
+
+  ret = uvc_stream_ctrl(strmh, ctrl);
+  if (ret != UVC_SUCCESS)
+    goto fail;
+
+  // Set up the streaming status and data space
+  strmh->running = 0;
+  /** @todo take only what we need */
+  strmh->outbuf = malloc( LIBUVC_XFER_BUF_SIZE );
+  strmh->holdbuf = malloc( LIBUVC_XFER_BUF_SIZE );
+   
+  pthread_mutex_init(&strmh->cb_mutex, NULL);
+  pthread_cond_init(&strmh->cb_cond, NULL);
+
+  DL_APPEND(devh->streams, strmh);
+
+  *strmhp = strmh;
+
+  UVC_EXIT(0);
+  return UVC_SUCCESS;
+
+fail:
+  if(strmh)
+    free(strmh);
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** Begin streaming video from the stream into the callback function.
+ * @ingroup streaming
+ *
+ * @param strmh UVC stream
+ * @param cb   User callback function. See {uvc_frame_callback_t} for restrictions.
+ * @param flags Stream setup flags, currently undefined. Set this to zero. The lower bit
+ * is reserved for backward compatibility.
+ */
+uvc_error_t uvc_stream_start(
+    uvc_stream_handle_t *strmh,
+    uvc_frame_callback_t *cb,
+    void *user_ptr,
+    uint8_t flags
+) {
+  /* USB interface we'll be using */
+  const struct libusb_interface *interface;
+  int interface_id;
+  char isochronous;
+  uvc_frame_desc_t *frame_desc;
+  uvc_format_desc_t *format_desc;
+  uvc_stream_ctrl_t *ctrl;
+  uvc_error_t ret;
+  /* Total amount of data per transfer */
+  size_t total_transfer_size = 0;
+  struct libusb_transfer *transfer;
+  int transfer_id;
+
+  ctrl = &strmh->cur_ctrl;
+
+  UVC_ENTER();
+
+  if (strmh->running) {
+    UVC_EXIT(UVC_ERROR_BUSY);
+    return UVC_ERROR_BUSY;
+  }
+
+  strmh->running = 1;
+  strmh->seq = 1;
+  strmh->fid = 0;
+  strmh->pts = 0;
+  strmh->last_scr = 0;
+
+  frame_desc = uvc_find_frame_desc_stream(strmh, ctrl->bFormatIndex, ctrl->bFrameIndex);
+  if (!frame_desc) {
+    ret = UVC_ERROR_INVALID_PARAM;
+    goto fail;
+  }
+  format_desc = frame_desc->parent;
+
+  strmh->frame_format = uvc_frame_format_for_guid(format_desc->guidFormat);
+  if (strmh->frame_format == UVC_FRAME_FORMAT_UNKNOWN) {
+    ret = UVC_ERROR_NOT_SUPPORTED;
+    goto fail;
+  }
+
+  // Get the interface that provides the chosen format and frame configuration
+  interface_id = strmh->stream_if->bInterfaceNumber;
+  interface = &strmh->devh->info->config->interface[interface_id];
+
+  /* A VS interface uses isochronous transfers iff it has multiple altsettings.
+   * (UVC 1.5: 2.4.3. VideoStreaming Interface) */
+  isochronous = interface->num_altsetting > 1;
+
+  if (isochronous) {
+    /* For isochronous streaming, we choose an appropriate altsetting for the endpoint
+     * and set up several transfers */
+    const struct libusb_interface_descriptor *altsetting = 0;
+    const struct libusb_endpoint_descriptor *endpoint;
+    /* The greatest number of bytes that the device might provide, per packet, in this
+     * configuration */
+    size_t config_bytes_per_packet;
+    /* Number of packets per transfer */
+    size_t packets_per_transfer = 0;
+    /* Size of packet transferable from the chosen endpoint */
+    size_t endpoint_bytes_per_packet = 0;
+    /* Index of the altsetting */
+    int alt_idx, ep_idx;
+    
+    config_bytes_per_packet = strmh->cur_ctrl.dwMaxPayloadTransferSize;
+
+    /* Go through the altsettings and find one whose packets are at least
+     * as big as our format's maximum per-packet usage. Assume that the
+     * packet sizes are increasing. */
+    for (alt_idx = 0; alt_idx < interface->num_altsetting; alt_idx++) {
+      altsetting = interface->altsetting + alt_idx;
+      endpoint_bytes_per_packet = 0;
+
+      /* Find the endpoint with the number specified in the VS header */
+      for (ep_idx = 0; ep_idx < altsetting->bNumEndpoints; ep_idx++) {
+        endpoint = altsetting->endpoint + ep_idx;
+
+        if (endpoint->bEndpointAddress == format_desc->parent->bEndpointAddress) {
+          endpoint_bytes_per_packet = endpoint->wMaxPacketSize;
+          // wMaxPacketSize: [unused:2 (multiplier-1):3 size:11]
+          endpoint_bytes_per_packet = (endpoint_bytes_per_packet & 0x07ff) *
+                                      (((endpoint_bytes_per_packet >> 11) & 3) + 1);
+          break;
+        }
+      }
+
+      if (endpoint_bytes_per_packet >= config_bytes_per_packet) {
+        /* Transfers will be at most one frame long: Divide the maximum frame size
+         * by the size of the endpoint and round up */
+        packets_per_transfer = (ctrl->dwMaxVideoFrameSize +
+                                endpoint_bytes_per_packet - 1) / endpoint_bytes_per_packet;
+
+        /* But keep a reasonable limit: Otherwise we start dropping data */
+        if (packets_per_transfer > 32)
+          packets_per_transfer = 32;
+        
+        total_transfer_size = packets_per_transfer * endpoint_bytes_per_packet;
+        break;
+      }
+    }
+
+    /* If we searched through all the altsettings and found nothing usable */
+    if (alt_idx == interface->num_altsetting) {
+      ret = UVC_ERROR_INVALID_MODE;
+      goto fail;
+    }
+
+    /* Select the altsetting */
+    ret = libusb_set_interface_alt_setting(strmh->devh->usb_devh,
+                                           altsetting->bInterfaceNumber,
+                                           altsetting->bAlternateSetting);
+    if (ret != UVC_SUCCESS) {
+      UVC_DEBUG("libusb_set_interface_alt_setting failed");
+      goto fail;
+    }
+
+    /* Set up the transfers */
+    for (transfer_id = 0; transfer_id < LIBUVC_NUM_TRANSFER_BUFS; ++transfer_id) {
+      transfer = libusb_alloc_transfer(packets_per_transfer);
+      strmh->transfers[transfer_id] = transfer;      
+      strmh->transfer_bufs[transfer_id] = malloc(total_transfer_size);
+
+      libusb_fill_iso_transfer(
+        transfer, strmh->devh->usb_devh, format_desc->parent->bEndpointAddress,
+        strmh->transfer_bufs[transfer_id],
+        total_transfer_size, packets_per_transfer, _uvc_stream_callback, (void*) strmh, 5000);
+
+      libusb_set_iso_packet_lengths(transfer, endpoint_bytes_per_packet);
+    }
+  } else {
+    for (transfer_id = 0; transfer_id < LIBUVC_NUM_TRANSFER_BUFS;
+        ++transfer_id) {
+      transfer = libusb_alloc_transfer(0);
+      strmh->transfers[transfer_id] = transfer;
+      strmh->transfer_bufs[transfer_id] = malloc (
+          strmh->cur_ctrl.dwMaxPayloadTransferSize );
+      libusb_fill_bulk_transfer ( transfer, strmh->devh->usb_devh,
+          format_desc->parent->bEndpointAddress,
+          strmh->transfer_bufs[transfer_id],
+          strmh->cur_ctrl.dwMaxPayloadTransferSize, _uvc_stream_callback,
+          ( void* ) strmh, 5000 );
+    }
+  }
+
+  strmh->user_cb = cb;
+  strmh->user_ptr = user_ptr;
+
+  /* If the user wants it, set up a thread that calls the user's function
+   * with the contents of each frame.
+   */
+  if (cb) {
+    pthread_create(&strmh->cb_thread, NULL, _uvc_user_caller, (void*) strmh);
+  }
+
+  for (transfer_id = 0; transfer_id < LIBUVC_NUM_TRANSFER_BUFS;
+      transfer_id++) {
+    ret = libusb_submit_transfer(strmh->transfers[transfer_id]);
+    if (ret != UVC_SUCCESS) {
+      UVC_DEBUG("libusb_submit_transfer failed: %d",ret);
+      break;
+    }
+  }
+
+  if ( ret != UVC_SUCCESS && transfer_id > 0 ) {
+    for ( ; transfer_id < LIBUVC_NUM_TRANSFER_BUFS; transfer_id++) {
+      free ( strmh->transfers[transfer_id]->buffer );
+      libusb_free_transfer ( strmh->transfers[transfer_id]);
+      strmh->transfers[transfer_id] = 0;
+    }
+    ret = UVC_SUCCESS;
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+fail:
+  strmh->running = 0;
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** Begin streaming video from the stream into the callback function.
+ * @ingroup streaming
+ *
+ * @deprecated The stream type (bulk vs. isochronous) will be determined by the
+ * type of interface associated with the uvc_stream_ctrl_t parameter, regardless
+ * of whether the caller requests isochronous streaming. Please switch to
+ * uvc_stream_start().
+ *
+ * @param strmh UVC stream
+ * @param cb   User callback function. See {uvc_frame_callback_t} for restrictions.
+ */
+uvc_error_t uvc_stream_start_iso(
+    uvc_stream_handle_t *strmh,
+    uvc_frame_callback_t *cb,
+    void *user_ptr
+) {
+  return uvc_stream_start(strmh, cb, user_ptr, 0);
+}
+
+/** @internal
+ * @brief User callback runner thread
+ * @note There should be at most one of these per currently streaming device
+ * @param arg Device handle
+ */
+void *_uvc_user_caller(void *arg) {
+  uvc_stream_handle_t *strmh = (uvc_stream_handle_t *) arg;
+
+  uint32_t last_seq = 0;
+
+  do {
+    pthread_mutex_lock(&strmh->cb_mutex);
+
+    while (strmh->running && last_seq == strmh->hold_seq) {
+      pthread_cond_wait(&strmh->cb_cond, &strmh->cb_mutex);
+    }
+
+    if (!strmh->running) {
+      pthread_mutex_unlock(&strmh->cb_mutex);
+      break;
+    }
+    
+    last_seq = strmh->hold_seq;
+    _uvc_populate_frame(strmh);
+    
+    pthread_mutex_unlock(&strmh->cb_mutex);
+    
+    strmh->user_cb(&strmh->frame, strmh->user_ptr);
+  } while(1);
+
+  return NULL; // return value ignored
+}
+
+/** @internal
+ * @brief Populate the fields of a frame to be handed to user code
+ * must be called with stream cb lock held!
+ */
+void _uvc_populate_frame(uvc_stream_handle_t *strmh) {
+  uvc_frame_t *frame = &strmh->frame;
+  uvc_frame_desc_t *frame_desc;
+
+  /** @todo this stuff that hits the main config cache should really happen
+   * in start() so that only one thread hits these data. all of this stuff
+   * is going to be reopen_on_change anyway
+   */
+
+  frame_desc = uvc_find_frame_desc(strmh->devh, strmh->cur_ctrl.bFormatIndex,
+				   strmh->cur_ctrl.bFrameIndex);
+
+  frame->frame_format = strmh->frame_format;
+  
+  frame->width = frame_desc->wWidth;
+  frame->height = frame_desc->wHeight;
+  
+  switch (frame->frame_format) {
+  case UVC_FRAME_FORMAT_YUYV:
+    frame->step = frame->width * 2;
+    break;
+  case UVC_FRAME_FORMAT_MJPEG:
+    frame->step = 0;
+    break;
+  default:
+    frame->step = 0;
+    break;
+  }
+
+  frame->sequence = strmh->hold_seq;
+  /** @todo set the frame time */
+  // frame->capture_time
+
+  /* copy the image data from the hold buffer to the frame (unnecessary extra buf?) */
+  if (frame->data_bytes < strmh->hold_bytes) {
+    frame->data = realloc(frame->data, strmh->hold_bytes);
+  }
+  frame->data_bytes = strmh->hold_bytes;
+  memcpy(frame->data, strmh->holdbuf, frame->data_bytes);
+
+
+
+}
+
+/** Poll for a frame
+ * @ingroup streaming
+ *
+ * @param devh UVC device
+ * @param[out] frame Location to store pointer to captured frame (NULL on error)
+ * @param timeout_us >0: Wait at most N microseconds; 0: Wait indefinitely; -1: return immediately
+ */
+uvc_error_t uvc_stream_get_frame(uvc_stream_handle_t *strmh,
+			  uvc_frame_t **frame,
+			  int32_t timeout_us) {
+  time_t add_secs;
+  time_t add_nsecs;
+  struct timespec ts;
+  struct timeval tv;
+
+  if (!strmh->running)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (strmh->user_cb)
+    return UVC_ERROR_CALLBACK_EXISTS;
+
+  pthread_mutex_lock(&strmh->cb_mutex);
+
+  if (strmh->last_polled_seq < strmh->hold_seq) {
+    _uvc_populate_frame(strmh);
+    *frame = &strmh->frame;
+    strmh->last_polled_seq = strmh->hold_seq;
+  } else if (timeout_us != -1) {
+    if (timeout_us == 0) {
+      pthread_cond_wait(&strmh->cb_cond, &strmh->cb_mutex);
+    } else {
+      add_secs = timeout_us / 1000000;
+      add_nsecs = (timeout_us % 1000000) * 1000;
+      ts.tv_sec = 0;
+      ts.tv_nsec = 0;
+
+#if _POSIX_TIMERS > 0
+      clock_gettime(CLOCK_REALTIME, &ts);
+#else
+      gettimeofday(&tv, NULL);
+      ts.tv_sec = tv.tv_sec;
+      ts.tv_nsec = tv.tv_usec * 1000;
+#endif
+
+      ts.tv_sec += add_secs;
+      ts.tv_nsec += add_nsecs;
+
+      /* pthread_cond_timedwait FAILS with EINVAL if ts.tv_nsec > 1000000000 (1 billion)
+       * Since we are just adding values to the timespec, we have to increment the seconds if nanoseconds is greater than 1 billion,
+       * and then re-adjust the nanoseconds in the correct range.
+       * */
+      ts.tv_sec += ts.tv_nsec / 1000000000;
+      ts.tv_nsec = ts.tv_nsec % 1000000000;
+
+      int err = pthread_cond_timedwait(&strmh->cb_cond, &strmh->cb_mutex, &ts);
+
+      //TODO: How should we handle EINVAL?
+      switch(err){
+      case EINVAL:
+          *frame = NULL;
+          return UVC_ERROR_OTHER;
+      case ETIMEDOUT:
+          *frame = NULL;
+          return UVC_ERROR_TIMEOUT;
+      }
+    }
+    
+    if (strmh->last_polled_seq < strmh->hold_seq) {
+      _uvc_populate_frame(strmh);
+      *frame = &strmh->frame;
+      strmh->last_polled_seq = strmh->hold_seq;
+    } else {
+      *frame = NULL;
+    }
+  } else {
+    *frame = NULL;
+  }
+
+  pthread_mutex_unlock(&strmh->cb_mutex);
+
+  return UVC_SUCCESS;
+}
+
+/** @brief Stop streaming video
+ * @ingroup streaming
+ *
+ * Closes all streams, ends threads and cancels pollers
+ *
+ * @param devh UVC device
+ */
+void uvc_stop_streaming(uvc_device_handle_t *devh) {
+  uvc_stream_handle_t *strmh, *strmh_tmp;
+
+  DL_FOREACH_SAFE(devh->streams, strmh, strmh_tmp) {
+    uvc_stream_close(strmh);
+  }
+}
+
+/** @brief Stop stream.
+ * @ingroup streaming
+ *
+ * Stops stream, ends threads and cancels pollers
+ *
+ * @param devh UVC device
+ */
+uvc_error_t uvc_stream_stop(uvc_stream_handle_t *strmh) {
+  int i;
+
+  if (!strmh->running)
+    return UVC_ERROR_INVALID_PARAM;
+
+  strmh->running = 0;
+
+  pthread_mutex_lock(&strmh->cb_mutex);
+
+  for(i=0; i < LIBUVC_NUM_TRANSFER_BUFS; i++) {
+    if(strmh->transfers[i] != NULL) {
+      int res = libusb_cancel_transfer(strmh->transfers[i]);
+      if(res < 0 && res != LIBUSB_ERROR_NOT_FOUND ) {
+        free(strmh->transfers[i]->buffer);
+        libusb_free_transfer(strmh->transfers[i]);
+        strmh->transfers[i] = NULL;
+      }
+    }
+  }
+
+  /* Wait for transfers to complete/cancel */
+  do {
+    for(i=0; i < LIBUVC_NUM_TRANSFER_BUFS; i++) {
+      if(strmh->transfers[i] != NULL)
+        break;
+    }
+    if(i == LIBUVC_NUM_TRANSFER_BUFS )
+      break;
+    pthread_cond_wait(&strmh->cb_cond, &strmh->cb_mutex);
+  } while(1);
+  // Kick the user thread awake
+  pthread_cond_broadcast(&strmh->cb_cond);
+  pthread_mutex_unlock(&strmh->cb_mutex);
+
+  /** @todo stop the actual stream, camera side? */
+
+  if (strmh->user_cb) {
+    /* wait for the thread to stop (triggered by
+     * LIBUSB_TRANSFER_CANCELLED transfer) */
+    pthread_join(strmh->cb_thread, NULL);
+  }
+
+  return UVC_SUCCESS;
+}
+
+/** @brief Close stream.
+ * @ingroup streaming
+ *
+ * Closes stream, frees handle and all streaming resources.
+ *
+ * @param strmh UVC stream handle
+ */
+void uvc_stream_close(uvc_stream_handle_t *strmh) {
+  if (strmh->running)
+    uvc_stream_stop(strmh);
+
+  uvc_release_if(strmh->devh, strmh->stream_if->bInterfaceNumber);
+
+  if (strmh->frame.data)
+    free(strmh->frame.data);
+
+  free(strmh->outbuf);
+  free(strmh->holdbuf);
+
+  pthread_cond_destroy(&strmh->cb_cond);
+  pthread_mutex_destroy(&strmh->cb_mutex);
+
+  DL_DELETE(strmh->devh->streams, strmh);
+  free(strmh);
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/test.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/test.c b/thirdparty/libuvc-0.0.6/src/test.c
new file mode 100644
index 0000000..e48cfc9
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/test.c
@@ -0,0 +1,153 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+#include <stdio.h>
+#include <opencv/highgui.h>
+
+#include "libuvc/libuvc.h"
+
+void cb(uvc_frame_t *frame, void *ptr) {
+  uvc_frame_t *bgr;
+  uvc_error_t ret;
+  IplImage* cvImg;
+
+  printf("callback! length = %u, ptr = %d\n", frame->data_bytes, (int) ptr);
+
+  bgr = uvc_allocate_frame(frame->width * frame->height * 3);
+  if (!bgr) {
+    printf("unable to allocate bgr frame!");
+    return;
+  }
+
+  ret = uvc_any2bgr(frame, bgr);
+  if (ret) {
+    uvc_perror(ret, "uvc_any2bgr");
+    uvc_free_frame(bgr);
+    return;
+  }
+
+  cvImg = cvCreateImageHeader(
+      cvSize(bgr->width, bgr->height),
+      IPL_DEPTH_8U,
+      3);
+
+  cvSetData(cvImg, bgr->data, bgr->width * 3); 
+
+  cvNamedWindow("Test", CV_WINDOW_AUTOSIZE);
+  cvShowImage("Test", cvImg);
+  cvWaitKey(10);
+
+  cvReleaseImageHeader(&cvImg);
+
+  uvc_free_frame(bgr);
+}
+
+int main(int argc, char **argv) {
+  uvc_context_t *ctx;
+  uvc_error_t res;
+  uvc_device_t *dev;
+  uvc_device_handle_t *devh;
+  uvc_stream_ctrl_t ctrl;
+
+  res = uvc_init(&ctx, NULL);
+
+  if (res < 0) {
+    uvc_perror(res, "uvc_init");
+    return res;
+  }
+
+  puts("UVC initialized");
+
+  res = uvc_find_device(
+      ctx, &dev,
+      0, 0, NULL);
+
+  if (res < 0) {
+    uvc_perror(res, "uvc_find_device");
+  } else {
+    puts("Device found");
+
+    res = uvc_open(dev, &devh);
+
+    if (res < 0) {
+      uvc_perror(res, "uvc_open");
+    } else {
+      puts("Device opened");
+
+      uvc_print_diag(devh, stderr);
+
+      res = uvc_get_stream_ctrl_format_size(
+          devh, &ctrl, UVC_FRAME_FORMAT_YUYV, 640, 480, 30
+      );
+
+      uvc_print_stream_ctrl(&ctrl, stderr);
+
+      if (res < 0) {
+        uvc_perror(res, "get_mode");
+      } else {
+        res = uvc_start_streaming(devh, &ctrl, cb, 12345, 0);
+
+        if (res < 0) {
+          uvc_perror(res, "start_streaming");
+        } else {
+          puts("Streaming for 10 seconds...");
+          uvc_error_t resAEMODE = uvc_set_ae_mode(devh, 1);
+          uvc_perror(resAEMODE, "set_ae_mode");
+          int i;
+          for (i = 1; i <= 10; i++) {
+            /* uvc_error_t resPT = uvc_set_pantilt_abs(devh, i * 20 * 3600, 0); */
+            /* uvc_perror(resPT, "set_pt_abs"); */
+            uvc_error_t resEXP = uvc_set_exposure_abs(devh, 20 + i * 5);
+            uvc_perror(resEXP, "set_exp_abs");
+            
+            sleep(1);
+          }
+          sleep(10);
+          uvc_stop_streaming(devh);
+	  puts("Done streaming.");
+        }
+      }
+
+      uvc_close(devh);
+      puts("Device closed");
+    }
+
+    uvc_unref_device(dev);
+  }
+
+  uvc_exit(ctx);
+  puts("UVC exited");
+
+  return 0;
+}
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/standard-units.yaml
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/standard-units.yaml b/thirdparty/libuvc-0.0.6/standard-units.yaml
new file mode 100644
index 0000000..198c401
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/standard-units.yaml
@@ -0,0 +1,518 @@
+units:
+  camera_terminal:
+    type: standard
+    description: Standard camera input terminal (captures images from sensor)
+    control_prefix: CT
+    controls:
+      scanning_mode:
+        control: SCANNING_MODE
+        length: 1
+        fields:
+          mode:
+            type: int
+            position: 0
+            length: 1
+            doc: '0: interlaced, 1: progressive'
+      ae_mode:
+        control: AE_MODE
+        length: 1
+        fields:
+          mode:
+            type: int
+            position: 0
+            length: 1
+            doc: '1: manual mode; 2: auto mode; 4: shutter priority mode; 8: aperture
+              priority mode'
+        doc:
+          get: |-
+            @brief Reads camera's auto-exposure mode.
+
+            See uvc_set_ae_mode() for a description of the available modes.
+          set: |-
+            @brief Sets camera's auto-exposure mode.
+
+            Cameras may support any of the following AE modes:
+             * UVC_AUTO_EXPOSURE_MODE_MANUAL (1) - manual exposure time, manual iris
+             * UVC_AUTO_EXPOSURE_MODE_AUTO (2) - auto exposure time, auto iris
+             * UVC_AUTO_EXPOSURE_MODE_SHUTTER_PRIORITY (4) - manual exposure time, auto iris
+             * UVC_AUTO_EXPOSURE_MODE_APERTURE_PRIORITY (8) - auto exposure time, manual iris
+
+            Most cameras provide manual mode and aperture priority mode.
+      ae_priority:
+        control: AE_PRIORITY
+        length: 1
+        fields:
+          priority:
+            type: int
+            position: 0
+            length: 1
+            doc: '0: frame rate must remain constant; 1: frame rate may be varied
+              for AE purposes'
+        doc:
+          get: |-
+            @brief Checks whether the camera may vary the frame rate for exposure control reasons.
+            See uvc_set_ae_priority() for a description of the `priority` field.
+          set: |-
+            @brief Chooses whether the camera may vary the frame rate for exposure control reasons.
+            A `priority` value of zero means the camera may not vary its frame rate. A value of 1
+            means the frame rate is variable. This setting has no effect outside of the `auto` and
+            `shutter_priority` auto-exposure modes.
+      exposure_abs:
+        control: EXPOSURE_TIME_ABSOLUTE
+        length: 4
+        fields:
+          time:
+            type: int
+            position: 0
+            length: 4
+            doc: ''
+        doc:
+          get: |-
+            @brief Gets the absolute exposure time.
+
+            See uvc_set_exposure_abs() for a description of the `time` field.
+          set: |-
+            @brief Sets the absolute exposure time.
+
+            The `time` parameter should be provided in units of 0.0001 seconds (e.g., use the value 100
+            for a 10ms exposure period). Auto exposure should be set to `manual` or `shutter_priority`
+            before attempting to change this setting.
+      exposure_rel:
+        control: EXPOSURE_TIME_RELATIVE
+        length: 1
+        fields:
+          step:
+            type: int
+            position: 0
+            length: 1
+            signed: true
+            doc: number of steps by which to change the exposure time, or zero to
+              set the default exposure time
+        doc: '@brief {gets_sets} the exposure time relative to the current setting.'
+      focus_abs:
+        control: FOCUS_ABSOLUTE
+        length: 2
+        fields:
+          focus:
+            type: int
+            position: 0
+            length: 2
+            doc: focal target distance in millimeters
+        doc: '@brief {gets_sets} the distance at which an object is optimally focused.'
+      focus_rel:
+        control: FOCUS_RELATIVE
+        length: 2
+        fields:
+          focus_rel:
+            type: int
+            position: 0
+            length: 1
+            signed: true
+            doc: TODO
+          speed:
+            type: int
+            position: 1
+            length: 1
+            doc: TODO
+      focus_simple_range:
+        control: FOCUS_SIMPLE
+        length: 1
+        fields:
+          focus:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      focus_auto:
+        control: FOCUS_AUTO
+        length: 1
+        fields:
+          state:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      iris_abs:
+        control: IRIS_ABSOLUTE
+        length: 2
+        fields:
+          iris:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      iris_rel:
+        control: IRIS_RELATIVE
+        length: 1
+        fields:
+          iris_rel:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      zoom_abs:
+        control: ZOOM_ABSOLUTE
+        length: 2
+        fields:
+          focal_length:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      zoom_rel:
+        control: ZOOM_RELATIVE
+        length: 3
+        fields:
+          zoom_rel:
+            type: int
+            position: 0
+            length: 1
+            signed: true
+            doc: TODO
+          digital_zoom:
+            type: int
+            position: 1
+            length: 1
+            doc: TODO
+          speed:
+            type: int
+            position: 2
+            length: 1
+            doc: TODO
+      pantilt_abs:
+        control: PANTILT_ABSOLUTE
+        length: 8
+        fields:
+          pan:
+            type: int
+            position: 0
+            length: 4
+            signed: true
+            doc: TODO
+          tilt:
+            type: int
+            position: 4
+            length: 4
+            signed: true
+            doc: TODO
+      pantilt_rel:
+        control: PANTILT_RELATIVE
+        length: 4
+        fields:
+          pan_rel:
+            type: int
+            position: 0
+            length: 1
+            signed: true
+            doc: TODO
+          pan_speed:
+            type: int
+            position: 1
+            length: 1
+            doc: TODO
+          tilt_rel:
+            type: int
+            position: 2
+            length: 1
+            signed: true
+            doc: TODO
+          tilt_speed:
+            type: int
+            position: 3
+            length: 1
+            doc: TODO
+      roll_abs:
+        control: ROLL_ABSOLUTE
+        length: 2
+        fields:
+          roll:
+            type: int
+            position: 0
+            length: 2
+            signed: true
+            doc: TODO
+      roll_rel:
+        control: ROLL_RELATIVE
+        length: 2
+        fields:
+          roll_rel:
+            type: int
+            position: 0
+            length: 1
+            signed: true
+            doc: TODO
+          speed:
+            type: int
+            position: 1
+            length: 1
+            doc: TODO
+      privacy:
+        control: PRIVACY
+        length: 1
+        fields:
+          privacy:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      digital_window:
+        control: DIGITAL_WINDOW
+        length: 12
+        fields:
+          window_top:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+          window_left:
+            type: int
+            position: 2
+            length: 2
+            doc: TODO
+          window_bottom:
+            type: int
+            position: 4
+            length: 2
+            doc: TODO
+          window_right:
+            type: int
+            position: 6
+            length: 2
+            doc: TODO
+          num_steps:
+            type: int
+            position: 8
+            length: 2
+            doc: TODO
+          num_steps_units:
+            type: int
+            position: 10
+            length: 2
+            doc: TODO
+      digital_roi:
+        control: REGION_OF_INTEREST
+        length: 10
+        fields:
+          roi_top:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+          roi_left:
+            type: int
+            position: 2
+            length: 2
+            doc: TODO
+          roi_bottom:
+            type: int
+            position: 4
+            length: 2
+            doc: TODO
+          roi_right:
+            type: int
+            position: 6
+            length: 2
+            doc: TODO
+          auto_controls:
+            type: int
+            position: 8
+            length: 2
+            doc: TODO
+  processing_unit:
+    type: standard
+    description: Standard processing unit (processes images between other units)
+    control_prefix: PU
+    controls:
+      backlight_compensation:
+        control: BACKLIGHT_COMPENSATION
+        length: 2
+        fields:
+          backlight_compensation:
+            type: int
+            position: 0
+            length: 2
+            doc: device-dependent backlight compensation mode; zero means backlight
+              compensation is disabled
+      brightness:
+        control: BRIGHTNESS
+        length: 2
+        fields:
+          brightness:
+            type: int
+            position: 0
+            length: 2
+            signed: true
+            doc: TODO
+      contrast:
+        control: CONTRAST
+        length: 2
+        fields:
+          contrast:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      contrast_auto:
+        control: CONTRAST_AUTO
+        length: 1
+        fields:
+          contrast_auto:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      gain:
+        control: GAIN
+        length: 2
+        fields:
+          gain:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      power_line_frequency:
+        control: POWER_LINE_FREQUENCY
+        length: 1
+        fields:
+          power_line_frequency:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      hue:
+        control: HUE
+        length: 2
+        fields:
+          hue:
+            type: int
+            position: 0
+            length: 2
+            signed: true
+            doc: TODO
+      hue_auto:
+        control: HUE_AUTO
+        length: 1
+        fields:
+          hue_auto:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      saturation:
+        control: SATURATION
+        length: 2
+        fields:
+          saturation:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      sharpness:
+        control: SHARPNESS
+        length: 2
+        fields:
+          sharpness:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      gamma:
+        control: GAMMA
+        length: 2
+        fields:
+          gamma:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      white_balance_temperature:
+        control: WHITE_BALANCE_TEMPERATURE
+        length: 2
+        fields:
+          temperature:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      white_balance_temperature_auto:
+        control: WHITE_BALANCE_TEMPERATURE_AUTO
+        length: 1
+        fields:
+          temperature_auto:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      white_balance_component:
+        control: WHITE_BALANCE_COMPONENT
+        length: 4
+        fields:
+          blue:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+          red:
+            type: int
+            position: 2
+            length: 2
+            doc: TODO
+      white_balance_component_auto:
+        control: WHITE_BALANCE_COMPONENT_AUTO
+        length: 1
+        fields:
+          white_balance_component_auto:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      digital_multiplier:
+        control: DIGITAL_MULTIPLIER
+        length: 2
+        fields:
+          multiplier_step:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      digital_multiplier_limit:
+        control: DIGITAL_MULTIPLIER_LIMIT
+        length: 2
+        fields:
+          multiplier_step:
+            type: int
+            position: 0
+            length: 2
+            doc: TODO
+      analog_video_standard:
+        control: ANALOG_VIDEO_STANDARD
+        length: 1
+        fields:
+          video_standard:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+      analog_video_lock_status:
+        control: ANALOG_LOCK_STATUS
+        length: 1
+        fields:
+          status:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO
+  selector_unit:
+    type: standard
+    description: Standard selector unit (controls connectivity between other units)
+    control_prefix: SU
+    controls:
+      input_select:
+        control: INPUT_SELECT
+        length: 1
+        fields:
+          selector:
+            type: int
+            position: 0
+            length: 1
+            doc: TODO


[8/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/cameras/logitech_hd_pro_920.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/cameras/logitech_hd_pro_920.txt b/thirdparty/libuvc-0.0.6/cameras/logitech_hd_pro_920.txt
new file mode 100644
index 0000000..2fbe69c
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/cameras/logitech_hd_pro_920.txt
@@ -0,0 +1,1817 @@
+
+Bus 001 Device 018: ID 046d:082d Logitech, Inc. HD Pro Webcam C920
+Device Descriptor:
+  bLength                18
+  bDescriptorType         1
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  idVendor           0x046d Logitech, Inc.
+  idProduct          0x082d HD Pro Webcam C920
+  bcdDevice            0.11
+  iManufacturer           0 
+  iProduct                2 HD Pro Webcam C920
+  iSerial                 1 E1CA2A7F
+  bNumConfigurations      1
+  Configuration Descriptor:
+    bLength                 9
+    bDescriptorType         2
+    wTotalLength         3452
+    bNumInterfaces          4
+    bConfigurationValue     1
+    iConfiguration          0 
+    bmAttributes         0x80
+      (Bus Powered)
+    MaxPower              500mA
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         0
+      bInterfaceCount         2
+      bFunctionClass         14 Video
+      bFunctionSubClass       3 Video Interface Collection
+      bFunctionProtocol       0 
+      iFunction               0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        0
+      bAlternateSetting       0
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      1 Video Control
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoControl Interface Descriptor:
+        bLength                13
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdUVC               1.00
+        wTotalLength          214
+        dwClockFrequency      300.000000MHz
+        bInCollection           1
+        baInterfaceNr( 0)       1
+      VideoControl Interface Descriptor:
+        bLength                18
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Camera Sensor
+        bAssocTerminal          0
+        iTerminal               0 
+        wObjectiveFocalLengthMin      0
+        wObjectiveFocalLengthMax      0
+        wOcularFocalLength            0
+        bControlSize                  3
+        bmControls           0x00020a2e
+          Auto-Exposure Mode
+          Auto-Exposure Priority
+          Exposure Time (Absolute)
+          Focus (Absolute)
+          Zoom (Absolute)
+          PanTilt (Absolute)
+          Focus, Auto
+      VideoControl Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      5 (PROCESSING_UNIT)
+      Warning: Descriptor too short
+        bUnitID                 3
+        bSourceID               1
+        wMaxMultiplier      16384
+        bControlSize            2
+        bmControls     0x0000175b
+          Brightness
+          Contrast
+          Saturation
+          Sharpness
+          White Balance Temperature
+          Backlight Compensation
+          Gain
+          Power Line Frequency
+          White Balance Temperature, Auto
+        iProcessing             0 
+        bmVideoStandards     0x1b
+          None
+          NTSC - 525/60
+          SECAM - 625/50
+          NTSC - 625/50
+      VideoControl Interface Descriptor:
+        bLength                27
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                 6
+        guidExtensionCode         {d09ee423-7811-314f-ae52-d2fb8a8d3b48}
+        bNumControl            10
+        bNrPins                 1
+        baSourceID( 0)          3
+        bControlSize            2
+        bmControls( 0)       0xff
+        bmControls( 1)       0x03
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                27
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                 8
+        guidExtensionCode         {e48e6769-0f41-db40-a850-7420d7d8240e}
+        bNumControl             7
+        bNrPins                 1
+        baSourceID( 0)          1
+        bControlSize            2
+        bmControls( 0)       0x3b
+        bmControls( 1)       0x03
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                28
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                 9
+        guidExtensionCode         {a94c5d1f-11de-8744-840d-50933c8ec8d1}
+        bNumControl            17
+        bNrPins                 1
+        baSourceID( 0)          1
+        bControlSize            3
+        bmControls( 0)       0xf3
+        bmControls( 1)       0xff
+        bmControls( 2)       0x23
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                27
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                10
+        guidExtensionCode         {1502e449-34f4-fe47-b158-0e885023e51b}
+        bNumControl             7
+        bNrPins                 1
+        baSourceID( 0)          1
+        bControlSize            2
+        bmControls( 0)       0xaa
+        bmControls( 1)       0x07
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                27
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                11
+        guidExtensionCode         {212de5ff-3080-2c4e-82d9-f587d00540bd}
+        bNumControl             2
+        bNrPins                 1
+        baSourceID( 0)          1
+        bControlSize            2
+        bmControls( 0)       0x00
+        bmControls( 1)       0x41
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                27
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                12
+        guidExtensionCode         {41769ea2-04de-e347-8b2b-f4341aff003b}
+        bNumControl            11
+        bNrPins                 1
+        baSourceID( 0)          3
+        bControlSize            2
+        bmControls( 0)       0x07
+        bmControls( 1)       0x7f
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             4
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          0
+        bSourceID               3
+        iTerminal               0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x83  EP 3 IN
+        bmAttributes            3
+          Transfer Type            Interrupt
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0040  1x 64 bytes
+        bInterval               8
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoStreaming Interface Descriptor:
+        bLength                            16
+        bDescriptorType                    36
+        bDescriptorSubtype                  1 (INPUT_HEADER)
+        bNumFormats                         3
+        wTotalLength                     2822
+        bEndPointAddress                  129
+        bmInfo                              0
+        bTerminalLink                       4
+        bStillCaptureMethod                 0
+        bTriggerSupport                     0
+        bTriggerUsage                       0
+        bControlSize                        1
+        bmaControls( 0)                    27
+        bmaControls( 1)                    27
+        bmaControls( 2)                    27
+      VideoStreaming Interface Descriptor:
+        bLength                            27
+        bDescriptorType                    36
+        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
+        bFormatIndex                        1
+        bNumFrameDescriptors               19
+        guidFormat                            {59555932-0000-1000-8000-00aa00389b71}
+        bBitsPerPixel                      16
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 2 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                 24576000
+        dwMaxBitRate                147456000
+        dwMaxVideoFrameBufferSize      614400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                            90
+        dwMinBitRate                  1152000
+        dwMaxBitRate                  6912000
+        dwMaxVideoFrameBufferSize       28800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                           120
+        dwMinBitRate                  1536000
+        dwMaxBitRate                  9216000
+        dwMaxVideoFrameBufferSize       38400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         4
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            176
+        wHeight                           144
+        dwMinBitRate                  2027520
+        dwMaxBitRate                 12165120
+        dwMaxVideoFrameBufferSize       50688
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         5
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           180
+        dwMinBitRate                  4608000
+        dwMaxBitRate                 27648000
+        dwMaxVideoFrameBufferSize      115200
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         6
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                  6144000
+        dwMaxBitRate                 36864000
+        dwMaxVideoFrameBufferSize      153600
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         7
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                  8110080
+        dwMaxBitRate                 48660480
+        dwMaxVideoFrameBufferSize      202752
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         8
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            432
+        wHeight                           240
+        dwMinBitRate                  8294400
+        dwMaxBitRate                 49766400
+        dwMaxVideoFrameBufferSize      207360
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         9
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           360
+        dwMinBitRate                 18432000
+        dwMaxBitRate                110592000
+        dwMaxVideoFrameBufferSize      460800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        10
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           448
+        dwMinBitRate                 28672000
+        dwMaxBitRate                172032000
+        dwMaxVideoFrameBufferSize      716800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        11
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           600
+        dwMinBitRate                 38400000
+        dwMaxBitRate                184320000
+        dwMaxVideoFrameBufferSize      960000
+        dwDefaultFrameInterval         416666
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            416666
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           1333333
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        12
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            864
+        wHeight                           480
+        dwMinBitRate                 33177600
+        dwMaxBitRate                159252480
+        dwMaxVideoFrameBufferSize      829440
+        dwDefaultFrameInterval         416666
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            416666
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           1333333
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            42
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        13
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            960
+        wHeight                           720
+        dwMinBitRate                 55296000
+        dwMaxBitRate                165888000
+        dwMaxVideoFrameBufferSize     1382400
+        dwDefaultFrameInterval         666666
+        bFrameIntervalType                  4
+        dwFrameInterval( 0)            666666
+        dwFrameInterval( 1)           1000000
+        dwFrameInterval( 2)           1333333
+        dwFrameInterval( 3)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            42
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        14
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1024
+        wHeight                           576
+        dwMinBitRate                 47185920
+        dwMaxBitRate                141557760
+        dwMaxVideoFrameBufferSize     1179648
+        dwDefaultFrameInterval         666666
+        bFrameIntervalType                  4
+        dwFrameInterval( 0)            666666
+        dwFrameInterval( 1)           1000000
+        dwFrameInterval( 2)           1333333
+        dwFrameInterval( 3)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        15
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           720
+        dwMinBitRate                 73728000
+        dwMaxBitRate                147456000
+        dwMaxVideoFrameBufferSize     1843200
+        dwDefaultFrameInterval        1000000
+        bFrameIntervalType                  3
+        dwFrameInterval( 0)           1000000
+        dwFrameInterval( 1)           1333333
+        dwFrameInterval( 2)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            34
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        16
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                           896
+        dwMinBitRate                114688000
+        dwMaxBitRate                172032000
+        dwMaxVideoFrameBufferSize     2867200
+        dwDefaultFrameInterval        1333333
+        bFrameIntervalType                  2
+        dwFrameInterval( 0)           1333333
+        dwFrameInterval( 1)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        17
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1920
+        wHeight                          1080
+        dwMinBitRate                165888000
+        dwMaxBitRate                165888000
+        dwMaxVideoFrameBufferSize     4147200
+        dwDefaultFrameInterval        2000000
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        18
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           2304
+        wHeight                          1296
+        dwMinBitRate                238878720
+        dwMaxBitRate                238878720
+        dwMaxVideoFrameBufferSize     5971968
+        dwDefaultFrameInterval        4999998
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           4999998
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        19
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           2304
+        wHeight                          1536
+        dwMinBitRate                283115520
+        dwMaxBitRate                283115520
+        dwMaxVideoFrameBufferSize     7077888
+        dwDefaultFrameInterval        4999998
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           4999998
+      VideoStreaming Interface Descriptor:
+        bLength                             6
+        bDescriptorType                    36
+        bDescriptorSubtype                 13 (COLORFORMAT)
+        bColorPrimaries                     1 (BT.709,sRGB)
+        bTransferCharacteristics            1 (BT.709)
+        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
+      VideoStreaming Interface Descriptor:
+        bLength                            28
+        bDescriptorType                    36
+        bDescriptorSubtype                 16 (FORMAT_FRAME_BASED)
+        bFormatIndex                        2
+        bNumFrameDescriptors               17
+        guidFormat                            {48323634-0000-1000-8000-00aa00389b71}
+        bBitsPerPixel                      16
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 2 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+          bVariableSize                     1
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                 24576000
+        dwMaxBitRate                147456000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                            90
+        dwMinBitRate                  1152000
+        dwMaxBitRate                  6912000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                           120
+        dwMinBitRate                  1536000
+        dwMaxBitRate                  9216000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         4
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            176
+        wHeight                           144
+        dwMinBitRate                  2027520
+        dwMaxBitRate                 12165120
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         5
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           180
+        dwMinBitRate                  4608000
+        dwMaxBitRate                 27648000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         6
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                  6144000
+        dwMaxBitRate                 36864000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         7
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                  8110080
+        dwMaxBitRate                 48660480
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         8
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            432
+        wHeight                           240
+        dwMinBitRate                  8294400
+        dwMaxBitRate                 49766400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                         9
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           360
+        dwMinBitRate                 18432000
+        dwMaxBitRate                110592000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        10
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           448
+        dwMinBitRate                 28672000
+        dwMaxBitRate                172032000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        11
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           600
+        dwMinBitRate                 38400000
+        dwMaxBitRate                230400000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        12
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            864
+        wHeight                           480
+        dwMinBitRate                 33177600
+        dwMaxBitRate                199065600
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        13
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            960
+        wHeight                           720
+        dwMinBitRate                 55296000
+        dwMaxBitRate                331776000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        14
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1024
+        wHeight                           576
+        dwMinBitRate                 47185920
+        dwMaxBitRate                283115520
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        15
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           720
+        dwMinBitRate                 73728000
+        dwMaxBitRate                442368000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        16
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                           896
+        dwMinBitRate                114688000
+        dwMaxBitRate                688128000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                 17 (FRAME_FRAME_BASED)
+        bFrameIndex                        17
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1920
+        wHeight                          1080
+        dwMinBitRate                165888000
+        dwMaxBitRate                995328000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwBytesPerLine                      0
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                             6
+        bDescriptorType                    36
+        bDescriptorSubtype                 13 (COLORFORMAT)
+        bColorPrimaries                     1 (BT.709,sRGB)
+        bTransferCharacteristics            1 (BT.709)
+        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
+      VideoStreaming Interface Descriptor:
+        bLength                            11
+        bDescriptorType                    36
+        bDescriptorSubtype                  6 (FORMAT_MJPEG)
+        bFormatIndex                        3
+        bNumFrameDescriptors               17
+        bFlags                              1
+          Fixed-size samples: Yes
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 1 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                 24576000
+        dwMaxBitRate                147456000
+        dwMaxVideoFrameBufferSize      614400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                            90
+        dwMinBitRate                  1152000
+        dwMaxBitRate                  6912000
+        dwMaxVideoFrameBufferSize       28800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                           120
+        dwMinBitRate                  1536000
+        dwMaxBitRate                  9216000
+        dwMaxVideoFrameBufferSize       38400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         4
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            176
+        wHeight                           144
+        dwMinBitRate                  2027520
+        dwMaxBitRate                 12165120
+        dwMaxVideoFrameBufferSize       50688
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         5
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           180
+        dwMinBitRate                  4608000
+        dwMaxBitRate                 27648000
+        dwMaxVideoFrameBufferSize      115200
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         6
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                  6144000
+        dwMaxBitRate                 36864000
+        dwMaxVideoFrameBufferSize      153600
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         7
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                  8110080
+        dwMaxBitRate                 48660480
+        dwMaxVideoFrameBufferSize      202752
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         8
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            432
+        wHeight                           240
+        dwMinBitRate                  8294400
+        dwMaxBitRate                 49766400
+        dwMaxVideoFrameBufferSize      207360
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         9
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           360
+        dwMinBitRate                 18432000
+        dwMaxBitRate                110592000
+        dwMaxVideoFrameBufferSize      460800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        10
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           448
+        dwMinBitRate                 28672000
+        dwMaxBitRate                172032000
+        dwMaxVideoFrameBufferSize      716800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        11
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           600
+        dwMinBitRate                 38400000
+        dwMaxBitRate                230400000
+        dwMaxVideoFrameBufferSize      960000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        12
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            864
+        wHeight                           480
+        dwMinBitRate                 33177600
+        dwMaxBitRate                199065600
+        dwMaxVideoFrameBufferSize      829440
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        13
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            960
+        wHeight                           720
+        dwMinBitRate                 55296000
+        dwMaxBitRate                331776000
+        dwMaxVideoFrameBufferSize     1382400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        14
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1024
+        wHeight                           576
+        dwMinBitRate                 47185920
+        dwMaxBitRate                283115520
+        dwMaxVideoFrameBufferSize     1179648
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        15
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           720
+        dwMinBitRate                 73728000
+        dwMaxBitRate                442368000
+        dwMaxVideoFrameBufferSize     1843200
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        16
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                           896
+        dwMinBitRate                114688000
+        dwMaxBitRate                688128000
+        dwMaxVideoFrameBufferSize     2867200
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            54
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        17
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1920
+        wHeight                          1080
+        dwMinBitRate                165888000
+        dwMaxBitRate                995328000
+        dwMaxVideoFrameBufferSize     4147200
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  7
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            416666
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           1333333
+        dwFrameInterval( 6)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                             6
+        bDescriptorType                    36
+        bDescriptorSubtype                 13 (COLORFORMAT)
+        bColorPrimaries                     1 (BT.709,sRGB)
+        bTransferCharacteristics            1 (BT.709)
+        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x00c0  1x 192 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       2
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0180  1x 384 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       3
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0200  1x 512 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       4
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0280  1x 640 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       5
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0320  1x 800 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       6
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x03b0  1x 944 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       7
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0a80  2x 640 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       8
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0b20  2x 800 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       9
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0be0  2x 992 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting      10
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x1380  3x 896 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting      11
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x13fc  3x 1020 bytes
+        bInterval               1
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         2
+      bInterfaceCount         2
+      bFunctionClass          1 Audio
+      bFunctionSubClass       2 Streaming
+      bFunctionProtocol       0 
+      iFunction               0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        2
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      1 Control Device
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdADC               1.00
+        wTotalLength           38
+        bInCollection           1
+        baInterfaceNr( 0)       3
+      AudioControl Interface Descriptor:
+        bLength                12
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Microphone
+        bAssocTerminal          0
+        bNrChannels             1
+        wChannelConfig     0x0003
+          Left Front (L)
+          Right Front (R)
+        iChannelNames           0 
+        iTerminal               0 
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             3
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          0
+        bSourceID               5
+        iTerminal               0 
+      AudioControl Interface Descriptor:
+        bLength                 8
+        bDescriptorType        36
+        bDescriptorSubtype      6 (FEATURE_UNIT)
+        bUnitID                 5
+        bSourceID               1
+        bControlSize            1
+        bmaControls( 0)      0x03
+          Mute Control
+          Volume Control
+        iFeature                0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                255 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             2
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            1 Discrete
+        tSamFreq[ 0]        16000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0044  1x 68 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       2
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                255 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             2
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            1 Discrete
+        tSamFreq[ 0]        24000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0064  1x 100 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       3
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                255 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             2
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            1 Discrete
+        tSamFreq[ 0]        32000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0084  1x 132 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+Device Qualifier (for other device speed):
+  bLength                10
+  bDescriptorType         6
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  bNumConfigurations      1
+Device Status:     0x0000
+  (Bus Powered)


[9/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
MINIFICPP-283 Created a USB camera sensor processor

This closes #171.

Signed-off-by: Marc Parisi <ph...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/2d9e5719
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/2d9e5719
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/2d9e5719

Branch: refs/heads/master
Commit: 2d9e571905adf5fc5d8abca2e8699a3f1f3e42f3
Parents: 0bdc00e
Author: Andy I. Christianson <an...@andyic.org>
Authored: Wed Nov 1 19:25:36 2017 -0400
Committer: Marc Parisi <ph...@apache.org>
Committed: Wed Nov 8 15:32:43 2017 -0500

----------------------------------------------------------------------
 .travis.yml                                     |    6 +
 CMakeLists.txt                                  |   10 +
 LICENSE                                         |   34 +
 README.md                                       |   10 +
 extensions/usb-camera/CMakeLists.txt            |   96 +
 extensions/usb-camera/GetUSBCamera.cpp          |  430 ++++
 extensions/usb-camera/GetUSBCamera.h            |  147 ++
 libminifi/test/usb-camera-tests/CMakeLists.txt  |   37 +
 thirdparty/libuvc-0.0.6/.gitignore              |    2 +
 thirdparty/libuvc-0.0.6/.travis.yml             |   16 +
 thirdparty/libuvc-0.0.6/CMakeLists.txt          |  118 +
 thirdparty/libuvc-0.0.6/LICENSE.txt             |   31 +
 thirdparty/libuvc-0.0.6/README.md               |   26 +
 thirdparty/libuvc-0.0.6/cameras/isight_imac.txt |  228 ++
 .../libuvc-0.0.6/cameras/isight_macbook.txt     |  228 ++
 .../cameras/logitech_hd_pro_920.txt             | 1817 ++++++++++++++
 .../libuvc-0.0.6/cameras/ms_lifecam_show.txt    |  767 ++++++
 .../libuvc-0.0.6/cameras/quickcampro9000.txt    | 1543 ++++++++++++
 .../cameras/quickcampro9000_builtin_ctrls.txt   |   13 +
 .../cameras/quickcampro9000_extra_ctrls.txt     |   18 +
 thirdparty/libuvc-0.0.6/changelog.txt           |   45 +
 thirdparty/libuvc-0.0.6/doxygen.conf            | 2284 ++++++++++++++++++
 thirdparty/libuvc-0.0.6/include/libuvc/libuvc.h |  741 ++++++
 .../libuvc-0.0.6/include/libuvc/libuvc_config.h |   22 +
 .../include/libuvc/libuvc_config.h.in           |   22 +
 .../include/libuvc/libuvc_internal.h            |  300 +++
 thirdparty/libuvc-0.0.6/include/utlist.h        |  490 ++++
 thirdparty/libuvc-0.0.6/libuvc.pc.in            |   11 +
 thirdparty/libuvc-0.0.6/libuvcConfig.cmake.in   |    3 +
 .../libuvc-0.0.6/libuvcConfigVersion.cmake.in   |   11 +
 thirdparty/libuvc-0.0.6/src/ctrl-gen.c          | 2259 +++++++++++++++++
 thirdparty/libuvc-0.0.6/src/ctrl-gen.py         |  302 +++
 thirdparty/libuvc-0.0.6/src/ctrl.c              |  165 ++
 thirdparty/libuvc-0.0.6/src/device.c            | 1791 ++++++++++++++
 thirdparty/libuvc-0.0.6/src/diag.c              |  355 +++
 thirdparty/libuvc-0.0.6/src/example.c           |  148 ++
 thirdparty/libuvc-0.0.6/src/frame-mjpeg.c       |  187 ++
 thirdparty/libuvc-0.0.6/src/frame.c             |  449 ++++
 thirdparty/libuvc-0.0.6/src/init.c              |  163 ++
 thirdparty/libuvc-0.0.6/src/misc.c              |   58 +
 thirdparty/libuvc-0.0.6/src/stream.c            | 1288 ++++++++++
 thirdparty/libuvc-0.0.6/src/test.c              |  153 ++
 thirdparty/libuvc-0.0.6/standard-units.yaml     |  518 ++++
 43 files changed, 17342 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 892c329..1bec32e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -40,6 +40,8 @@ matrix:
           - ccache
           - libpython3.4-dev
           - liblua5.1-0-dev
+          - libusb-1.0-0-dev
+          - libpng12-dev
       before_install:
         # Establish updated toolchain as default
         - sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
@@ -60,6 +62,8 @@ matrix:
         - package='graphviz'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='python'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='lua'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
+        - package='libusb'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
+        - package='libpng'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
     - os: osx
       osx_image: xcode8.3
       env:
@@ -76,6 +80,8 @@ matrix:
         - package='graphviz'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='python'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
         - package='lua'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
+        - package='libusb'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
+        - package='libpng'; [[ $(brew ls --versions ${package}) ]] && { brew outdated ${package} || brew upgrade ${package}; } || brew install ${package}
 
 script:
   - mkdir ./build && cd ./build && cmake .. ${CMAKE_BUILD_OPTIONS} && make -j2 VERBOSE=1 && make test ARGS="-j2 --output-on-failure" && make linter && make apache-rat && make docs

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07fabcf..0ecfc45 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,6 +156,16 @@ createExtension(DISABLE_SCRIPTING
 				"extensions/script"
 				"${TEST_DIR}/script-tests")
 
+## USB camera extensions
+createExtension(DISABLE_USB_CAMERA
+				USB-CAMERA-EXTENSIONS
+				"USB CAMERA EXTENSIONS"
+				"This enables USB camera support"
+				"extensions/usb-camera"
+				"${TEST_DIR}/usb-camera-tests"
+				"TRUE"
+				"thirdparty/libuvc-0.0.6")
+
 ## NOW WE CAN ADD LIBRARIES AND EXTENSIONS TO MAIN
 
 add_subdirectory(main)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index 815dafc..7ba88e2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -547,6 +547,40 @@ The source is available under a 3-Clause BSD License.
 	USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
 	DAMAGE.
 
+This product bundles 'libuvc' which is available under a BSD license.
+
+Software License Agreement (BSD License)
+
+Copyright (C) 2010-2015 Ken Tossell
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the following
+   disclaimer in the documentation and/or other materials provided
+   with the distribution.
+ * Neither the name of the author nor other contributors may be
+   used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
 This product bundles 'JsonCpp' which is available under a MIT license.
 
 The JsonCpp library's source code, including accompanying documentation,

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 0c73b2b..6f8400d 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,7 @@ Perspectives of the role of MiNiFi should be from the perspective of the agent a
   * ExecuteProcess
   * ExecuteScript
   * GetFile
+  * GetUSBCamera
   * GenerateFlowFile
   * InvokeHTTP
   * LogAttribute
@@ -103,6 +104,8 @@ DIRECTORY UNLESS YOU SPECIFY -DDISABLE_ROCKSDB=true WITH CMAKE ***
 * libarchive
 * Python 3 -- Required, unless Python support is disabled
 * Lua -- Optional, unless Lua support is enabled
+* libusb -- Optional, unless USB Camera support is enabled
+* libpng -- Optional, unless USB Camera support is enabled
 
 The needed dependencies can be installed with the following commands for:
 
@@ -125,6 +128,8 @@ $ # (Optional) for building Python support
 $ yum install python34-devel
 $ # (Optional) for building Lua support
 $ yum install lua-devel
+$ # (Optional) for building USB Camera support
+$ yum install libusb-devel libpng-devel
 $ # (Optional) for building docker image
 $ yum install docker
 $ # (Optional) for system integration tests
@@ -146,6 +151,8 @@ $ # (Optional) for building Python support
 $ apt-get install libpython3-dev
 $ # (Optional) for building Lua support
 $ apt-get install liblua5.1-0-dev
+$ # (Optional) for building USB Camera support
+$ apt-get install libusb-1.0.0-0-dev libpng12-dev
 $ # (Optional) for building docker image
 $ apt-get install docker.io
 $ # (Optional) for system integration tests
@@ -165,6 +172,8 @@ $ brew install cmake \
   doxygen
 $ brew install curl
 $ brew link curl --force
+$ # (Optional) for building USB Camera support
+$ brew install libusb libpng
 $ # (Optional) for building docker image/running system integration tests
 $ # Install docker using instructions at https://docs.docker.com/docker-for-mac/install/
 $ sudo pip install virtualenv
@@ -189,6 +198,7 @@ $ sudo pip install virtualenv
     - `-DDISABLE_CURL=1`
     - `-DDISABLE_ROCKSDB=1`
     - `-DDISABLE_LIBARCHIVE=1`
+    - `-DDISABLE_USB_CAMERA=1`
     - `-DDISABLE_SCRIPTING=1`
     - `-DDISABLE_PYTHON_SCRIPTING=1`
     - `-DENABLE_LUA_SCRIPTING=1`

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/extensions/usb-camera/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/extensions/usb-camera/CMakeLists.txt b/extensions/usb-camera/CMakeLists.txt
new file mode 100644
index 0000000..e24de93
--- /dev/null
+++ b/extensions/usb-camera/CMakeLists.txt
@@ -0,0 +1,96 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+set(CMAKE_EXE_LINKER_FLAGS "-Wl,--export-all-symbols")
+set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-symbols")
+
+find_package(PkgConfig)
+pkg_check_modules(LIBUSB libusb-1.0)
+
+find_package(png QUIET)
+if(PNG_FOUND)
+    set(PNG_LINK_FLAGS ${PNG_LIBRARIES})
+else()
+    pkg_check_modules(PNG QUIET libpng)
+    if(PNG_FOUND)
+        set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS})
+        set(PNG_LINK_FLAGS ${PNG_LDFLAGS})
+    else()
+        find_path(PNG_INCLUDE_DIR png.h)
+        if(PNG_INCLUDE_DIR)
+            set(PNG_FOUND ON)
+            set(PNG_LINK_FLAGS -lpng)
+        endif()
+    endif()
+endif()
+
+if (NOT PNG_FOUND)
+    message(FATAL_ERROR "A compatible PNG library is required to build GetUSBCamera.")
+endif()
+
+include_directories(../../libminifi/include  ../../libminifi/include/core  ../../thirdparty/spdlog-20170710/include ../../thirdparty/concurrentqueue ../../thirdparty/yaml-cpp-yaml-cpp-0.5.3/include ../../thirdparty/civetweb-1.9.1/include ../../thirdparty/jsoncpp/include  ../../thirdparty/) 
+
+include_directories(../../thirdparty/libuvc-0.0.6/include)
+
+file(GLOB SOURCES  "*.cpp")
+
+add_library(minifi-usb-camera-extensions STATIC ${SOURCES})
+set_property(TARGET minifi-usb-camera-extensions PROPERTY POSITION_INDEPENDENT_CODE ON)
+if(THREADS_HAVE_PTHREAD_ARG)
+  target_compile_options(PUBLIC minifi-usb-camera-extensions "-pthread")
+endif()
+if(CMAKE_THREAD_LIBS_INIT)
+  target_link_libraries(minifi-usb-camera-extensions "${CMAKE_THREAD_LIBS_INIT}")
+endif()
+
+find_package(UUID REQUIRED)
+target_link_libraries(minifi-usb-camera-extensions ${LIBMINIFI} ${UUID_LIBRARIES} ${JSONCPP_LIB})
+add_dependencies(minifi-usb-camera-extensions jsoncpp_project)
+find_package(OpenSSL REQUIRED)
+include_directories(${OPENSSL_INCLUDE_DIR})
+target_link_libraries(minifi-usb-camera-extensions ${CMAKE_DL_LIBS} )
+target_link_libraries(minifi-usb-camera-extensions ${PNG_LINK_FLAGS})
+target_link_libraries(minifi-usb-camera-extensions uvc_static )
+target_link_libraries(minifi-usb-camera-extensions ${LIBUSB_LIBRARIES})
+find_package(ZLIB REQUIRED)
+include_directories(${ZLIB_INCLUDE_DIRS})
+target_link_libraries (minifi-usb-camera-extensions ${ZLIB_LIBRARIES})
+find_package(Boost COMPONENTS system filesystem REQUIRED)
+include_directories(${Boost_INCLUDE_DIRS})
+target_link_libraries(minifi-usb-camera-extensions ${Boost_SYSTEM_LIBRARY})
+target_link_libraries(minifi-usb-camera-extensions ${Boost_FILESYSTEM_LIBRARY})
+if (WIN32)
+    set_target_properties(minifi-usb-camera-extensions PROPERTIES
+        LINK_FLAGS "/WHOLEARCHIVE"
+    )
+elseif (APPLE)
+    set_target_properties(minifi-usb-camera-extensions PROPERTIES
+        LINK_FLAGS "-Wl,-all_load"
+    )
+else ()
+    set_target_properties(minifi-usb-camera-extensions PROPERTIES
+        LINK_FLAGS "-Wl,--whole-archive"
+    )
+endif ()
+
+
+SET (USB-CAMERA-EXTENSIONS minifi-usb-camera-extensions PARENT_SCOPE)
+
+register_extension(minifi-usb-camera-extensions)
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/extensions/usb-camera/GetUSBCamera.cpp
----------------------------------------------------------------------
diff --git a/extensions/usb-camera/GetUSBCamera.cpp b/extensions/usb-camera/GetUSBCamera.cpp
new file mode 100644
index 0000000..5f87b45
--- /dev/null
+++ b/extensions/usb-camera/GetUSBCamera.cpp
@@ -0,0 +1,430 @@
+/**
+ * @file GetUSBCamera.cpp
+ * GetUSBCamera class implementation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <png.h>
+
+#include <utility>
+
+#include "GetUSBCamera.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+core::Property GetUSBCamera::FPS(  // NOLINT
+    "FPS",
+    "Frames per second to capture from USB camera",
+    "1");
+core::Property GetUSBCamera::Format(  // NOLINT
+    "Format",
+    "Frame format (currently only PNG and RAW are supported; RAW is a binary pixel buffer of RGB values)",
+    "PNG");
+core::Property GetUSBCamera::VendorID(  // NOLINT
+    "USB Vendor ID",
+    "USB Vendor ID of camera device, in hexadecimal format",
+    "0x0");
+core::Property GetUSBCamera::ProductID(  // NOLINT
+    "USB Product ID",
+    "USB Product ID of camera device, in hexadecimal format",
+    "0x0");
+core::Property GetUSBCamera::SerialNo(  // NOLINT
+    "USB Serial No.",
+    "USB Serial No. of camera device",
+    "");
+core::Relationship GetUSBCamera::Success(  // NOLINT
+    "success",
+    "Sucessfully captured images sent here");
+core::Relationship GetUSBCamera::Failure(  // NOLINT
+    "failure",
+    "Failures sent here");
+
+void GetUSBCamera::initialize() {
+  std::set<core::Property> properties;
+  properties.insert(FPS);
+  properties.insert(Format);
+  properties.insert(VendorID);
+  properties.insert(ProductID);
+  properties.insert(SerialNo);
+  setSupportedProperties(properties);
+
+  std::set<core::Relationship> relationships;
+  relationships.insert(Success);
+  relationships.insert(Failure);
+  setSupportedRelationships(relationships);
+}
+
+void GetUSBCamera::onFrame(uvc_frame_t *frame, void *ptr) {
+  auto cb_data = reinterpret_cast<GetUSBCamera::CallbackData *>(ptr);
+  std::unique_lock<std::recursive_mutex> lock(*(cb_data->dev_access_mtx), std::try_to_lock);
+
+  if (!lock.owns_lock()) {
+    return;
+  }
+
+  auto now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
+
+  if (now - cb_data->last_frame_time < std::chrono::milliseconds(static_cast<int>(1000.0 / cb_data->target_fps))) {
+    return;
+  }
+
+  cb_data->last_frame_time = now;
+
+  try {
+    uvc_error_t ret;
+    cb_data->logger->log_info("Got frame");
+
+    ret = uvc_any2rgb(frame, cb_data->frame_buffer);
+
+    if (ret) {
+      cb_data->logger->log_error("Failed to convert frame to RGB: %s", uvc_strerror(ret));
+      return;
+    }
+
+    auto session = cb_data->session_factory->createSession();
+    auto flow_file = session->create();
+
+    std::string flow_file_name;
+    flow_file->getAttribute("filename", flow_file_name);
+    cb_data->logger->log_info("Created flow file: %s", flow_file_name);
+
+    // Initialize callback according to output format
+    std::shared_ptr<OutputStreamCallback> write_cb;
+
+    if (cb_data->format == "PNG") {
+      write_cb = std::make_shared<GetUSBCamera::PNGWriteCallback>(cb_data->png_write_mtx,
+                                                                  cb_data->frame_buffer,
+                                                                  cb_data->device_width,
+                                                                  cb_data->device_height);
+    } else if (cb_data->format == "RAW") {
+      write_cb = std::make_shared<GetUSBCamera::RawWriteCallback>(cb_data->frame_buffer);
+    } else {
+      cb_data->logger->log_warn("Invalid format specified (%s); defaulting to PNG", cb_data->format);
+      write_cb = std::make_shared<GetUSBCamera::PNGWriteCallback>(cb_data->png_write_mtx,
+                                                                  cb_data->frame_buffer,
+                                                                  cb_data->device_width,
+                                                                  cb_data->device_height);
+    }
+
+    session->write(flow_file, write_cb.get());
+    session->transfer(flow_file, GetUSBCamera::Success);
+    session->commit();
+  } catch (std::exception &exception) {
+    cb_data->logger->log_debug("GetUSBCamera Caught Exception %s", exception.what());
+  } catch (...) {
+    cb_data->logger->log_debug("GetUSBCamera Caught Unknown Exception");
+  }
+}
+
+void GetUSBCamera::onSchedule(core::ProcessContext *context,
+                              core::ProcessSessionFactory *session_factory) {
+  std::lock_guard<std::recursive_mutex> lock(*dev_access_mtx_);
+
+  double default_fps = 1;
+  double target_fps = default_fps;
+  std::string conf_fps_str;
+  context->getProperty("FPS", conf_fps_str);
+
+  if (conf_fps_str.empty()) {
+    logger_->log_info("FPS property was not set; using default %f", default_fps);
+  } else {
+    try {
+      target_fps = std::stod(conf_fps_str);
+    } catch (std::invalid_argument &e) {
+      logger_->log_error("Could not parse configured FPS value (will use default %f): %s", default_fps, conf_fps_str);
+    }
+  }
+
+  std::string conf_format_str;
+  context->getProperty("Format", conf_format_str);
+
+  int usb_vendor_id;
+  std::string conf_vendor_id;
+  context->getProperty("USB Vendor ID", conf_vendor_id);
+  std::stringstream(conf_vendor_id) >> std::hex >> usb_vendor_id;
+  logger_->log_info("Using USB Vendor ID: %x", usb_vendor_id);
+
+  int usb_product_id;
+  std::string conf_product_id;
+  context->getProperty("USB Product ID", conf_product_id);
+  std::stringstream(conf_product_id) >> std::hex >> usb_product_id;
+  logger_->log_info("Using USB Product ID: %x", usb_product_id);
+
+  const char *usb_serial_no = nullptr;
+  std::string conf_serial;
+  context->getProperty("USB Serial No.", conf_serial);
+
+  if (!conf_serial.empty()) {
+    usb_serial_no = conf_serial.c_str();
+    logger_->log_info("Using USB Serial No.: %s", conf_serial);
+  }
+
+  cleanupUvc();
+  logger_->log_info("Beginning to capture frames from USB camera");
+
+  uvc_stream_ctrl_t ctrl{};
+  uvc_error_t res;
+  res = uvc_init(&ctx_, nullptr);
+
+  if (res < 0) {
+    logger_->log_error("Failed to initialize UVC service context");
+    ctx_ = nullptr;
+    return;
+  }
+
+  logger_->log_info("UVC initialized");
+
+  // Locate device
+  res = uvc_find_device(
+      ctx_, &dev_,
+      usb_vendor_id,
+      usb_product_id,
+      usb_serial_no);
+
+  if (res < 0) {
+    logger_->log_error("Unable to find device: %s", uvc_strerror(res));
+    dev_ = nullptr;
+  } else {
+    logger_->log_info("Device found");
+
+    // Open the device
+    res = uvc_open(dev_, &devh_);
+
+    if (res < 0) {
+      logger_->log_error("Unable to open device: %s", uvc_strerror(res));
+      devh_ = nullptr;
+    } else {
+      logger_->log_info("Device opened");
+
+      // Iterate resolutions & framerates >= context fps, or nearest
+      uint16_t width = 0;
+      uint16_t height = 0;
+      uint32_t max_size = 0;
+      uint32_t fps = 0;
+
+      for (auto fmt_desc = uvc_get_format_descs(devh_); fmt_desc; fmt_desc = fmt_desc->next) {
+        uvc_frame_desc_t *frame_desc;
+        switch (fmt_desc->bDescriptorSubtype) {
+          case UVC_VS_FORMAT_UNCOMPRESSED:
+          case UVC_VS_FORMAT_FRAME_BASED:
+            for (frame_desc = fmt_desc->frame_descs; frame_desc; frame_desc = frame_desc->next) {
+              uint32_t frame_fps = 10000000 / frame_desc->dwDefaultFrameInterval;
+              if (frame_desc->dwMaxVideoFrameBufferSize > max_size && frame_fps >= target_fps) {
+                width = frame_desc->wWidth;
+                height = frame_desc->wHeight;
+                max_size = frame_desc->dwMaxVideoFrameBufferSize;
+                fps = frame_fps;
+              }
+            }
+
+          case UVC_VS_FORMAT_MJPEG:logger_->log_info("Skipping MJPEG frame formats");
+
+          default:logger_->log_info("Found unknown format");
+        }
+      }
+
+      if (fps == 0) {
+        logger_->log_error("Could not find suitable frame format from device. "
+                               "Try changing configuration (lower FPS) or device.");
+        return;
+      }
+
+      logger_->log_info("Negotiating stream profile (looking for %dx%d @ %d)", width, height, fps);
+
+      res = uvc_get_stream_ctrl_format_size(
+          devh_, &ctrl,
+          UVC_FRAME_FORMAT_UNCOMPRESSED,
+          width, height, fps
+      );
+
+      if (res < 0) {
+        logger_->log_error("Failed to find a matching stream profile: %s", uvc_strerror(res));
+      } else {
+        cb_data_.session_factory = session_factory;
+
+        if (frame_buffer_ != nullptr) {
+          uvc_free_frame(frame_buffer_);
+        }
+
+        frame_buffer_ = uvc_allocate_frame(width * height * 3);
+
+        if (!frame_buffer_) {
+          printf("unable to allocate bgr frame!");
+          logger_->log_error("Unable to allocate RGB frame");
+          return;
+        }
+
+        cb_data_.frame_buffer = frame_buffer_;
+        cb_data_.context = context;
+        cb_data_.png_write_mtx = png_write_mtx_;
+        cb_data_.dev_access_mtx = dev_access_mtx_;
+        cb_data_.logger = logger_;
+        cb_data_.format = conf_format_str;
+        cb_data_.device_width = width;
+        cb_data_.device_height = height;
+        cb_data_.device_fps = fps;
+        cb_data_.target_fps = target_fps;
+        cb_data_.last_frame_time = std::chrono::milliseconds(0);
+
+        res = uvc_start_streaming(devh_, &ctrl, onFrame, &cb_data_, 0);
+
+        if (res < 0) {
+          logger_->log_error("Unable to start streaming: %s", uvc_strerror(res));
+        } else {
+          logger_->log_info("Streaming...");
+
+          // Enable auto-exposure
+          uvc_set_ae_mode(devh_, 1);
+        }
+      }
+    }
+  }
+}
+
+void GetUSBCamera::cleanupUvc() {
+  std::lock_guard<std::recursive_mutex> lock(*dev_access_mtx_);
+
+  if (frame_buffer_ != nullptr) {
+    logger_->log_info("Deallocating frame buffer");
+    uvc_free_frame(frame_buffer_);
+  }
+
+  if (devh_ != nullptr) {
+    logger_->log_info("Stopping UVC streaming");
+    uvc_stop_streaming(devh_);
+    logger_->log_info("Closing UVC device handle");
+    uvc_close(devh_);
+  }
+
+  if (dev_ != nullptr) {
+    logger_->log_info("Closing UVC device descriptor");
+    uvc_unref_device(dev_);
+  }
+
+  if (ctx_ != nullptr) {
+    logger_->log_info("Closing UVC context");
+    uvc_exit(ctx_);
+  }
+
+  if (camera_thread_ != nullptr) {
+    camera_thread_->join();
+    logger_->log_info("UVC thread ended");
+  }
+}
+
+void GetUSBCamera::onTrigger(core::ProcessContext *context,
+                             core::ProcessSession *session) {
+  auto flowFile = session->get();
+
+  if (flowFile) {
+    logger_->log_error("Received flowfile, but this processor does not support input flow files; routing to failure");
+    session->transfer(flowFile, Failure);
+  }
+}
+
+GetUSBCamera::PNGWriteCallback::PNGWriteCallback(std::shared_ptr<std::mutex> write_mtx,
+                                                 uvc_frame_t *frame,
+                                                 uint32_t width,
+                                                 uint32_t height)
+    : logger_(logging::LoggerFactory<PNGWriteCallback>::getLogger()),
+      frame_(frame),
+      width_(width),
+      height_(height),
+      png_write_mtx_(std::move(write_mtx)) {
+}
+
+int64_t GetUSBCamera::PNGWriteCallback::process(std::shared_ptr<io::BaseStream> stream) {
+  std::lock_guard<std::mutex> lock(*png_write_mtx_);
+  logger_->log_info("Writing %d bytes of raw capture data to PNG output", frame_->data_bytes);
+  png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
+
+  if (!png) {
+    logger_->log_error("Failed to create PNG write struct");
+    return 0;
+  }
+
+  png_infop info = png_create_info_struct(png);
+
+  if (!info) {
+    logger_->log_error("Failed to create PNG info struct");
+    return 0;
+  }
+
+  if (setjmp(png_jmpbuf(png))) {
+    logger_->log_error("Failed to set PNG jmpbuf");
+    return 0;
+  }
+
+  try {
+
+    png_set_write_fn(png, this, [](png_structp out_png,
+                                   png_bytep out_data,
+                                   png_size_t num_bytes) {
+      auto this_callback = reinterpret_cast<PNGWriteCallback *>(png_get_io_ptr(out_png));
+      std::copy(out_data, out_data + num_bytes, std::back_inserter(this_callback->png_output_buf_));
+    }, [](png_structp flush_png) {});
+
+    png_set_IHDR(
+        png,
+        info,
+        width_, height_,
+        8,
+        PNG_COLOR_TYPE_RGB,
+        PNG_INTERLACE_NONE,
+        PNG_COMPRESSION_TYPE_DEFAULT,
+        PNG_FILTER_TYPE_DEFAULT
+    );
+    png_write_info(png, info);
+
+    png_bytep row_pointers[height_];
+
+    for (int y = 0; y < height_; y++) {
+      row_pointers[y] = reinterpret_cast<png_byte *>(frame_->data) + width_ * y * 3;
+    }
+
+    png_write_image(png, &row_pointers[0]);
+    png_write_end(png, nullptr);
+
+    png_destroy_write_struct(&png, &info);
+  } catch (...) {
+    if (png && info) {
+      png_destroy_write_struct(&png, &info);
+    }
+    throw;
+  }
+
+  return stream->writeData(png_output_buf_.data(), png_output_buf_.size());
+}
+
+GetUSBCamera::RawWriteCallback::RawWriteCallback(uvc_frame_t *frame)
+    : logger_(logging::LoggerFactory<RawWriteCallback>::getLogger()),
+      frame_(frame) {
+}
+
+int64_t GetUSBCamera::RawWriteCallback::process(std::shared_ptr<io::BaseStream> stream) {
+  logger_->log_info("Writing %d bytes of raw capture data", frame_->data_bytes);
+  return stream->writeData(reinterpret_cast<uint8_t *>(frame_->data), frame_->data_bytes);
+}
+
+} /* namespace processors */
+} /* namespace minifi */
+} /* namespace nifi */
+} /* namespace apache */
+} /* namespace org */

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/extensions/usb-camera/GetUSBCamera.h
----------------------------------------------------------------------
diff --git a/extensions/usb-camera/GetUSBCamera.h b/extensions/usb-camera/GetUSBCamera.h
new file mode 100644
index 0000000..4cc2b81
--- /dev/null
+++ b/extensions/usb-camera/GetUSBCamera.h
@@ -0,0 +1,147 @@
+/**
+ * @file GetUSBCamera.h
+ * GetUSBCamera class declaration
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef LIBMINIFI_INCLUDE_PROCESSORS_GETUSBCAMERA_H_
+#define LIBMINIFI_INCLUDE_PROCESSORS_GETUSBCAMERA_H_
+
+#include <list>
+#include <memory>
+#include <string>
+
+#include <libuvc/libuvc.h>
+
+#include "FlowFileRecord.h"
+#include "core/Processor.h"
+#include "core/ProcessSession.h"
+#include "core/Core.h"
+#include "core/logging/LoggerConfiguration.h"
+#include "core/Resource.h"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+class GetUSBCamera : public core::Processor {
+ public:
+  explicit GetUSBCamera(const std::string &name, uuid_t uuid = nullptr)
+      : core::Processor(name, uuid),
+        logger_(logging::LoggerFactory<GetUSBCamera>::getLogger()) {
+    png_write_mtx_ = std::make_shared<std::mutex>();
+    dev_access_mtx_ = std::make_shared<std::recursive_mutex>();
+  }
+
+  virtual ~GetUSBCamera() {
+    // We cannot interrupt the PNG write process
+    std::lock_guard<std::mutex> lock(*png_write_mtx_);
+    cleanupUvc();
+  }
+
+  void notifyStop() override {
+    // We cannot interrupt the PNG write process
+    std::lock_guard<std::mutex> lock(*png_write_mtx_);
+    cleanupUvc();
+  }
+
+  static core::Property FPS;
+  static core::Property Format;
+  static core::Property VendorID;
+  static core::Property ProductID;
+  static core::Property SerialNo;
+
+  static core::Relationship Success;
+  static core::Relationship Failure;
+
+  void onSchedule(core::ProcessContext *context,
+                  core::ProcessSessionFactory *session_factory) override;
+  void onTrigger(core::ProcessContext *context,
+                 core::ProcessSession *session) override;
+  void initialize() override;
+
+  typedef struct {
+    core::ProcessContext *context;
+    core::ProcessSessionFactory *session_factory;
+    std::shared_ptr<logging::Logger> logger;
+    std::shared_ptr<std::mutex> png_write_mtx;
+    std::shared_ptr<std::recursive_mutex> dev_access_mtx;
+    std::string format;
+    uvc_frame_t *frame_buffer;
+    uint16_t device_width;
+    uint16_t device_height;
+    uint32_t device_fps;
+    double target_fps;
+    std::chrono::milliseconds last_frame_time;
+  } CallbackData;
+
+  static void onFrame(uvc_frame_t *frame, void *ptr);
+
+  // Write callback for storing camera capture data in PNG format
+  class PNGWriteCallback : public OutputStreamCallback {
+   public:
+    PNGWriteCallback(std::shared_ptr<std::mutex> write_mtx, uvc_frame_t *frame, uint32_t width, uint32_t height);
+    int64_t process(std::shared_ptr<io::BaseStream> stream) override;
+
+   private:
+    std::shared_ptr<std::mutex> png_write_mtx_;
+    uvc_frame_t *frame_;
+    uint32_t width_;
+    uint32_t height_;
+    std::vector<uint8_t> png_output_buf_;
+    std::shared_ptr<logging::Logger> logger_;
+  };
+
+  // Write callback for storing camera capture data as a raw RGB pixel buffer
+  class RawWriteCallback : public OutputStreamCallback {
+   public:
+    explicit RawWriteCallback(uvc_frame_t *frame);
+    int64_t process(std::shared_ptr<io::BaseStream> stream) override;
+
+   private:
+    uvc_frame_t *frame_;
+    std::shared_ptr<logging::Logger> logger_;
+  };
+
+ private:
+  std::shared_ptr<logging::Logger> logger_;
+  static std::shared_ptr<utils::IdGenerator> id_generator_;
+
+  std::shared_ptr<std::thread> camera_thread_;
+  CallbackData cb_data_;
+
+  std::shared_ptr<std::mutex> png_write_mtx_;
+  std::shared_ptr<std::recursive_mutex> dev_access_mtx_;
+
+  uvc_frame_t *frame_buffer_ = nullptr;
+  uvc_context_t *ctx_ = nullptr;
+  uvc_device_t *dev_ = nullptr;
+  uvc_device_handle_t *devh_ = nullptr;
+
+  void cleanupUvc();
+};
+
+REGISTER_RESOURCE(GetUSBCamera);
+
+} /* namespace processors */
+} /* namespace minifi */
+} /* namespace nifi */
+} /* namespace apache */
+} /* namespace org */
+
+#endif  // LIBMINIFI_INCLUDE_PROCESSORS_GETUSBCAMERA_H_

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/libminifi/test/usb-camera-tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/libminifi/test/usb-camera-tests/CMakeLists.txt b/libminifi/test/usb-camera-tests/CMakeLists.txt
new file mode 100644
index 0000000..c00b300
--- /dev/null
+++ b/libminifi/test/usb-camera-tests/CMakeLists.txt
@@ -0,0 +1,37 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+file(GLOB USB_CAMERA_INTEGRATION_TESTS  "*.cpp")
+
+SET(EXTENSIONS_TEST_COUNT 0)
+FOREACH(testfile ${USB_CAMERA_INTEGRATION_TESTS})
+	get_filename_component(testfilename "${testfile}" NAME_WE)
+	add_executable("${testfilename}" "${testfile}" ${SPD_SOURCES} "${TEST_DIR}/TestBase.cpp")
+	target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/usb-camera")
+	target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/thirdparty/libuvc-0.0.6/include")
+	createTests("${testfilename}")
+	if (APPLE)
+	      target_link_libraries (${testfilename} -Wl,-all_load minifi-usb-camera-extensions)
+	else ()
+	    target_link_libraries (${testfilename} -Wl,--whole-archive minifi-usb-camera-extensions -Wl,--no-whole-archive)
+	endif ()
+	MATH(EXPR EXTENSIONS_TEST_COUNT "${EXTENSIONS_TEST_COUNT}+1")
+	add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
+ENDFOREACH()
+message("-- Finished building ${USB_CAMERA-EXTENSIONS_TEST_COUNT} Lib Archive related test file(s)...")

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/.gitignore
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/.gitignore b/thirdparty/libuvc-0.0.6/.gitignore
new file mode 100644
index 0000000..5f97a27
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/.gitignore
@@ -0,0 +1,2 @@
+# Build directory (recommended location)
+build/

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/.travis.yml
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/.travis.yml b/thirdparty/libuvc-0.0.6/.travis.yml
new file mode 100644
index 0000000..fe27da4
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/.travis.yml
@@ -0,0 +1,16 @@
+sudo: false
+language: cpp
+compiler:
+ - gcc
+ - clang
+addons:
+ apt:
+  packages:
+   - libusb-1.0-0-dev
+   - libjpeg-dev
+before_script:
+ - mkdir build
+ - cd build
+ - cmake ..
+script:
+ - make

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/CMakeLists.txt b/thirdparty/libuvc-0.0.6/CMakeLists.txt
new file mode 100644
index 0000000..9252224
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/CMakeLists.txt
@@ -0,0 +1,118 @@
+cmake_minimum_required(VERSION 2.8)
+project(libuvc)
+
+if (NOT CMAKE_BUILD_TYPE)
+  message(STATUS "No build type selected, default to Release")
+  set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
+endif ()
+
+if (NOT CMAKE_BUILD_TARGET)
+  message(STATUS "No target type selected, default to both shared and static library")
+  set(CMAKE_BUILD_TARGET "Both" CACHE STRING "" FORCE)
+endif()
+
+set(libuvc_VERSION_MAJOR 0)
+set(libuvc_VERSION_MINOR 0)
+set(libuvc_VERSION_PATCH 6)
+set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERSION_PATCH})
+
+set(libuvc_DESCRIPTION "A cross-platform library for USB video devices")
+set(libuvc_URL "https://github.com/ktossell/libuvc")
+
+find_package(PkgConfig)
+pkg_check_modules(LIBUSB libusb-1.0)
+
+include(GNUInstallDirs)
+
+SET(CMAKE_C_FLAGS_DEBUG "-g -DUVC_DEBUGGING")
+
+SET(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/lib/cmake/libuvc" CACHE PATH
+	"Installation directory for CMake files")
+
+SET(SOURCES src/ctrl.c src/ctrl-gen.c src/device.c src/diag.c
+           src/frame.c src/init.c src/stream.c
+           src/misc.c)
+
+include_directories(
+  ${libuvc_SOURCE_DIR}/include
+  ${libuvc_BINARY_DIR}/include
+  ${LIBUSB_INCLUDE_DIRS}
+)
+
+message(WARNING "libuvc will not support JPEG decoding.")
+
+if(${CMAKE_BUILD_TARGET} MATCHES "Shared")
+  set(BUILD_UVC_SHARED TRUE)
+elseif(${CMAKE_BUILD_TARGET} MATCHES "Static")
+  set(BUILD_UVC_STATIC TRUE)
+elseif(${CMAKE_BUILD_TARGET} MATCHES "Both")
+  set(BUILD_UVC_SHARED TRUE)
+  set(BUILD_UVC_STATIC TRUE)
+else()
+  message( FATAL_ERROR "Invalid build type ${CMAKE_BUILD_TARGET}" )
+endif()
+
+if(BUILD_UVC_SHARED)
+  add_library(uvc SHARED ${SOURCES})
+  list(APPEND UVC_TARGETS uvc)
+endif()
+
+if(BUILD_UVC_STATIC)
+  add_library(uvc_static STATIC ${SOURCES})
+  set_target_properties(uvc_static PROPERTIES OUTPUT_NAME uvc)
+  list(APPEND UVC_TARGETS uvc_static)
+endif()
+
+configure_file(include/libuvc/libuvc_config.h.in
+  ${PROJECT_BINARY_DIR}/include/libuvc/libuvc_config.h @ONLY)
+
+foreach(target_name ${UVC_TARGETS})
+  set_target_properties(${target_name} PROPERTIES
+    PUBLIC_HEADER "include/libuvc/libuvc.h;${libuvc_BINARY_DIR}/include/libuvc/libuvc_config.h" )
+endforeach()
+
+if(BUILD_UVC_SHARED)
+  if(JPEG_FOUND)
+    target_link_libraries (uvc ${JPEG_LINK_FLAGS})
+  endif(JPEG_FOUND)
+
+  target_link_libraries(uvc ${LIBUSB_LIBRARIES})
+
+  #add_executable(test src/test.c)
+  #target_link_libraries(test uvc ${LIBUSB_LIBRARIES} opencv_highgui
+  #  opencv_core)
+endif()
+
+install(TARGETS ${UVC_TARGETS}
+    EXPORT libuvcTargets
+  LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}"
+  ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}"
+  PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc"
+)
+
+export(TARGETS ${UVC_TARGETS}
+  FILE "${PROJECT_BINARY_DIR}/libuvcTargets.cmake")
+export(PACKAGE libuvc)
+
+set(CONF_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
+set(CONF_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
+set(CONF_LIBRARY "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_SHARED_LIBRARY_PREFIX}uvc${CMAKE_SHARED_LIBRARY_SUFFIX}")
+
+configure_file(libuvcConfig.cmake.in ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/libuvcConfig.cmake)
+
+configure_file(libuvcConfigVersion.cmake.in ${PROJECT_BINARY_DIR}/libuvcConfigVersion.cmake @ONLY)
+
+configure_file(libuvc.pc.in ${PROJECT_BINARY_DIR}/libuvc.pc @ONLY)
+
+install(FILES
+  "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/libuvcConfig.cmake"
+  "${PROJECT_BINARY_DIR}/libuvcConfigVersion.cmake"
+  DESTINATION "${INSTALL_CMAKE_DIR}")
+
+install(EXPORT libuvcTargets
+  DESTINATION "${INSTALL_CMAKE_DIR}")
+
+install(FILES
+  "${PROJECT_BINARY_DIR}/libuvc.pc"
+  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/LICENSE.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/LICENSE.txt b/thirdparty/libuvc-0.0.6/LICENSE.txt
new file mode 100644
index 0000000..4acc5dd
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/LICENSE.txt
@@ -0,0 +1,31 @@
+Software License Agreement (BSD License)
+
+Copyright (C) 2010-2015 Ken Tossell
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the following
+   disclaimer in the documentation and/or other materials provided
+   with the distribution.
+ * Neither the name of the author nor other contributors may be
+   used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/README.md
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/README.md b/thirdparty/libuvc-0.0.6/README.md
new file mode 100644
index 0000000..399441a
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/README.md
@@ -0,0 +1,26 @@
+`libuvc` is a cross-platform library for USB video devices, built atop `libusb`.
+It enables fine-grained control over USB video devices exporting the standard USB Video Class
+(UVC) interface, enabling developers to write drivers for previously unsupported devices,
+or just access UVC devices in a generic fashion.
+
+## Getting and Building libuvc
+
+Prerequisites: You will need `libusb` and [CMake](http://www.cmake.org/) installed.
+
+To build, you can just run these shell commands:
+
+    git clone https://github.com/ktossell/libuvc
+    cd libuvc
+    mkdir build
+    cd build
+    cmake ..
+    make && sudo make install
+
+and you're set! If you want to change the build configuration, you can edit `CMakeCache.txt`
+in the build directory, or use a CMake GUI to make the desired changes.
+
+## Developing with libuvc
+
+The documentation for `libuvc` can currently be found at https://int80k.com/libuvc/doc/.
+
+Happy hacking!

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/cameras/isight_imac.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/cameras/isight_imac.txt b/thirdparty/libuvc-0.0.6/cameras/isight_imac.txt
new file mode 100644
index 0000000..e367025
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/cameras/isight_imac.txt
@@ -0,0 +1,228 @@
+
+Bus 001 Device 007: ID 05ac:8501 Apple, Inc. Built-in iSight [Micron]
+Device Descriptor:
+  bLength                18
+  bDescriptorType         1
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  idVendor           0x05ac Apple, Inc.
+  idProduct          0x8501 Built-in iSight [Micron]
+  bcdDevice            1.89
+  iManufacturer           1 Micron
+  iProduct                2 Built-in iSight
+  iSerial                 0 
+  bNumConfigurations      1
+  Configuration Descriptor:
+    bLength                 9
+    bDescriptorType         2
+    wTotalLength          267
+    bNumInterfaces          2
+    bConfigurationValue     1
+    iConfiguration          0 
+    bmAttributes         0x80
+      (Bus Powered)
+    MaxPower              100mA
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         0
+      bInterfaceCount         2
+      bFunctionClass         14 Video
+      bFunctionSubClass       3 Video Interface Collection
+      bFunctionProtocol       0 
+      iFunction               0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        0
+      bAlternateSetting       0
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      1 Video Control
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoControl Interface Descriptor:
+        bLength                13
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdUVC               1.00
+        wTotalLength           49
+        dwClockFrequency       13.500000MHz
+        bInCollection           1
+        baInterfaceNr( 0)       1
+      VideoControl Interface Descriptor:
+        bLength                16
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Camera Sensor
+        bAssocTerminal          0
+        iTerminal               0 
+        wObjectiveFocalLengthMin      0
+        wObjectiveFocalLengthMax      0
+        wOcularFocalLength            0
+        bControlSize                  1
+        bmControls           0x00000000
+      VideoControl Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      5 (PROCESSING_UNIT)
+      Warning: Descriptor too short
+        bUnitID                 2
+        bSourceID               1
+        wMaxMultiplier          0
+        bControlSize            2
+        bmControls     0x00000039
+          Brightness
+          Saturation
+          Sharpness
+          Gamma
+        iProcessing             0 
+        bmVideoStandards     0x 9
+          None
+          SECAM - 625/50
+      VideoControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             3
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          0
+        bSourceID               2
+        iTerminal               0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            3
+          Transfer Type            Interrupt
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0008  1x 8 bytes
+        bInterval              10
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoStreaming Interface Descriptor:
+        bLength                            14
+        bDescriptorType                    36
+        bDescriptorSubtype                  1 (INPUT_HEADER)
+        bNumFormats                         1
+        wTotalLength                      155
+        bEndPointAddress                  130
+        bmInfo                              0
+        bTerminalLink                       3
+        bStillCaptureMethod                 0
+        bTriggerSupport                     0
+        bTriggerUsage                       0
+        bControlSize                        1
+        bmaControls( 0)                    27
+      VideoStreaming Interface Descriptor:
+        bLength                            27
+        bDescriptorType                    36
+        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
+        bFormatIndex                        1
+        bNumFrameDescriptors                3
+        guidFormat                            {55595659-0000-1000-8000-00aa00389b71}
+        bBitsPerPixel                      16
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 1 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                383976960
+        dwMaxBitRate                383976960
+        dwMaxVideoFrameBufferSize      614400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  0
+        dwMinFrameInterval             333333
+        dwMaxFrameInterval             333333
+        dwFrameIntervalStep                 0
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                383976960
+        dwMaxBitRate                383976960
+        dwMaxVideoFrameBufferSize      202752
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  0
+        dwMinFrameInterval             333333
+        dwMaxFrameInterval             333333
+        dwFrameIntervalStep                 0
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                383976960
+        dwMaxBitRate                383976960
+        dwMaxVideoFrameBufferSize      153600
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  0
+        dwMinFrameInterval             333333
+        dwMaxFrameInterval             333333
+        dwFrameIntervalStep                 0
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x1400  3x 1024 bytes
+        bInterval               1
+Device Qualifier (for other device speed):
+  bLength                10
+  bDescriptorType         6
+  bcdUSB               2.00
+  bDeviceClass           14 Video
+  bDeviceSubClass         2 Video Streaming
+  bDeviceProtocol         0 
+  bMaxPacketSize0         8
+  bNumConfigurations      1
+Device Status:     0x0000
+  (Bus Powered)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/cameras/isight_macbook.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/cameras/isight_macbook.txt b/thirdparty/libuvc-0.0.6/cameras/isight_macbook.txt
new file mode 100644
index 0000000..62d0337
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/cameras/isight_macbook.txt
@@ -0,0 +1,228 @@
+
+Bus 001 Device 010: ID 05ac:8501 Apple, Inc. Built-in iSight [Micron]
+Device Descriptor:
+  bLength                18
+  bDescriptorType         1
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  idVendor           0x05ac Apple, Inc.
+  idProduct          0x8501 Built-in iSight [Micron]
+  bcdDevice            1.89
+  iManufacturer           1 Micron
+  iProduct                2 Built-in iSight
+  iSerial                 0 
+  bNumConfigurations      1
+  Configuration Descriptor:
+    bLength                 9
+    bDescriptorType         2
+    wTotalLength          267
+    bNumInterfaces          2
+    bConfigurationValue     1
+    iConfiguration          0 
+    bmAttributes         0x80
+      (Bus Powered)
+    MaxPower              100mA
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         0
+      bInterfaceCount         2
+      bFunctionClass         14 Video
+      bFunctionSubClass       3 Video Interface Collection
+      bFunctionProtocol       0 
+      iFunction               0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        0
+      bAlternateSetting       0
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      1 Video Control
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoControl Interface Descriptor:
+        bLength                13
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdUVC               1.00
+        wTotalLength           49
+        dwClockFrequency       13.500000MHz
+        bInCollection           1
+        baInterfaceNr( 0)       1
+      VideoControl Interface Descriptor:
+        bLength                16
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Camera Sensor
+        bAssocTerminal          0
+        iTerminal               0 
+        wObjectiveFocalLengthMin      0
+        wObjectiveFocalLengthMax      0
+        wOcularFocalLength            0
+        bControlSize                  1
+        bmControls           0x00000000
+      VideoControl Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      5 (PROCESSING_UNIT)
+      Warning: Descriptor too short
+        bUnitID                 2
+        bSourceID               1
+        wMaxMultiplier          0
+        bControlSize            2
+        bmControls     0x00000039
+          Brightness
+          Saturation
+          Sharpness
+          Gamma
+        iProcessing             0 
+        bmVideoStandards     0x 9
+          None
+          SECAM - 625/50
+      VideoControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             3
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          0
+        bSourceID               2
+        iTerminal               0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            3
+          Transfer Type            Interrupt
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0008  1x 8 bytes
+        bInterval              10
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoStreaming Interface Descriptor:
+        bLength                            14
+        bDescriptorType                    36
+        bDescriptorSubtype                  1 (INPUT_HEADER)
+        bNumFormats                         1
+        wTotalLength                      155
+        bEndPointAddress                  130
+        bmInfo                              0
+        bTerminalLink                       3
+        bStillCaptureMethod                 0
+        bTriggerSupport                     0
+        bTriggerUsage                       0
+        bControlSize                        1
+        bmaControls( 0)                    27
+      VideoStreaming Interface Descriptor:
+        bLength                            27
+        bDescriptorType                    36
+        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
+        bFormatIndex                        1
+        bNumFrameDescriptors                3
+        guidFormat                            {55595659-0000-1000-8000-00aa00389b71}
+        bBitsPerPixel                      16
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 1 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                383976960
+        dwMaxBitRate                383976960
+        dwMaxVideoFrameBufferSize      614400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  0
+        dwMinFrameInterval             333333
+        dwMaxFrameInterval             333333
+        dwFrameIntervalStep                 0
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                383976960
+        dwMaxBitRate                383976960
+        dwMaxVideoFrameBufferSize      202752
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  0
+        dwMinFrameInterval             333333
+        dwMaxFrameInterval             333333
+        dwFrameIntervalStep                 0
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                383976960
+        dwMaxBitRate                383976960
+        dwMaxVideoFrameBufferSize      153600
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  0
+        dwMinFrameInterval             333333
+        dwMaxFrameInterval             333333
+        dwFrameIntervalStep                 0
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x1400  3x 1024 bytes
+        bInterval               1
+Device Qualifier (for other device speed):
+  bLength                10
+  bDescriptorType         6
+  bcdUSB               2.00
+  bDeviceClass           14 Video
+  bDeviceSubClass         2 Video Streaming
+  bDeviceProtocol         0 
+  bMaxPacketSize0         8
+  bNumConfigurations      1
+Device Status:     0x0000
+  (Bus Powered)


[7/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/cameras/ms_lifecam_show.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/cameras/ms_lifecam_show.txt b/thirdparty/libuvc-0.0.6/cameras/ms_lifecam_show.txt
new file mode 100644
index 0000000..d8f9650
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/cameras/ms_lifecam_show.txt
@@ -0,0 +1,767 @@
+
+Bus 001 Device 010: ID 045e:0729 Microsoft Corp. 
+Device Descriptor:
+  bLength                18
+  bDescriptorType         1
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  idVendor           0x045e Microsoft Corp.
+  idProduct          0x0729 
+  bcdDevice            1.00
+  iManufacturer           1 Microsoft
+  iProduct                2 Microsoft� LifeCam Show(TM)
+  iSerial                 0 
+  bNumConfigurations      1
+  Configuration Descriptor:
+    bLength                 9
+    bDescriptorType         2
+    wTotalLength          961
+    bNumInterfaces          5
+    bConfigurationValue     1
+    iConfiguration          0 
+    bmAttributes         0x80
+      (Bus Powered)
+    MaxPower              320mA
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         0
+      bInterfaceCount         2
+      bFunctionClass         14 Video
+      bFunctionSubClass       3 Video Interface Collection
+      bFunctionProtocol       0 
+      iFunction               2 Microsoft� LifeCam Show(TM)
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        0
+      bAlternateSetting       0
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      1 Video Control
+      bInterfaceProtocol      0 
+      iInterface              2 Microsoft� LifeCam Show(TM)
+      VideoControl Interface Descriptor:
+        bLength                13
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdUVC               1.00
+        wTotalLength           79
+        dwClockFrequency       24.000000MHz
+        bInCollection           1
+        baInterfaceNr( 0)       1
+      VideoControl Interface Descriptor:
+        bLength                18
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Camera Sensor
+        bAssocTerminal          0
+        iTerminal               0 
+        wObjectiveFocalLengthMin      0
+        wObjectiveFocalLengthMax      0
+        wOcularFocalLength            0
+        bControlSize                  3
+        bmControls           0x00000a0a
+          Auto-Exposure Mode
+          Exposure Time (Absolute)
+          Zoom (Absolute)
+          PanTilt (Absolute)
+      VideoControl Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      5 (PROCESSING_UNIT)
+      Warning: Descriptor too short
+        bUnitID                 2
+        bSourceID               1
+        wMaxMultiplier          0
+        bControlSize            2
+        bmControls     0x0000073b
+          Brightness
+          Contrast
+          Saturation
+          Sharpness
+          Gamma
+          Backlight Compensation
+          Gain
+          Power Line Frequency
+        iProcessing             0 
+        bmVideoStandards     0x 9
+          None
+          SECAM - 625/50
+      VideoControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             3
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          0
+        bSourceID               2
+        iTerminal               0 
+      VideoControl Interface Descriptor:
+        bLength                28
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                 4
+        guidExtensionCode         {5dc717a9-1941-da11-ae0e-000d56ac7b4c}
+        bNumControl             8
+        bNrPins                 1
+        baSourceID( 0)          1
+        bControlSize            3
+        bmControls( 0)       0xf9
+        bmControls( 1)       0x01
+        bmControls( 2)       0xc0
+        iExtension              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            3
+          Transfer Type            Interrupt
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x000a  1x 10 bytes
+        bInterval               5
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoStreaming Interface Descriptor:
+        bLength                            15
+        bDescriptorType                    36
+        bDescriptorSubtype                  1 (INPUT_HEADER)
+        bNumFormats                         2
+        wTotalLength                      587
+        bEndPointAddress                  130
+        bmInfo                              0
+        bTerminalLink                       3
+        bStillCaptureMethod                 2
+        bTriggerSupport                     1
+        bTriggerUsage                       1
+        bControlSize                        1
+        bmaControls( 0)                    27
+        bmaControls( 1)                    27
+      VideoStreaming Interface Descriptor:
+        bLength                            27
+        bDescriptorType                    36
+        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
+        bFormatIndex                        1
+        bNumFrameDescriptors                6
+        guidFormat                            {59555932-0000-1000-8000-00aa00389b71}
+        bBitsPerPixel                      16
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 1 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         4
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            176
+        wHeight                           144
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         5
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                           120
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         6
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           600
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
+        bEndpointAddress                    0
+        bNumImageSizePatterns               6
+        wWidth( 0)                        352
+        wHeight( 0)                       288
+        wWidth( 1)                        640
+        wHeight( 1)                       480
+        wWidth( 2)                        320
+        wHeight( 2)                       240
+        wWidth( 3)                        176
+        wHeight( 3)                       144
+        wWidth( 4)                        160
+        wHeight( 4)                       120
+        wWidth( 5)                        800
+        wHeight( 5)                       600
+        bNumCompressionPatterns             6
+      VideoStreaming Interface Descriptor:
+        bLength                             6
+        bDescriptorType                    36
+        bDescriptorSubtype                 13 (COLORFORMAT)
+        bColorPrimaries                     0 (Unspecified)
+        bTransferCharacteristics            0 (Unspecified)
+        bMatrixCoefficients                 0 (Unspecified)
+      VideoStreaming Interface Descriptor:
+        bLength                            11
+        bDescriptorType                    36
+        bDescriptorSubtype                  6 (FORMAT_MJPEG)
+        bFormatIndex                        2
+        bNumFrameDescriptors                9
+        bFlags                              1
+          Fixed-size samples: Yes
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 1 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         4
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            176
+        wHeight                           144
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         5
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                           120
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         6
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           600
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval         666667
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)            666667
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         7
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1024
+        wHeight                           768
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval        1333333
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           1333333
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         8
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           960
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval        1333333
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           1333333
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         9
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                          1200
+        dwMinBitRate                196608000
+        dwMaxBitRate                196608000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval        1333333
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           1333333
+      VideoStreaming Interface Descriptor:
+        bLength                            42
+        bDescriptorType                    36
+        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
+        bEndpointAddress                    0
+        bNumImageSizePatterns               9
+        wWidth( 0)                        352
+        wHeight( 0)                       288
+        wWidth( 1)                        640
+        wHeight( 1)                       480
+        wWidth( 2)                        320
+        wHeight( 2)                       240
+        wWidth( 3)                        176
+        wHeight( 3)                       144
+        wWidth( 4)                        160
+        wHeight( 4)                       120
+        wWidth( 5)                        800
+        wHeight( 5)                       600
+        wWidth( 6)                       1024
+        wHeight( 6)                       768
+        wWidth( 7)                       1280
+        wHeight( 7)                       960
+        wWidth( 8)                       1600
+        wHeight( 8)                      1200
+        bNumCompressionPatterns             9
+      VideoStreaming Interface Descriptor:
+        bLength                             6
+        bDescriptorType                    36
+        bDescriptorSubtype                 13 (COLORFORMAT)
+        bColorPrimaries                     0 (Unspecified)
+        bTransferCharacteristics            0 (Unspecified)
+        bMatrixCoefficients                 0 (Unspecified)
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0080  1x 128 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       2
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0200  1x 512 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       3
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0400  1x 1024 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       4
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0b00  2x 768 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       5
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0c00  2x 1024 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       6
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x1380  3x 896 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       7
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x82  EP 2 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x1400  3x 1024 bytes
+        bInterval               1
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         2
+      bInterfaceCount         2
+      bFunctionClass          1 Audio
+      bFunctionSubClass       2 Streaming
+      bFunctionProtocol       0 
+      iFunction               2 Microsoft� LifeCam Show(TM)
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        2
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      1 Control Device
+      bInterfaceProtocol      0 
+      iInterface              2 Microsoft� LifeCam Show(TM)
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdADC               1.00
+        wTotalLength           39
+        bInCollection           1
+        baInterfaceNr( 0)       3
+      AudioControl Interface Descriptor:
+        bLength                12
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Microphone
+        bAssocTerminal          0
+        bNrChannels             1
+        wChannelConfig     0x0000
+        iChannelNames           0 
+        iTerminal               0 
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      6 (FEATURE_UNIT)
+        bUnitID                 2
+        bSourceID               1
+        bControlSize            1
+        bmaControls( 0)      0x00
+        bmaControls( 1)      0x03
+          Mute
+          Volume
+        iFeature                0 
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             3
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          1
+        bSourceID               2
+        iTerminal               0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                  1 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                14
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             1
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            2 Discrete
+        tSamFreq[ 0]        44100
+        tSamFreq[ 1]        48000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x83  EP 3 IN
+        bmAttributes            1
+          Transfer Type            Isochronous
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0062  1x 98 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        4
+      bAlternateSetting       0
+      bNumEndpoints           1
+      bInterfaceClass         3 Human Interface Device
+      bInterfaceSubClass      1 Boot Interface Subclass
+      bInterfaceProtocol      1 Keyboard
+      iInterface              0 
+        HID Device Descriptor:
+          bLength                 9
+          bDescriptorType        33
+          bcdHID               1.10
+          bCountryCode            0 Not supported
+          bNumDescriptors         1
+          bDescriptorType        34 Report
+          wDescriptorLength      24
+         Report Descriptors: 
+           ** UNAVAILABLE **
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x85  EP 5 IN
+        bmAttributes            3
+          Transfer Type            Interrupt
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0001  1x 1 bytes
+        bInterval              10
+Device Qualifier (for other device speed):
+  bLength                10
+  bDescriptorType         6
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  bNumConfigurations      1
+Device Status:     0x0000
+  (Bus Powered)


[4/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/include/libuvc/libuvc.h
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/include/libuvc/libuvc.h b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc.h
new file mode 100644
index 0000000..fa0aea0
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc.h
@@ -0,0 +1,741 @@
+#ifndef LIBUVC_H
+#define LIBUVC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h> // FILE
+#include <stdint.h>
+#include <sys/time.h>
+#include <libuvc/libuvc_config.h>
+
+struct libusb_context;
+struct libusb_device_handle;
+
+/** UVC error types, based on libusb errors
+ * @ingroup diag
+ */
+typedef enum uvc_error {
+  /** Success (no error) */
+  UVC_SUCCESS = 0,
+  /** Input/output error */
+  UVC_ERROR_IO = -1,
+  /** Invalid parameter */
+  UVC_ERROR_INVALID_PARAM = -2,
+  /** Access denied */
+  UVC_ERROR_ACCESS = -3,
+  /** No such device */
+  UVC_ERROR_NO_DEVICE = -4,
+  /** Entity not found */
+  UVC_ERROR_NOT_FOUND = -5,
+  /** Resource busy */
+  UVC_ERROR_BUSY = -6,
+  /** Operation timed out */
+  UVC_ERROR_TIMEOUT = -7,
+  /** Overflow */
+  UVC_ERROR_OVERFLOW = -8,
+  /** Pipe error */
+  UVC_ERROR_PIPE = -9,
+  /** System call interrupted */
+  UVC_ERROR_INTERRUPTED = -10,
+  /** Insufficient memory */
+  UVC_ERROR_NO_MEM = -11,
+  /** Operation not supported */
+  UVC_ERROR_NOT_SUPPORTED = -12,
+  /** Device is not UVC-compliant */
+  UVC_ERROR_INVALID_DEVICE = -50,
+  /** Mode not supported */
+  UVC_ERROR_INVALID_MODE = -51,
+  /** Resource has a callback (can't use polling and async) */
+  UVC_ERROR_CALLBACK_EXISTS = -52,
+  /** Undefined error */
+  UVC_ERROR_OTHER = -99
+} uvc_error_t;
+
+/** Color coding of stream, transport-independent
+ * @ingroup streaming
+ */
+enum uvc_frame_format {
+  UVC_FRAME_FORMAT_UNKNOWN = 0,
+  /** Any supported format */
+  UVC_FRAME_FORMAT_ANY = 0,
+  UVC_FRAME_FORMAT_UNCOMPRESSED,
+  UVC_FRAME_FORMAT_COMPRESSED,
+  /** YUYV/YUV2/YUV422: YUV encoding with one luminance value per pixel and
+   * one UV (chrominance) pair for every two pixels.
+   */
+  UVC_FRAME_FORMAT_YUYV,
+  UVC_FRAME_FORMAT_UYVY,
+  /** 24-bit RGB */
+  UVC_FRAME_FORMAT_RGB,
+  UVC_FRAME_FORMAT_BGR,
+  /** Motion-JPEG (or JPEG) encoded images */
+  UVC_FRAME_FORMAT_MJPEG,
+  /** Greyscale images */
+  UVC_FRAME_FORMAT_GRAY8,
+  UVC_FRAME_FORMAT_GRAY16,
+  /* Raw colour mosaic images */
+  UVC_FRAME_FORMAT_BY8,
+  UVC_FRAME_FORMAT_BA81,
+  UVC_FRAME_FORMAT_SGRBG8,
+  UVC_FRAME_FORMAT_SGBRG8,
+  UVC_FRAME_FORMAT_SRGGB8,
+  UVC_FRAME_FORMAT_SBGGR8,
+  /** Number of formats understood */
+  UVC_FRAME_FORMAT_COUNT,
+};
+
+/* UVC_COLOR_FORMAT_* have been replaced with UVC_FRAME_FORMAT_*. Please use
+ * UVC_FRAME_FORMAT_* instead of using these. */
+#define UVC_COLOR_FORMAT_UNKNOWN UVC_FRAME_FORMAT_UNKNOWN
+#define UVC_COLOR_FORMAT_UNCOMPRESSED UVC_FRAME_FORMAT_UNCOMPRESSED
+#define UVC_COLOR_FORMAT_COMPRESSED UVC_FRAME_FORMAT_COMPRESSED
+#define UVC_COLOR_FORMAT_YUYV UVC_FRAME_FORMAT_YUYV
+#define UVC_COLOR_FORMAT_UYVY UVC_FRAME_FORMAT_UYVY
+#define UVC_COLOR_FORMAT_RGB UVC_FRAME_FORMAT_RGB
+#define UVC_COLOR_FORMAT_BGR UVC_FRAME_FORMAT_BGR
+#define UVC_COLOR_FORMAT_MJPEG UVC_FRAME_FORMAT_MJPEG
+#define UVC_COLOR_FORMAT_GRAY8 UVC_FRAME_FORMAT_GRAY8
+#define UVC_COLOR_FORMAT_GRAY16 UVC_FRAME_FORMAT_GRAY16
+
+/** VideoStreaming interface descriptor subtype (A.6) */
+enum uvc_vs_desc_subtype {
+  UVC_VS_UNDEFINED = 0x00,
+  UVC_VS_INPUT_HEADER = 0x01,
+  UVC_VS_OUTPUT_HEADER = 0x02,
+  UVC_VS_STILL_IMAGE_FRAME = 0x03,
+  UVC_VS_FORMAT_UNCOMPRESSED = 0x04,
+  UVC_VS_FRAME_UNCOMPRESSED = 0x05,
+  UVC_VS_FORMAT_MJPEG = 0x06,
+  UVC_VS_FRAME_MJPEG = 0x07,
+  UVC_VS_FORMAT_MPEG2TS = 0x0a,
+  UVC_VS_FORMAT_DV = 0x0c,
+  UVC_VS_COLORFORMAT = 0x0d,
+  UVC_VS_FORMAT_FRAME_BASED = 0x10,
+  UVC_VS_FRAME_FRAME_BASED = 0x11,
+  UVC_VS_FORMAT_STREAM_BASED = 0x12
+};
+
+struct uvc_format_desc;
+struct uvc_frame_desc;
+
+/** Frame descriptor
+ *
+ * A "frame" is a configuration of a streaming format
+ * for a particular image size at one of possibly several
+ * available frame rates.
+ */
+typedef struct uvc_frame_desc {
+  struct uvc_format_desc *parent;
+  struct uvc_frame_desc *prev, *next;
+  /** Type of frame, such as JPEG frame or uncompressed frme */
+  enum uvc_vs_desc_subtype bDescriptorSubtype;
+  /** Index of the frame within the list of specs available for this format */
+  uint8_t bFrameIndex;
+  uint8_t bmCapabilities;
+  /** Image width */
+  uint16_t wWidth;
+  /** Image height */
+  uint16_t wHeight;
+  /** Bitrate of corresponding stream at minimal frame rate */
+  uint32_t dwMinBitRate;
+  /** Bitrate of corresponding stream at maximal frame rate */
+  uint32_t dwMaxBitRate;
+  /** Maximum number of bytes for a video frame */
+  uint32_t dwMaxVideoFrameBufferSize;
+  /** Default frame interval (in 100ns units) */
+  uint32_t dwDefaultFrameInterval;
+  /** Minimum frame interval for continuous mode (100ns units) */
+  uint32_t dwMinFrameInterval;
+  /** Maximum frame interval for continuous mode (100ns units) */
+  uint32_t dwMaxFrameInterval;
+  /** Granularity of frame interval range for continuous mode (100ns) */
+  uint32_t dwFrameIntervalStep;
+  /** Frame intervals */
+  uint8_t bFrameIntervalType;
+  /** number of bytes per line */
+  uint32_t dwBytesPerLine;
+  /** Available frame rates, zero-terminated (in 100ns units) */
+  uint32_t *intervals;
+} uvc_frame_desc_t;
+
+/** Format descriptor
+ *
+ * A "format" determines a stream's image type (e.g., raw YUYV or JPEG)
+ * and includes many "frame" configurations.
+ */
+typedef struct uvc_format_desc {
+  struct uvc_streaming_interface *parent;
+  struct uvc_format_desc *prev, *next;
+  /** Type of image stream, such as JPEG or uncompressed. */
+  enum uvc_vs_desc_subtype bDescriptorSubtype;
+  /** Identifier of this format within the VS interface's format list */
+  uint8_t bFormatIndex;
+  uint8_t bNumFrameDescriptors;
+  /** Format specifier */
+  union {
+    uint8_t guidFormat[16];
+    uint8_t fourccFormat[4];
+  };
+  /** Format-specific data */
+  union {
+    /** BPP for uncompressed stream */
+    uint8_t bBitsPerPixel;
+    /** Flags for JPEG stream */
+    uint8_t bmFlags;
+  };
+  /** Default {uvc_frame_desc} to choose given this format */
+  uint8_t bDefaultFrameIndex;
+  uint8_t bAspectRatioX;
+  uint8_t bAspectRatioY;
+  uint8_t bmInterlaceFlags;
+  uint8_t bCopyProtect;
+  uint8_t bVariableSize;
+  /** Available frame specifications for this format */
+  struct uvc_frame_desc *frame_descs;
+} uvc_format_desc_t;
+
+/** UVC request code (A.8) */
+enum uvc_req_code {
+  UVC_RC_UNDEFINED = 0x00,
+  UVC_SET_CUR = 0x01,
+  UVC_GET_CUR = 0x81,
+  UVC_GET_MIN = 0x82,
+  UVC_GET_MAX = 0x83,
+  UVC_GET_RES = 0x84,
+  UVC_GET_LEN = 0x85,
+  UVC_GET_INFO = 0x86,
+  UVC_GET_DEF = 0x87
+};
+
+enum uvc_device_power_mode {
+  UVC_VC_VIDEO_POWER_MODE_FULL = 0x000b,
+  UVC_VC_VIDEO_POWER_MODE_DEVICE_DEPENDENT = 0x001b,
+};
+
+/** Camera terminal control selector (A.9.4) */
+enum uvc_ct_ctrl_selector {
+  UVC_CT_CONTROL_UNDEFINED = 0x00,
+  UVC_CT_SCANNING_MODE_CONTROL = 0x01,
+  UVC_CT_AE_MODE_CONTROL = 0x02,
+  UVC_CT_AE_PRIORITY_CONTROL = 0x03,
+  UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL = 0x04,
+  UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL = 0x05,
+  UVC_CT_FOCUS_ABSOLUTE_CONTROL = 0x06,
+  UVC_CT_FOCUS_RELATIVE_CONTROL = 0x07,
+  UVC_CT_FOCUS_AUTO_CONTROL = 0x08,
+  UVC_CT_IRIS_ABSOLUTE_CONTROL = 0x09,
+  UVC_CT_IRIS_RELATIVE_CONTROL = 0x0a,
+  UVC_CT_ZOOM_ABSOLUTE_CONTROL = 0x0b,
+  UVC_CT_ZOOM_RELATIVE_CONTROL = 0x0c,
+  UVC_CT_PANTILT_ABSOLUTE_CONTROL = 0x0d,
+  UVC_CT_PANTILT_RELATIVE_CONTROL = 0x0e,
+  UVC_CT_ROLL_ABSOLUTE_CONTROL = 0x0f,
+  UVC_CT_ROLL_RELATIVE_CONTROL = 0x10,
+  UVC_CT_PRIVACY_CONTROL = 0x11,
+  UVC_CT_FOCUS_SIMPLE_CONTROL = 0x12,
+  UVC_CT_DIGITAL_WINDOW_CONTROL = 0x13,
+  UVC_CT_REGION_OF_INTEREST_CONTROL = 0x14
+};
+
+/** Processing unit control selector (A.9.5) */
+enum uvc_pu_ctrl_selector {
+  UVC_PU_CONTROL_UNDEFINED = 0x00,
+  UVC_PU_BACKLIGHT_COMPENSATION_CONTROL = 0x01,
+  UVC_PU_BRIGHTNESS_CONTROL = 0x02,
+  UVC_PU_CONTRAST_CONTROL = 0x03,
+  UVC_PU_GAIN_CONTROL = 0x04,
+  UVC_PU_POWER_LINE_FREQUENCY_CONTROL = 0x05,
+  UVC_PU_HUE_CONTROL = 0x06,
+  UVC_PU_SATURATION_CONTROL = 0x07,
+  UVC_PU_SHARPNESS_CONTROL = 0x08,
+  UVC_PU_GAMMA_CONTROL = 0x09,
+  UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL = 0x0a,
+  UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL = 0x0b,
+  UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL = 0x0c,
+  UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL = 0x0d,
+  UVC_PU_DIGITAL_MULTIPLIER_CONTROL = 0x0e,
+  UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL = 0x0f,
+  UVC_PU_HUE_AUTO_CONTROL = 0x10,
+  UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL = 0x11,
+  UVC_PU_ANALOG_LOCK_STATUS_CONTROL = 0x12,
+  UVC_PU_CONTRAST_AUTO_CONTROL = 0x13
+};
+
+/** USB terminal type (B.1) */
+enum uvc_term_type {
+  UVC_TT_VENDOR_SPECIFIC = 0x0100,
+  UVC_TT_STREAMING = 0x0101
+};
+
+/** Input terminal type (B.2) */
+enum uvc_it_type {
+  UVC_ITT_VENDOR_SPECIFIC = 0x0200,
+  UVC_ITT_CAMERA = 0x0201,
+  UVC_ITT_MEDIA_TRANSPORT_INPUT = 0x0202
+};
+
+/** Output terminal type (B.3) */
+enum uvc_ot_type {
+  UVC_OTT_VENDOR_SPECIFIC = 0x0300,
+  UVC_OTT_DISPLAY = 0x0301,
+  UVC_OTT_MEDIA_TRANSPORT_OUTPUT = 0x0302
+};
+
+/** External terminal type (B.4) */
+enum uvc_et_type {
+  UVC_EXTERNAL_VENDOR_SPECIFIC = 0x0400,
+  UVC_COMPOSITE_CONNECTOR = 0x0401,
+  UVC_SVIDEO_CONNECTOR = 0x0402,
+  UVC_COMPONENT_CONNECTOR = 0x0403
+};
+
+/** Context, equivalent to libusb's contexts.
+ *
+ * May either own a libusb context or use one that's already made.
+ *
+ * Always create these with uvc_get_context.
+ */
+struct uvc_context;
+typedef struct uvc_context uvc_context_t;
+
+/** UVC device.
+ *
+ * Get this from uvc_get_device_list() or uvc_find_device().
+ */
+struct uvc_device;
+typedef struct uvc_device uvc_device_t;
+
+/** Handle on an open UVC device.
+ *
+ * Get one of these from uvc_open(). Once you uvc_close()
+ * it, it's no longer valid.
+ */
+struct uvc_device_handle;
+typedef struct uvc_device_handle uvc_device_handle_t;
+
+/** Handle on an open UVC stream.
+ *
+ * Get one of these from uvc_stream_open*().
+ * Once you uvc_stream_close() it, it will no longer be valid.
+ */
+struct uvc_stream_handle;
+typedef struct uvc_stream_handle uvc_stream_handle_t;
+
+/** Representation of the interface that brings data into the UVC device */
+typedef struct uvc_input_terminal {
+  struct uvc_input_terminal *prev, *next;
+  /** Index of the terminal within the device */
+  uint8_t bTerminalID;
+  /** Type of terminal (e.g., camera) */
+  enum uvc_it_type wTerminalType;
+  uint16_t wObjectiveFocalLengthMin;
+  uint16_t wObjectiveFocalLengthMax;
+  uint16_t wOcularFocalLength;
+  /** Camera controls (meaning of bits given in {uvc_ct_ctrl_selector}) */
+  uint64_t bmControls;
+} uvc_input_terminal_t;
+
+typedef struct uvc_output_terminal {
+  struct uvc_output_terminal *prev, *next;
+  /** @todo */
+} uvc_output_terminal_t;
+
+/** Represents post-capture processing functions */
+typedef struct uvc_processing_unit {
+  struct uvc_processing_unit *prev, *next;
+  /** Index of the processing unit within the device */
+  uint8_t bUnitID;
+  /** Index of the terminal from which the device accepts images */
+  uint8_t bSourceID;
+  /** Processing controls (meaning of bits given in {uvc_pu_ctrl_selector}) */
+  uint64_t bmControls;
+} uvc_processing_unit_t;
+
+/** Represents selector unit to connect other units */
+typedef struct uvc_selector_unit {
+  struct uvc_selector_unit *prev, *next;
+  /** Index of the selector unit within the device */
+  uint8_t bUnitID;
+} uvc_selector_unit_t;
+
+/** Custom processing or camera-control functions */
+typedef struct uvc_extension_unit {
+  struct uvc_extension_unit *prev, *next;
+  /** Index of the extension unit within the device */
+  uint8_t bUnitID;
+  /** GUID identifying the extension unit */
+  uint8_t guidExtensionCode[16];
+  /** Bitmap of available controls (manufacturer-dependent) */
+  uint64_t bmControls;
+} uvc_extension_unit_t;
+
+enum uvc_status_class {
+  UVC_STATUS_CLASS_CONTROL = 0x10,
+  UVC_STATUS_CLASS_CONTROL_CAMERA = 0x11,
+  UVC_STATUS_CLASS_CONTROL_PROCESSING = 0x12,
+};
+
+enum uvc_status_attribute {
+  UVC_STATUS_ATTRIBUTE_VALUE_CHANGE = 0x00,
+  UVC_STATUS_ATTRIBUTE_INFO_CHANGE = 0x01,
+  UVC_STATUS_ATTRIBUTE_FAILURE_CHANGE = 0x02,
+  UVC_STATUS_ATTRIBUTE_UNKNOWN = 0xff
+};
+
+/** A callback function to accept status updates
+ * @ingroup device
+ */
+typedef void(uvc_status_callback_t)(enum uvc_status_class status_class,
+                                    int event,
+                                    int selector,
+                                    enum uvc_status_attribute status_attribute,
+                                    void *data, size_t data_len,
+                                    void *user_ptr);
+
+/** A callback function to accept button events
+ * @ingroup device
+ */
+typedef void(uvc_button_callback_t)(int button,
+                                    int state,
+                                    void *user_ptr);
+
+/** Structure representing a UVC device descriptor.
+ *
+ * (This isn't a standard structure.)
+ */
+typedef struct uvc_device_descriptor {
+  /** Vendor ID */
+  uint16_t idVendor;
+  /** Product ID */
+  uint16_t idProduct;
+  /** UVC compliance level, e.g. 0x0100 (1.0), 0x0110 */
+  uint16_t bcdUVC;
+  /** Serial number (null if unavailable) */
+  const char *serialNumber;
+  /** Device-reported manufacturer name (or null) */
+  const char *manufacturer;
+  /** Device-reporter product name (or null) */
+  const char *product;
+} uvc_device_descriptor_t;
+
+/** An image frame received from the UVC device
+ * @ingroup streaming
+ */
+typedef struct uvc_frame {
+  /** Image data for this frame */
+  void *data;
+  /** Size of image data buffer */
+  size_t data_bytes;
+  /** Width of image in pixels */
+  uint32_t width;
+  /** Height of image in pixels */
+  uint32_t height;
+  /** Pixel data format */
+  enum uvc_frame_format frame_format;
+  /** Number of bytes per horizontal line (undefined for compressed format) */
+  size_t step;
+  /** Frame number (may skip, but is strictly monotonically increasing) */
+  uint32_t sequence;
+  /** Estimate of system time when the device started capturing the image */
+  struct timeval capture_time;
+  /** Handle on the device that produced the image.
+   * @warning You must not call any uvc_* functions during a callback. */
+  uvc_device_handle_t *source;
+  /** Is the data buffer owned by the library?
+   * If 1, the data buffer can be arbitrarily reallocated by frame conversion
+   * functions.
+   * If 0, the data buffer will not be reallocated or freed by the library.
+   * Set this field to zero if you are supplying the buffer.
+   */
+  uint8_t library_owns_data;
+} uvc_frame_t;
+
+/** A callback function to handle incoming assembled UVC frames
+ * @ingroup streaming
+ */
+typedef void(uvc_frame_callback_t)(struct uvc_frame *frame, void *user_ptr);
+
+/** Streaming mode, includes all information needed to select stream
+ * @ingroup streaming
+ */
+typedef struct uvc_stream_ctrl {
+  uint16_t bmHint;
+  uint8_t bFormatIndex;
+  uint8_t bFrameIndex;
+  uint32_t dwFrameInterval;
+  uint16_t wKeyFrameRate;
+  uint16_t wPFrameRate;
+  uint16_t wCompQuality;
+  uint16_t wCompWindowSize;
+  uint16_t wDelay;
+  uint32_t dwMaxVideoFrameSize;
+  uint32_t dwMaxPayloadTransferSize;
+  uint32_t dwClockFrequency;
+  uint8_t bmFramingInfo;
+  uint8_t bPreferredVersion;
+  uint8_t bMinVersion;
+  uint8_t bMaxVersion;
+  uint8_t bInterfaceNumber;
+} uvc_stream_ctrl_t;
+
+uvc_error_t uvc_init(uvc_context_t **ctx, struct libusb_context *usb_ctx);
+void uvc_exit(uvc_context_t *ctx);
+
+uvc_error_t uvc_get_device_list(
+    uvc_context_t *ctx,
+    uvc_device_t ***list);
+void uvc_free_device_list(uvc_device_t **list, uint8_t unref_devices);
+
+uvc_error_t uvc_get_device_descriptor(
+    uvc_device_t *dev,
+    uvc_device_descriptor_t **desc);
+void uvc_free_device_descriptor(
+    uvc_device_descriptor_t *desc);
+
+uint8_t uvc_get_bus_number(uvc_device_t *dev);
+uint8_t uvc_get_device_address(uvc_device_t *dev);
+
+uvc_error_t uvc_find_device(
+    uvc_context_t *ctx,
+    uvc_device_t **dev,
+    int vid, int pid, const char *sn);
+
+uvc_error_t uvc_find_devices(
+    uvc_context_t *ctx,
+    uvc_device_t ***devs,
+    int vid, int pid, const char *sn);
+
+uvc_error_t uvc_open(
+    uvc_device_t *dev,
+    uvc_device_handle_t **devh);
+void uvc_close(uvc_device_handle_t *devh);
+
+uvc_device_t *uvc_get_device(uvc_device_handle_t *devh);
+struct libusb_device_handle *uvc_get_libusb_handle(uvc_device_handle_t *devh);
+
+void uvc_ref_device(uvc_device_t *dev);
+void uvc_unref_device(uvc_device_t *dev);
+
+void uvc_set_status_callback(uvc_device_handle_t *devh,
+                             uvc_status_callback_t cb,
+                             void *user_ptr);
+
+void uvc_set_button_callback(uvc_device_handle_t *devh,
+                             uvc_button_callback_t cb,
+                             void *user_ptr);
+
+const uvc_input_terminal_t *uvc_get_camera_terminal(uvc_device_handle_t *devh);
+const uvc_input_terminal_t *uvc_get_input_terminals(uvc_device_handle_t *devh);
+const uvc_output_terminal_t *uvc_get_output_terminals(uvc_device_handle_t *devh);
+const uvc_selector_unit_t *uvc_get_selector_units(uvc_device_handle_t *devh);
+const uvc_processing_unit_t *uvc_get_processing_units(uvc_device_handle_t *devh);
+const uvc_extension_unit_t *uvc_get_extension_units(uvc_device_handle_t *devh);
+
+uvc_error_t uvc_get_stream_ctrl_format_size(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    enum uvc_frame_format format,
+    int width, int height,
+    int fps
+    );
+
+const uvc_format_desc_t *uvc_get_format_descs(uvc_device_handle_t* );
+
+uvc_error_t uvc_probe_stream_ctrl(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl);
+
+uvc_error_t uvc_start_streaming(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    uvc_frame_callback_t *cb,
+    void *user_ptr,
+    uint8_t flags);
+
+uvc_error_t uvc_start_iso_streaming(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    uvc_frame_callback_t *cb,
+    void *user_ptr);
+
+void uvc_stop_streaming(uvc_device_handle_t *devh);
+
+uvc_error_t uvc_stream_open_ctrl(uvc_device_handle_t *devh, uvc_stream_handle_t **strmh, uvc_stream_ctrl_t *ctrl);
+uvc_error_t uvc_stream_ctrl(uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl);
+uvc_error_t uvc_stream_start(uvc_stream_handle_t *strmh,
+    uvc_frame_callback_t *cb,
+    void *user_ptr,
+    uint8_t flags);
+uvc_error_t uvc_stream_start_iso(uvc_stream_handle_t *strmh,
+    uvc_frame_callback_t *cb,
+    void *user_ptr);
+uvc_error_t uvc_stream_get_frame(
+    uvc_stream_handle_t *strmh,
+    uvc_frame_t **frame,
+    int32_t timeout_us
+);
+uvc_error_t uvc_stream_stop(uvc_stream_handle_t *strmh);
+void uvc_stream_close(uvc_stream_handle_t *strmh);
+
+int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl);
+int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len, enum uvc_req_code req_code);
+int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len);
+
+uvc_error_t uvc_get_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode *mode, enum uvc_req_code req_code);
+uvc_error_t uvc_set_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode mode);
+
+/* AUTO-GENERATED control accessors! Update them with the output of `ctrl-gen.py decl`. */
+uvc_error_t uvc_get_scanning_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
+uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode);
+
+uvc_error_t uvc_get_ae_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code);
+uvc_error_t uvc_set_ae_mode(uvc_device_handle_t *devh, uint8_t mode);
+
+uvc_error_t uvc_get_ae_priority(uvc_device_handle_t *devh, uint8_t* priority, enum uvc_req_code req_code);
+uvc_error_t uvc_set_ae_priority(uvc_device_handle_t *devh, uint8_t priority);
+
+uvc_error_t uvc_get_exposure_abs(uvc_device_handle_t *devh, uint32_t* time, enum uvc_req_code req_code);
+uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time);
+
+uvc_error_t uvc_get_exposure_rel(uvc_device_handle_t *devh, int8_t* step, enum uvc_req_code req_code);
+uvc_error_t uvc_set_exposure_rel(uvc_device_handle_t *devh, int8_t step);
+
+uvc_error_t uvc_get_focus_abs(uvc_device_handle_t *devh, uint16_t* focus, enum uvc_req_code req_code);
+uvc_error_t uvc_set_focus_abs(uvc_device_handle_t *devh, uint16_t focus);
+
+uvc_error_t uvc_get_focus_rel(uvc_device_handle_t *devh, int8_t* focus_rel, uint8_t* speed, enum uvc_req_code req_code);
+uvc_error_t uvc_set_focus_rel(uvc_device_handle_t *devh, int8_t focus_rel, uint8_t speed);
+
+uvc_error_t uvc_get_focus_simple_range(uvc_device_handle_t *devh, uint8_t* focus, enum uvc_req_code req_code);
+uvc_error_t uvc_set_focus_simple_range(uvc_device_handle_t *devh, uint8_t focus);
+
+uvc_error_t uvc_get_focus_auto(uvc_device_handle_t *devh, uint8_t* state, enum uvc_req_code req_code);
+uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state);
+
+uvc_error_t uvc_get_iris_abs(uvc_device_handle_t *devh, uint16_t* iris, enum uvc_req_code req_code);
+uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris);
+
+uvc_error_t uvc_get_iris_rel(uvc_device_handle_t *devh, uint8_t* iris_rel, enum uvc_req_code req_code);
+uvc_error_t uvc_set_iris_rel(uvc_device_handle_t *devh, uint8_t iris_rel);
+
+uvc_error_t uvc_get_zoom_abs(uvc_device_handle_t *devh, uint16_t* focal_length, enum uvc_req_code req_code);
+uvc_error_t uvc_set_zoom_abs(uvc_device_handle_t *devh, uint16_t focal_length);
+
+uvc_error_t uvc_get_zoom_rel(uvc_device_handle_t *devh, int8_t* zoom_rel, uint8_t* digital_zoom, uint8_t* speed, enum uvc_req_code req_code);
+uvc_error_t uvc_set_zoom_rel(uvc_device_handle_t *devh, int8_t zoom_rel, uint8_t digital_zoom, uint8_t speed);
+
+uvc_error_t uvc_get_pantilt_abs(uvc_device_handle_t *devh, int32_t* pan, int32_t* tilt, enum uvc_req_code req_code);
+uvc_error_t uvc_set_pantilt_abs(uvc_device_handle_t *devh, int32_t pan, int32_t tilt);
+
+uvc_error_t uvc_get_pantilt_rel(uvc_device_handle_t *devh, int8_t* pan_rel, uint8_t* pan_speed, int8_t* tilt_rel, uint8_t* tilt_speed, enum uvc_req_code req_code);
+uvc_error_t uvc_set_pantilt_rel(uvc_device_handle_t *devh, int8_t pan_rel, uint8_t pan_speed, int8_t tilt_rel, uint8_t tilt_speed);
+
+uvc_error_t uvc_get_roll_abs(uvc_device_handle_t *devh, int16_t* roll, enum uvc_req_code req_code);
+uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll);
+
+uvc_error_t uvc_get_roll_rel(uvc_device_handle_t *devh, int8_t* roll_rel, uint8_t* speed, enum uvc_req_code req_code);
+uvc_error_t uvc_set_roll_rel(uvc_device_handle_t *devh, int8_t roll_rel, uint8_t speed);
+
+uvc_error_t uvc_get_privacy(uvc_device_handle_t *devh, uint8_t* privacy, enum uvc_req_code req_code);
+uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy);
+
+uvc_error_t uvc_get_digital_window(uvc_device_handle_t *devh, uint16_t* window_top, uint16_t* window_left, uint16_t* window_bottom, uint16_t* window_right, uint16_t* num_steps, uint16_t* num_steps_units, enum uvc_req_code req_code);
+uvc_error_t uvc_set_digital_window(uvc_device_handle_t *devh, uint16_t window_top, uint16_t window_left, uint16_t window_bottom, uint16_t window_right, uint16_t num_steps, uint16_t num_steps_units);
+
+uvc_error_t uvc_get_digital_roi(uvc_device_handle_t *devh, uint16_t* roi_top, uint16_t* roi_left, uint16_t* roi_bottom, uint16_t* roi_right, uint16_t* auto_controls, enum uvc_req_code req_code);
+uvc_error_t uvc_set_digital_roi(uvc_device_handle_t *devh, uint16_t roi_top, uint16_t roi_left, uint16_t roi_bottom, uint16_t roi_right, uint16_t auto_controls);
+
+uvc_error_t uvc_get_backlight_compensation(uvc_device_handle_t *devh, uint16_t* backlight_compensation, enum uvc_req_code req_code);
+uvc_error_t uvc_set_backlight_compensation(uvc_device_handle_t *devh, uint16_t backlight_compensation);
+
+uvc_error_t uvc_get_brightness(uvc_device_handle_t *devh, int16_t* brightness, enum uvc_req_code req_code);
+uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness);
+
+uvc_error_t uvc_get_contrast(uvc_device_handle_t *devh, uint16_t* contrast, enum uvc_req_code req_code);
+uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast);
+
+uvc_error_t uvc_get_contrast_auto(uvc_device_handle_t *devh, uint8_t* contrast_auto, enum uvc_req_code req_code);
+uvc_error_t uvc_set_contrast_auto(uvc_device_handle_t *devh, uint8_t contrast_auto);
+
+uvc_error_t uvc_get_gain(uvc_device_handle_t *devh, uint16_t* gain, enum uvc_req_code req_code);
+uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain);
+
+uvc_error_t uvc_get_power_line_frequency(uvc_device_handle_t *devh, uint8_t* power_line_frequency, enum uvc_req_code req_code);
+uvc_error_t uvc_set_power_line_frequency(uvc_device_handle_t *devh, uint8_t power_line_frequency);
+
+uvc_error_t uvc_get_hue(uvc_device_handle_t *devh, int16_t* hue, enum uvc_req_code req_code);
+uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue);
+
+uvc_error_t uvc_get_hue_auto(uvc_device_handle_t *devh, uint8_t* hue_auto, enum uvc_req_code req_code);
+uvc_error_t uvc_set_hue_auto(uvc_device_handle_t *devh, uint8_t hue_auto);
+
+uvc_error_t uvc_get_saturation(uvc_device_handle_t *devh, uint16_t* saturation, enum uvc_req_code req_code);
+uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation);
+
+uvc_error_t uvc_get_sharpness(uvc_device_handle_t *devh, uint16_t* sharpness, enum uvc_req_code req_code);
+uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness);
+
+uvc_error_t uvc_get_gamma(uvc_device_handle_t *devh, uint16_t* gamma, enum uvc_req_code req_code);
+uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma);
+
+uvc_error_t uvc_get_white_balance_temperature(uvc_device_handle_t *devh, uint16_t* temperature, enum uvc_req_code req_code);
+uvc_error_t uvc_set_white_balance_temperature(uvc_device_handle_t *devh, uint16_t temperature);
+
+uvc_error_t uvc_get_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t* temperature_auto, enum uvc_req_code req_code);
+uvc_error_t uvc_set_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t temperature_auto);
+
+uvc_error_t uvc_get_white_balance_component(uvc_device_handle_t *devh, uint16_t* blue, uint16_t* red, enum uvc_req_code req_code);
+uvc_error_t uvc_set_white_balance_component(uvc_device_handle_t *devh, uint16_t blue, uint16_t red);
+
+uvc_error_t uvc_get_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t* white_balance_component_auto, enum uvc_req_code req_code);
+uvc_error_t uvc_set_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t white_balance_component_auto);
+
+uvc_error_t uvc_get_digital_multiplier(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
+uvc_error_t uvc_set_digital_multiplier(uvc_device_handle_t *devh, uint16_t multiplier_step);
+
+uvc_error_t uvc_get_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code);
+uvc_error_t uvc_set_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t multiplier_step);
+
+uvc_error_t uvc_get_analog_video_standard(uvc_device_handle_t *devh, uint8_t* video_standard, enum uvc_req_code req_code);
+uvc_error_t uvc_set_analog_video_standard(uvc_device_handle_t *devh, uint8_t video_standard);
+
+uvc_error_t uvc_get_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t* status, enum uvc_req_code req_code);
+uvc_error_t uvc_set_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t status);
+
+uvc_error_t uvc_get_input_select(uvc_device_handle_t *devh, uint8_t* selector, enum uvc_req_code req_code);
+uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector);
+/* end AUTO-GENERATED control accessors */
+
+void uvc_perror(uvc_error_t err, const char *msg);
+const char* uvc_strerror(uvc_error_t err);
+void uvc_print_diag(uvc_device_handle_t *devh, FILE *stream);
+void uvc_print_stream_ctrl(uvc_stream_ctrl_t *ctrl, FILE *stream);
+
+uvc_frame_t *uvc_allocate_frame(size_t data_bytes);
+void uvc_free_frame(uvc_frame_t *frame);
+
+uvc_error_t uvc_duplicate_frame(uvc_frame_t *in, uvc_frame_t *out);
+
+uvc_error_t uvc_yuyv2rgb(uvc_frame_t *in, uvc_frame_t *out);
+uvc_error_t uvc_uyvy2rgb(uvc_frame_t *in, uvc_frame_t *out);
+uvc_error_t uvc_any2rgb(uvc_frame_t *in, uvc_frame_t *out);
+
+uvc_error_t uvc_yuyv2bgr(uvc_frame_t *in, uvc_frame_t *out);
+uvc_error_t uvc_uyvy2bgr(uvc_frame_t *in, uvc_frame_t *out);
+uvc_error_t uvc_any2bgr(uvc_frame_t *in, uvc_frame_t *out);
+
+uvc_error_t uvc_yuyv2y(uvc_frame_t *in, uvc_frame_t *out);
+uvc_error_t uvc_yuyv2uv(uvc_frame_t *in, uvc_frame_t *out);
+
+#ifdef LIBUVC_HAS_JPEG
+uvc_error_t uvc_mjpeg2rgb(uvc_frame_t *in, uvc_frame_t *out);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // !def(LIBUVC_H)
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h
new file mode 100644
index 0000000..9ab0ac9
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h
@@ -0,0 +1,22 @@
+#ifndef LIBUVC_CONFIG_H
+#define LIBUVC_CONFIG_H
+
+#define LIBUVC_VERSION_MAJOR 0
+#define LIBUVC_VERSION_MINOR 0
+#define LIBUVC_VERSION_PATCH 6
+#define LIBUVC_VERSION_STR "0.0.6"
+#define LIBUVC_VERSION_INT                      \
+  ((0 << 16) |             \
+   (0 << 8) |              \
+   (6))
+
+/** @brief Test whether libuvc is new enough
+ * This macro evaluates true iff the current version is
+ * at least as new as the version specified.
+ */
+#define LIBUVC_VERSION_GTE(major, minor, patch)                         \
+  (LIBUVC_VERSION_INT >= (((major) << 16) | ((minor) << 8) | (patch)))
+
+/* #define LIBUVC_HAS_JPEG 1 */
+
+#endif // !def(LIBUVC_CONFIG_H)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h.in
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h.in b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h.in
new file mode 100644
index 0000000..3bbd653
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_config.h.in
@@ -0,0 +1,22 @@
+#ifndef LIBUVC_CONFIG_H
+#define LIBUVC_CONFIG_H
+
+#define LIBUVC_VERSION_MAJOR @libuvc_VERSION_MAJOR@
+#define LIBUVC_VERSION_MINOR @libuvc_VERSION_MINOR@
+#define LIBUVC_VERSION_PATCH @libuvc_VERSION_PATCH@
+#define LIBUVC_VERSION_STR "@libuvc_VERSION@"
+#define LIBUVC_VERSION_INT                      \
+  ((@libuvc_VERSION_MAJOR@ << 16) |             \
+   (@libuvc_VERSION_MINOR@ << 8) |              \
+   (@libuvc_VERSION_PATCH@))
+
+/** @brief Test whether libuvc is new enough
+ * This macro evaluates true iff the current version is
+ * at least as new as the version specified.
+ */
+#define LIBUVC_VERSION_GTE(major, minor, patch)                         \
+  (LIBUVC_VERSION_INT >= (((major) << 16) | ((minor) << 8) | (patch)))
+
+#cmakedefine LIBUVC_HAS_JPEG 1
+
+#endif // !def(LIBUVC_CONFIG_H)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_internal.h
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_internal.h b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_internal.h
new file mode 100644
index 0000000..829b294
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/include/libuvc/libuvc_internal.h
@@ -0,0 +1,300 @@
+/** @file libuvc_internal.h
+  * @brief Implementation-specific UVC constants and structures.
+  * @cond include_hidden
+  */
+#ifndef LIBUVC_INTERNAL_H
+#define LIBUVC_INTERNAL_H
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <signal.h>
+#include <libusb.h>
+#include "utlist.h"
+
+/** Converts an unaligned four-byte little-endian integer into an int32 */
+#define DW_TO_INT(p) ((p)[0] | ((p)[1] << 8) | ((p)[2] << 16) | ((p)[3] << 24))
+/** Converts an unaligned two-byte little-endian integer into an int16 */
+#define SW_TO_SHORT(p) ((p)[0] | ((p)[1] << 8))
+/** Converts an int16 into an unaligned two-byte little-endian integer */
+#define SHORT_TO_SW(s, p) \
+  (p)[0] = (s); \
+  (p)[1] = (s) >> 8;
+/** Converts an int32 into an unaligned four-byte little-endian integer */
+#define INT_TO_DW(i, p) \
+  (p)[0] = (i); \
+  (p)[1] = (i) >> 8; \
+  (p)[2] = (i) >> 16; \
+  (p)[3] = (i) >> 24;
+
+/** Selects the nth item in a doubly linked list. n=-1 selects the last item. */
+#define DL_NTH(head, out, n) \
+  do { \
+    int dl_nth_i = 0; \
+    LDECLTYPE(head) dl_nth_p = (head); \
+    if ((n) < 0) { \
+      while (dl_nth_p && dl_nth_i > (n)) { \
+        dl_nth_p = dl_nth_p->prev; \
+        dl_nth_i--; \
+      } \
+    } else { \
+      while (dl_nth_p && dl_nth_i < (n)) { \
+        dl_nth_p = dl_nth_p->next; \
+        dl_nth_i++; \
+      } \
+    } \
+    (out) = dl_nth_p; \
+  } while (0);
+
+#ifdef UVC_DEBUGGING
+#include <libgen.h>
+#define UVC_DEBUG(format, ...) fprintf(stderr, "[%s:%d/%s] " format "\n", basename(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__)
+#define UVC_ENTER() fprintf(stderr, "[%s:%d] begin %s\n", basename(__FILE__), __LINE__, __FUNCTION__)
+#define UVC_EXIT(code) fprintf(stderr, "[%s:%d] end %s (%d)\n", basename(__FILE__), __LINE__, __FUNCTION__, code)
+#define UVC_EXIT_VOID() fprintf(stderr, "[%s:%d] end %s\n", basename(__FILE__), __LINE__, __FUNCTION__)
+#else
+#define UVC_DEBUG(format, ...)
+#define UVC_ENTER()
+#define UVC_EXIT_VOID()
+#define UVC_EXIT(code)
+#endif
+
+/* http://stackoverflow.com/questions/19452971/array-size-macro-that-rejects-pointers */
+#define IS_INDEXABLE(arg) (sizeof(arg[0]))
+#define IS_ARRAY(arg) (IS_INDEXABLE(arg) && (((void *) &arg) == ((void *) arg)))
+#define ARRAYSIZE(arr) (sizeof(arr) / (IS_ARRAY(arr) ? sizeof(arr[0]) : 0))
+
+/** Video interface subclass code (A.2) */
+enum uvc_int_subclass_code {
+  UVC_SC_UNDEFINED = 0x00,
+  UVC_SC_VIDEOCONTROL = 0x01,
+  UVC_SC_VIDEOSTREAMING = 0x02,
+  UVC_SC_VIDEO_INTERFACE_COLLECTION = 0x03
+};
+
+/** Video interface protocol code (A.3) */
+enum uvc_int_proto_code {
+  UVC_PC_PROTOCOL_UNDEFINED = 0x00
+};
+
+/** VideoControl interface descriptor subtype (A.5) */
+enum uvc_vc_desc_subtype {
+  UVC_VC_DESCRIPTOR_UNDEFINED = 0x00,
+  UVC_VC_HEADER = 0x01,
+  UVC_VC_INPUT_TERMINAL = 0x02,
+  UVC_VC_OUTPUT_TERMINAL = 0x03,
+  UVC_VC_SELECTOR_UNIT = 0x04,
+  UVC_VC_PROCESSING_UNIT = 0x05,
+  UVC_VC_EXTENSION_UNIT = 0x06
+};
+
+/** UVC endpoint descriptor subtype (A.7) */
+enum uvc_ep_desc_subtype {
+  UVC_EP_UNDEFINED = 0x00,
+  UVC_EP_GENERAL = 0x01,
+  UVC_EP_ENDPOINT = 0x02,
+  UVC_EP_INTERRUPT = 0x03
+};
+
+/** VideoControl interface control selector (A.9.1) */
+enum uvc_vc_ctrl_selector {
+  UVC_VC_CONTROL_UNDEFINED = 0x00,
+  UVC_VC_VIDEO_POWER_MODE_CONTROL = 0x01,
+  UVC_VC_REQUEST_ERROR_CODE_CONTROL = 0x02
+};
+
+/** Terminal control selector (A.9.2) */
+enum uvc_term_ctrl_selector {
+  UVC_TE_CONTROL_UNDEFINED = 0x00
+};
+
+/** Selector unit control selector (A.9.3) */
+enum uvc_su_ctrl_selector {
+  UVC_SU_CONTROL_UNDEFINED = 0x00,
+  UVC_SU_INPUT_SELECT_CONTROL = 0x01
+};
+
+/** Extension unit control selector (A.9.6) */
+enum uvc_xu_ctrl_selector {
+  UVC_XU_CONTROL_UNDEFINED = 0x00
+};
+
+/** VideoStreaming interface control selector (A.9.7) */
+enum uvc_vs_ctrl_selector {
+  UVC_VS_CONTROL_UNDEFINED = 0x00,
+  UVC_VS_PROBE_CONTROL = 0x01,
+  UVC_VS_COMMIT_CONTROL = 0x02,
+  UVC_VS_STILL_PROBE_CONTROL = 0x03,
+  UVC_VS_STILL_COMMIT_CONTROL = 0x04,
+  UVC_VS_STILL_IMAGE_TRIGGER_CONTROL = 0x05,
+  UVC_VS_STREAM_ERROR_CODE_CONTROL = 0x06,
+  UVC_VS_GENERATE_KEY_FRAME_CONTROL = 0x07,
+  UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL = 0x08,
+  UVC_VS_SYNC_DELAY_CONTROL = 0x09
+};
+
+/** Status packet type (2.4.2.2) */
+enum uvc_status_type {
+  UVC_STATUS_TYPE_CONTROL = 1,
+  UVC_STATUS_TYPE_STREAMING = 2
+};
+
+/** Payload header flags (2.4.3.3) */
+#define UVC_STREAM_EOH (1 << 7)
+#define UVC_STREAM_ERR (1 << 6)
+#define UVC_STREAM_STI (1 << 5)
+#define UVC_STREAM_RES (1 << 4)
+#define UVC_STREAM_SCR (1 << 3)
+#define UVC_STREAM_PTS (1 << 2)
+#define UVC_STREAM_EOF (1 << 1)
+#define UVC_STREAM_FID (1 << 0)
+
+/** Control capabilities (4.1.2) */
+#define UVC_CONTROL_CAP_GET (1 << 0)
+#define UVC_CONTROL_CAP_SET (1 << 1)
+#define UVC_CONTROL_CAP_DISABLED (1 << 2)
+#define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3)
+#define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4)
+
+struct uvc_streaming_interface;
+struct uvc_device_info;
+
+/** VideoStream interface */
+typedef struct uvc_streaming_interface {
+  struct uvc_device_info *parent;
+  struct uvc_streaming_interface *prev, *next;
+  /** Interface number */
+  uint8_t bInterfaceNumber;
+  /** Video formats that this interface provides */
+  struct uvc_format_desc *format_descs;
+  /** USB endpoint to use when communicating with this interface */
+  uint8_t bEndpointAddress;
+  uint8_t bTerminalLink;
+} uvc_streaming_interface_t;
+
+/** VideoControl interface */
+typedef struct uvc_control_interface {
+  struct uvc_device_info *parent;
+  struct uvc_input_terminal *input_term_descs;
+  // struct uvc_output_terminal *output_term_descs;
+  struct uvc_selector_unit *selector_unit_descs;
+  struct uvc_processing_unit *processing_unit_descs;
+  struct uvc_extension_unit *extension_unit_descs;
+  uint16_t bcdUVC;
+  uint32_t dwClockFrequency;
+  uint8_t bEndpointAddress;
+  /** Interface number */
+  uint8_t bInterfaceNumber;
+} uvc_control_interface_t;
+
+struct uvc_stream_ctrl;
+
+struct uvc_device {
+  struct uvc_context *ctx;
+  int ref;
+  libusb_device *usb_dev;
+};
+
+typedef struct uvc_device_info {
+  /** Configuration descriptor for USB device */
+  struct libusb_config_descriptor *config;
+  /** VideoControl interface provided by device */
+  uvc_control_interface_t ctrl_if;
+  /** VideoStreaming interfaces on the device */
+  uvc_streaming_interface_t *stream_ifs;
+} uvc_device_info_t;
+
+/*
+  set a high number of transfer buffers. This uses a lot of ram, but
+  avoids problems with scheduling delays on slow boards causing missed
+  transfers. A better approach may be to make the transfer thread FIFO
+  scheduled (if we have root).
+  We could/should change this to allow reduce it to, say, 5 by default
+  and then allow the user to change the number of buffers as required.
+ */
+#define LIBUVC_NUM_TRANSFER_BUFS 100
+
+#define LIBUVC_XFER_BUF_SIZE	( 16 * 1024 * 1024 )
+
+struct uvc_stream_handle {
+  struct uvc_device_handle *devh;
+  struct uvc_stream_handle *prev, *next;
+  struct uvc_streaming_interface *stream_if;
+
+  /** if true, stream is running (streaming video to host) */
+  uint8_t running;
+  /** Current control block */
+  struct uvc_stream_ctrl cur_ctrl;
+
+  /* listeners may only access hold*, and only when holding a
+   * lock on cb_mutex (probably signaled with cb_cond) */
+  uint8_t fid;
+  uint32_t seq, hold_seq;
+  uint32_t pts, hold_pts;
+  uint32_t last_scr, hold_last_scr;
+  size_t got_bytes, hold_bytes;
+  uint8_t *outbuf, *holdbuf;
+  pthread_mutex_t cb_mutex;
+  pthread_cond_t cb_cond;
+  pthread_t cb_thread;
+  uint32_t last_polled_seq;
+  uvc_frame_callback_t *user_cb;
+  void *user_ptr;
+  struct libusb_transfer *transfers[LIBUVC_NUM_TRANSFER_BUFS];
+  uint8_t *transfer_bufs[LIBUVC_NUM_TRANSFER_BUFS];
+  struct uvc_frame frame;
+  enum uvc_frame_format frame_format;
+};
+
+/** Handle on an open UVC device
+ *
+ * @todo move most of this into a uvc_device struct?
+ */
+struct uvc_device_handle {
+  struct uvc_device *dev;
+  struct uvc_device_handle *prev, *next;
+  /** Underlying USB device handle */
+  libusb_device_handle *usb_devh;
+  struct uvc_device_info *info;
+  struct libusb_transfer *status_xfer;
+  uint8_t status_buf[32];
+  /** Function to call when we receive status updates from the camera */
+  uvc_status_callback_t *status_cb;
+  void *status_user_ptr;
+  /** Function to call when we receive button events from the camera */
+  uvc_button_callback_t *button_cb;
+  void *button_user_ptr;
+
+  uvc_stream_handle_t *streams;
+  /** Whether the camera is an iSight that sends one header per frame */
+  uint8_t is_isight;
+  uint32_t claimed;
+};
+
+/** Context within which we communicate with devices */
+struct uvc_context {
+  /** Underlying context for USB communication */
+  struct libusb_context *usb_ctx;
+  /** True iff libuvc initialized the underlying USB context */
+  uint8_t own_usb_ctx;
+  /** List of open devices in this context */
+  uvc_device_handle_t *open_devices;
+  pthread_t handler_thread;
+  int kill_handler_thread;
+};
+
+uvc_error_t uvc_query_stream_ctrl(
+    uvc_device_handle_t *devh,
+    uvc_stream_ctrl_t *ctrl,
+    uint8_t probe,
+    enum uvc_req_code req);
+
+void uvc_start_handler_thread(uvc_context_t *ctx);
+uvc_error_t uvc_claim_if(uvc_device_handle_t *devh, int idx);
+uvc_error_t uvc_release_if(uvc_device_handle_t *devh, int idx);
+
+#endif // !def(LIBUVC_INTERNAL_H)
+/** @endcond */
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/include/utlist.h
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/include/utlist.h b/thirdparty/libuvc-0.0.6/include/utlist.h
new file mode 100644
index 0000000..34c725b
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/include/utlist.h
@@ -0,0 +1,490 @@
+/*
+Copyright (c) 2007-2010, Troy D. Hanson   http://uthash.sourceforge.net
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef UTLIST_H
+#define UTLIST_H
+
+#define UTLIST_VERSION 1.9.1
+
+/* 
+ * This file contains macros to manipulate singly and doubly-linked lists.
+ *
+ * 1. LL_ macros:  singly-linked lists.
+ * 2. DL_ macros:  doubly-linked lists.
+ * 3. CDL_ macros: circular doubly-linked lists.
+ *
+ * To use singly-linked lists, your structure must have a "next" pointer.
+ * To use doubly-linked lists, your structure must "prev" and "next" pointers.
+ * Either way, the pointer to the head of the list must be initialized to NULL.
+ * 
+ * ----------------.EXAMPLE -------------------------
+ * struct item {
+ *      int id;
+ *      struct item *prev, *next;
+ * }
+ *
+ * struct item *list = NULL:
+ *
+ * int main() {
+ *      struct item *item;
+ *      ... allocate and populate item ...
+ *      DL_APPEND(list, item);
+ * }
+ * --------------------------------------------------
+ *
+ * For doubly-linked lists, the append and delete macros are O(1)
+ * For singly-linked lists, append and delete are O(n) but prepend is O(1)
+ * The sort macro is O(n log(n)) for all types of single/double/circular lists.
+ */
+
+/* These macros use decltype or the earlier __typeof GNU extension.
+   As decltype is only available in newer compilers (VS2010 or gcc 4.3+
+   when compiling c++ code), this code uses whatever method is needed
+   or, for VS2008 where neither is available, uses casting workarounds. */
+#ifdef _MSC_VER            /* MS compiler */
+#if _MSC_VER >= 1600 && defined(__cplusplus)  /* VS2010 or newer in C++ mode */
+#define LDECLTYPE(x) decltype(x)
+#else                     /* VS2008 or older (or VS2010 in C mode) */
+#define NO_DECLTYPE
+#define LDECLTYPE(x) char*
+#endif
+#else                      /* GNU, Sun and other compilers */
+#define LDECLTYPE(x) __typeof(x)
+#endif
+
+/* for VS2008 we use some workarounds to get around the lack of decltype,
+ * namely, we always reassign our tmp variable to the list head if we need
+ * to dereference its prev/next pointers, and save/restore the real head.*/
+#ifdef NO_DECLTYPE
+#define _SV(elt,list) _tmp = (char*)(list); {char **_alias = (char**)&(list); *_alias = (elt); }
+#define _NEXT(elt,list) ((char*)((list)->next))
+#define _NEXTASGN(elt,list,to) { char **_alias = (char**)&((list)->next); *_alias=(char*)(to); }
+#define _PREV(elt,list) ((char*)((list)->prev))
+#define _PREVASGN(elt,list,to) { char **_alias = (char**)&((list)->prev); *_alias=(char*)(to); }
+#define _RS(list) { char **_alias = (char**)&(list); *_alias=_tmp; }
+#define _CASTASGN(a,b) { char **_alias = (char**)&(a); *_alias=(char*)(b); }
+#else 
+#define _SV(elt,list)
+#define _NEXT(elt,list) ((elt)->next)
+#define _NEXTASGN(elt,list,to) ((elt)->next)=(to)
+#define _PREV(elt,list) ((elt)->prev)
+#define _PREVASGN(elt,list,to) ((elt)->prev)=(to)
+#define _RS(list)
+#define _CASTASGN(a,b) (a)=(b)
+#endif
+
+/******************************************************************************
+ * The sort macro is an adaptation of Simon Tatham's O(n log(n)) mergesort    *
+ * Unwieldy variable names used here to avoid shadowing passed-in variables.  *
+ *****************************************************************************/
+#define LL_SORT(list, cmp)                                                                     \
+do {                                                                                           \
+  LDECLTYPE(list) _ls_p;                                                                       \
+  LDECLTYPE(list) _ls_q;                                                                       \
+  LDECLTYPE(list) _ls_e;                                                                       \
+  LDECLTYPE(list) _ls_tail;                                                                    \
+  LDECLTYPE(list) _ls_oldhead;                                                                 \
+  LDECLTYPE(list) _tmp;                                                                        \
+  int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping;                       \
+  if (list) {                                                                                  \
+    _ls_insize = 1;                                                                            \
+    _ls_looping = 1;                                                                           \
+    while (_ls_looping) {                                                                      \
+      _CASTASGN(_ls_p,list);                                                                   \
+      _CASTASGN(_ls_oldhead,list);                                                             \
+      list = NULL;                                                                             \
+      _ls_tail = NULL;                                                                         \
+      _ls_nmerges = 0;                                                                         \
+      while (_ls_p) {                                                                          \
+        _ls_nmerges++;                                                                         \
+        _ls_q = _ls_p;                                                                         \
+        _ls_psize = 0;                                                                         \
+        for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) {                                         \
+          _ls_psize++;                                                                         \
+          _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list);                               \
+          if (!_ls_q) break;                                                                   \
+        }                                                                                      \
+        _ls_qsize = _ls_insize;                                                                \
+        while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) {                                    \
+          if (_ls_psize == 0) {                                                                \
+            _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+          } else if (_ls_qsize == 0 || !_ls_q) {                                               \
+            _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+          } else if (cmp(_ls_p,_ls_q) <= 0) {                                                  \
+            _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+          } else {                                                                             \
+            _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+          }                                                                                    \
+          if (_ls_tail) {                                                                      \
+            _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e); _RS(list);                     \
+          } else {                                                                             \
+            _CASTASGN(list,_ls_e);                                                             \
+          }                                                                                    \
+          _ls_tail = _ls_e;                                                                    \
+        }                                                                                      \
+        _ls_p = _ls_q;                                                                         \
+      }                                                                                        \
+      _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,NULL); _RS(list);                            \
+      if (_ls_nmerges <= 1) {                                                                  \
+        _ls_looping=0;                                                                         \
+      }                                                                                        \
+      _ls_insize *= 2;                                                                         \
+    }                                                                                          \
+  } else _tmp=NULL; /* quiet gcc unused variable warning */                                    \
+} while (0)
+
+#define DL_SORT(list, cmp)                                                                     \
+do {                                                                                           \
+  LDECLTYPE(list) _ls_p;                                                                       \
+  LDECLTYPE(list) _ls_q;                                                                       \
+  LDECLTYPE(list) _ls_e;                                                                       \
+  LDECLTYPE(list) _ls_tail;                                                                    \
+  LDECLTYPE(list) _ls_oldhead;                                                                 \
+  LDECLTYPE(list) _tmp;                                                                        \
+  int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping;                       \
+  if (list) {                                                                                  \
+    _ls_insize = 1;                                                                            \
+    _ls_looping = 1;                                                                           \
+    while (_ls_looping) {                                                                      \
+      _CASTASGN(_ls_p,list);                                                                   \
+      _CASTASGN(_ls_oldhead,list);                                                             \
+      list = NULL;                                                                             \
+      _ls_tail = NULL;                                                                         \
+      _ls_nmerges = 0;                                                                         \
+      while (_ls_p) {                                                                          \
+        _ls_nmerges++;                                                                         \
+        _ls_q = _ls_p;                                                                         \
+        _ls_psize = 0;                                                                         \
+        for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) {                                         \
+          _ls_psize++;                                                                         \
+          _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list);                               \
+          if (!_ls_q) break;                                                                   \
+        }                                                                                      \
+        _ls_qsize = _ls_insize;                                                                \
+        while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) {                                    \
+          if (_ls_psize == 0) {                                                                \
+            _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+          } else if (_ls_qsize == 0 || !_ls_q) {                                               \
+            _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+          } else if (cmp(_ls_p,_ls_q) <= 0) {                                                  \
+            _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+          } else {                                                                             \
+            _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+          }                                                                                    \
+          if (_ls_tail) {                                                                      \
+            _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e); _RS(list);                     \
+          } else {                                                                             \
+            _CASTASGN(list,_ls_e);                                                             \
+          }                                                                                    \
+          _SV(_ls_e,list); _PREVASGN(_ls_e,list,_ls_tail); _RS(list);                          \
+          _ls_tail = _ls_e;                                                                    \
+        }                                                                                      \
+        _ls_p = _ls_q;                                                                         \
+      }                                                                                        \
+      _CASTASGN(list->prev, _ls_tail);                                                         \
+      _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,NULL); _RS(list);                            \
+      if (_ls_nmerges <= 1) {                                                                  \
+        _ls_looping=0;                                                                         \
+      }                                                                                        \
+      _ls_insize *= 2;                                                                         \
+    }                                                                                          \
+  } else _tmp=NULL; /* quiet gcc unused variable warning */                                    \
+} while (0)
+
+#define CDL_SORT(list, cmp)                                                                    \
+do {                                                                                           \
+  LDECLTYPE(list) _ls_p;                                                                       \
+  LDECLTYPE(list) _ls_q;                                                                       \
+  LDECLTYPE(list) _ls_e;                                                                       \
+  LDECLTYPE(list) _ls_tail;                                                                    \
+  LDECLTYPE(list) _ls_oldhead;                                                                 \
+  LDECLTYPE(list) _tmp;                                                                        \
+  LDECLTYPE(list) _tmp2;                                                                       \
+  int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping;                       \
+  if (list) {                                                                                  \
+    _ls_insize = 1;                                                                            \
+    _ls_looping = 1;                                                                           \
+    while (_ls_looping) {                                                                      \
+      _CASTASGN(_ls_p,list);                                                                   \
+      _CASTASGN(_ls_oldhead,list);                                                             \
+      list = NULL;                                                                             \
+      _ls_tail = NULL;                                                                         \
+      _ls_nmerges = 0;                                                                         \
+      while (_ls_p) {                                                                          \
+        _ls_nmerges++;                                                                         \
+        _ls_q = _ls_p;                                                                         \
+        _ls_psize = 0;                                                                         \
+        for (_ls_i = 0; _ls_i < _ls_insize; _ls_i++) {                                         \
+          _ls_psize++;                                                                         \
+          _SV(_ls_q,list);                                                                     \
+          if (_NEXT(_ls_q,list) == _ls_oldhead) {                                              \
+            _ls_q = NULL;                                                                      \
+          } else {                                                                             \
+            _ls_q = _NEXT(_ls_q,list);                                                         \
+          }                                                                                    \
+          _RS(list);                                                                           \
+          if (!_ls_q) break;                                                                   \
+        }                                                                                      \
+        _ls_qsize = _ls_insize;                                                                \
+        while (_ls_psize > 0 || (_ls_qsize > 0 && _ls_q)) {                                    \
+          if (_ls_psize == 0) {                                                                \
+            _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+            if (_ls_q == _ls_oldhead) { _ls_q = NULL; }                                        \
+          } else if (_ls_qsize == 0 || !_ls_q) {                                               \
+            _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+            if (_ls_p == _ls_oldhead) { _ls_p = NULL; }                                        \
+          } else if (cmp(_ls_p,_ls_q) <= 0) {                                                  \
+            _ls_e = _ls_p; _SV(_ls_p,list); _ls_p = _NEXT(_ls_p,list); _RS(list); _ls_psize--; \
+            if (_ls_p == _ls_oldhead) { _ls_p = NULL; }                                        \
+          } else {                                                                             \
+            _ls_e = _ls_q; _SV(_ls_q,list); _ls_q = _NEXT(_ls_q,list); _RS(list); _ls_qsize--; \
+            if (_ls_q == _ls_oldhead) { _ls_q = NULL; }                                        \
+          }                                                                                    \
+          if (_ls_tail) {                                                                      \
+            _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_ls_e); _RS(list);                     \
+          } else {                                                                             \
+            _CASTASGN(list,_ls_e);                                                             \
+          }                                                                                    \
+          _SV(_ls_e,list); _PREVASGN(_ls_e,list,_ls_tail); _RS(list);                          \
+          _ls_tail = _ls_e;                                                                    \
+        }                                                                                      \
+        _ls_p = _ls_q;                                                                         \
+      }                                                                                        \
+      _CASTASGN(list->prev,_ls_tail);                                                          \
+      _CASTASGN(_tmp2,list);                                                                   \
+      _SV(_ls_tail,list); _NEXTASGN(_ls_tail,list,_tmp2); _RS(list);                           \
+      if (_ls_nmerges <= 1) {                                                                  \
+        _ls_looping=0;                                                                         \
+      }                                                                                        \
+      _ls_insize *= 2;                                                                         \
+    }                                                                                          \
+  } else _tmp=NULL; /* quiet gcc unused variable warning */                                    \
+} while (0)
+
+/******************************************************************************
+ * singly linked list macros (non-circular)                                   *
+ *****************************************************************************/
+#define LL_PREPEND(head,add)                                                                   \
+do {                                                                                           \
+  (add)->next = head;                                                                          \
+  head = add;                                                                                  \
+} while (0)
+
+#define LL_APPEND(head,add)                                                                    \
+do {                                                                                           \
+  LDECLTYPE(head) _tmp;                                                                        \
+  (add)->next=NULL;                                                                            \
+  if (head) {                                                                                  \
+    _tmp = head;                                                                               \
+    while (_tmp->next) { _tmp = _tmp->next; }                                                  \
+    _tmp->next=(add);                                                                          \
+  } else {                                                                                     \
+    (head)=(add);                                                                              \
+  }                                                                                            \
+} while (0)
+
+#define LL_DELETE(head,del)                                                                    \
+do {                                                                                           \
+  LDECLTYPE(head) _tmp;                                                                        \
+  if ((head) == (del)) {                                                                       \
+    (head)=(head)->next;                                                                       \
+  } else {                                                                                     \
+    _tmp = head;                                                                               \
+    while (_tmp->next && (_tmp->next != (del))) {                                              \
+      _tmp = _tmp->next;                                                                       \
+    }                                                                                          \
+    if (_tmp->next) {                                                                          \
+      _tmp->next = ((del)->next);                                                              \
+    }                                                                                          \
+  }                                                                                            \
+} while (0)
+
+/* Here are VS2008 replacements for LL_APPEND and LL_DELETE */
+#define LL_APPEND_VS2008(head,add)                                                             \
+do {                                                                                           \
+  if (head) {                                                                                  \
+    (add)->next = head;     /* use add->next as a temp variable */                             \
+    while ((add)->next->next) { (add)->next = (add)->next->next; }                             \
+    (add)->next->next=(add);                                                                   \
+  } else {                                                                                     \
+    (head)=(add);                                                                              \
+  }                                                                                            \
+  (add)->next=NULL;                                                                            \
+} while (0)
+
+#define LL_DELETE_VS2008(head,del)                                                             \
+do {                                                                                           \
+  if ((head) == (del)) {                                                                       \
+    (head)=(head)->next;                                                                       \
+  } else {                                                                                     \
+    char *_tmp = (char*)(head);                                                                \
+    while (head->next && (head->next != (del))) {                                              \
+      head = head->next;                                                                       \
+    }                                                                                          \
+    if (head->next) {                                                                          \
+      head->next = ((del)->next);                                                              \
+    }                                                                                          \
+    {                                                                                          \
+      char **_head_alias = (char**)&(head);                                                    \
+      *_head_alias = _tmp;                                                                     \
+    }                                                                                          \
+  }                                                                                            \
+} while (0)
+#ifdef NO_DECLTYPE
+#undef LL_APPEND
+#define LL_APPEND LL_APPEND_VS2008
+#undef LL_DELETE
+#define LL_DELETE LL_DELETE_VS2008
+#endif
+/* end VS2008 replacements */
+
+#define LL_FOREACH(head,el)                                                                    \
+    for(el=head;el;el=el->next)
+
+#define LL_FOREACH_SAFE(head,el,tmp)                                                           \
+  for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
+
+#define LL_SEARCH_SCALAR(head,out,field,val)                                                   \
+do {                                                                                           \
+    LL_FOREACH(head,out) {                                                                     \
+      if ((out)->field == (val)) break;                                                        \
+    }                                                                                          \
+} while(0) 
+
+#define LL_SEARCH(head,out,elt,cmp)                                                            \
+do {                                                                                           \
+    LL_FOREACH(head,out) {                                                                     \
+      if ((cmp(out,elt))==0) break;                                                            \
+    }                                                                                          \
+} while(0) 
+
+/******************************************************************************
+ * doubly linked list macros (non-circular)                                   *
+ *****************************************************************************/
+#define DL_PREPEND(head,add)                                                                   \
+do {                                                                                           \
+ (add)->next = head;                                                                           \
+ if (head) {                                                                                   \
+   (add)->prev = (head)->prev;                                                                 \
+   (head)->prev = (add);                                                                       \
+ } else {                                                                                      \
+   (add)->prev = (add);                                                                        \
+ }                                                                                             \
+ (head) = (add);                                                                               \
+} while (0)
+
+#define DL_APPEND(head,add)                                                                    \
+do {                                                                                           \
+  if (head) {                                                                                  \
+      (add)->prev = (head)->prev;                                                              \
+      (head)->prev->next = (add);                                                              \
+      (head)->prev = (add);                                                                    \
+      (add)->next = NULL;                                                                      \
+  } else {                                                                                     \
+      (head)=(add);                                                                            \
+      (head)->prev = (head);                                                                   \
+      (head)->next = NULL;                                                                     \
+  }                                                                                            \
+} while (0);
+
+#define DL_DELETE(head,del)                                                                    \
+do {                                                                                           \
+  if ((del)->prev == (del)) {                                                                  \
+      (head)=NULL;                                                                             \
+  } else if ((del)==(head)) {                                                                  \
+      (del)->next->prev = (del)->prev;                                                         \
+      (head) = (del)->next;                                                                    \
+  } else {                                                                                     \
+      (del)->prev->next = (del)->next;                                                         \
+      if ((del)->next) {                                                                       \
+          (del)->next->prev = (del)->prev;                                                     \
+      } else {                                                                                 \
+          (head)->prev = (del)->prev;                                                          \
+      }                                                                                        \
+  }                                                                                            \
+} while (0);
+
+
+#define DL_FOREACH(head,el)                                                                    \
+    for(el=head;el;el=el->next)
+
+/* this version is safe for deleting the elements during iteration */
+#define DL_FOREACH_SAFE(head,el,tmp)                                                           \
+  for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
+
+/* these are identical to their singly-linked list counterparts */
+#define DL_SEARCH_SCALAR LL_SEARCH_SCALAR
+#define DL_SEARCH LL_SEARCH
+
+/******************************************************************************
+ * circular doubly linked list macros                                         *
+ *****************************************************************************/
+#define CDL_PREPEND(head,add)                                                                  \
+do {                                                                                           \
+ if (head) {                                                                                   \
+   (add)->prev = (head)->prev;                                                                 \
+   (add)->next = (head);                                                                       \
+   (head)->prev = (add);                                                                       \
+   (add)->prev->next = (add);                                                                  \
+ } else {                                                                                      \
+   (add)->prev = (add);                                                                        \
+   (add)->next = (add);                                                                        \
+ }                                                                                             \
+(head)=(add);                                                                                  \
+} while (0)
+
+#define CDL_DELETE(head,del)                                                                   \
+do {                                                                                           \
+  if ( ((head)==(del)) && ((head)->next == (head))) {                                          \
+      (head) = 0L;                                                                             \
+  } else {                                                                                     \
+     (del)->next->prev = (del)->prev;                                                          \
+     (del)->prev->next = (del)->next;                                                          \
+     if ((del) == (head)) (head)=(del)->next;                                                  \
+  }                                                                                            \
+} while (0);
+
+#define CDL_FOREACH(head,el)                                                                   \
+    for(el=head;el;el=(el->next==head ? 0L : el->next)) 
+
+#define CDL_FOREACH_SAFE(head,el,tmp1,tmp2)                                                    \
+  for((el)=(head), ((tmp1)=(head)?((head)->prev):NULL);                                        \
+      (el) && ((tmp2)=(el)->next, 1);                                                          \
+      ((el) = (((el)==(tmp1)) ? 0L : (tmp2))))
+
+#define CDL_SEARCH_SCALAR(head,out,field,val)                                                  \
+do {                                                                                           \
+    CDL_FOREACH(head,out) {                                                                    \
+      if ((out)->field == (val)) break;                                                        \
+    }                                                                                          \
+} while(0) 
+
+#define CDL_SEARCH(head,out,elt,cmp)                                                           \
+do {                                                                                           \
+    CDL_FOREACH(head,out) {                                                                    \
+      if ((cmp(out,elt))==0) break;                                                            \
+    }                                                                                          \
+} while(0) 
+
+#endif /* UTLIST_H */
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/libuvc.pc.in
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/libuvc.pc.in b/thirdparty/libuvc-0.0.6/libuvc.pc.in
new file mode 100644
index 0000000..4f7adb8
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/libuvc.pc.in
@@ -0,0 +1,11 @@
+libdir=@CONF_LIBRARY_DIR@
+includedir=@CONF_INCLUDE_DIR@
+
+Name: libuvc
+Description: @libuvc_DESCRIPTION@
+URL: @libuvc_URL@
+Version: @libuvc_VERSION@
+Libs: -L${libdir} -luvc
+Libs.private: -lusb-1.0
+Cflags: -I${includedir}
+Requires: libusb-1.0

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/libuvcConfig.cmake.in
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/libuvcConfig.cmake.in b/thirdparty/libuvc-0.0.6/libuvcConfig.cmake.in
new file mode 100644
index 0000000..e5b0cae
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/libuvcConfig.cmake.in
@@ -0,0 +1,3 @@
+# - Config file for the libuvc package
+set(libuvc_INCLUDE_DIRS "@CONF_INCLUDE_DIR@")
+set(libuvc_LIBRARIES "@CONF_LIBRARY@")

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/libuvcConfigVersion.cmake.in
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/libuvcConfigVersion.cmake.in b/thirdparty/libuvc-0.0.6/libuvcConfigVersion.cmake.in
new file mode 100644
index 0000000..00ff766
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/libuvcConfigVersion.cmake.in
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION "@libuvc_VERSION@")
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  set(PACKAGE_VERSION_COMPATIBLE TRUE)
+  if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+    set(PACKAGE_VERSION_EXACT TRUE)
+  endif()
+endif()


[2/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/device.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/device.c b/thirdparty/libuvc-0.0.6/src/device.c
new file mode 100644
index 0000000..a987735
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/device.c
@@ -0,0 +1,1791 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+/**
+ * @defgroup device Device handling and enumeration
+ * @brief Support for finding, inspecting and opening UVC devices
+ */
+
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+
+int uvc_already_open(uvc_context_t *ctx, struct libusb_device *usb_dev);
+void uvc_free_devh(uvc_device_handle_t *devh);
+
+uvc_error_t uvc_get_device_info(uvc_device_t *dev, uvc_device_info_t **info);
+void uvc_free_device_info(uvc_device_info_t *info);
+
+uvc_error_t uvc_scan_control(uvc_device_t *dev, uvc_device_info_t *info);
+uvc_error_t uvc_parse_vc(uvc_device_t *dev,
+			 uvc_device_info_t *info,
+			 const unsigned char *block, size_t block_size);
+uvc_error_t uvc_parse_vc_selector_unit(uvc_device_t *dev,
+					uvc_device_info_t *info,
+					const unsigned char *block, size_t block_size);
+uvc_error_t uvc_parse_vc_extension_unit(uvc_device_t *dev,
+					uvc_device_info_t *info,
+					const unsigned char *block,
+					size_t block_size);
+uvc_error_t uvc_parse_vc_header(uvc_device_t *dev,
+				uvc_device_info_t *info,
+				const unsigned char *block, size_t block_size);
+uvc_error_t uvc_parse_vc_input_terminal(uvc_device_t *dev,
+					uvc_device_info_t *info,
+					const unsigned char *block,
+					size_t block_size);
+uvc_error_t uvc_parse_vc_processing_unit(uvc_device_t *dev,
+					 uvc_device_info_t *info,
+					 const unsigned char *block,
+					 size_t block_size);
+
+uvc_error_t uvc_scan_streaming(uvc_device_t *dev,
+			       uvc_device_info_t *info,
+			       int interface_idx);
+uvc_error_t uvc_parse_vs(uvc_device_t *dev,
+			 uvc_device_info_t *info,
+			 uvc_streaming_interface_t *stream_if,
+			 const unsigned char *block, size_t block_size);
+uvc_error_t uvc_parse_vs_format_uncompressed(uvc_streaming_interface_t *stream_if,
+					     const unsigned char *block,
+					     size_t block_size);
+uvc_error_t uvc_parse_vs_format_mjpeg(uvc_streaming_interface_t *stream_if,
+					     const unsigned char *block,
+					     size_t block_size);
+uvc_error_t uvc_parse_vs_frame_uncompressed(uvc_streaming_interface_t *stream_if,
+					    const unsigned char *block,
+					    size_t block_size);
+uvc_error_t uvc_parse_vs_frame_format(uvc_streaming_interface_t *stream_if,
+					    const unsigned char *block,
+					    size_t block_size);
+uvc_error_t uvc_parse_vs_frame_frame(uvc_streaming_interface_t *stream_if,
+					    const unsigned char *block,
+					    size_t block_size);
+uvc_error_t uvc_parse_vs_input_header(uvc_streaming_interface_t *stream_if,
+				      const unsigned char *block,
+				      size_t block_size);
+
+void LIBUSB_CALL _uvc_status_callback(struct libusb_transfer *transfer);
+
+/** @internal
+ * @brief Test whether the specified USB device has been opened as a UVC device
+ * @ingroup device
+ *
+ * @param ctx Context in which to search for the UVC device
+ * @param usb_dev USB device to find
+ * @return true if the device is open in this context
+ */
+int uvc_already_open(uvc_context_t *ctx, struct libusb_device *usb_dev) {
+  uvc_device_handle_t *devh;
+
+  DL_FOREACH(ctx->open_devices, devh) {
+    if (usb_dev == devh->dev->usb_dev)
+      return 1;
+  }
+
+  return 0;
+}
+
+/** @brief Finds a camera identified by vendor, product and/or serial number
+ * @ingroup device
+ *
+ * @param[in] ctx UVC context in which to search for the camera
+ * @param[out] dev Reference to the camera, or NULL if not found
+ * @param[in] vid Vendor ID number, optional
+ * @param[in] pid Product ID number, optional
+ * @param[in] sn Serial number or NULL
+ * @return Error finding device or UVC_SUCCESS
+ */
+uvc_error_t uvc_find_device(
+    uvc_context_t *ctx, uvc_device_t **dev,
+    int vid, int pid, const char *sn) {
+  uvc_error_t ret = UVC_SUCCESS;
+
+  uvc_device_t **list;
+  uvc_device_t *test_dev;
+  int dev_idx;
+  int found_dev;
+
+  UVC_ENTER();
+
+  ret = uvc_get_device_list(ctx, &list);
+
+  if (ret != UVC_SUCCESS) {
+    UVC_EXIT(ret);
+    return ret;
+  }
+
+  dev_idx = 0;
+  found_dev = 0;
+
+  while (!found_dev && (test_dev = list[dev_idx++]) != NULL) {
+    uvc_device_descriptor_t *desc;
+
+    if (uvc_get_device_descriptor(test_dev, &desc) != UVC_SUCCESS)
+      continue;
+
+    if ((!vid || desc->idVendor == vid)
+        && (!pid || desc->idProduct == pid)
+        && (!sn || (desc->serialNumber && !strcmp(desc->serialNumber, sn))))
+      found_dev = 1;
+
+    uvc_free_device_descriptor(desc);
+  }
+
+  if (found_dev)
+    uvc_ref_device(test_dev);
+
+  uvc_free_device_list(list, 1);
+
+  if (found_dev) {
+    *dev = test_dev;
+    UVC_EXIT(UVC_SUCCESS);
+    return UVC_SUCCESS;
+  } else {
+    UVC_EXIT(UVC_ERROR_NO_DEVICE);
+    return UVC_ERROR_NO_DEVICE;
+  }
+}
+
+/** @brief Finds all cameras identified by vendor, product and/or serial number
+ * @ingroup device
+ *
+ * @param[in] ctx UVC context in which to search for the camera
+ * @param[out] devs List of matching cameras
+ * @param[in] vid Vendor ID number, optional
+ * @param[in] pid Product ID number, optional
+ * @param[in] sn Serial number or NULL
+ * @return Error finding device or UVC_SUCCESS
+ */
+uvc_error_t uvc_find_devices(
+    uvc_context_t *ctx, uvc_device_t ***devs,
+    int vid, int pid, const char *sn) {
+  uvc_error_t ret = UVC_SUCCESS;
+
+  uvc_device_t **list;
+  uvc_device_t *test_dev;
+  int dev_idx;
+  int found_dev;
+
+  uvc_device_t **list_internal;
+  int num_uvc_devices;
+
+  UVC_ENTER();
+
+  ret = uvc_get_device_list(ctx, &list);
+
+  if (ret != UVC_SUCCESS) {
+    UVC_EXIT(ret);
+    return ret;
+  }
+
+  num_uvc_devices = 0;
+  dev_idx = 0;
+  found_dev = 0;
+
+  list_internal = malloc(sizeof(*list_internal));
+  *list_internal = NULL;
+
+  while ((test_dev = list[dev_idx++]) != NULL) {
+    uvc_device_descriptor_t *desc;
+
+    if (uvc_get_device_descriptor(test_dev, &desc) != UVC_SUCCESS)
+      continue;
+
+    if ((!vid || desc->idVendor == vid)
+        && (!pid || desc->idProduct == pid)
+        && (!sn || (desc->serialNumber && !strcmp(desc->serialNumber, sn)))) {
+      found_dev = 1;
+      uvc_ref_device(test_dev);
+
+      num_uvc_devices++;
+      list_internal = realloc(list_internal, (num_uvc_devices + 1) * sizeof(*list_internal));
+
+      list_internal[num_uvc_devices - 1] = test_dev;
+      list_internal[num_uvc_devices] = NULL;
+    }
+
+    uvc_free_device_descriptor(desc);
+  }
+
+  uvc_free_device_list(list, 1);
+
+  if (found_dev) {
+    *devs = list_internal;
+    UVC_EXIT(UVC_SUCCESS);
+    return UVC_SUCCESS;
+  } else {
+    UVC_EXIT(UVC_ERROR_NO_DEVICE);
+    return UVC_ERROR_NO_DEVICE;
+  }
+}
+
+/** @brief Get the number of the bus to which the device is attached
+ * @ingroup device
+ */
+uint8_t uvc_get_bus_number(uvc_device_t *dev) {
+  return libusb_get_bus_number(dev->usb_dev);
+}
+
+/** @brief Get the number assigned to the device within its bus
+ * @ingroup device
+ */
+uint8_t uvc_get_device_address(uvc_device_t *dev) {
+  return libusb_get_device_address(dev->usb_dev);
+}
+
+/** @brief Open a UVC device
+ * @ingroup device
+ *
+ * @param dev Device to open
+ * @param[out] devh Handle on opened device
+ * @return Error opening device or SUCCESS
+ */
+uvc_error_t uvc_open(
+    uvc_device_t *dev,
+    uvc_device_handle_t **devh) {
+  uvc_error_t ret;
+  struct libusb_device_handle *usb_devh;
+  uvc_device_handle_t *internal_devh;
+  struct libusb_device_descriptor desc;
+
+  UVC_ENTER();
+
+  ret = libusb_open(dev->usb_dev, &usb_devh);
+  UVC_DEBUG("libusb_open() = %d", ret);
+
+  if (ret != UVC_SUCCESS) {
+    UVC_EXIT(ret);
+    return ret;
+  }
+
+  uvc_ref_device(dev);
+
+  internal_devh = calloc(1, sizeof(*internal_devh));
+  internal_devh->dev = dev;
+  internal_devh->usb_devh = usb_devh;
+
+  ret = uvc_get_device_info(dev, &(internal_devh->info));
+
+  if (ret != UVC_SUCCESS)
+    goto fail;
+
+  UVC_DEBUG("claiming control interface %d", internal_devh->info->ctrl_if.bInterfaceNumber);
+  ret = uvc_claim_if(internal_devh, internal_devh->info->ctrl_if.bInterfaceNumber);
+  if (ret != UVC_SUCCESS)
+    goto fail;
+
+  libusb_get_device_descriptor(dev->usb_dev, &desc);
+  internal_devh->is_isight = (desc.idVendor == 0x05ac && desc.idProduct == 0x8501);
+
+  if (internal_devh->info->ctrl_if.bEndpointAddress) {
+    internal_devh->status_xfer = libusb_alloc_transfer(0);
+    if (!internal_devh->status_xfer) {
+      ret = UVC_ERROR_NO_MEM;
+      goto fail;
+    }
+
+    libusb_fill_interrupt_transfer(internal_devh->status_xfer,
+                                   usb_devh,
+                                   internal_devh->info->ctrl_if.bEndpointAddress,
+                                   internal_devh->status_buf,
+                                   sizeof(internal_devh->status_buf),
+                                   _uvc_status_callback,
+                                   internal_devh,
+                                   0);
+    ret = libusb_submit_transfer(internal_devh->status_xfer);
+    UVC_DEBUG("libusb_submit_transfer() = %d", ret);
+
+    if (ret) {
+      fprintf(stderr,
+              "uvc: device has a status interrupt endpoint, but unable to read from it\n");
+      goto fail;
+    }
+  }
+
+  if (dev->ctx->own_usb_ctx && dev->ctx->open_devices == NULL) {
+    /* Since this is our first device, we need to spawn the event handler thread */
+    uvc_start_handler_thread(dev->ctx);
+  }
+
+  DL_APPEND(dev->ctx->open_devices, internal_devh);
+  *devh = internal_devh;
+
+  UVC_EXIT(ret);
+
+  return ret;
+
+ fail:
+  if ( internal_devh->info ) {
+    uvc_release_if(internal_devh, internal_devh->info->ctrl_if.bInterfaceNumber);
+  }
+  libusb_close(usb_devh);
+  uvc_unref_device(dev);
+  uvc_free_devh(internal_devh);
+
+  UVC_EXIT(ret);
+
+  return ret;
+}
+
+/**
+ * @internal
+ * @brief Parses the complete device descriptor for a device
+ * @ingroup device
+ * @note Free *info with uvc_free_device_info when you're done
+ *
+ * @param dev Device to parse descriptor for
+ * @param info Where to store a pointer to the new info struct
+ */
+uvc_error_t uvc_get_device_info(uvc_device_t *dev,
+				uvc_device_info_t **info) {
+  uvc_error_t ret;
+  uvc_device_info_t *internal_info;
+
+  UVC_ENTER();
+
+  internal_info = calloc(1, sizeof(*internal_info));
+  if (!internal_info) {
+    UVC_EXIT(UVC_ERROR_NO_MEM);
+    return UVC_ERROR_NO_MEM;
+  }
+
+  if (libusb_get_config_descriptor(dev->usb_dev,
+				   0,
+				   &(internal_info->config)) != 0) {
+    free(internal_info);
+    UVC_EXIT(UVC_ERROR_IO);
+    return UVC_ERROR_IO;
+  }
+
+  ret = uvc_scan_control(dev, internal_info);
+  if (ret != UVC_SUCCESS) {
+    uvc_free_device_info(internal_info);
+    UVC_EXIT(ret);
+    return ret;
+  }
+
+  *info = internal_info;
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/**
+ * @internal
+ * @brief Frees the device descriptor for a device
+ * @ingroup device
+ *
+ * @param info Which device info block to free
+ */
+void uvc_free_device_info(uvc_device_info_t *info) {
+  uvc_input_terminal_t *input_term, *input_term_tmp;
+  uvc_processing_unit_t *proc_unit, *proc_unit_tmp;
+  uvc_extension_unit_t *ext_unit, *ext_unit_tmp;
+
+  uvc_streaming_interface_t *stream_if, *stream_if_tmp;
+  uvc_format_desc_t *format, *format_tmp;
+  uvc_frame_desc_t *frame, *frame_tmp;
+
+  UVC_ENTER();
+
+  DL_FOREACH_SAFE(info->ctrl_if.input_term_descs, input_term, input_term_tmp) {
+    DL_DELETE(info->ctrl_if.input_term_descs, input_term);
+    free(input_term);
+  }
+
+  DL_FOREACH_SAFE(info->ctrl_if.processing_unit_descs, proc_unit, proc_unit_tmp) {
+    DL_DELETE(info->ctrl_if.processing_unit_descs, proc_unit);
+    free(proc_unit);
+  }
+
+  DL_FOREACH_SAFE(info->ctrl_if.extension_unit_descs, ext_unit, ext_unit_tmp) {
+    DL_DELETE(info->ctrl_if.extension_unit_descs, ext_unit);
+    free(ext_unit);
+  }
+
+  DL_FOREACH_SAFE(info->stream_ifs, stream_if, stream_if_tmp) {
+    DL_FOREACH_SAFE(stream_if->format_descs, format, format_tmp) {
+      DL_FOREACH_SAFE(format->frame_descs, frame, frame_tmp) {
+        if (frame->intervals)
+          free(frame->intervals);
+
+        DL_DELETE(format->frame_descs, frame);
+        free(frame);
+      }
+
+      DL_DELETE(stream_if->format_descs, format);
+      free(format);
+    }
+
+    DL_DELETE(info->stream_ifs, stream_if);
+    free(stream_if);
+  }
+
+  if (info->config)
+    libusb_free_config_descriptor(info->config);
+
+  free(info);
+
+  UVC_EXIT_VOID();
+}
+
+/**
+ * @brief Get a descriptor that contains the general information about
+ * a device
+ * @ingroup device
+ *
+ * Free *desc with uvc_free_device_descriptor when you're done.
+ *
+ * @param dev Device to fetch information about
+ * @param[out] desc Descriptor structure
+ * @return Error if unable to fetch information, else SUCCESS
+ */
+uvc_error_t uvc_get_device_descriptor(
+    uvc_device_t *dev,
+    uvc_device_descriptor_t **desc) {
+  uvc_device_descriptor_t *desc_internal;
+  struct libusb_device_descriptor usb_desc;
+  struct libusb_device_handle *usb_devh;
+  uvc_error_t ret;
+
+  UVC_ENTER();
+
+  ret = libusb_get_device_descriptor(dev->usb_dev, &usb_desc);
+
+  if (ret != UVC_SUCCESS) {
+    UVC_EXIT(ret);
+    return ret;
+  }
+
+  desc_internal = calloc(1, sizeof(*desc_internal));
+  desc_internal->idVendor = usb_desc.idVendor;
+  desc_internal->idProduct = usb_desc.idProduct;
+
+  if (libusb_open(dev->usb_dev, &usb_devh) == 0) {
+    unsigned char buf[64];
+
+    int bytes = libusb_get_string_descriptor_ascii(
+        usb_devh, usb_desc.iSerialNumber, buf, sizeof(buf));
+
+    if (bytes > 0)
+      desc_internal->serialNumber = strdup((const char*) buf);
+
+    bytes = libusb_get_string_descriptor_ascii(
+        usb_devh, usb_desc.iManufacturer, buf, sizeof(buf));
+
+    if (bytes > 0)
+      desc_internal->manufacturer = strdup((const char*) buf);
+
+    bytes = libusb_get_string_descriptor_ascii(
+        usb_devh, usb_desc.iProduct, buf, sizeof(buf));
+
+    if (bytes > 0)
+      desc_internal->product = strdup((const char*) buf);
+
+    libusb_close(usb_devh);
+  } else {
+    UVC_DEBUG("can't open device %04x:%04x, not fetching serial etc.",
+	      usb_desc.idVendor, usb_desc.idProduct);
+  }
+
+  *desc = desc_internal;
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/**
+ * @brief Frees a device descriptor created with uvc_get_device_descriptor
+ * @ingroup device
+ *
+ * @param desc Descriptor to free
+ */
+void uvc_free_device_descriptor(
+    uvc_device_descriptor_t *desc) {
+  UVC_ENTER();
+
+  if (desc->serialNumber)
+    free((void*) desc->serialNumber);
+
+  if (desc->manufacturer)
+    free((void*) desc->manufacturer);
+
+  if (desc->product)
+    free((void*) desc->product);
+
+  free(desc);
+
+  UVC_EXIT_VOID();
+}
+
+/**
+ * @brief Get a list of the UVC devices attached to the system
+ * @ingroup device
+ *
+ * @note Free the list with uvc_free_device_list when you're done.
+ *
+ * @param ctx UVC context in which to list devices
+ * @param list List of uvc_device structures
+ * @return Error if unable to list devices, else SUCCESS
+ */
+uvc_error_t uvc_get_device_list(
+    uvc_context_t *ctx,
+    uvc_device_t ***list) {
+  struct libusb_device **usb_dev_list;
+  struct libusb_device *usb_dev;
+  int num_usb_devices;
+
+  uvc_device_t **list_internal;
+  int num_uvc_devices;
+
+  /* per device */
+  int dev_idx;
+  struct libusb_config_descriptor *config;
+  struct libusb_device_descriptor desc;
+  uint8_t got_interface;
+
+  /* per interface */
+  int interface_idx;
+  const struct libusb_interface *interface;
+
+  /* per altsetting */
+  int altsetting_idx;
+  const struct libusb_interface_descriptor *if_desc;
+
+  UVC_ENTER();
+
+  num_usb_devices = libusb_get_device_list(ctx->usb_ctx, &usb_dev_list);
+
+  if (num_usb_devices < 0) {
+    UVC_EXIT(UVC_ERROR_IO);
+    return UVC_ERROR_IO;
+  }
+
+  list_internal = malloc(sizeof(*list_internal));
+  *list_internal = NULL;
+
+  num_uvc_devices = 0;
+  dev_idx = -1;
+
+  while ((usb_dev = usb_dev_list[++dev_idx]) != NULL) {
+    got_interface = 0;
+
+    if (libusb_get_config_descriptor(usb_dev, 0, &config) != 0)
+      continue;
+
+    if ( libusb_get_device_descriptor ( usb_dev, &desc ) != LIBUSB_SUCCESS )
+      continue;
+
+    for (interface_idx = 0;
+	 !got_interface && interface_idx < config->bNumInterfaces;
+	 ++interface_idx) {
+      interface = &config->interface[interface_idx];
+
+      for (altsetting_idx = 0;
+	   !got_interface && altsetting_idx < interface->num_altsetting;
+	   ++altsetting_idx) {
+	if_desc = &interface->altsetting[altsetting_idx];
+
+        // Skip TIS cameras that definitely aren't UVC even though they might
+        // look that way
+
+        if ( 0x199e == desc.idVendor && desc.idProduct  >= 0x8201 &&
+            desc.idProduct <= 0x8208 ) {
+          continue;
+        }
+
+        // Special case for Imaging Source cameras
+	/* Video, Streaming */
+        if ( 0x199e == desc.idVendor && ( 0x8101 == desc.idProduct ||
+            0x8102 == desc.idProduct ) &&
+            if_desc->bInterfaceClass == 255 &&
+            if_desc->bInterfaceSubClass == 2 ) {
+	  got_interface = 1;
+	}
+
+	/* Video, Streaming */
+	if (if_desc->bInterfaceClass == 14 && if_desc->bInterfaceSubClass == 2) {
+	  got_interface = 1;
+	}
+      }
+    }
+
+    libusb_free_config_descriptor(config);
+
+    if (got_interface) {
+      uvc_device_t *uvc_dev = malloc(sizeof(*uvc_dev));
+      uvc_dev->ctx = ctx;
+      uvc_dev->ref = 0;
+      uvc_dev->usb_dev = usb_dev;
+      uvc_ref_device(uvc_dev);
+
+      num_uvc_devices++;
+      list_internal = realloc(list_internal, (num_uvc_devices + 1) * sizeof(*list_internal));
+
+      list_internal[num_uvc_devices - 1] = uvc_dev;
+      list_internal[num_uvc_devices] = NULL;
+
+      UVC_DEBUG("    UVC: %d", dev_idx);
+    } else {
+      UVC_DEBUG("non-UVC: %d", dev_idx);
+    }
+  }
+
+  libusb_free_device_list(usb_dev_list, 1);
+
+  *list = list_internal;
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/**
+ * @brief Frees a list of device structures created with uvc_get_device_list.
+ * @ingroup device
+ *
+ * @param list Device list to free
+ * @param unref_devices Decrement the reference counter for each device
+ * in the list, and destroy any entries that end up with zero references
+ */
+void uvc_free_device_list(uvc_device_t **list, uint8_t unref_devices) {
+  uvc_device_t *dev;
+  int dev_idx = 0;
+
+  UVC_ENTER();
+
+  if (unref_devices) {
+    while ((dev = list[dev_idx++]) != NULL) {
+      uvc_unref_device(dev);
+    }
+  }
+
+  free(list);
+
+  UVC_EXIT_VOID();
+}
+
+/**
+ * @brief Get the uvc_device_t corresponding to an open device
+ * @ingroup device
+ *
+ * @note Unref the uvc_device_t when you're done with it
+ *
+ * @param devh Device handle to an open UVC device
+ */
+uvc_device_t *uvc_get_device(uvc_device_handle_t *devh) {
+  uvc_ref_device(devh->dev);
+  return devh->dev;
+}
+
+/**
+ * @brief Get the underlying libusb device handle for an open device
+ * @ingroup device
+ *
+ * This can be used to access other interfaces on the same device, e.g.
+ * a webcam microphone.
+ *
+ * @note The libusb device handle is only valid while the UVC device is open;
+ * it will be invalidated upon calling uvc_close.
+ *
+ * @param devh UVC device handle to an open device
+ */
+libusb_device_handle *uvc_get_libusb_handle(uvc_device_handle_t *devh) {
+  return devh->usb_devh;
+}
+
+/**
+ * @brief Get camera terminal descriptor for the open device.
+ *
+ * @note Do not modify the returned structure.
+ * @note The returned structure is part of a linked list, but iterating through
+ * it will make it no longer the camera terminal
+ *
+ * @param devh Device handle to an open UVC device
+ */
+const uvc_input_terminal_t *uvc_get_camera_terminal(uvc_device_handle_t *devh) {
+  const uvc_input_terminal_t *term = uvc_get_input_terminals(devh);
+  while(term != NULL) {
+    if (term->wTerminalType == UVC_ITT_CAMERA) {
+      break;
+    }
+    else {
+      term = term->next;
+    }
+  }
+  return term;
+}
+
+
+/**
+ * @brief Get input terminal descriptors for the open device.
+ *
+ * @note Do not modify the returned structure.
+ * @note The returned structure is part of a linked list. Iterate through
+ *       it by using the 'next' pointers.
+ *
+ * @param devh Device handle to an open UVC device
+ */
+const uvc_input_terminal_t *uvc_get_input_terminals(uvc_device_handle_t *devh) {
+  return devh->info->ctrl_if.input_term_descs;
+}
+
+/**
+ * @brief Get output terminal descriptors for the open device.
+ *
+ * @note Do not modify the returned structure.
+ * @note The returned structure is part of a linked list. Iterate through
+ *       it by using the 'next' pointers.
+ *
+ * @param devh Device handle to an open UVC device
+ */
+const uvc_output_terminal_t *uvc_get_output_terminals(uvc_device_handle_t *devh) {
+  return NULL; /* @todo */
+}
+
+/**
+ * @brief Get selector unit descriptors for the open device.
+ *
+ * @note Do not modify the returned structure.
+ * @note The returned structure is part of a linked list. Iterate through
+ *       it by using the 'next' pointers.
+ *
+ * @param devh Device handle to an open UVC device
+ */
+const uvc_selector_unit_t *uvc_get_selector_units(uvc_device_handle_t *devh) {
+  return devh->info->ctrl_if.selector_unit_descs;
+}
+
+/**
+ * @brief Get processing unit descriptors for the open device.
+ *
+ * @note Do not modify the returned structure.
+ * @note The returned structure is part of a linked list. Iterate through
+ *       it by using the 'next' pointers.
+ *
+ * @param devh Device handle to an open UVC device
+ */
+const uvc_processing_unit_t *uvc_get_processing_units(uvc_device_handle_t *devh) {
+  return devh->info->ctrl_if.processing_unit_descs;
+}
+
+/**
+ * @brief Get extension unit descriptors for the open device.
+ *
+ * @note Do not modify the returned structure.
+ * @note The returned structure is part of a linked list. Iterate through
+ *       it by using the 'next' pointers.
+ *
+ * @param devh Device handle to an open UVC device
+ */
+const uvc_extension_unit_t *uvc_get_extension_units(uvc_device_handle_t *devh) {
+  return devh->info->ctrl_if.extension_unit_descs;
+}
+
+/**
+ * @brief Increment the reference count for a device
+ * @ingroup device
+ *
+ * @param dev Device to reference
+ */
+void uvc_ref_device(uvc_device_t *dev) {
+  UVC_ENTER();
+
+  dev->ref++;
+  libusb_ref_device(dev->usb_dev);
+
+  UVC_EXIT_VOID();
+}
+
+/**
+ * @brief Decrement the reference count for a device
+ * @ingropu device
+ * @note If the count reaches zero, the device will be discarded
+ *
+ * @param dev Device to unreference
+ */
+void uvc_unref_device(uvc_device_t *dev) {
+  UVC_ENTER();
+
+  libusb_unref_device(dev->usb_dev);
+  dev->ref--;
+
+  if (dev->ref == 0)
+    free(dev);
+
+  UVC_EXIT_VOID();
+}
+
+/** @internal
+ * Claim a UVC interface, detaching the kernel driver if necessary.
+ * @ingroup device
+ *
+ * @param devh UVC device handle
+ * @param idx UVC interface index
+ */
+uvc_error_t uvc_claim_if(uvc_device_handle_t *devh, int idx) {
+  int ret = UVC_SUCCESS;
+
+  UVC_ENTER();
+
+  if ( devh->claimed & ( 1 << idx )) {
+    fprintf ( stderr, "attempt to claim already-claimed interface %d\n", idx );
+    UVC_EXIT(ret);
+    return ret;
+  }
+
+  /* Tell libusb to detach any active kernel drivers. libusb will keep track of whether
+   * it found a kernel driver for this interface. */
+  ret = libusb_detach_kernel_driver(devh->usb_devh, idx);
+
+  if (ret == UVC_SUCCESS || ret == LIBUSB_ERROR_NOT_FOUND || ret == LIBUSB_ERROR_NOT_SUPPORTED) {
+    UVC_DEBUG("claiming interface %d", idx);
+    if (!( ret = libusb_claim_interface(devh->usb_devh, idx))) {
+      devh->claimed |= ( 1 << idx );
+    }
+  } else {
+    UVC_DEBUG("not claiming interface %d: unable to detach kernel driver (%s)",
+              idx, uvc_strerror(ret));
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** @internal
+ * Release a UVC interface.
+ * @ingroup device
+ *
+ * @param devh UVC device handle
+ * @param idx UVC interface index
+ */
+uvc_error_t uvc_release_if(uvc_device_handle_t *devh, int idx) {
+  int ret = UVC_SUCCESS;
+
+  UVC_ENTER();
+  UVC_DEBUG("releasing interface %d", idx);
+  if (!( devh->claimed & ( 1 << idx ))) {
+    fprintf ( stderr, "attempt to release unclaimed interface %d\n", idx );
+    UVC_EXIT(ret);
+    return ret;
+  }
+
+  /* libusb_release_interface *should* reset the alternate setting to the first available,
+     but sometimes (e.g. on Darwin) it doesn't. Thus, we do it explicitly here.
+     This is needed to de-initialize certain cameras. */
+  libusb_set_interface_alt_setting(devh->usb_devh, idx, 0);
+  ret = libusb_release_interface(devh->usb_devh, idx);
+
+  if (UVC_SUCCESS == ret) {
+    devh->claimed &= ~( 1 << idx );
+    /* Reattach any kernel drivers that were disabled when we claimed this interface */
+    ret = libusb_attach_kernel_driver(devh->usb_devh, idx);
+
+    if (ret == UVC_SUCCESS) {
+      UVC_DEBUG("reattached kernel driver to interface %d", idx);
+    } else if (ret == LIBUSB_ERROR_NOT_FOUND || ret == LIBUSB_ERROR_NOT_SUPPORTED) {
+      ret = UVC_SUCCESS;  /* NOT_FOUND and NOT_SUPPORTED are OK: nothing to do */
+    } else {
+      UVC_DEBUG("error reattaching kernel driver to interface %d: %s",
+                idx, uvc_strerror(ret));
+    }
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** @internal
+ * Find a device's VideoControl interface and process its descriptor
+ * @ingroup device
+ */
+uvc_error_t uvc_scan_control(uvc_device_t *dev, uvc_device_info_t *info) {
+  const struct libusb_interface_descriptor *if_desc;
+  uvc_error_t parse_ret, ret;
+  int interface_idx;
+  const unsigned char *buffer;
+  size_t buffer_left, block_size;
+
+  UVC_ENTER();
+
+  ret = UVC_SUCCESS;
+  if_desc = NULL;
+
+  uvc_device_descriptor_t* dev_desc;
+  int haveTISCamera = 0;
+  uvc_get_device_descriptor ( dev, &dev_desc );
+  if ( 0x199e == dev_desc->idVendor && ( 0x8101 == dev_desc->idProduct ||
+      0x8102 == dev_desc->idProduct )) {
+    haveTISCamera = 1;
+  }
+  uvc_free_device_descriptor ( dev_desc );
+
+  for (interface_idx = 0; interface_idx < info->config->bNumInterfaces; ++interface_idx) {
+    if_desc = &info->config->interface[interface_idx].altsetting[0];
+
+    if ( haveTISCamera && if_desc->bInterfaceClass == 255 && if_desc->bInterfaceSubClass == 1) // Video, Control
+      break;
+
+    if (if_desc->bInterfaceClass == 14 && if_desc->bInterfaceSubClass == 1) // Video, Control
+      break;
+
+    if_desc = NULL;
+  }
+
+  if (if_desc == NULL) {
+    UVC_EXIT(UVC_ERROR_INVALID_DEVICE);
+    return UVC_ERROR_INVALID_DEVICE;
+  }
+
+  info->ctrl_if.bInterfaceNumber = interface_idx;
+  if (if_desc->bNumEndpoints != 0) {
+    info->ctrl_if.bEndpointAddress = if_desc->endpoint[0].bEndpointAddress;
+  }
+
+  buffer = if_desc->extra;
+  buffer_left = if_desc->extra_length;
+
+  while (buffer_left >= 3) { // parseX needs to see buf[0,2] = length,type
+    block_size = buffer[0];
+    parse_ret = uvc_parse_vc(dev, info, buffer, block_size);
+
+    if (parse_ret != UVC_SUCCESS) {
+      ret = parse_ret;
+      break;
+    }
+
+    buffer_left -= block_size;
+    buffer += block_size;
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** @internal
+ * @brief Parse a VideoControl header.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vc_header(uvc_device_t *dev,
+				uvc_device_info_t *info,
+				const unsigned char *block, size_t block_size) {
+  size_t i;
+  uvc_error_t scan_ret, ret = UVC_SUCCESS;
+
+  UVC_ENTER();
+
+  /*
+  int uvc_version;
+  uvc_version = (block[4] >> 4) * 1000 + (block[4] & 0x0f) * 100
+    + (block[3] >> 4) * 10 + (block[3] & 0x0f);
+  */
+
+  info->ctrl_if.bcdUVC = SW_TO_SHORT(&block[3]);
+
+  switch (info->ctrl_if.bcdUVC) {
+  case 0x0100:
+    info->ctrl_if.dwClockFrequency = DW_TO_INT(block + 7);
+  case 0x010a:
+    info->ctrl_if.dwClockFrequency = DW_TO_INT(block + 7);
+  case 0x0110:
+    break;
+  default:
+    UVC_EXIT(UVC_ERROR_NOT_SUPPORTED);
+    return UVC_ERROR_NOT_SUPPORTED;
+  }
+
+  for (i = 12; i < block_size; ++i) {
+    scan_ret = uvc_scan_streaming(dev, info, block[i]);
+    if (scan_ret != UVC_SUCCESS) {
+      ret = scan_ret;
+      break;
+    }
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** @internal
+ * @brief Parse a VideoControl input terminal.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vc_input_terminal(uvc_device_t *dev,
+					uvc_device_info_t *info,
+					const unsigned char *block, size_t block_size) {
+  uvc_input_terminal_t *term;
+  size_t i;
+
+  UVC_ENTER();
+
+  /* only supporting camera-type input terminals */
+  if (SW_TO_SHORT(&block[4]) != UVC_ITT_CAMERA) {
+    UVC_EXIT(UVC_SUCCESS);
+    return UVC_SUCCESS;
+  }
+
+  term = calloc(1, sizeof(*term));
+
+  term->bTerminalID = block[3];
+  term->wTerminalType = SW_TO_SHORT(&block[4]);
+  term->wObjectiveFocalLengthMin = SW_TO_SHORT(&block[8]);
+  term->wObjectiveFocalLengthMax = SW_TO_SHORT(&block[10]);
+  term->wOcularFocalLength = SW_TO_SHORT(&block[12]);
+
+  for (i = 14 + block[14]; i >= 15; --i)
+    term->bmControls = block[i] + (term->bmControls << 8);
+
+  DL_APPEND(info->ctrl_if.input_term_descs, term);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoControl processing unit.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vc_processing_unit(uvc_device_t *dev,
+					 uvc_device_info_t *info,
+					 const unsigned char *block, size_t block_size) {
+  uvc_processing_unit_t *unit;
+  size_t i;
+
+  UVC_ENTER();
+
+  unit = calloc(1, sizeof(*unit));
+  unit->bUnitID = block[3];
+  unit->bSourceID = block[4];
+
+  for (i = 7 + block[7]; i >= 8; --i)
+    unit->bmControls = block[i] + (unit->bmControls << 8);
+
+  DL_APPEND(info->ctrl_if.processing_unit_descs, unit);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoControl selector unit.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vc_selector_unit(uvc_device_t *dev,
+					 uvc_device_info_t *info,
+					 const unsigned char *block, size_t block_size) {
+  uvc_selector_unit_t *unit;
+
+  UVC_ENTER();
+
+  unit = calloc(1, sizeof(*unit));
+  unit->bUnitID = block[3];
+
+  DL_APPEND(info->ctrl_if.selector_unit_descs, unit);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoControl extension unit.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vc_extension_unit(uvc_device_t *dev,
+					uvc_device_info_t *info,
+					const unsigned char *block, size_t block_size) {
+  uvc_extension_unit_t *unit = calloc(1, sizeof(*unit));
+  const uint8_t *start_of_controls;
+  int size_of_controls, num_in_pins;
+  int i;
+
+  UVC_ENTER();
+
+  unit->bUnitID = block[3];
+  memcpy(unit->guidExtensionCode, &block[4], 16);
+
+  num_in_pins = block[21];
+  size_of_controls = block[22 + num_in_pins];
+  start_of_controls = &block[23 + num_in_pins];
+
+  for (i = size_of_controls - 1; i >= 0; --i)
+    unit->bmControls = start_of_controls[i] + (unit->bmControls << 8);
+
+  DL_APPEND(info->ctrl_if.extension_unit_descs, unit);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * Process a single VideoControl descriptor block
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vc(
+    uvc_device_t *dev,
+    uvc_device_info_t *info,
+    const unsigned char *block, size_t block_size) {
+  int descriptor_subtype;
+  uvc_error_t ret = UVC_SUCCESS;
+
+  UVC_ENTER();
+
+  if (block[1] != 36) { // not a CS_INTERFACE descriptor??
+    UVC_EXIT(UVC_SUCCESS);
+    return UVC_SUCCESS; // UVC_ERROR_INVALID_DEVICE;
+  }
+
+  descriptor_subtype = block[2];
+
+  switch (descriptor_subtype) {
+  case UVC_VC_HEADER:
+    ret = uvc_parse_vc_header(dev, info, block, block_size);
+    break;
+  case UVC_VC_INPUT_TERMINAL:
+    ret = uvc_parse_vc_input_terminal(dev, info, block, block_size);
+    break;
+  case UVC_VC_OUTPUT_TERMINAL:
+    break;
+  case UVC_VC_SELECTOR_UNIT:
+    ret = uvc_parse_vc_selector_unit(dev, info, block, block_size);
+    break;
+  case UVC_VC_PROCESSING_UNIT:
+    ret = uvc_parse_vc_processing_unit(dev, info, block, block_size);
+    break;
+  case UVC_VC_EXTENSION_UNIT:
+    ret = uvc_parse_vc_extension_unit(dev, info, block, block_size);
+    break;
+  default:
+    ret = UVC_ERROR_INVALID_DEVICE;
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** @internal
+ * Process a VideoStreaming interface
+ * @ingroup device
+ */
+uvc_error_t uvc_scan_streaming(uvc_device_t *dev,
+			       uvc_device_info_t *info,
+			       int interface_idx) {
+  const struct libusb_interface_descriptor *if_desc;
+  const unsigned char *buffer;
+  size_t buffer_left, block_size;
+  uvc_error_t ret, parse_ret;
+  uvc_streaming_interface_t *stream_if;
+
+  UVC_ENTER();
+
+  ret = UVC_SUCCESS;
+
+  if_desc = &(info->config->interface[interface_idx].altsetting[0]);
+  buffer = if_desc->extra;
+  buffer_left = if_desc->extra_length;
+
+  stream_if = calloc(1, sizeof(*stream_if));
+  stream_if->parent = info;
+  stream_if->bInterfaceNumber = if_desc->bInterfaceNumber;
+  DL_APPEND(info->stream_ifs, stream_if);
+
+  while (buffer_left >= 3) {
+    block_size = buffer[0];
+    parse_ret = uvc_parse_vs(dev, info, stream_if, buffer, block_size);
+
+    if (parse_ret != UVC_SUCCESS) {
+      ret = parse_ret;
+      break;
+    }
+
+    buffer_left -= block_size;
+    buffer += block_size;
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** @internal
+ * @brief Parse a VideoStreaming header block.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vs_input_header(uvc_streaming_interface_t *stream_if,
+				      const unsigned char *block,
+				      size_t block_size) {
+  UVC_ENTER();
+
+  stream_if->bEndpointAddress = block[6] & 0x8f;
+  stream_if->bTerminalLink = block[8];
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoStreaming uncompressed format block.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vs_format_uncompressed(uvc_streaming_interface_t *stream_if,
+					     const unsigned char *block,
+					     size_t block_size) {
+  UVC_ENTER();
+
+  uvc_format_desc_t *format = calloc(1, sizeof(*format));
+
+  format->parent = stream_if;
+  format->bDescriptorSubtype = block[2];
+  format->bFormatIndex = block[3];
+  //format->bmCapabilities = block[4];
+  //format->bmFlags = block[5];
+  memcpy(format->guidFormat, &block[5], 16);
+  format->bBitsPerPixel = block[21];
+  format->bDefaultFrameIndex = block[22];
+  format->bAspectRatioX = block[23];
+  format->bAspectRatioY = block[24];
+  format->bmInterlaceFlags = block[25];
+  format->bCopyProtect = block[26];
+
+  DL_APPEND(stream_if->format_descs, format);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoStreaming frame format block.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vs_frame_format(uvc_streaming_interface_t *stream_if,
+					     const unsigned char *block,
+					     size_t block_size) {
+  UVC_ENTER();
+
+  uvc_format_desc_t *format = calloc(1, sizeof(*format));
+
+  format->parent = stream_if;
+  format->bDescriptorSubtype = block[2];
+  format->bFormatIndex = block[3];
+  format->bNumFrameDescriptors = block[4];
+  memcpy(format->guidFormat, &block[5], 16);
+  format->bBitsPerPixel = block[21];
+  format->bDefaultFrameIndex = block[22];
+  format->bAspectRatioX = block[23];
+  format->bAspectRatioY = block[24];
+  format->bmInterlaceFlags = block[25];
+  format->bCopyProtect = block[26];
+  format->bVariableSize = block[27];
+
+  DL_APPEND(stream_if->format_descs, format);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoStreaming MJPEG format block.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vs_format_mjpeg(uvc_streaming_interface_t *stream_if,
+					     const unsigned char *block,
+					     size_t block_size) {
+  UVC_ENTER();
+
+  uvc_format_desc_t *format = calloc(1, sizeof(*format));
+
+  format->parent = stream_if;
+  format->bDescriptorSubtype = block[2];
+  format->bFormatIndex = block[3];
+  memcpy(format->fourccFormat, "MJPG", 4);
+  format->bmFlags = block[5];
+  format->bBitsPerPixel = 0;
+  format->bDefaultFrameIndex = block[6];
+  format->bAspectRatioX = block[7];
+  format->bAspectRatioY = block[8];
+  format->bmInterlaceFlags = block[9];
+  format->bCopyProtect = block[10];
+
+  DL_APPEND(stream_if->format_descs, format);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoStreaming uncompressed frame block.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vs_frame_frame(uvc_streaming_interface_t *stream_if,
+					    const unsigned char *block,
+					    size_t block_size) {
+  uvc_format_desc_t *format;
+  uvc_frame_desc_t *frame;
+
+  const unsigned char *p;
+  int i;
+
+  UVC_ENTER();
+
+  format = stream_if->format_descs->prev;
+  frame = calloc(1, sizeof(*frame));
+
+  frame->parent = format;
+
+  frame->bDescriptorSubtype = block[2];
+  frame->bFrameIndex = block[3];
+  frame->bmCapabilities = block[4];
+  frame->wWidth = block[5] + (block[6] << 8);
+  frame->wHeight = block[7] + (block[8] << 8);
+  frame->dwMinBitRate = DW_TO_INT(&block[9]);
+  frame->dwMaxBitRate = DW_TO_INT(&block[13]);
+  frame->dwDefaultFrameInterval = DW_TO_INT(&block[17]);
+  frame->bFrameIntervalType = block[21];
+  frame->dwBytesPerLine = DW_TO_INT(&block[22]);
+
+  if (block[21] == 0) {
+    frame->dwMinFrameInterval = DW_TO_INT(&block[26]);
+    frame->dwMaxFrameInterval = DW_TO_INT(&block[30]);
+    frame->dwFrameIntervalStep = DW_TO_INT(&block[34]);
+  } else {
+    frame->intervals = calloc(block[21] + 1, sizeof(frame->intervals[0]));
+    p = &block[26];
+
+    for (i = 0; i < block[21]; ++i) {
+      frame->intervals[i] = DW_TO_INT(p);
+      p += 4;
+    }
+    frame->intervals[block[21]] = 0;
+  }
+
+  DL_APPEND(format->frame_descs, frame);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * @brief Parse a VideoStreaming uncompressed frame block.
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vs_frame_uncompressed(uvc_streaming_interface_t *stream_if,
+					    const unsigned char *block,
+					    size_t block_size) {
+  uvc_format_desc_t *format;
+  uvc_frame_desc_t *frame;
+
+  const unsigned char *p;
+  int i;
+
+  UVC_ENTER();
+
+  format = stream_if->format_descs->prev;
+  frame = calloc(1, sizeof(*frame));
+
+  frame->parent = format;
+
+  frame->bDescriptorSubtype = block[2];
+  frame->bFrameIndex = block[3];
+  frame->bmCapabilities = block[4];
+  frame->wWidth = block[5] + (block[6] << 8);
+  frame->wHeight = block[7] + (block[8] << 8);
+  frame->dwMinBitRate = DW_TO_INT(&block[9]);
+  frame->dwMaxBitRate = DW_TO_INT(&block[13]);
+  frame->dwMaxVideoFrameBufferSize = DW_TO_INT(&block[17]);
+  frame->dwDefaultFrameInterval = DW_TO_INT(&block[21]);
+  frame->bFrameIntervalType = block[25];
+
+  if (block[25] == 0) {
+    frame->dwMinFrameInterval = DW_TO_INT(&block[26]);
+    frame->dwMaxFrameInterval = DW_TO_INT(&block[30]);
+    frame->dwFrameIntervalStep = DW_TO_INT(&block[34]);
+  } else {
+    frame->intervals = calloc(block[25] + 1, sizeof(frame->intervals[0]));
+    p = &block[26];
+
+    for (i = 0; i < block[25]; ++i) {
+      frame->intervals[i] = DW_TO_INT(p);
+      p += 4;
+    }
+    frame->intervals[block[25]] = 0;
+  }
+
+  DL_APPEND(format->frame_descs, frame);
+
+  UVC_EXIT(UVC_SUCCESS);
+  return UVC_SUCCESS;
+}
+
+/** @internal
+ * Process a single VideoStreaming descriptor block
+ * @ingroup device
+ */
+uvc_error_t uvc_parse_vs(
+    uvc_device_t *dev,
+    uvc_device_info_t *info,
+    uvc_streaming_interface_t *stream_if,
+    const unsigned char *block, size_t block_size) {
+  uvc_error_t ret;
+  int descriptor_subtype;
+
+  UVC_ENTER();
+
+  ret = UVC_SUCCESS;
+  descriptor_subtype = block[2];
+
+  switch (descriptor_subtype) {
+  case UVC_VS_INPUT_HEADER:
+    ret = uvc_parse_vs_input_header(stream_if, block, block_size);
+    break;
+  case UVC_VS_OUTPUT_HEADER:
+    fprintf ( stderr, "unsupported descriptor subtype VS_OUTPUT_HEADER\n" );
+    break;
+  case UVC_VS_STILL_IMAGE_FRAME:
+    fprintf ( stderr, "unsupported descriptor subtype VS_STILL_IMAGE_FRAME\n" );
+    break;
+  case UVC_VS_FORMAT_UNCOMPRESSED:
+    ret = uvc_parse_vs_format_uncompressed(stream_if, block, block_size);
+    break;
+  case UVC_VS_FORMAT_MJPEG:
+    ret = uvc_parse_vs_format_mjpeg(stream_if, block, block_size);
+    break;
+  case UVC_VS_FRAME_UNCOMPRESSED:
+  case UVC_VS_FRAME_MJPEG:
+    ret = uvc_parse_vs_frame_uncompressed(stream_if, block, block_size);
+    break;
+  case UVC_VS_FORMAT_MPEG2TS:
+    fprintf ( stderr, "unsupported descriptor subtype VS_FORMAT_MPEG2TS\n" );
+    break;
+  case UVC_VS_FORMAT_DV:
+    fprintf ( stderr, "unsupported descriptor subtype VS_FORMAT_DV\n" );
+    break;
+  case UVC_VS_COLORFORMAT:
+    fprintf ( stderr, "unsupported descriptor subtype VS_COLORFORMAT\n" );
+    break;
+  case UVC_VS_FORMAT_FRAME_BASED:
+    ret = uvc_parse_vs_frame_format ( stream_if, block, block_size );
+    break;
+  case UVC_VS_FRAME_FRAME_BASED:
+    ret = uvc_parse_vs_frame_frame ( stream_if, block, block_size );
+    break;
+  case UVC_VS_FORMAT_STREAM_BASED:
+    fprintf ( stderr, "unsupported descriptor subtype VS_FORMAT_STREAM_BASED\n" );
+    break;
+  default:
+    /** @todo handle JPEG and maybe still frames or even DV... */
+    //fprintf ( stderr, "unsupported descriptor subtype: %d\n",descriptor_subtype );
+    break;
+  }
+
+  UVC_EXIT(ret);
+  return ret;
+}
+
+/** @internal
+ * @brief Free memory associated with a UVC device
+ * @pre Streaming must be stopped, and threads must have died
+ */
+void uvc_free_devh(uvc_device_handle_t *devh) {
+  UVC_ENTER();
+
+  if (devh->info)
+    uvc_free_device_info(devh->info);
+
+  if (devh->status_xfer)
+    libusb_free_transfer(devh->status_xfer);
+
+  free(devh);
+
+  UVC_EXIT_VOID();
+}
+
+/** @brief Close a device
+ *
+ * @ingroup device
+ *
+ * Ends any stream that's in progress.
+ *
+ * The device handle and frame structures will be invalidated.
+ */
+void uvc_close(uvc_device_handle_t *devh) {
+  UVC_ENTER();
+  uvc_context_t *ctx = devh->dev->ctx;
+
+  if (devh->streams)
+    uvc_stop_streaming(devh);
+
+  uvc_release_if(devh, devh->info->ctrl_if.bInterfaceNumber);
+
+  /* If we are managing the libusb context and this is the last open device,
+   * then we need to cancel the handler thread. When we call libusb_close,
+   * it'll cause a return from the thread's libusb_handle_events call, after
+   * which the handler thread will check the flag we set and then exit. */
+  if (ctx->own_usb_ctx && ctx->open_devices == devh && devh->next == NULL) {
+    ctx->kill_handler_thread = 1;
+    libusb_close(devh->usb_devh);
+    pthread_join(ctx->handler_thread, NULL);
+  } else {
+    libusb_close(devh->usb_devh);
+  }
+
+  DL_DELETE(ctx->open_devices, devh);
+
+  uvc_unref_device(devh->dev);
+
+  uvc_free_devh(devh);
+
+  UVC_EXIT_VOID();
+}
+
+/** @internal
+ * @brief Get number of open devices
+ */
+size_t uvc_num_devices(uvc_context_t *ctx) {
+  size_t count = 0;
+
+  uvc_device_handle_t *devh;
+
+  UVC_ENTER();
+
+  DL_FOREACH(ctx->open_devices, devh) {
+    count++;
+  }
+
+  UVC_EXIT((int) count);
+  return count;
+}
+
+void uvc_process_control_status(uvc_device_handle_t *devh, unsigned char *data, int len) {
+  enum uvc_status_class status_class;
+  uint8_t originator = 0, selector = 0, event = 0;
+  enum uvc_status_attribute attribute = UVC_STATUS_ATTRIBUTE_UNKNOWN;
+  void *content = NULL;
+  size_t content_len = 0;
+  int found_entity = 0;
+  struct uvc_input_terminal *input_terminal;
+  struct uvc_processing_unit *processing_unit;
+
+  UVC_ENTER();
+
+  if (len < 5) {
+    UVC_DEBUG("Short read of VideoControl status update (%d bytes)", len);
+    UVC_EXIT_VOID();
+    return;
+  }
+
+  originator = data[1];
+  event = data[2];
+  selector = data[3];
+
+  if (originator == 0) {
+    UVC_DEBUG("Unhandled update from VC interface");
+    UVC_EXIT_VOID();
+    return;  /* @todo VideoControl virtual entity interface updates */
+  }
+
+  if (event != 0) {
+    UVC_DEBUG("Unhandled VC event %d", (int) event);
+    UVC_EXIT_VOID();
+    return;
+  }
+
+  /* printf("bSelector: %d\n", selector); */
+
+  DL_FOREACH(devh->info->ctrl_if.input_term_descs, input_terminal) {
+    if (input_terminal->bTerminalID == originator) {
+      status_class = UVC_STATUS_CLASS_CONTROL_CAMERA;
+      found_entity = 1;
+      break;
+    }
+  }
+
+  if (!found_entity) {
+    DL_FOREACH(devh->info->ctrl_if.processing_unit_descs, processing_unit) {
+      if (processing_unit->bUnitID == originator) {
+        status_class = UVC_STATUS_CLASS_CONTROL_PROCESSING;
+        found_entity = 1;
+        break;
+      }
+    }
+  }
+
+  if (!found_entity) {
+    UVC_DEBUG("Got status update for unknown VideoControl entity %d",
+  (int) originator);
+    UVC_EXIT_VOID();
+    return;
+  }
+
+  attribute = data[4];
+  content = data + 5;
+  content_len = len - 5;
+
+  UVC_DEBUG("Event: class=%d, event=%d, selector=%d, attribute=%d, content_len=%zd",
+    status_class, event, selector, attribute, content_len);
+
+  if(devh->status_cb) {
+    UVC_DEBUG("Running user-supplied status callback");
+    devh->status_cb(status_class,
+                    event,
+                    selector,
+                    attribute,
+                    content, content_len,
+                    devh->status_user_ptr);
+  }
+  
+  UVC_EXIT_VOID();
+}
+
+void uvc_process_streaming_status(uvc_device_handle_t *devh, unsigned char *data, int len) {
+  
+  UVC_ENTER();
+
+  if (len < 3) {
+    UVC_DEBUG("Invalid streaming status event received.\n");
+    UVC_EXIT_VOID();
+    return;
+  }
+
+  if (data[2] == 0) {
+    if (len < 4) {
+      UVC_DEBUG("Short read of status update (%d bytes)", len);
+      UVC_EXIT_VOID();
+      return;
+    }
+    UVC_DEBUG("Button (intf %u) %s len %d\n", data[1], data[3] ? "pressed" : "released", len);
+    
+    if(devh->button_cb) {
+      UVC_DEBUG("Running user-supplied button callback");
+      devh->button_cb(data[1],
+                      data[3],
+                      devh->button_user_ptr);
+    }
+  } else {
+    UVC_DEBUG("Stream %u error event %02x %02x len %d.\n", data[1], data[2], data[3], len);
+  }
+
+  UVC_EXIT_VOID();
+}
+
+void uvc_process_status_xfer(uvc_device_handle_t *devh, struct libusb_transfer *transfer) {
+  
+  UVC_ENTER();
+
+  /* printf("Got transfer of aLen = %d\n", transfer->actual_length); */
+
+  if (transfer->actual_length > 0) {
+    switch (transfer->buffer[0] & 0x0f) {
+    case 1: /* VideoControl interface */
+      uvc_process_control_status(devh, transfer->buffer, transfer->actual_length);
+      break;
+    case 2:  /* VideoStreaming interface */
+      uvc_process_streaming_status(devh, transfer->buffer, transfer->actual_length);
+      break;
+    }
+  }
+
+  UVC_EXIT_VOID();
+}
+
+/** @internal
+ * @brief Process asynchronous status updates from the device.
+ */
+void LIBUSB_CALL _uvc_status_callback(struct libusb_transfer *transfer) {
+  UVC_ENTER();
+
+  uvc_device_handle_t *devh = (uvc_device_handle_t *) transfer->user_data;
+
+  switch (transfer->status) {
+  case LIBUSB_TRANSFER_ERROR:
+  case LIBUSB_TRANSFER_CANCELLED:
+  case LIBUSB_TRANSFER_NO_DEVICE:
+    UVC_DEBUG("not processing/resubmitting, status = %d", transfer->status);
+    UVC_EXIT_VOID();
+    return;
+  case LIBUSB_TRANSFER_COMPLETED:
+    uvc_process_status_xfer(devh, transfer);
+    break;
+  case LIBUSB_TRANSFER_TIMED_OUT:
+  case LIBUSB_TRANSFER_STALL:
+  case LIBUSB_TRANSFER_OVERFLOW:
+    UVC_DEBUG("retrying transfer, status = %d", transfer->status);
+    break;
+  }
+
+#ifdef UVC_DEBUGGING
+  uvc_error_t ret =
+#endif
+      libusb_submit_transfer(transfer);
+  UVC_DEBUG("libusb_submit_transfer() = %d", ret);
+
+  UVC_EXIT_VOID();
+}
+
+/** @brief Set a callback function to receive status updates
+ *
+ * @ingroup device
+ */
+void uvc_set_status_callback(uvc_device_handle_t *devh,
+                             uvc_status_callback_t cb,
+                             void *user_ptr) {
+  UVC_ENTER();
+
+  devh->status_cb = cb;
+  devh->status_user_ptr = user_ptr;
+
+  UVC_EXIT_VOID();
+}
+
+/** @brief Set a callback function to receive button events
+ *
+ * @ingroup device
+ */
+void uvc_set_button_callback(uvc_device_handle_t *devh,
+                             uvc_button_callback_t cb,
+                             void *user_ptr) {
+  UVC_ENTER();
+
+  devh->button_cb = cb;
+  devh->button_user_ptr = user_ptr;
+
+  UVC_EXIT_VOID();
+}
+
+/**
+ * @brief Get format descriptions for the open device.
+ *
+ * @note Do not modify the returned structure.
+ *
+ * @param devh Device handle to an open UVC device
+ */
+const uvc_format_desc_t *uvc_get_format_descs(uvc_device_handle_t *devh) {
+  return devh->info->stream_ifs->format_descs;
+}
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/diag.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/diag.c b/thirdparty/libuvc-0.0.6/src/diag.c
new file mode 100644
index 0000000..fa17731
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/diag.c
@@ -0,0 +1,355 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+/**
+ * @defgroup diag Diagnostics
+ * @brief Interpretation of devices, error codes and negotiated stream parameters
+ */
+
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+
+/** @internal */
+typedef struct _uvc_error_msg {
+  uvc_error_t err;
+  const char *msg;
+} _uvc_error_msg_t;
+
+static const _uvc_error_msg_t uvc_error_msgs[] = {
+  {UVC_SUCCESS, "Success"},
+  {UVC_ERROR_IO, "I/O error"},
+  {UVC_ERROR_INVALID_PARAM, "Invalid parameter"},
+  {UVC_ERROR_ACCESS, "Access denied"},
+  {UVC_ERROR_NO_DEVICE, "No such device"},
+  {UVC_ERROR_NOT_FOUND, "Not found"},
+  {UVC_ERROR_BUSY, "Busy"},
+  {UVC_ERROR_TIMEOUT, "Timeout"},
+  {UVC_ERROR_OVERFLOW, "Overflow"},
+  {UVC_ERROR_PIPE, "Pipe"},
+  {UVC_ERROR_INTERRUPTED, "Interrupted"},
+  {UVC_ERROR_NO_MEM, "Out of memory"},
+  {UVC_ERROR_NOT_SUPPORTED, "Not supported"},
+  {UVC_ERROR_INVALID_DEVICE, "Invalid device"},
+  {UVC_ERROR_INVALID_MODE, "Invalid mode"},
+  {UVC_ERROR_CALLBACK_EXISTS, "Callback exists"}
+};
+
+/** @brief Print a message explaining an error in the UVC driver
+ * @ingroup diag
+ *
+ * @param err UVC error code
+ * @param msg Optional custom message, prepended to output
+ */
+void uvc_perror(uvc_error_t err, const char *msg) {
+  if (msg && *msg) {
+    fputs(msg, stderr);
+    fputs(": ", stderr);
+  }
+
+  fprintf(stderr, "%s (%d)\n", uvc_strerror(err), err);
+}
+
+/** @brief Return a string explaining an error in the UVC driver
+ * @ingroup diag
+ *
+ * @param err UVC error code
+ * @return error message
+ */
+const char* uvc_strerror(uvc_error_t err) {
+  size_t idx;
+
+  for (idx = 0; idx < sizeof(uvc_error_msgs) / sizeof(*uvc_error_msgs); ++idx) {
+    if (uvc_error_msgs[idx].err == err) {
+      return uvc_error_msgs[idx].msg;
+    }
+  }
+
+  return "Unknown error";
+}
+
+/** @brief Print the values in a stream control block
+ * @ingroup diag
+ *
+ * @param devh UVC device
+ * @param stream Output stream (stderr if NULL)
+ */
+void uvc_print_stream_ctrl(uvc_stream_ctrl_t *ctrl, FILE *stream) {
+  if (stream == NULL)
+    stream = stderr;
+
+  fprintf(stream, "bmHint: %04x\n", ctrl->bmHint);
+  fprintf(stream, "bFormatIndex: %d\n", ctrl->bFormatIndex);
+  fprintf(stream, "bFrameIndex: %d\n", ctrl->bFrameIndex);
+  fprintf(stream, "dwFrameInterval: %u\n", ctrl->dwFrameInterval);
+  fprintf(stream, "wKeyFrameRate: %d\n", ctrl->wKeyFrameRate);
+  fprintf(stream, "wPFrameRate: %d\n", ctrl->wPFrameRate);
+  fprintf(stream, "wCompQuality: %d\n", ctrl->wCompQuality);
+  fprintf(stream, "wCompWindowSize: %d\n", ctrl->wCompWindowSize);
+  fprintf(stream, "wDelay: %d\n", ctrl->wDelay);
+  fprintf(stream, "dwMaxVideoFrameSize: %u\n", ctrl->dwMaxVideoFrameSize);
+  fprintf(stream, "dwMaxPayloadTransferSize: %u\n", ctrl->dwMaxPayloadTransferSize);
+  fprintf(stream, "bInterfaceNumber: %d\n", ctrl->bInterfaceNumber);
+}
+
+static const char *_uvc_name_for_format_subtype(uint8_t subtype) {
+  switch (subtype) {
+  case UVC_VS_FORMAT_UNCOMPRESSED:
+    return "UncompressedFormat";
+  case UVC_VS_FORMAT_MJPEG:
+    return "MJPEGFormat";
+  case UVC_VS_FORMAT_FRAME_BASED:
+    return "FrameFormat";
+  default:
+    return "Unknown";
+  }
+}
+
+/** @brief Print camera capabilities and configuration.
+ * @ingroup diag
+ *
+ * @param devh UVC device
+ * @param stream Output stream (stderr if NULL)
+ */
+void uvc_print_diag(uvc_device_handle_t *devh, FILE *stream) {
+  if (stream == NULL)
+    stream = stderr;
+
+  if (devh->info->ctrl_if.bcdUVC) {
+    uvc_streaming_interface_t *stream_if;
+    int stream_idx = 0;
+
+    uvc_device_descriptor_t *desc;
+    uvc_get_device_descriptor(devh->dev, &desc);
+
+    fprintf(stream, "DEVICE CONFIGURATION (%04x:%04x/%s) ---\n",
+        desc->idVendor, desc->idProduct,
+        desc->serialNumber ? desc->serialNumber : "[none]");
+
+    uvc_free_device_descriptor(desc);
+
+    fprintf(stream, "Status: %s\n", devh->streams ? "streaming" : "idle");
+
+    fprintf(stream, "VideoControl:\n"
+        "\tbcdUVC: 0x%04x\n",
+        devh->info->ctrl_if.bcdUVC);
+
+    DL_FOREACH(devh->info->stream_ifs, stream_if) {
+      uvc_format_desc_t *fmt_desc;
+
+      ++stream_idx;
+
+      fprintf(stream, "VideoStreaming(%d):\n"
+          "\tbEndpointAddress: %d\n\tFormats:\n",
+          stream_idx, stream_if->bEndpointAddress);
+
+      DL_FOREACH(stream_if->format_descs, fmt_desc) {
+        uvc_frame_desc_t *frame_desc;
+        int i;
+
+        switch (fmt_desc->bDescriptorSubtype) {
+          case UVC_VS_FORMAT_UNCOMPRESSED:
+          case UVC_VS_FORMAT_MJPEG:
+          case UVC_VS_FORMAT_FRAME_BASED:
+            fprintf(stream,
+                "\t\%s(%d)\n"
+                "\t\t  bits per pixel: %d\n"
+                "\t\t  GUID: ",
+                _uvc_name_for_format_subtype(fmt_desc->bDescriptorSubtype),
+                fmt_desc->bFormatIndex,
+                fmt_desc->bBitsPerPixel);
+
+            for (i = 0; i < 16; ++i)
+              fprintf(stream, "%02x", fmt_desc->guidFormat[i]);
+
+            fprintf(stream, " (%4s)\n", fmt_desc->fourccFormat );
+
+            fprintf(stream,
+                "\t\t  default frame: %d\n"
+                "\t\t  aspect ratio: %dx%d\n"
+                "\t\t  interlace flags: %02x\n"
+                "\t\t  copy protect: %02x\n",
+                fmt_desc->bDefaultFrameIndex,
+                fmt_desc->bAspectRatioX,
+                fmt_desc->bAspectRatioY,
+                fmt_desc->bmInterlaceFlags,
+                fmt_desc->bCopyProtect);
+
+            DL_FOREACH(fmt_desc->frame_descs, frame_desc) {
+              uint32_t *interval_ptr;
+
+              fprintf(stream,
+                  "\t\t\tFrameDescriptor(%d)\n"
+                  "\t\t\t  capabilities: %02x\n"
+                  "\t\t\t  size: %dx%d\n"
+                  "\t\t\t  bit rate: %d-%d\n"
+                  "\t\t\t  max frame size: %d\n"
+                  "\t\t\t  default interval: 1/%d\n",
+                  frame_desc->bFrameIndex,
+                  frame_desc->bmCapabilities,
+                  frame_desc->wWidth,
+                  frame_desc->wHeight,
+                  frame_desc->dwMinBitRate,
+                  frame_desc->dwMaxBitRate,
+                  frame_desc->dwMaxVideoFrameBufferSize,
+                  10000000 / frame_desc->dwDefaultFrameInterval);
+              if (frame_desc->intervals) {
+                for (interval_ptr = frame_desc->intervals;
+                     *interval_ptr;
+                     ++interval_ptr) {
+                  fprintf(stream,
+                      "\t\t\t  interval[%d]: 1/%d\n",
+		      (int) (interval_ptr - frame_desc->intervals),
+		      10000000 / *interval_ptr);
+                }
+              } else {
+                fprintf(stream,
+                    "\t\t\t  min interval[%d] = 1/%d\n"
+                    "\t\t\t  max interval[%d] = 1/%d\n",
+                    frame_desc->dwMinFrameInterval,
+                    10000000 / frame_desc->dwMinFrameInterval,
+                    frame_desc->dwMaxFrameInterval,
+                    10000000 / frame_desc->dwMaxFrameInterval);
+                if (frame_desc->dwFrameIntervalStep)
+                  fprintf(stream,
+                      "\t\t\t  interval step[%d] = 1/%d\n",
+                      frame_desc->dwFrameIntervalStep,
+                      10000000 / frame_desc->dwFrameIntervalStep);
+              }
+            }
+            break;
+          default:
+            fprintf(stream, "\t-UnknownFormat (%d)\n",
+                fmt_desc->bDescriptorSubtype );
+        }
+      }
+    }
+
+    fprintf(stream, "END DEVICE CONFIGURATION\n");
+  } else {
+    fprintf(stream, "uvc_print_diag: Device not configured!\n");
+  }
+}
+
+/** @brief Print all possible frame configuration.
+ * @ingroup diag
+ *
+ * @param devh UVC device
+ * @param stream Output stream (stderr if NULL)
+ */
+void uvc_print_frameformats(uvc_device_handle_t *devh) {
+
+  if (devh->info->ctrl_if.bcdUVC) {
+    uvc_streaming_interface_t *stream_if;
+    int stream_idx = 0;
+    DL_FOREACH(devh->info->stream_ifs, stream_if) {
+      uvc_format_desc_t *fmt_desc;
+      ++stream_idx;
+
+      DL_FOREACH(stream_if->format_descs, fmt_desc) {
+        uvc_frame_desc_t *frame_desc;
+        int i;
+
+        switch (fmt_desc->bDescriptorSubtype) {
+          case UVC_VS_FORMAT_UNCOMPRESSED:
+          case UVC_VS_FORMAT_MJPEG:
+          case UVC_VS_FORMAT_FRAME_BASED:
+            printf("         \%s(%d)\n"
+                "            bits per pixel: %d\n"
+                "            GUID: ",
+                _uvc_name_for_format_subtype(fmt_desc->bDescriptorSubtype),
+                fmt_desc->bFormatIndex,
+                fmt_desc->bBitsPerPixel);
+
+            for (i = 0; i < 16; ++i)
+              printf("%02x", fmt_desc->guidFormat[i]);
+
+            printf(" (%4s)\n", fmt_desc->fourccFormat );
+
+            printf("            default frame: %d\n"
+                "            aspect ratio: %dx%d\n"
+                "            interlace flags: %02x\n"
+                "            copy protect: %02x\n",
+                fmt_desc->bDefaultFrameIndex,
+                fmt_desc->bAspectRatioX,
+                fmt_desc->bAspectRatioY,
+                fmt_desc->bmInterlaceFlags,
+                fmt_desc->bCopyProtect);
+
+            DL_FOREACH(fmt_desc->frame_descs, frame_desc) {
+              uint32_t *interval_ptr;
+
+              printf("               FrameDescriptor(%d)\n"
+                  "                  capabilities: %02x\n"
+                  "                  size: %dx%d\n"
+                  "                  bit rate: %d-%d\n"
+                  "                  max frame size: %d\n"
+                  "                  default interval: 1/%d\n",
+                  frame_desc->bFrameIndex,
+                  frame_desc->bmCapabilities,
+                  frame_desc->wWidth,
+                  frame_desc->wHeight,
+                  frame_desc->dwMinBitRate,
+                  frame_desc->dwMaxBitRate,
+                  frame_desc->dwMaxVideoFrameBufferSize,
+                  10000000 / frame_desc->dwDefaultFrameInterval);
+              if (frame_desc->intervals) {
+                for (interval_ptr = frame_desc->intervals;
+                     *interval_ptr;
+                     ++interval_ptr) {
+                  printf("                  interval[%d]: 1/%d\n",
+		      (int) (interval_ptr - frame_desc->intervals),
+		      10000000 / *interval_ptr);
+                }
+              } else {
+                printf("                  min interval[%d] = 1/%d\n"
+                    "                  max interval[%d] = 1/%d\n",
+                    frame_desc->dwMinFrameInterval,
+                    10000000 / frame_desc->dwMinFrameInterval,
+                    frame_desc->dwMaxFrameInterval,
+                    10000000 / frame_desc->dwMaxFrameInterval);
+                if (frame_desc->dwFrameIntervalStep)
+                  printf("                  interval step[%d] = 1/%d\n",
+                      frame_desc->dwFrameIntervalStep,
+                      10000000 / frame_desc->dwFrameIntervalStep);
+              }
+            }
+            break;
+          default:
+            printf("\t-UnknownFormat (%d)\n",fmt_desc->bDescriptorSubtype );
+        }
+      }
+    }
+  } else {
+    printf("uvc_print_frameformats: Device not configured!\n");
+  }
+}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/example.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/example.c b/thirdparty/libuvc-0.0.6/src/example.c
new file mode 100644
index 0000000..8178cbf
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/example.c
@@ -0,0 +1,148 @@
+#include "libuvc/libuvc.h"
+#include <stdio.h>
+
+/* This callback function runs once per frame. Use it to perform any
+ * quick processing you need, or have it put the frame into your application's
+ * input queue. If this function takes too long, you'll start losing frames. */
+void cb(uvc_frame_t *frame, void *ptr) {
+  uvc_frame_t *bgr;
+  uvc_error_t ret;
+
+  /* We'll convert the image from YUV/JPEG to BGR, so allocate space */
+  bgr = uvc_allocate_frame(frame->width * frame->height * 3);
+  if (!bgr) {
+    printf("unable to allocate bgr frame!");
+    return;
+  }
+
+  /* Do the BGR conversion */
+  ret = uvc_any2bgr(frame, bgr);
+  if (ret) {
+    uvc_perror(ret, "uvc_any2bgr");
+    uvc_free_frame(bgr);
+    return;
+  }
+
+  /* Call a user function:
+   *
+   * my_type *my_obj = (*my_type) ptr;
+   * my_user_function(ptr, bgr);
+   * my_other_function(ptr, bgr->data, bgr->width, bgr->height);
+   */
+
+  /* Call a C++ method:
+   *
+   * my_type *my_obj = (*my_type) ptr;
+   * my_obj->my_func(bgr);
+   */
+
+  /* Use opencv.highgui to display the image:
+   * 
+   * cvImg = cvCreateImageHeader(
+   *     cvSize(bgr->width, bgr->height),
+   *     IPL_DEPTH_8U,
+   *     3);
+   *
+   * cvSetData(cvImg, bgr->data, bgr->width * 3); 
+   *
+   * cvNamedWindow("Test", CV_WINDOW_AUTOSIZE);
+   * cvShowImage("Test", cvImg);
+   * cvWaitKey(10);
+   *
+   * cvReleaseImageHeader(&cvImg);
+   */
+
+  uvc_free_frame(bgr);
+}
+
+int main(int argc, char **argv) {
+  uvc_context_t *ctx;
+  uvc_device_t *dev;
+  uvc_device_handle_t *devh;
+  uvc_stream_ctrl_t ctrl;
+  uvc_error_t res;
+
+  /* Initialize a UVC service context. Libuvc will set up its own libusb
+   * context. Replace NULL with a libusb_context pointer to run libuvc
+   * from an existing libusb context. */
+  res = uvc_init(&ctx, NULL);
+
+  if (res < 0) {
+    uvc_perror(res, "uvc_init");
+    return res;
+  }
+
+  puts("UVC initialized");
+
+  /* Locates the first attached UVC device, stores in dev */
+  res = uvc_find_device(
+      ctx, &dev,
+      0, 0, NULL); /* filter devices: vendor_id, product_id, "serial_num" */
+
+  if (res < 0) {
+    uvc_perror(res, "uvc_find_device"); /* no devices found */
+  } else {
+    puts("Device found");
+
+    /* Try to open the device: requires exclusive access */
+    res = uvc_open(dev, &devh);
+
+    if (res < 0) {
+      uvc_perror(res, "uvc_open"); /* unable to open device */
+    } else {
+      puts("Device opened");
+
+      /* Print out a message containing all the information that libuvc
+       * knows about the device */
+      uvc_print_diag(devh, stderr);
+
+      /* Try to negotiate a 640x480 30 fps YUYV stream profile */
+      res = uvc_get_stream_ctrl_format_size(
+          devh, &ctrl, /* result stored in ctrl */
+          UVC_FRAME_FORMAT_YUYV, /* YUV 422, aka YUV 4:2:2. try _COMPRESSED */
+          640, 480, 30 /* width, height, fps */
+      );
+
+      /* Print out the result */
+      uvc_print_stream_ctrl(&ctrl, stderr);
+
+      if (res < 0) {
+        uvc_perror(res, "get_mode"); /* device doesn't provide a matching stream */
+      } else {
+        /* Start the video stream. The library will call user function cb:
+         *   cb(frame, (void*) 12345)
+         */
+        res = uvc_start_streaming(devh, &ctrl, cb, 12345, 0);
+
+        if (res < 0) {
+          uvc_perror(res, "start_streaming"); /* unable to start stream */
+        } else {
+          puts("Streaming...");
+
+          uvc_set_ae_mode(devh, 1); /* e.g., turn on auto exposure */
+
+          sleep(10); /* stream for 10 seconds */
+
+          /* End the stream. Blocks until last callback is serviced */
+          uvc_stop_streaming(devh);
+          puts("Done streaming.");
+        }
+      }
+
+      /* Release our handle on the device */
+      uvc_close(devh);
+      puts("Device closed");
+    }
+
+    /* Release the device descriptor */
+    uvc_unref_device(dev);
+  }
+
+  /* Close the UVC context. This closes and cleans up any existing device handles,
+   * and it closes the libusb context if one was not provided. */
+  uvc_exit(ctx);
+  puts("UVC exited");
+
+  return 0;
+}
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/frame-mjpeg.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/frame-mjpeg.c b/thirdparty/libuvc-0.0.6/src/frame-mjpeg.c
new file mode 100644
index 0000000..d2a3fee
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/frame-mjpeg.c
@@ -0,0 +1,187 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2014 Robert Xiao
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+
+/**
+ * @defgroup frame Frame processing
+ */
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+#include <jpeglib.h>
+#include <setjmp.h>
+
+extern uvc_error_t uvc_ensure_frame_size(uvc_frame_t *frame, size_t need_bytes);
+
+struct error_mgr {
+  struct jpeg_error_mgr super;
+  jmp_buf jmp;
+};
+
+static void _error_exit(j_common_ptr dinfo) {
+  struct error_mgr *myerr = (struct error_mgr *)dinfo->err;
+  (*dinfo->err->output_message)(dinfo);
+  longjmp(myerr->jmp, 1);
+}
+
+/* ISO/IEC 10918-1:1993(E) K.3.3. Default Huffman tables used by MJPEG UVC devices
+   which don't specify a Huffman table in the JPEG stream. */
+static const unsigned char dc_lumi_len[] = 
+  {0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0};
+static const unsigned char dc_lumi_val[] = 
+  {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+
+static const unsigned char dc_chromi_len[] = 
+  {0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0};
+static const unsigned char dc_chromi_val[] = 
+  {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+
+static const unsigned char ac_lumi_len[] = 
+  {0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d};
+static const unsigned char ac_lumi_val[] = 
+  {0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21,
+   0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71,
+   0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x23, 0x42, 0xb1,
+   0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x24, 0x33, 0x62, 0x72,
+   0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25,
+   0x26, 0x27, 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37,
+   0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+   0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+   0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
+   0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x83,
+   0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93,
+   0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3,
+   0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3,
+   0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
+   0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3,
+   0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
+   0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1,
+   0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa};
+static const unsigned char ac_chromi_len[] = 
+  {0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77};
+static const unsigned char ac_chromi_val[] = 
+  {0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31,
+   0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22,
+   0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xa1, 0xb1, 0xc1,
+   0x09, 0x23, 0x33, 0x52, 0xf0, 0x15, 0x62, 0x72, 0xd1,
+   0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18,
+   0x19, 0x1a, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36,
+   0x37, 0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47,
+   0x48, 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+   0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+   0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
+   0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
+   0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a,
+   0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,
+   0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba,
+   0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,
+   0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
+   0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+   0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa};
+
+#define COPY_HUFF_TABLE(dinfo,tbl,name) do { \
+  if(dinfo->tbl == NULL) dinfo->tbl = jpeg_alloc_huff_table((j_common_ptr)dinfo); \
+  memcpy(dinfo->tbl->bits, name##_len, sizeof(name##_len)); \
+  memset(dinfo->tbl->huffval, 0, sizeof(dinfo->tbl->huffval)); \
+  memcpy(dinfo->tbl->huffval, name##_val, sizeof(name##_val)); \
+} while(0)
+
+static void insert_huff_tables(j_decompress_ptr dinfo) {
+  COPY_HUFF_TABLE(dinfo, dc_huff_tbl_ptrs[0], dc_lumi);
+  COPY_HUFF_TABLE(dinfo, dc_huff_tbl_ptrs[1], dc_chromi);
+  COPY_HUFF_TABLE(dinfo, ac_huff_tbl_ptrs[0], ac_lumi);
+  COPY_HUFF_TABLE(dinfo, ac_huff_tbl_ptrs[1], ac_chromi);
+}
+
+/** @brief Convert an MJPEG frame to RGB
+ * @ingroup frame
+ *
+ * @param in MJPEG frame
+ * @param out RGB frame
+ */
+uvc_error_t uvc_mjpeg2rgb(uvc_frame_t *in, uvc_frame_t *out) {
+  struct jpeg_decompress_struct dinfo;
+  struct error_mgr jerr;
+  size_t lines_read;
+
+  if (in->frame_format != UVC_FRAME_FORMAT_MJPEG)
+    return UVC_ERROR_INVALID_PARAM;
+
+  if (uvc_ensure_frame_size(out, in->width * in->height * 3) < 0)
+    return UVC_ERROR_NO_MEM;
+
+  out->width = in->width;
+  out->height = in->height;
+  out->frame_format = UVC_FRAME_FORMAT_RGB;
+  out->step = in->width * 3;
+  out->sequence = in->sequence;
+  out->capture_time = in->capture_time;
+  out->source = in->source;
+
+  dinfo.err = jpeg_std_error(&jerr.super);
+  jerr.super.error_exit = _error_exit;
+
+  if (setjmp(jerr.jmp)) {
+    goto fail;
+  }
+
+  jpeg_create_decompress(&dinfo);
+  jpeg_mem_src(&dinfo, in->data, in->data_bytes);
+  jpeg_read_header(&dinfo, TRUE);
+
+  if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
+    /* This frame is missing the Huffman tables: fill in the standard ones */
+    insert_huff_tables(&dinfo);
+  }
+
+  dinfo.out_color_space = JCS_RGB;
+  dinfo.dct_method = JDCT_IFAST;
+
+  jpeg_start_decompress(&dinfo);
+
+  lines_read = 0;
+  while (dinfo.output_scanline < dinfo.output_height) {
+    unsigned char *buffer[1] = {( unsigned char*) out->data + lines_read * out->step };
+    int num_scanlines;
+
+    num_scanlines = jpeg_read_scanlines(&dinfo, buffer, 1);
+    lines_read += num_scanlines;
+  }
+
+  jpeg_finish_decompress(&dinfo);
+  jpeg_destroy_decompress(&dinfo);
+  return 0;
+
+fail:
+  jpeg_destroy_decompress(&dinfo);
+  return UVC_ERROR_OTHER;
+}


[6/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/cameras/quickcampro9000.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/cameras/quickcampro9000.txt b/thirdparty/libuvc-0.0.6/cameras/quickcampro9000.txt
new file mode 100644
index 0000000..5b859b3
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/cameras/quickcampro9000.txt
@@ -0,0 +1,1543 @@
+
+Bus 001 Device 009: ID 046d:0809 Logitech, Inc. Webcam Pro 9000
+Device Descriptor:
+  bLength                18
+  bDescriptorType         1
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  idVendor           0x046d Logitech, Inc.
+  idProduct          0x0809 Webcam Pro 9000
+  bcdDevice            0.10
+  iManufacturer           0 
+  iProduct                0 
+  iSerial                 2 XXXXXXXX
+  bNumConfigurations      1
+  Configuration Descriptor:
+    bLength                 9
+    bDescriptorType         2
+    wTotalLength         2589
+    bNumInterfaces          4
+    bConfigurationValue     1
+    iConfiguration          0 
+    bmAttributes         0x80
+      (Bus Powered)
+    MaxPower              500mA
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         0
+      bInterfaceCount         2
+      bFunctionClass         14 Video
+      bFunctionSubClass       3 Video Interface Collection
+      bFunctionProtocol       0 
+      iFunction               0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        0
+      bAlternateSetting       0
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      1 Video Control
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoControl Interface Descriptor:
+        bLength                13
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdUVC               1.00
+        wTotalLength          245
+        dwClockFrequency       48.000000MHz
+        bInCollection           1
+        baInterfaceNr( 0)       1
+      VideoControl Interface Descriptor:
+        bLength                18
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Camera Sensor
+        bAssocTerminal          0
+        iTerminal               0 
+        wObjectiveFocalLengthMin      0
+        wObjectiveFocalLengthMax      0
+        wOcularFocalLength            0
+        bControlSize                  3
+        bmControls           0x0000080e
+          Auto-Exposure Mode
+          Auto-Exposure Priority
+          Exposure Time (Absolute)
+          PanTilt (Absolute)
+      VideoControl Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      5 (PROCESSING_UNIT)
+      Warning: Descriptor too short
+        bUnitID                 2
+        bSourceID               1
+        wMaxMultiplier      16384
+        bControlSize            2
+        bmControls     0x0000175b
+          Brightness
+          Contrast
+          Saturation
+          Sharpness
+          White Balance Temperature
+          Backlight Compensation
+          Gain
+          Power Line Frequency
+          White Balance Temperature, Auto
+        iProcessing             0 
+        bmVideoStandards     0x1b
+          None
+          NTSC - 525/60
+          SECAM - 625/50
+          NTSC - 625/50
+      VideoControl Interface Descriptor:
+        bLength                27
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                 4
+        guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d221e}
+        bNumControl            10
+        bNrPins                 1
+        baSourceID( 0)          2
+        bControlSize            2
+        bmControls( 0)       0xff
+        bmControls( 1)       0x03
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                27
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                13
+        guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d221f}
+        bNumControl             7
+        bNrPins                 1
+        baSourceID( 0)          2
+        bControlSize            2
+        bmControls( 0)       0x6f
+        bmControls( 1)       0x01
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                28
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                 8
+        guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d2251}
+        bNumControl             3
+        bNrPins                 1
+        baSourceID( 0)          4
+        bControlSize            3
+        bmControls( 0)       0x19
+        bmControls( 1)       0x00
+        bmControls( 2)       0x00
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                28
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                10
+        guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d2252}
+        bNumControl            24
+        bNrPins                 1
+        baSourceID( 0)          4
+        bControlSize            3
+        bmControls( 0)       0xff
+        bmControls( 1)       0xff
+        bmControls( 2)       0xff
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                28
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                14
+        guidExtensionCode         {b7935ba4-15c7-0245-90f4-532a3b311365}
+        bNumControl             4
+        bNrPins                 1
+        baSourceID( 0)          1
+        bControlSize            3
+        bmControls( 0)       0x0f
+        bmControls( 1)       0x00
+        bmControls( 2)       0x00
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                28
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                 9
+        guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d2256}
+        bNumControl             5
+        bNrPins                 1
+        baSourceID( 0)          4
+        bControlSize            3
+        bmControls( 0)       0x0c
+        bmControls( 1)       0x00
+        bmControls( 2)       0x00
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                28
+        bDescriptorType        36
+        bDescriptorSubtype      6 (EXTENSION_UNIT)
+        bUnitID                12
+        guidExtensionCode         {82066163-7050-ab49-b8cc-b3855e8d2250}
+        bNumControl            17
+        bNrPins                 1
+        baSourceID( 0)          4
+        bControlSize            3
+        bmControls( 0)       0xfe
+        bmControls( 1)       0x7f
+        bmControls( 2)       0x70
+        iExtension              0 
+      VideoControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             5
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          0
+        bSourceID               4
+        iTerminal               0 
+      ** UNRECOGNIZED:  20 41 01 0b 82 06 61 63 70 50 ab 49 b8 cc b3 85 5e 8d 22 55 01 01 04 03 01 00 00 00 00 00 00 00
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x87  EP 7 IN
+        bmAttributes            3
+          Transfer Type            Interrupt
+          Synch Type               None
+          Usage Type               Data
+        wMaxPacketSize     0x0010  1x 16 bytes
+        bInterval               8
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      VideoStreaming Interface Descriptor:
+        bLength                            16
+        bDescriptorType                    36
+        bDescriptorSubtype                  1 (INPUT_HEADER)
+        bNumFormats                         3
+        wTotalLength                     1852
+        bEndPointAddress                  129
+        bmInfo                              0
+        bTerminalLink                       5
+        bStillCaptureMethod                 2
+        bTriggerSupport                     1
+        bTriggerUsage                       0
+        bControlSize                        1
+        bmaControls( 0)                    27
+        bmaControls( 1)                    27
+        bmaControls( 2)                    27
+      VideoStreaming Interface Descriptor:
+        bLength                            27
+        bDescriptorType                    36
+        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
+        bFormatIndex                        1
+        bNumFrameDescriptors               18
+        guidFormat                            {59555932-0000-1000-8000-00aa00389b71}
+        bBitsPerPixel                      16
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 1 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                 24576000
+        dwMaxBitRate                147456000
+        dwMaxVideoFrameBufferSize      614400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                           120
+        dwMinBitRate                  1536000
+        dwMaxBitRate                  9216000
+        dwMaxVideoFrameBufferSize       38400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            176
+        wHeight                           144
+        dwMinBitRate                  2027520
+        dwMaxBitRate                 12165120
+        dwMaxVideoFrameBufferSize       50688
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         4
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                  6144000
+        dwMaxBitRate                 36864000
+        dwMaxVideoFrameBufferSize      153600
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         5
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                  8110080
+        dwMaxBitRate                 48660480
+        dwMaxVideoFrameBufferSize      202752
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         6
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           360
+        dwMinBitRate                 18432000
+        dwMaxBitRate                110592000
+        dwMaxVideoFrameBufferSize      460800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         7
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           400
+        dwMinBitRate                 20480000
+        dwMaxBitRate                122880000
+        dwMaxVideoFrameBufferSize      512000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            46
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         8
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            768
+        wHeight                           480
+        dwMinBitRate                 29491200
+        dwMaxBitRate                147456000
+        dwMaxVideoFrameBufferSize      737280
+        dwDefaultFrameInterval         400000
+        bFrameIntervalType                  5
+        dwFrameInterval( 0)            400000
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            46
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                         9
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           456
+        dwMinBitRate                 29184000
+        dwMaxBitRate                145920000
+        dwMaxVideoFrameBufferSize      729600
+        dwDefaultFrameInterval         400000
+        bFrameIntervalType                  5
+        dwFrameInterval( 0)            400000
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            46
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        10
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           504
+        dwMinBitRate                 32256000
+        dwMaxBitRate                161280000
+        dwMaxVideoFrameBufferSize      806400
+        dwDefaultFrameInterval         400000
+        bFrameIntervalType                  5
+        dwFrameInterval( 0)            400000
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            46
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        11
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           600
+        dwMinBitRate                 38400000
+        dwMaxBitRate                192000000
+        dwMaxVideoFrameBufferSize      960000
+        dwDefaultFrameInterval         400000
+        bFrameIntervalType                  5
+        dwFrameInterval( 0)            400000
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            46
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        12
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            864
+        wHeight                           480
+        dwMinBitRate                 33177600
+        dwMaxBitRate                165888000
+        dwMaxVideoFrameBufferSize      829440
+        dwDefaultFrameInterval         400000
+        bFrameIntervalType                  5
+        dwFrameInterval( 0)            400000
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            38
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        13
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            960
+        wHeight                           720
+        dwMinBitRate                 55296000
+        dwMaxBitRate                165888000
+        dwMaxVideoFrameBufferSize     1382400
+        dwDefaultFrameInterval        1000000
+        bFrameIntervalType                  3
+        dwFrameInterval( 0)            666666
+        dwFrameInterval( 1)           1000000
+        dwFrameInterval( 2)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            34
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        14
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           720
+        dwMinBitRate                 73728000
+        dwMaxBitRate                147456000
+        dwMaxVideoFrameBufferSize     1843200
+        dwDefaultFrameInterval        2000000
+        bFrameIntervalType                  2
+        dwFrameInterval( 0)           1333333
+        dwFrameInterval( 1)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            34
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        15
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           800
+        dwMinBitRate                 81920000
+        dwMaxBitRate                163840000
+        dwMaxVideoFrameBufferSize     2048000
+        dwDefaultFrameInterval        2000000
+        bFrameIntervalType                  2
+        dwFrameInterval( 0)           1333333
+        dwFrameInterval( 1)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        16
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                           904
+        dwMinBitRate                115712000
+        dwMaxBitRate                115712000
+        dwMaxVideoFrameBufferSize     2892800
+        dwDefaultFrameInterval        2000000
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        17
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                          1000
+        dwMinBitRate                128000000
+        dwMaxBitRate                128000000
+        dwMaxVideoFrameBufferSize     3200000
+        dwDefaultFrameInterval        2000000
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            30
+        bDescriptorType                    36
+        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
+        bFrameIndex                        18
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                          1200
+        dwMinBitRate                153600000
+        dwMaxBitRate                153600000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval        2000000
+        bFrameIntervalType                  1
+        dwFrameInterval( 0)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            79
+        bDescriptorType                    36
+        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
+        bEndpointAddress                    0
+        bNumImageSizePatterns              18
+        wWidth( 0)                        640
+        wHeight( 0)                       480
+        wWidth( 1)                        160
+        wHeight( 1)                       120
+        wWidth( 2)                        176
+        wHeight( 2)                       144
+        wWidth( 3)                        320
+        wHeight( 3)                       240
+        wWidth( 4)                        352
+        wHeight( 4)                       288
+        wWidth( 5)                        640
+        wHeight( 5)                       360
+        wWidth( 6)                        640
+        wHeight( 6)                       400
+        wWidth( 7)                        768
+        wHeight( 7)                       480
+        wWidth( 8)                        800
+        wHeight( 8)                       456
+        wWidth( 9)                        800
+        wHeight( 9)                       504
+        wWidth(10)                        800
+        wHeight(10)                       600
+        wWidth(11)                        864
+        wHeight(11)                       480
+        wWidth(12)                        960
+        wHeight(12)                       720
+        wWidth(13)                       1280
+        wHeight(13)                       720
+        wWidth(14)                       1280
+        wHeight(14)                       800
+        wWidth(15)                       1600
+        wHeight(15)                       904
+        wWidth(16)                       1600
+        wHeight(16)                      1000
+        wWidth(17)                       1600
+        wHeight(17)                      1200
+        bNumCompressionPatterns            18
+        bCompression( 0)                    5
+      VideoStreaming Interface Descriptor:
+        bLength                             6
+        bDescriptorType                    36
+        bDescriptorSubtype                 13 (COLORFORMAT)
+        bColorPrimaries                     1 (BT.709,sRGB)
+        bTransferCharacteristics            1 (BT.709)
+        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
+      VideoStreaming Interface Descriptor:
+        bLength                            11
+        bDescriptorType                    36
+        bDescriptorSubtype                  6 (FORMAT_MJPEG)
+        bFormatIndex                        2
+        bNumFrameDescriptors               18
+        bFlags                              1
+          Fixed-size samples: Yes
+        bDefaultFrameIndex                  1
+        bAspectRatioX                       0
+        bAspectRatioY                       0
+        bmInterlaceFlags                 0x00
+          Interlaced stream or variable: No
+          Fields per frame: 1 fields
+          Field 1 first: No
+          Field pattern: Field 1 only
+          bCopyProtect                      0
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         1
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           480
+        dwMinBitRate                 24576000
+        dwMaxBitRate                147456000
+        dwMaxVideoFrameBufferSize      614400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         2
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            160
+        wHeight                           120
+        dwMinBitRate                  1536000
+        dwMaxBitRate                  9216000
+        dwMaxVideoFrameBufferSize       38400
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         3
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            176
+        wHeight                           144
+        dwMinBitRate                  2027520
+        dwMaxBitRate                 12165120
+        dwMaxVideoFrameBufferSize       50688
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         4
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            320
+        wHeight                           240
+        dwMinBitRate                  6144000
+        dwMaxBitRate                 36864000
+        dwMaxVideoFrameBufferSize      153600
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         5
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            352
+        wHeight                           288
+        dwMinBitRate                  8110080
+        dwMaxBitRate                 48660480
+        dwMaxVideoFrameBufferSize      202752
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         6
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           360
+        dwMinBitRate                 18432000
+        dwMaxBitRate                110592000
+        dwMaxVideoFrameBufferSize      460800
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         7
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            640
+        wHeight                           400
+        dwMinBitRate                 20480000
+        dwMaxBitRate                122880000
+        dwMaxVideoFrameBufferSize      512000
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         8
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            768
+        wHeight                           480
+        dwMinBitRate                 29491200
+        dwMaxBitRate                176947200
+        dwMaxVideoFrameBufferSize      737280
+        dwDefaultFrameInterval         333333
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                         9
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           456
+        dwMinBitRate                 29184000
+        dwMaxBitRate                175104000
+        dwMaxVideoFrameBufferSize      729600
+        dwDefaultFrameInterval         666666
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        10
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           504
+        dwMinBitRate                 32256000
+        dwMaxBitRate                193536000
+        dwMaxVideoFrameBufferSize      806400
+        dwDefaultFrameInterval         666666
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        11
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            800
+        wHeight                           600
+        dwMinBitRate                 38400000
+        dwMaxBitRate                230400000
+        dwMaxVideoFrameBufferSize      960000
+        dwDefaultFrameInterval         666666
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        12
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            864
+        wHeight                           480
+        dwMinBitRate                 33177600
+        dwMaxBitRate                199065600
+        dwMaxVideoFrameBufferSize      829440
+        dwDefaultFrameInterval         666666
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        13
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                            960
+        wHeight                           720
+        dwMinBitRate                 55296000
+        dwMaxBitRate                331776000
+        dwMaxVideoFrameBufferSize     1382400
+        dwDefaultFrameInterval        1000000
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            50
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        14
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           720
+        dwMinBitRate                 73728000
+        dwMaxBitRate                442368000
+        dwMaxVideoFrameBufferSize     1843200
+        dwDefaultFrameInterval        1000000
+        bFrameIntervalType                  6
+        dwFrameInterval( 0)            333333
+        dwFrameInterval( 1)            400000
+        dwFrameInterval( 2)            500000
+        dwFrameInterval( 3)            666666
+        dwFrameInterval( 4)           1000000
+        dwFrameInterval( 5)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            46
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        15
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1280
+        wHeight                           800
+        dwMinBitRate                 81920000
+        dwMaxBitRate                409600000
+        dwMaxVideoFrameBufferSize     2048000
+        dwDefaultFrameInterval        1000000
+        bFrameIntervalType                  5
+        dwFrameInterval( 0)            400000
+        dwFrameInterval( 1)            500000
+        dwFrameInterval( 2)            666666
+        dwFrameInterval( 3)           1000000
+        dwFrameInterval( 4)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            34
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        16
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                           904
+        dwMinBitRate                115712000
+        dwMaxBitRate                231424000
+        dwMaxVideoFrameBufferSize     2892800
+        dwDefaultFrameInterval        1000000
+        bFrameIntervalType                  2
+        dwFrameInterval( 0)           1000000
+        dwFrameInterval( 1)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            34
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        17
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                          1000
+        dwMinBitRate                128000000
+        dwMaxBitRate                256000000
+        dwMaxVideoFrameBufferSize     3200000
+        dwDefaultFrameInterval        1000000
+        bFrameIntervalType                  2
+        dwFrameInterval( 0)           1000000
+        dwFrameInterval( 1)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            34
+        bDescriptorType                    36
+        bDescriptorSubtype                  7 (FRAME_MJPEG)
+        bFrameIndex                        18
+        bmCapabilities                   0x00
+          Still image unsupported
+        wWidth                           1600
+        wHeight                          1200
+        dwMinBitRate                153600000
+        dwMaxBitRate                307200000
+        dwMaxVideoFrameBufferSize     3840000
+        dwDefaultFrameInterval        2000000
+        bFrameIntervalType                  2
+        dwFrameInterval( 0)           1000000
+        dwFrameInterval( 1)           2000000
+      VideoStreaming Interface Descriptor:
+        bLength                            83
+        bDescriptorType                    36
+        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
+        bEndpointAddress                    0
+        bNumImageSizePatterns              18
+        wWidth( 0)                        640
+        wHeight( 0)                       480
+        wWidth( 1)                        160
+        wHeight( 1)                       120
+        wWidth( 2)                        176
+        wHeight( 2)                       144
+        wWidth( 3)                        320
+        wHeight( 3)                       240
+        wWidth( 4)                        352
+        wHeight( 4)                       288
+        wWidth( 5)                        640
+        wHeight( 5)                       360
+        wWidth( 6)                        640
+        wHeight( 6)                       400
+        wWidth( 7)                        768
+        wHeight( 7)                       480
+        wWidth( 8)                        800
+        wHeight( 8)                       456
+        wWidth( 9)                        800
+        wHeight( 9)                       504
+        wWidth(10)                        800
+        wHeight(10)                       600
+        wWidth(11)                        864
+        wHeight(11)                       480
+        wWidth(12)                        960
+        wHeight(12)                       720
+        wWidth(13)                       1280
+        wHeight(13)                       720
+        wWidth(14)                       1280
+        wHeight(14)                       800
+        wWidth(15)                       1600
+        wHeight(15)                       904
+        wWidth(16)                       1600
+        wHeight(16)                      1000
+        wWidth(17)                       1600
+        wHeight(17)                      1200
+        bNumCompressionPatterns            18
+        bCompression( 0)                    5
+        bCompression( 1)                   10
+        bCompression( 2)                   15
+        bCompression( 3)                   20
+        bCompression( 4)                   25
+      VideoStreaming Interface Descriptor:
+        bLength                             6
+        bDescriptorType                    36
+        bDescriptorSubtype                 13 (COLORFORMAT)
+        bColorPrimaries                     1 (BT.709,sRGB)
+        bTransferCharacteristics            1 (BT.709)
+        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x00c0  1x 192 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       2
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0180  1x 384 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       3
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0200  1x 512 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       4
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0280  1x 640 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       5
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0320  1x 800 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       6
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x03b0  1x 944 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       7
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0a80  2x 640 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       8
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0b20  2x 800 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting       9
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0be0  2x 992 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting      10
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x1380  3x 896 bytes
+        bInterval               1
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        1
+      bAlternateSetting      11
+      bNumEndpoints           1
+      bInterfaceClass        14 Video
+      bInterfaceSubClass      2 Video Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      Endpoint Descriptor:
+        bLength                 7
+        bDescriptorType         5
+        bEndpointAddress     0x81  EP 1 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x13fc  3x 1020 bytes
+        bInterval               1
+    Interface Association:
+      bLength                 8
+      bDescriptorType        11
+      bFirstInterface         2
+      bInterfaceCount         2
+      bFunctionClass          1 Audio
+      bFunctionSubClass       2 Streaming
+      bFunctionProtocol       0 
+      iFunction               0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        2
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      1 Control Device
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      1 (HEADER)
+        bcdADC               1.00
+        wTotalLength           38
+        bInCollection           1
+        baInterfaceNr( 0)       3
+      AudioControl Interface Descriptor:
+        bLength                12
+        bDescriptorType        36
+        bDescriptorSubtype      2 (INPUT_TERMINAL)
+        bTerminalID             1
+        wTerminalType      0x0201 Microphone
+        bAssocTerminal          0
+        bNrChannels             1
+        wChannelConfig     0x0000
+        iChannelNames           0 
+        iTerminal               0 
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
+        bTerminalID             3
+        wTerminalType      0x0101 USB Streaming
+        bAssocTerminal          1
+        bSourceID               5
+        iTerminal               0 
+      AudioControl Interface Descriptor:
+        bLength                 9
+        bDescriptorType        36
+        bDescriptorSubtype      6 (FEATURE_UNIT)
+        bUnitID                 5
+        bSourceID               1
+        bControlSize            1
+        bmaControls( 0)      0x03
+          Mute
+          Volume
+        bmaControls( 1)      0x00
+        iFeature                0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       0
+      bNumEndpoints           0
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       1
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                  1 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             1
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            1 Discrete
+        tSamFreq[ 0]        16000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x86  EP 6 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0044  1x 68 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       2
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                  1 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             1
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            1 Discrete
+        tSamFreq[ 0]        24000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x86  EP 6 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0064  1x 100 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       3
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                  1 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             1
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            1 Discrete
+        tSamFreq[ 0]        32000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x86  EP 6 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x0084  1x 132 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+    Interface Descriptor:
+      bLength                 9
+      bDescriptorType         4
+      bInterfaceNumber        3
+      bAlternateSetting       4
+      bNumEndpoints           1
+      bInterfaceClass         1 Audio
+      bInterfaceSubClass      2 Streaming
+      bInterfaceProtocol      0 
+      iInterface              0 
+      AudioStreaming Interface Descriptor:
+        bLength                 7
+        bDescriptorType        36
+        bDescriptorSubtype      1 (AS_GENERAL)
+        bTerminalLink           3
+        bDelay                  1 frames
+        wFormatTag              1 PCM
+      AudioStreaming Interface Descriptor:
+        bLength                11
+        bDescriptorType        36
+        bDescriptorSubtype      2 (FORMAT_TYPE)
+        bFormatType             1 (FORMAT_TYPE_I)
+        bNrChannels             1
+        bSubframeSize           2
+        bBitResolution         16
+        bSamFreqType            1 Discrete
+        tSamFreq[ 0]        48000
+      Endpoint Descriptor:
+        bLength                 9
+        bDescriptorType         5
+        bEndpointAddress     0x86  EP 6 IN
+        bmAttributes            5
+          Transfer Type            Isochronous
+          Synch Type               Asynchronous
+          Usage Type               Data
+        wMaxPacketSize     0x00c4  1x 196 bytes
+        bInterval               4
+        bRefresh                0
+        bSynchAddress           0
+        AudioControl Endpoint Descriptor:
+          bLength                 7
+          bDescriptorType        37
+          bDescriptorSubtype      1 (EP_GENERAL)
+          bmAttributes         0x01
+            Sampling Frequency
+          bLockDelayUnits         0 Undefined
+          wLockDelay              0 Undefined
+Device Qualifier (for other device speed):
+  bLength                10
+  bDescriptorType         6
+  bcdUSB               2.00
+  bDeviceClass          239 Miscellaneous Device
+  bDeviceSubClass         2 ?
+  bDeviceProtocol         1 Interface Association
+  bMaxPacketSize0        64
+  bNumConfigurations      1
+Device Status:     0x0000
+  (Bus Powered)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_builtin_ctrls.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_builtin_ctrls.txt b/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_builtin_ctrls.txt
new file mode 100644
index 0000000..2b2969e
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_builtin_ctrls.txt
@@ -0,0 +1,13 @@
+Listing available controls for device video0:
+  Exposure, Auto Priority
+  Exposure (Absolute)
+  Exposure, Auto
+  Backlight Compensation
+  Sharpness
+  White Balance Temperature
+  Power Line Frequency
+  Gain
+  White Balance Temperature, Auto
+  Saturation
+  Contrast
+  Brightness

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_extra_ctrls.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_extra_ctrls.txt b/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_extra_ctrls.txt
new file mode 100644
index 0000000..205aaf6
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/cameras/quickcampro9000_extra_ctrls.txt
@@ -0,0 +1,18 @@
+Listing available controls for device video0:
+  Raw bits per pixel
+  Disable video processing
+  LED1 Frequency
+  LED1 Mode
+  Focus
+  Exposure, Auto Priority
+  Exposure (Absolute)
+  Exposure, Auto
+  Backlight Compensation
+  Sharpness
+  White Balance Temperature
+  Power Line Frequency
+  Gain
+  White Balance Temperature, Auto
+  Saturation
+  Contrast
+  Brightness

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/changelog.txt
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/changelog.txt b/thirdparty/libuvc-0.0.6/changelog.txt
new file mode 100644
index 0000000..1f569d1
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/changelog.txt
@@ -0,0 +1,45 @@
+Changes in 0.0.5 (2014-07-19)
+----------------
+
+New features:
+ - Added support for all of the camera terminal and processing unit controls, including the controls
+   that appeared in UVC 1.1 and 1.5.
+ - Added LIBUVC_VERSION_GTE(major, minor, patch) macro.
+
+Bug fixes:
+ - Switching to explicit kernel driver detachment since auto_detach isn't available in libusb < 1.0.16.
+ - The cmake module now looks for libuvc.dylib instead of libuvc.so on OS X.
+
+
+Changes in 0.0.4 (2014-06-26)
+----------------
+
+New features:
+ - Support devices with multiple streaming interfaces and multiple concurrent streams.
+   A new uvc_stream* API is added, along with a uvc_stream_handle type to encapsulate the
+   state of a single UVC stream. Multiple streams can run alongside each other, provided
+   your USB connection has enough bandwidth. Streams can be individually stopped and
+   resumed; the old uvc_start/stop_streaming API is still provided as a convenient way
+   to interact with the usual one-stream devices.
+ - Added support for MJPEG streams.
+ - Added functions for checking/setting autofocus mode.
+ - Added an interface to set/get arbitrary controls on units and terminals.
+ - Made the input, output, processing and extension units public.
+ - Implemented uvc_get_device and uvc_get_libusb_handle.
+ - Add a library-owned flag to uvc_frame_t so that users may allocate their own frame buffers.
+
+Bug fixes:
+ - Send frames as soon as they're received, not when the following frame arrives
+ - Fixed call to NULL when no status callback is provided.
+ - Fixed crash that occurred during shutdown if the USB device was disconnected during streaming.
+
+Miscellaneous improvements:
+ - Hid the transfer method (isochronous vs bulk) from the user. This was never really
+   selectable; the camera's streaming interface supports either bulk or isochronous
+   transfers, so now libuvc will figure out which one is appropriate. The `isochronous`
+   parameter has been converted to a `flags` parameter, which is currently unused but
+   could be used to convey up to 7 bits of stream mode information in the future.
+ - Improved the method for claiming the camera's interfaces.
+ - Renamed UVC_COLOR_FORMAT_* to UVC_FRAME_FORMAT_*. The old #defines are still available.
+ - Simplified format definition and lookup.
+ - Improved transfer status (error) handling.


[3/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/ctrl-gen.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/ctrl-gen.c b/thirdparty/libuvc-0.0.6/src/ctrl-gen.c
new file mode 100644
index 0000000..30c0ab6
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/ctrl-gen.c
@@ -0,0 +1,2259 @@
+/* This is an AUTO-GENERATED file! Update it with the output of `ctrl-gen.py def`. */
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+
+static const int REQ_TYPE_SET = 0x21;
+static const int REQ_TYPE_GET = 0xa1;
+
+/** @ingroup ctrl
+ * @brief Reads the SCANNING_MODE control.
+ * @param devh UVC device handle
+ * @param[out] mode 0: interlaced, 1: progressive
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_scanning_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_SCANNING_MODE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *mode = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the SCANNING_MODE control.
+ * @param devh UVC device handle
+ * @param mode 0: interlaced, 1: progressive
+ */
+uvc_error_t uvc_set_scanning_mode(uvc_device_handle_t *devh, uint8_t mode) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = mode;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_SCANNING_MODE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads camera's auto-exposure mode.
+ * 
+ * See uvc_set_ae_mode() for a description of the available modes.
+ * @param devh UVC device handle
+ * @param[out] mode 1: manual mode; 2: auto mode; 4: shutter priority mode; 8: aperture priority mode
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_ae_mode(uvc_device_handle_t *devh, uint8_t* mode, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_AE_MODE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *mode = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets camera's auto-exposure mode.
+ * 
+ * Cameras may support any of the following AE modes:
+ *  * UVC_AUTO_EXPOSURE_MODE_MANUAL (1) - manual exposure time, manual iris
+ *  * UVC_AUTO_EXPOSURE_MODE_AUTO (2) - auto exposure time, auto iris
+ *  * UVC_AUTO_EXPOSURE_MODE_SHUTTER_PRIORITY (4) - manual exposure time, auto iris
+ *  * UVC_AUTO_EXPOSURE_MODE_APERTURE_PRIORITY (8) - auto exposure time, manual iris
+ * 
+ * Most cameras provide manual mode and aperture priority mode.
+ * @param devh UVC device handle
+ * @param mode 1: manual mode; 2: auto mode; 4: shutter priority mode; 8: aperture priority mode
+ */
+uvc_error_t uvc_set_ae_mode(uvc_device_handle_t *devh, uint8_t mode) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = mode;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_AE_MODE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Checks whether the camera may vary the frame rate for exposure control reasons.
+ * See uvc_set_ae_priority() for a description of the `priority` field.
+ * @param devh UVC device handle
+ * @param[out] priority 0: frame rate must remain constant; 1: frame rate may be varied for AE purposes
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_ae_priority(uvc_device_handle_t *devh, uint8_t* priority, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_AE_PRIORITY_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *priority = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Chooses whether the camera may vary the frame rate for exposure control reasons.
+ * A `priority` value of zero means the camera may not vary its frame rate. A value of 1
+ * means the frame rate is variable. This setting has no effect outside of the `auto` and
+ * `shutter_priority` auto-exposure modes.
+ * @param devh UVC device handle
+ * @param priority 0: frame rate must remain constant; 1: frame rate may be varied for AE purposes
+ */
+uvc_error_t uvc_set_ae_priority(uvc_device_handle_t *devh, uint8_t priority) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = priority;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_AE_PRIORITY_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Gets the absolute exposure time.
+ * 
+ * See uvc_set_exposure_abs() for a description of the `time` field.
+ * @param devh UVC device handle
+ * @param[out] time 
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_exposure_abs(uvc_device_handle_t *devh, uint32_t* time, enum uvc_req_code req_code) {
+  uint8_t data[4];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *time = DW_TO_INT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the absolute exposure time.
+ * 
+ * The `time` parameter should be provided in units of 0.0001 seconds (e.g., use the value 100
+ * for a 10ms exposure period). Auto exposure should be set to `manual` or `shutter_priority`
+ * before attempting to change this setting.
+ * @param devh UVC device handle
+ * @param time 
+ */
+uvc_error_t uvc_set_exposure_abs(uvc_device_handle_t *devh, uint32_t time) {
+  uint8_t data[4];
+  uvc_error_t ret;
+
+  INT_TO_DW(time, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the exposure time relative to the current setting.
+ * @param devh UVC device handle
+ * @param[out] step number of steps by which to change the exposure time, or zero to set the default exposure time
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_exposure_rel(uvc_device_handle_t *devh, int8_t* step, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *step = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the exposure time relative to the current setting.
+ * @param devh UVC device handle
+ * @param step number of steps by which to change the exposure time, or zero to set the default exposure time
+ */
+uvc_error_t uvc_set_exposure_rel(uvc_device_handle_t *devh, int8_t step) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = step;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the distance at which an object is optimally focused.
+ * @param devh UVC device handle
+ * @param[out] focus focal target distance in millimeters
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_focus_abs(uvc_device_handle_t *devh, uint16_t* focus, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_FOCUS_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *focus = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the distance at which an object is optimally focused.
+ * @param devh UVC device handle
+ * @param focus focal target distance in millimeters
+ */
+uvc_error_t uvc_set_focus_abs(uvc_device_handle_t *devh, uint16_t focus) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(focus, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_FOCUS_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the FOCUS_RELATIVE control.
+ * @param devh UVC device handle
+ * @param[out] focus_rel TODO
+ * @param[out] speed TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_focus_rel(uvc_device_handle_t *devh, int8_t* focus_rel, uint8_t* speed, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_FOCUS_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *focus_rel = data[0];
+    *speed = data[1];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the FOCUS_RELATIVE control.
+ * @param devh UVC device handle
+ * @param focus_rel TODO
+ * @param speed TODO
+ */
+uvc_error_t uvc_set_focus_rel(uvc_device_handle_t *devh, int8_t focus_rel, uint8_t speed) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  data[0] = focus_rel;
+  data[1] = speed;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_FOCUS_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the FOCUS_SIMPLE control.
+ * @param devh UVC device handle
+ * @param[out] focus TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_focus_simple_range(uvc_device_handle_t *devh, uint8_t* focus, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_FOCUS_SIMPLE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *focus = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the FOCUS_SIMPLE control.
+ * @param devh UVC device handle
+ * @param focus TODO
+ */
+uvc_error_t uvc_set_focus_simple_range(uvc_device_handle_t *devh, uint8_t focus) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = focus;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_FOCUS_SIMPLE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the FOCUS_AUTO control.
+ * @param devh UVC device handle
+ * @param[out] state TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_focus_auto(uvc_device_handle_t *devh, uint8_t* state, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_FOCUS_AUTO_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *state = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the FOCUS_AUTO control.
+ * @param devh UVC device handle
+ * @param state TODO
+ */
+uvc_error_t uvc_set_focus_auto(uvc_device_handle_t *devh, uint8_t state) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = state;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_FOCUS_AUTO_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the IRIS_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param[out] iris TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_iris_abs(uvc_device_handle_t *devh, uint16_t* iris, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_IRIS_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *iris = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the IRIS_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param iris TODO
+ */
+uvc_error_t uvc_set_iris_abs(uvc_device_handle_t *devh, uint16_t iris) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(iris, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_IRIS_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the IRIS_RELATIVE control.
+ * @param devh UVC device handle
+ * @param[out] iris_rel TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_iris_rel(uvc_device_handle_t *devh, uint8_t* iris_rel, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_IRIS_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *iris_rel = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the IRIS_RELATIVE control.
+ * @param devh UVC device handle
+ * @param iris_rel TODO
+ */
+uvc_error_t uvc_set_iris_rel(uvc_device_handle_t *devh, uint8_t iris_rel) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = iris_rel;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_IRIS_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the ZOOM_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param[out] focal_length TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_zoom_abs(uvc_device_handle_t *devh, uint16_t* focal_length, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_ZOOM_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *focal_length = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the ZOOM_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param focal_length TODO
+ */
+uvc_error_t uvc_set_zoom_abs(uvc_device_handle_t *devh, uint16_t focal_length) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(focal_length, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_ZOOM_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the ZOOM_RELATIVE control.
+ * @param devh UVC device handle
+ * @param[out] zoom_rel TODO
+ * @param[out] digital_zoom TODO
+ * @param[out] speed TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_zoom_rel(uvc_device_handle_t *devh, int8_t* zoom_rel, uint8_t* digital_zoom, uint8_t* speed, enum uvc_req_code req_code) {
+  uint8_t data[3];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_ZOOM_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *zoom_rel = data[0];
+    *digital_zoom = data[1];
+    *speed = data[2];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the ZOOM_RELATIVE control.
+ * @param devh UVC device handle
+ * @param zoom_rel TODO
+ * @param digital_zoom TODO
+ * @param speed TODO
+ */
+uvc_error_t uvc_set_zoom_rel(uvc_device_handle_t *devh, int8_t zoom_rel, uint8_t digital_zoom, uint8_t speed) {
+  uint8_t data[3];
+  uvc_error_t ret;
+
+  data[0] = zoom_rel;
+  data[1] = digital_zoom;
+  data[2] = speed;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_ZOOM_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the PANTILT_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param[out] pan TODO
+ * @param[out] tilt TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_pantilt_abs(uvc_device_handle_t *devh, int32_t* pan, int32_t* tilt, enum uvc_req_code req_code) {
+  uint8_t data[8];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_PANTILT_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *pan = DW_TO_INT(data + 0);
+    *tilt = DW_TO_INT(data + 4);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the PANTILT_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param pan TODO
+ * @param tilt TODO
+ */
+uvc_error_t uvc_set_pantilt_abs(uvc_device_handle_t *devh, int32_t pan, int32_t tilt) {
+  uint8_t data[8];
+  uvc_error_t ret;
+
+  INT_TO_DW(pan, data + 0);
+  INT_TO_DW(tilt, data + 4);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_PANTILT_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the PANTILT_RELATIVE control.
+ * @param devh UVC device handle
+ * @param[out] pan_rel TODO
+ * @param[out] pan_speed TODO
+ * @param[out] tilt_rel TODO
+ * @param[out] tilt_speed TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_pantilt_rel(uvc_device_handle_t *devh, int8_t* pan_rel, uint8_t* pan_speed, int8_t* tilt_rel, uint8_t* tilt_speed, enum uvc_req_code req_code) {
+  uint8_t data[4];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_PANTILT_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *pan_rel = data[0];
+    *pan_speed = data[1];
+    *tilt_rel = data[2];
+    *tilt_speed = data[3];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the PANTILT_RELATIVE control.
+ * @param devh UVC device handle
+ * @param pan_rel TODO
+ * @param pan_speed TODO
+ * @param tilt_rel TODO
+ * @param tilt_speed TODO
+ */
+uvc_error_t uvc_set_pantilt_rel(uvc_device_handle_t *devh, int8_t pan_rel, uint8_t pan_speed, int8_t tilt_rel, uint8_t tilt_speed) {
+  uint8_t data[4];
+  uvc_error_t ret;
+
+  data[0] = pan_rel;
+  data[1] = pan_speed;
+  data[2] = tilt_rel;
+  data[3] = tilt_speed;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_PANTILT_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the ROLL_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param[out] roll TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_roll_abs(uvc_device_handle_t *devh, int16_t* roll, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_ROLL_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *roll = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the ROLL_ABSOLUTE control.
+ * @param devh UVC device handle
+ * @param roll TODO
+ */
+uvc_error_t uvc_set_roll_abs(uvc_device_handle_t *devh, int16_t roll) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(roll, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_ROLL_ABSOLUTE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the ROLL_RELATIVE control.
+ * @param devh UVC device handle
+ * @param[out] roll_rel TODO
+ * @param[out] speed TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_roll_rel(uvc_device_handle_t *devh, int8_t* roll_rel, uint8_t* speed, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_ROLL_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *roll_rel = data[0];
+    *speed = data[1];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the ROLL_RELATIVE control.
+ * @param devh UVC device handle
+ * @param roll_rel TODO
+ * @param speed TODO
+ */
+uvc_error_t uvc_set_roll_rel(uvc_device_handle_t *devh, int8_t roll_rel, uint8_t speed) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  data[0] = roll_rel;
+  data[1] = speed;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_ROLL_RELATIVE_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the PRIVACY control.
+ * @param devh UVC device handle
+ * @param[out] privacy TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_privacy(uvc_device_handle_t *devh, uint8_t* privacy, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_PRIVACY_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *privacy = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the PRIVACY control.
+ * @param devh UVC device handle
+ * @param privacy TODO
+ */
+uvc_error_t uvc_set_privacy(uvc_device_handle_t *devh, uint8_t privacy) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = privacy;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_PRIVACY_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the DIGITAL_WINDOW control.
+ * @param devh UVC device handle
+ * @param[out] window_top TODO
+ * @param[out] window_left TODO
+ * @param[out] window_bottom TODO
+ * @param[out] window_right TODO
+ * @param[out] num_steps TODO
+ * @param[out] num_steps_units TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_digital_window(uvc_device_handle_t *devh, uint16_t* window_top, uint16_t* window_left, uint16_t* window_bottom, uint16_t* window_right, uint16_t* num_steps, uint16_t* num_steps_units, enum uvc_req_code req_code) {
+  uint8_t data[12];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_DIGITAL_WINDOW_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *window_top = SW_TO_SHORT(data + 0);
+    *window_left = SW_TO_SHORT(data + 2);
+    *window_bottom = SW_TO_SHORT(data + 4);
+    *window_right = SW_TO_SHORT(data + 6);
+    *num_steps = SW_TO_SHORT(data + 8);
+    *num_steps_units = SW_TO_SHORT(data + 10);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the DIGITAL_WINDOW control.
+ * @param devh UVC device handle
+ * @param window_top TODO
+ * @param window_left TODO
+ * @param window_bottom TODO
+ * @param window_right TODO
+ * @param num_steps TODO
+ * @param num_steps_units TODO
+ */
+uvc_error_t uvc_set_digital_window(uvc_device_handle_t *devh, uint16_t window_top, uint16_t window_left, uint16_t window_bottom, uint16_t window_right, uint16_t num_steps, uint16_t num_steps_units) {
+  uint8_t data[12];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(window_top, data + 0);
+  SHORT_TO_SW(window_left, data + 2);
+  SHORT_TO_SW(window_bottom, data + 4);
+  SHORT_TO_SW(window_right, data + 6);
+  SHORT_TO_SW(num_steps, data + 8);
+  SHORT_TO_SW(num_steps_units, data + 10);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_DIGITAL_WINDOW_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the REGION_OF_INTEREST control.
+ * @param devh UVC device handle
+ * @param[out] roi_top TODO
+ * @param[out] roi_left TODO
+ * @param[out] roi_bottom TODO
+ * @param[out] roi_right TODO
+ * @param[out] auto_controls TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_digital_roi(uvc_device_handle_t *devh, uint16_t* roi_top, uint16_t* roi_left, uint16_t* roi_bottom, uint16_t* roi_right, uint16_t* auto_controls, enum uvc_req_code req_code) {
+  uint8_t data[10];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_CT_REGION_OF_INTEREST_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *roi_top = SW_TO_SHORT(data + 0);
+    *roi_left = SW_TO_SHORT(data + 2);
+    *roi_bottom = SW_TO_SHORT(data + 4);
+    *roi_right = SW_TO_SHORT(data + 6);
+    *auto_controls = SW_TO_SHORT(data + 8);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the REGION_OF_INTEREST control.
+ * @param devh UVC device handle
+ * @param roi_top TODO
+ * @param roi_left TODO
+ * @param roi_bottom TODO
+ * @param roi_right TODO
+ * @param auto_controls TODO
+ */
+uvc_error_t uvc_set_digital_roi(uvc_device_handle_t *devh, uint16_t roi_top, uint16_t roi_left, uint16_t roi_bottom, uint16_t roi_right, uint16_t auto_controls) {
+  uint8_t data[10];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(roi_top, data + 0);
+  SHORT_TO_SW(roi_left, data + 2);
+  SHORT_TO_SW(roi_bottom, data + 4);
+  SHORT_TO_SW(roi_right, data + 6);
+  SHORT_TO_SW(auto_controls, data + 8);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_CT_REGION_OF_INTEREST_CONTROL << 8,
+    uvc_get_camera_terminal(devh)->bTerminalID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the BACKLIGHT_COMPENSATION control.
+ * @param devh UVC device handle
+ * @param[out] backlight_compensation device-dependent backlight compensation mode; zero means backlight compensation is disabled
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_backlight_compensation(uvc_device_handle_t *devh, uint16_t* backlight_compensation, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_BACKLIGHT_COMPENSATION_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *backlight_compensation = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the BACKLIGHT_COMPENSATION control.
+ * @param devh UVC device handle
+ * @param backlight_compensation device-dependent backlight compensation mode; zero means backlight compensation is disabled
+ */
+uvc_error_t uvc_set_backlight_compensation(uvc_device_handle_t *devh, uint16_t backlight_compensation) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(backlight_compensation, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_BACKLIGHT_COMPENSATION_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the BRIGHTNESS control.
+ * @param devh UVC device handle
+ * @param[out] brightness TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_brightness(uvc_device_handle_t *devh, int16_t* brightness, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_BRIGHTNESS_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *brightness = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the BRIGHTNESS control.
+ * @param devh UVC device handle
+ * @param brightness TODO
+ */
+uvc_error_t uvc_set_brightness(uvc_device_handle_t *devh, int16_t brightness) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(brightness, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_BRIGHTNESS_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the CONTRAST control.
+ * @param devh UVC device handle
+ * @param[out] contrast TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_contrast(uvc_device_handle_t *devh, uint16_t* contrast, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_CONTRAST_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *contrast = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the CONTRAST control.
+ * @param devh UVC device handle
+ * @param contrast TODO
+ */
+uvc_error_t uvc_set_contrast(uvc_device_handle_t *devh, uint16_t contrast) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(contrast, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_CONTRAST_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the CONTRAST_AUTO control.
+ * @param devh UVC device handle
+ * @param[out] contrast_auto TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_contrast_auto(uvc_device_handle_t *devh, uint8_t* contrast_auto, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_CONTRAST_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *contrast_auto = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the CONTRAST_AUTO control.
+ * @param devh UVC device handle
+ * @param contrast_auto TODO
+ */
+uvc_error_t uvc_set_contrast_auto(uvc_device_handle_t *devh, uint8_t contrast_auto) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = contrast_auto;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_CONTRAST_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the GAIN control.
+ * @param devh UVC device handle
+ * @param[out] gain TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_gain(uvc_device_handle_t *devh, uint16_t* gain, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_GAIN_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *gain = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the GAIN control.
+ * @param devh UVC device handle
+ * @param gain TODO
+ */
+uvc_error_t uvc_set_gain(uvc_device_handle_t *devh, uint16_t gain) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(gain, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_GAIN_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the POWER_LINE_FREQUENCY control.
+ * @param devh UVC device handle
+ * @param[out] power_line_frequency TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_power_line_frequency(uvc_device_handle_t *devh, uint8_t* power_line_frequency, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_POWER_LINE_FREQUENCY_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *power_line_frequency = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the POWER_LINE_FREQUENCY control.
+ * @param devh UVC device handle
+ * @param power_line_frequency TODO
+ */
+uvc_error_t uvc_set_power_line_frequency(uvc_device_handle_t *devh, uint8_t power_line_frequency) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = power_line_frequency;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_POWER_LINE_FREQUENCY_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the HUE control.
+ * @param devh UVC device handle
+ * @param[out] hue TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_hue(uvc_device_handle_t *devh, int16_t* hue, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_HUE_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *hue = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the HUE control.
+ * @param devh UVC device handle
+ * @param hue TODO
+ */
+uvc_error_t uvc_set_hue(uvc_device_handle_t *devh, int16_t hue) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(hue, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_HUE_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the HUE_AUTO control.
+ * @param devh UVC device handle
+ * @param[out] hue_auto TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_hue_auto(uvc_device_handle_t *devh, uint8_t* hue_auto, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_HUE_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *hue_auto = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the HUE_AUTO control.
+ * @param devh UVC device handle
+ * @param hue_auto TODO
+ */
+uvc_error_t uvc_set_hue_auto(uvc_device_handle_t *devh, uint8_t hue_auto) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = hue_auto;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_HUE_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the SATURATION control.
+ * @param devh UVC device handle
+ * @param[out] saturation TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_saturation(uvc_device_handle_t *devh, uint16_t* saturation, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_SATURATION_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *saturation = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the SATURATION control.
+ * @param devh UVC device handle
+ * @param saturation TODO
+ */
+uvc_error_t uvc_set_saturation(uvc_device_handle_t *devh, uint16_t saturation) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(saturation, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_SATURATION_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the SHARPNESS control.
+ * @param devh UVC device handle
+ * @param[out] sharpness TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_sharpness(uvc_device_handle_t *devh, uint16_t* sharpness, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_SHARPNESS_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *sharpness = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the SHARPNESS control.
+ * @param devh UVC device handle
+ * @param sharpness TODO
+ */
+uvc_error_t uvc_set_sharpness(uvc_device_handle_t *devh, uint16_t sharpness) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(sharpness, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_SHARPNESS_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the GAMMA control.
+ * @param devh UVC device handle
+ * @param[out] gamma TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_gamma(uvc_device_handle_t *devh, uint16_t* gamma, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_GAMMA_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *gamma = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the GAMMA control.
+ * @param devh UVC device handle
+ * @param gamma TODO
+ */
+uvc_error_t uvc_set_gamma(uvc_device_handle_t *devh, uint16_t gamma) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(gamma, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_GAMMA_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the WHITE_BALANCE_TEMPERATURE control.
+ * @param devh UVC device handle
+ * @param[out] temperature TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_white_balance_temperature(uvc_device_handle_t *devh, uint16_t* temperature, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *temperature = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the WHITE_BALANCE_TEMPERATURE control.
+ * @param devh UVC device handle
+ * @param temperature TODO
+ */
+uvc_error_t uvc_set_white_balance_temperature(uvc_device_handle_t *devh, uint16_t temperature) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(temperature, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the WHITE_BALANCE_TEMPERATURE_AUTO control.
+ * @param devh UVC device handle
+ * @param[out] temperature_auto TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t* temperature_auto, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *temperature_auto = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the WHITE_BALANCE_TEMPERATURE_AUTO control.
+ * @param devh UVC device handle
+ * @param temperature_auto TODO
+ */
+uvc_error_t uvc_set_white_balance_temperature_auto(uvc_device_handle_t *devh, uint8_t temperature_auto) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = temperature_auto;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the WHITE_BALANCE_COMPONENT control.
+ * @param devh UVC device handle
+ * @param[out] blue TODO
+ * @param[out] red TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_white_balance_component(uvc_device_handle_t *devh, uint16_t* blue, uint16_t* red, enum uvc_req_code req_code) {
+  uint8_t data[4];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *blue = SW_TO_SHORT(data + 0);
+    *red = SW_TO_SHORT(data + 2);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the WHITE_BALANCE_COMPONENT control.
+ * @param devh UVC device handle
+ * @param blue TODO
+ * @param red TODO
+ */
+uvc_error_t uvc_set_white_balance_component(uvc_device_handle_t *devh, uint16_t blue, uint16_t red) {
+  uint8_t data[4];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(blue, data + 0);
+  SHORT_TO_SW(red, data + 2);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the WHITE_BALANCE_COMPONENT_AUTO control.
+ * @param devh UVC device handle
+ * @param[out] white_balance_component_auto TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t* white_balance_component_auto, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *white_balance_component_auto = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the WHITE_BALANCE_COMPONENT_AUTO control.
+ * @param devh UVC device handle
+ * @param white_balance_component_auto TODO
+ */
+uvc_error_t uvc_set_white_balance_component_auto(uvc_device_handle_t *devh, uint8_t white_balance_component_auto) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = white_balance_component_auto;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the DIGITAL_MULTIPLIER control.
+ * @param devh UVC device handle
+ * @param[out] multiplier_step TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_digital_multiplier(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_DIGITAL_MULTIPLIER_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *multiplier_step = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the DIGITAL_MULTIPLIER control.
+ * @param devh UVC device handle
+ * @param multiplier_step TODO
+ */
+uvc_error_t uvc_set_digital_multiplier(uvc_device_handle_t *devh, uint16_t multiplier_step) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(multiplier_step, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_DIGITAL_MULTIPLIER_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the DIGITAL_MULTIPLIER_LIMIT control.
+ * @param devh UVC device handle
+ * @param[out] multiplier_step TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t* multiplier_step, enum uvc_req_code req_code) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *multiplier_step = SW_TO_SHORT(data + 0);
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the DIGITAL_MULTIPLIER_LIMIT control.
+ * @param devh UVC device handle
+ * @param multiplier_step TODO
+ */
+uvc_error_t uvc_set_digital_multiplier_limit(uvc_device_handle_t *devh, uint16_t multiplier_step) {
+  uint8_t data[2];
+  uvc_error_t ret;
+
+  SHORT_TO_SW(multiplier_step, data + 0);
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the ANALOG_VIDEO_STANDARD control.
+ * @param devh UVC device handle
+ * @param[out] video_standard TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_analog_video_standard(uvc_device_handle_t *devh, uint8_t* video_standard, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *video_standard = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the ANALOG_VIDEO_STANDARD control.
+ * @param devh UVC device handle
+ * @param video_standard TODO
+ */
+uvc_error_t uvc_set_analog_video_standard(uvc_device_handle_t *devh, uint8_t video_standard) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = video_standard;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the ANALOG_LOCK_STATUS control.
+ * @param devh UVC device handle
+ * @param[out] status TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t* status, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_PU_ANALOG_LOCK_STATUS_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *status = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the ANALOG_LOCK_STATUS control.
+ * @param devh UVC device handle
+ * @param status TODO
+ */
+uvc_error_t uvc_set_analog_video_lock_status(uvc_device_handle_t *devh, uint8_t status) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = status;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_PU_ANALOG_LOCK_STATUS_CONTROL << 8,
+    uvc_get_processing_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @ingroup ctrl
+ * @brief Reads the INPUT_SELECT control.
+ * @param devh UVC device handle
+ * @param[out] selector TODO
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_input_select(uvc_device_handle_t *devh, uint8_t* selector, enum uvc_req_code req_code) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_SU_INPUT_SELECT_CONTROL << 8,
+    uvc_get_selector_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {
+    *selector = data[0];
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+
+/** @ingroup ctrl
+ * @brief Sets the INPUT_SELECT control.
+ * @param devh UVC device handle
+ * @param selector TODO
+ */
+uvc_error_t uvc_set_input_select(uvc_device_handle_t *devh, uint8_t selector) {
+  uint8_t data[1];
+  uvc_error_t ret;
+
+  data[0] = selector;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_SU_INPUT_SELECT_CONTROL << 8,
+    uvc_get_selector_units(devh)->bUnitID << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/ctrl-gen.py
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/ctrl-gen.py b/thirdparty/libuvc-0.0.6/src/ctrl-gen.py
new file mode 100755
index 0000000..d349a73
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/ctrl-gen.py
@@ -0,0 +1,302 @@
+#!/usr/bin/env python
+from __future__ import print_function
+from collections import OrderedDict
+import getopt
+import sys
+import yaml
+
+class quoted(str): pass
+
+def quoted_presenter(dumper, data):
+    return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='"')
+yaml.add_representer(quoted, quoted_presenter)
+
+class literal(str): pass
+
+def literal_presenter(dumper, data):
+    return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
+yaml.add_representer(literal, literal_presenter)
+
+def ordered_dict_presenter(dumper, data):
+    return dumper.represent_dict(data.items())
+yaml.add_representer(OrderedDict, ordered_dict_presenter)
+
+def dict_constructor(loader, node):
+    return OrderedDict(loader.construct_pairs(node))
+_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG
+yaml.add_constructor(_mapping_tag, dict_constructor)
+
+class IntField(object):
+    def __init__(self, name, position, length, signed):
+        self.name = name
+        self.position = position
+        self.length = length
+        self.signed = signed
+
+        if not self.length in [1, 2, 4]:
+            raise Exception("bad length " + str(self.length))
+
+        self.user_type = ('u' if not signed else '') + 'int' + str(length * 8) + '_t'
+
+    def getter_sig(self):
+        return "{0}* {1}".format(self.user_type, self.name)
+
+    def unpack(self):
+        if self.length == 1:
+            return "*{0} = data[{1}];".format(self.name, self.position)
+        elif self.length == 2:
+            return "*{0} = SW_TO_SHORT(data + {1});".format(self.name, self.position)
+        elif self.length == 4:
+            return "*{0} = DW_TO_INT(data + {1});".format(self.name, self.position)
+
+    def setter_sig(self):
+        return "{0} {1}".format(self.user_type, self.name)
+
+    def pack(self):
+        if self.length == 1:
+            return "data[{0}] = {1};".format(self.position, self.name)
+        elif self.length == 2:
+            return "SHORT_TO_SW({0}, data + {1});".format(self.name, self.position)
+        elif self.length == 4:
+            return "INT_TO_DW({0}, data + {1});".format(self.name, self.position)
+
+    def spec(self):
+        rep = [('position', self.position), ('length', self.length)]
+        if self.signed:
+            rep.append(('signed', True))
+        return rep
+
+    @staticmethod
+    def load(spec):
+        return IntField(spec['name'], spec['position'], spec['length'], spec['signed'] if signed in spec else False)
+
+def load_field(name, spec):
+    if spec['type'] == 'int':
+        return IntField(name, spec['position'], spec['length'], spec.get('signed', False))
+    else:
+        raise Exception("unknown field type '{0}'".format(spec['type']))
+
+GETTER_TEMPLATE = """/** @ingroup ctrl
+ * {gen_doc}
+ * @param devh UVC device handle
+ * {args_doc}
+ * @param req_code UVC_GET_* request to execute
+ */
+uvc_error_t uvc_get_{control_name}(uvc_device_handle_t *devh, {args_signature}, enum uvc_req_code req_code) {{
+  uint8_t data[{control_length}];
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    {control_code} << 8,
+    {unit_fn} << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data)) {{
+    {unpack}
+    return UVC_SUCCESS;
+  }} else {{
+    return ret;
+  }}
+}}
+"""
+
+SETTER_TEMPLATE = """/** @ingroup ctrl
+ * {gen_doc}
+ * @param devh UVC device handle
+ * {args_doc}
+ */
+uvc_error_t uvc_set_{control_name}(uvc_device_handle_t *devh, {args_signature}) {{
+  uint8_t data[{control_length}];
+  uvc_error_t ret;
+
+  {pack}
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    {control_code} << 8,
+    {unit_fn} << 8 | devh->info->ctrl_if.bInterfaceNumber,
+    data,
+    sizeof(data),
+    0);
+
+  if (ret == sizeof(data))
+    return UVC_SUCCESS;
+  else
+    return ret;
+}}
+"""
+
+def gen_decl(unit_name, unit, control_name, control):
+    fields = [(load_field(field_name, field_details), field_details['doc']) for field_name, field_details in control['fields'].items()] if 'fields' in control else []
+
+    get_args_signature = ', '.join([field.getter_sig() for (field, desc) in fields])
+    set_args_signature = ', '.join([field.setter_sig() for (field, desc) in fields])
+
+    return "uvc_error_t uvc_get_{function_name}(uvc_device_handle_t *devh, {args_signature}, enum uvc_req_code req_code);\n".format(**{
+        "function_name": control_name,
+        "args_signature": get_args_signature
+    }) + "uvc_error_t uvc_set_{function_name}(uvc_device_handle_t *devh, {args_signature});\n".format(**{
+        "function_name": control_name,
+        "args_signature": set_args_signature
+    })
+
+def gen_ctrl(unit_name, unit, control_name, control):
+    fields = [(load_field(field_name, field_details), field_details['doc']) for field_name, field_details in control['fields'].items()] if 'fields' in control else []
+
+    get_args_signature = ', '.join([field.getter_sig() for (field, desc) in fields])
+    set_args_signature = ', '.join([field.setter_sig() for (field, desc) in fields])
+    unpack = "\n    ".join([field.unpack() for (field, desc) in fields])
+    pack = "\n  ".join([field.pack() for (field, desc) in fields])
+
+    get_gen_doc_raw = None
+    set_gen_doc_raw = None
+
+    if 'doc' in control:
+        doc = control['doc']
+
+        if isinstance(doc, str):
+            get_gen_doc_raw = "\n * ".join(doc.splitlines())
+            set_gen_doc_raw = get_gen_doc_raw
+        else:
+            if 'get' in doc:
+                get_gen_doc_raw = "\n * ".join(doc['get'].splitlines())
+            if 'set' in doc:
+                set_gen_doc_raw = "\n * ".join(doc['set'].splitlines())
+
+    if get_gen_doc_raw is not None:
+        get_gen_doc = get_gen_doc_raw.format(gets_sets='Reads')
+    else:
+        get_gen_doc = '@brief Reads the ' + control['control'] + ' control.'
+
+    if set_gen_doc_raw is not None:
+        set_gen_doc = set_gen_doc_raw.format(gets_sets='Sets')
+    else:
+        set_gen_doc = '@brief Sets the ' + control['control'] + ' control.'
+
+    get_args_doc = "\n * ".join(["@param[out] {0} {1}".format(field.name, desc) for (field, desc) in fields])
+    set_args_doc = "\n * ".join(["@param {0} {1}".format(field.name, desc) for (field, desc) in fields])
+
+    control_code = 'UVC_' + unit['control_prefix'] + '_' + control['control'] + '_CONTROL'
+
+    unit_fn = "uvc_get_camera_terminal(devh)->bTerminalID" if (unit_name == "camera_terminal") else ("uvc_get_" + unit_name + "s(devh)->bUnitID")
+
+    return GETTER_TEMPLATE.format(
+        unit=unit,
+        unit_fn=unit_fn,
+        control_name=control_name,
+        control_code=control_code,
+        control_length=control['length'],
+        args_signature=get_args_signature,
+        args_doc=get_args_doc,
+        gen_doc=get_gen_doc,
+        unpack=unpack) + "\n\n" + SETTER_TEMPLATE.format(
+            unit=unit,
+            unit_fn=unit_fn,
+            control_name=control_name,
+            control_code=control_code,
+            control_length=control['length'],
+            args_signature=set_args_signature,
+            args_doc=set_args_doc,
+            gen_doc=set_gen_doc,
+            pack=pack
+        )
+
+def export_unit(unit):
+    def fmt_doc(doc):
+        def wrap_doc_entry(entry):
+            if "\n" in entry:
+                return literal(entry)
+            else:
+                return entry
+
+        if isinstance(doc, str):
+            return wrap_doc_entry(doc)
+        else:
+            return OrderedDict([(mode, wrap_doc_entry(text)) for mode, text in doc.items()])
+
+    def fmt_ctrl(control_name, control_details):
+        contents = OrderedDict()
+        contents['control'] = control_details['control']
+        contents['length'] = control_details['length']
+        contents['fields'] = control_details['fields']
+
+        if 'doc' in control_details:
+            contents['doc'] = fmt_doc(control_details['doc'])
+
+        return (control_name, contents)
+
+    unit_out = OrderedDict()
+    unit_out['type'] = unit['type']
+    if 'guid' in unit:
+        unit_out['guid'] = unit['guid']
+    if 'description' in unit:
+        unit_out['description'] = unit['description']
+    if 'control_prefix' in unit:
+        unit_out['control_prefix'] = unit['control_prefix']
+    unit_out['controls'] = OrderedDict([fmt_ctrl(ctrl_name, ctrl_details) for ctrl_name, ctrl_details in unit['controls'].items()])
+    return unit_out
+
+if __name__ == '__main__':
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "hi:", ["help", "input="])
+    except getopt.GetoptError as err:
+        print(str(err))
+        usage()
+        sys.exit(-1)
+
+    inputs = []
+
+    for opt, val in opts:
+        if opt in ('-h', '--help'):
+            usage()
+            sys.exit(0)
+        elif opt in ('-i', '--input'):
+            inputs.append(val)
+
+    mode = None
+    for arg in args:
+        if arg in ('def', 'decl', 'yaml'):
+            if mode is None:
+                mode = arg
+            else:
+                print("Can't specify more than one mode")
+                sys.exit(-1)
+        else:
+            print("Invalid mode '{0}'".format(arg))
+            sys.exit(-1)
+
+    def iterunits():
+        for input_file in inputs:
+            with open(input_file, "r") as fp:
+                units = yaml.load(fp)['units']
+                for unit_name, unit_details in units.iteritems():
+                    yield unit_name, unit_details
+
+    if mode == 'def':
+        print("""/* This is an AUTO-GENERATED file! Update it with the output of `ctrl-gen.py def`. */
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+
+static const int REQ_TYPE_SET = 0x21;
+static const int REQ_TYPE_GET = 0xa1;
+""")
+        fun = gen_ctrl
+    elif mode == 'decl':
+        fun = gen_decl
+    elif mode == 'yaml':
+        exported_units = OrderedDict()
+        for unit_name, unit_details in iterunits():
+            exported_units[unit_name] = export_unit(unit_details)
+
+        yaml.dump({'units': exported_units}, sys.stdout, default_flow_style=False)
+        sys.exit(0)
+
+    for unit_name, unit_details in iterunits():
+        for control_name, control_details in unit_details['controls'].iteritems():
+            code = fun(unit_name, unit_details, control_name, control_details)
+            print(code)

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/src/ctrl.c
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/src/ctrl.c b/thirdparty/libuvc-0.0.6/src/ctrl.c
new file mode 100644
index 0000000..3dffe79
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/src/ctrl.c
@@ -0,0 +1,165 @@
+/*********************************************************************
+* Software License Agreement (BSD License)
+*
+*  Copyright (C) 2010-2012 Ken Tossell
+*  All rights reserved.
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*   * Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+*   * Redistributions in binary form must reproduce the above
+*     copyright notice, this list of conditions and the following
+*     disclaimer in the documentation and/or other materials provided
+*     with the distribution.
+*   * Neither the name of the author nor other contributors may be
+*     used to endorse or promote products derived from this software
+*     without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+*  POSSIBILITY OF SUCH DAMAGE.
+*********************************************************************/
+/**
+ * @defgroup ctrl Video capture and processing controls
+ * @brief Functions for manipulating device settings and stream parameters
+ *
+ * The `uvc_get_*` and `uvc_set_*` functions are used to read and write the settings associated
+ * with the device's input, processing and output units.
+ */
+
+#include "libuvc/libuvc.h"
+#include "libuvc/libuvc_internal.h"
+
+static const int REQ_TYPE_SET = 0x21;
+static const int REQ_TYPE_GET = 0xa1;
+
+/***** GENERIC CONTROLS *****/
+/**
+ * @brief Get the length of a control on a terminal or unit.
+ * 
+ * @param devh UVC device handle
+ * @param unit Unit or Terminal ID; obtain this from the uvc_extension_unit_t describing the extension unit
+ * @param ctrl Vendor-specific control number to query
+ * @return On success, the length of the control as reported by the device. Otherwise,
+ *   a uvc_error_t error describing the error encountered.
+ * @ingroup ctrl
+ */
+int uvc_get_ctrl_len(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl) {
+  unsigned char buf[2];
+
+  int ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, UVC_GET_LEN,
+    ctrl << 8,
+    unit << 8 | devh->info->ctrl_if.bInterfaceNumber,		// XXX saki
+    buf,
+    2,
+    0 /* timeout */);
+
+  if (ret < 0)
+    return ret;
+  else
+    return (unsigned short)SW_TO_SHORT(buf);
+}
+
+/**
+ * @brief Perform a GET_* request from an extension unit.
+ * 
+ * @param devh UVC device handle
+ * @param unit Unit ID; obtain this from the uvc_extension_unit_t describing the extension unit
+ * @param ctrl Control number to query
+ * @param data Data buffer to be filled by the device
+ * @param len Size of data buffer
+ * @param req_code GET_* request to execute
+ * @return On success, the number of bytes actually transferred. Otherwise,
+ *   a uvc_error_t error describing the error encountered.
+ * @ingroup ctrl
+ */
+int uvc_get_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len, enum uvc_req_code req_code) {
+  return libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    ctrl << 8,
+    unit << 8 | devh->info->ctrl_if.bInterfaceNumber,		// XXX saki
+    data,
+    len,
+    0 /* timeout */);
+}
+
+/**
+ * @brief Perform a SET_CUR request to a terminal or unit.
+ * 
+ * @param devh UVC device handle
+ * @param unit Unit or Terminal ID
+ * @param ctrl Control number to set
+ * @param data Data buffer to be sent to the device
+ * @param len Size of data buffer
+ * @return On success, the number of bytes actually transferred. Otherwise,
+ *   a uvc_error_t error describing the error encountered.
+ * @ingroup ctrl
+ */
+int uvc_set_ctrl(uvc_device_handle_t *devh, uint8_t unit, uint8_t ctrl, void *data, int len) {
+  return libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    ctrl << 8,
+    unit << 8 | devh->info->ctrl_if.bInterfaceNumber,		// XXX saki
+    data,
+    len,
+    0 /* timeout */);
+}
+
+/***** INTERFACE CONTROLS *****/
+uvc_error_t uvc_get_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode *mode, enum uvc_req_code req_code) {
+  uint8_t mode_char;
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_GET, req_code,
+    UVC_VC_VIDEO_POWER_MODE_CONTROL << 8,
+    devh->info->ctrl_if.bInterfaceNumber,	// XXX saki
+    &mode_char,
+    sizeof(mode_char),
+    0);
+
+  if (ret == 1) {
+    *mode = mode_char;
+    return UVC_SUCCESS;
+  } else {
+    return ret;
+  }
+}
+
+uvc_error_t uvc_set_power_mode(uvc_device_handle_t *devh, enum uvc_device_power_mode mode) {
+  uint8_t mode_char = mode;
+  uvc_error_t ret;
+
+  ret = libusb_control_transfer(
+    devh->usb_devh,
+    REQ_TYPE_SET, UVC_SET_CUR,
+    UVC_VC_VIDEO_POWER_MODE_CONTROL << 8,
+    devh->info->ctrl_if.bInterfaceNumber,	// XXX saki
+    &mode_char,
+    sizeof(mode_char),
+    0);
+
+  if (ret == 1)
+    return UVC_SUCCESS;
+  else
+    return ret;
+}
+
+/** @todo Request Error Code Control (UVC 1.5, 4.2.1.2) */


[5/9] nifi-minifi-cpp git commit: MINIFICPP-283 Created a USB camera sensor processor

Posted by ph...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/2d9e5719/thirdparty/libuvc-0.0.6/doxygen.conf
----------------------------------------------------------------------
diff --git a/thirdparty/libuvc-0.0.6/doxygen.conf b/thirdparty/libuvc-0.0.6/doxygen.conf
new file mode 100644
index 0000000..226134a
--- /dev/null
+++ b/thirdparty/libuvc-0.0.6/doxygen.conf
@@ -0,0 +1,2284 @@
+# Doxyfile 1.8.5
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = libuvc
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-
+# Traditional, Croatian, Czech, Danish, Dutch, English, Esperanto, Farsi,
+# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en,
+# Korean, Korean-en, Latvian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
+# Turkish, Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = NO
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = YES
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = YES
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = NO
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = NO
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = src \
+                         include/libuvc
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                = include/libuvc/libuvc_internal.h \
+                         include/utlist.h
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           = src
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = doc
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = YES
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = NO
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = YES
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             = API_EXPORTED= \
+                         LIBUSB_CALL= \
+                         DEFAULT_VISIBILITY=
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, 

<TRUNCATED>