Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
uvc_cam::Cam Class Reference

#include <uvc_cam.h>

Public Types

enum  mode_t { MODE_RGB, MODE_MJPG, MODE_YUYV }
 

Public Member Functions

 Cam (const char *device, mode_t _mode=MODE_RGB, int _width=640, int _height=480, int _fps=30)
 
int grab (unsigned char **frame, uint32_t &bytes_used)
 
void release (unsigned buf_idx)
 
bool set_auto_white_balance (bool on)
 
void set_control (uint32_t id, int val)
 
void set_motion_thresholds (int lum, int count)
 
bool set_v4l2_control (int id, int value, const std::string &name)
 
bool v4l2_query (int id, const std::string &name)
 
 ~Cam ()
 

Static Public Member Functions

static void enumerate ()
 

Public Attributes

enum uvc_cam::Cam::mode_t mode
 

Private Attributes

v4l2_buffer buf
 
unsigned buf_length
 
v4l2_capability cap
 
std::string device
 
int fd
 
v4l2_format fmt
 
unsigned fps
 
unsigned height
 
unsigned char * last_yuv_frame
 
void * mem [NUM_BUFFER]
 
int motion_threshold_count
 
int motion_threshold_luminance
 
v4l2_requestbuffers rb
 
unsigned char * rgb_frame
 
v4l2_streamparm streamparm
 
v4l2_timecode timecode
 
CSU32 UVC_CTRL_DATA_TYPE_BITMASK = 5
 
CSU32 UVC_CTRL_DATA_TYPE_BOOLEAN = 3
 
CSU32 UVC_CTRL_DATA_TYPE_ENUM = 4
 
CSU32 UVC_CTRL_DATA_TYPE_RAW = 0
 
CSU32 UVC_CTRL_DATA_TYPE_SIGNED = 1
 
CSU32 UVC_CTRL_DATA_TYPE_UNSIGNED = 2
 
CSU32 V4L2_CID_BACKLIGHT_COMPENSATION_NEW = V4L2_CID_BASE_NEW + 28
 
CSU32 V4L2_CID_BACKLIGHT_COMPENSATION_OLD = V4L2_CID_PRIVATE_BASE_OLD + 0
 
CSU32 V4L2_CID_BASE_EXTCTR = 0x0A046D01
 
CSU32 V4L2_CID_BASE_LOGITECH = V4L2_CID_BASE_EXTCTR
 
CSU32 V4L2_CID_BASE_NEW = V4L2_CTRL_CLASS_USER_NEW | 0x900
 
CSU32 V4L2_CID_CAMERA_CLASS_BASE_NEW = V4L2_CTRL_CLASS_CAMERA_NEW | 0x900
 
CSU32 V4L2_CID_CAMERA_CLASS_LAST = V4L2_CID_CAMERA_CLASS_BASE_NEW + 13
 
CSU32 V4L2_CID_DISABLE_PROCESSING_LOGITECH = V4L2_CID_BASE_LOGITECH + 0x70
 
CSU32 V4L2_CID_EXPOSURE_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 2
 
CSU32 V4L2_CID_EXPOSURE_ABSOLUTE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 11
 
CSU32 V4L2_CID_EXPOSURE_AUTO_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 1
 
CSU32 V4L2_CID_EXPOSURE_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD + 10
 
CSU32 V4L2_CID_EXPOSURE_AUTO_PRIORITY_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW+3
 
CSU32 V4L2_CID_FOCUS_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 10
 
CSU32 V4L2_CID_FOCUS_ABSOLUTE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 5
 
CSU32 V4L2_CID_FOCUS_AUTO_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 12
 
CSU32 V4L2_CID_FOCUS_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD + 4
 
CSU32 V4L2_CID_FOCUS_LOGITECH = V4L2_CID_BASE_LOGITECH + 3
 
CSU32 V4L2_CID_FOCUS_RELATIVE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 11
 
CSU32 V4L2_CID_FOCUS_RELATIVE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 6
 
CSU32 V4L2_CID_HUE_AUTO_NEW = V4L2_CID_BASE_NEW + 25
 
CSU32 V4L2_CID_HUE_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD + 3
 
CSU32 V4L2_CID_LAST_EXTCTR = V4L2_CID_RAW_BITS_PER_PIXEL_LOGITECH
 
CSU32 V4L2_CID_LAST_NEW = V4L2_CID_BASE_NEW + 29
 
CSU32 V4L2_CID_LED1_FREQUENCY_LOGITECH = V4L2_CID_BASE_LOGITECH + 5
 
CSU32 V4L2_CID_LED1_MODE_LOGITECH = V4L2_CID_BASE_LOGITECH + 4
 
CSU32 V4L2_CID_PAN_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 8
 
CSU32 V4L2_CID_PAN_RELATIVE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 4
 
CSU32 V4L2_CID_PAN_RELATIVE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 7
 
CSU32 V4L2_CID_PAN_RESET_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 6
 
CSU32 V4L2_CID_PANTILT_RESET_LOGITECH = V4L2_CID_BASE_LOGITECH + 2
 
CSU32 V4L2_CID_PANTILT_RESET_OLD = V4L2_CID_PRIVATE_BASE_OLD + 9
 
CSU32 V4L2_CID_POWER_LINE_FREQUENCY_NEW = V4L2_CID_BASE_NEW + 24
 
CSU32 V4L2_CID_POWER_LINE_FREQUENCY_OLD = V4L2_CID_PRIVATE_BASE_OLD + 1
 
CSU32 V4L2_CID_PRIVATE_BASE_OLD = 0x08000000
 
CSU32 V4L2_CID_PRIVATE_LAST = V4L2_CID_WHITE_BALANCE_TEMP_OLD + 1
 
CSU32 V4L2_CID_RAW_BITS_PER_PIXEL_LOGITECH = V4L2_CID_BASE_LOGITECH + 0x71
 
CSU32 V4L2_CID_SHARPNESS_NEW = V4L2_CID_BASE_NEW + 27
 
CSU32 V4L2_CID_SHARPNESS_OLD = V4L2_CID_PRIVATE_BASE_OLD + 2
 
CSU32 V4L2_CID_TILT_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 9
 
CSU32 V4L2_CID_TILT_RELATIVE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 5
 
CSU32 V4L2_CID_TILT_RELATIVE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 8
 
CSU32 V4L2_CID_TILT_RESET_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 7
 
CSU32 V4L2_CID_WHITE_BALANCE_TEMP_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD+12
 
CSU32 V4L2_CID_WHITE_BALANCE_TEMP_OLD = V4L2_CID_PRIVATE_BASE_OLD + 13
 
CSU32 V4L2_CID_WHITE_BALANCE_TEMPERATURE_NEW = V4L2_CID_BASE_NEW + 26
 
CSU32 V4L2_CTRL_CLASS_CAMERA_NEW = 0x009A0000
 
CSU32 V4L2_CTRL_CLASS_USER_NEW = 0x00980000
 
unsigned width
 

Static Private Attributes

static const unsigned NUM_BUFFER = 2
 

Detailed Description

Definition at line 55 of file uvc_cam.h.

Member Enumeration Documentation

Enumerator
MODE_RGB 
MODE_MJPG 
MODE_YUYV 

Definition at line 58 of file uvc_cam.h.

Constructor & Destructor Documentation

Cam::Cam ( const char *  device,
mode_t  _mode = MODE_RGB,
int  _width = 640,
int  _height = 480,
int  _fps = 30 
)

Definition at line 21 of file uvc_cam.cpp.

Cam::~Cam ( )

Definition at line 222 of file uvc_cam.cpp.

Member Function Documentation

void Cam::enumerate ( )
static

Definition at line 240 of file uvc_cam.cpp.

int Cam::grab ( unsigned char **  frame,
uint32_t &  bytes_used 
)

Definition at line 333 of file uvc_cam.cpp.

void Cam::release ( unsigned  buf_idx)

Definition at line 416 of file uvc_cam.cpp.

bool uvc_cam::Cam::set_auto_white_balance ( bool  on)
void Cam::set_control ( uint32_t  id,
int  val 
)

Definition at line 471 of file uvc_cam.cpp.

void Cam::set_motion_thresholds ( int  lum,
int  count 
)

Definition at line 492 of file uvc_cam.cpp.

bool Cam::set_v4l2_control ( int  id,
int  value,
const std::string &  name 
)

Definition at line 447 of file uvc_cam.cpp.

bool Cam::v4l2_query ( int  id,
const std::string &  name 
)

Definition at line 424 of file uvc_cam.cpp.

Member Data Documentation

v4l2_buffer uvc_cam::Cam::buf
private

Definition at line 78 of file uvc_cam.h.

unsigned uvc_cam::Cam::buf_length
private

Definition at line 82 of file uvc_cam.h.

v4l2_capability uvc_cam::Cam::cap
private

Definition at line 75 of file uvc_cam.h.

std::string uvc_cam::Cam::device
private

Definition at line 71 of file uvc_cam.h.

int uvc_cam::Cam::fd
private

Definition at line 72 of file uvc_cam.h.

v4l2_format uvc_cam::Cam::fmt
private

Definition at line 74 of file uvc_cam.h.

unsigned uvc_cam::Cam::fps
private

Definition at line 73 of file uvc_cam.h.

unsigned uvc_cam::Cam::height
private

Definition at line 73 of file uvc_cam.h.

unsigned char * uvc_cam::Cam::last_yuv_frame
private

Definition at line 83 of file uvc_cam.h.

void* uvc_cam::Cam::mem[NUM_BUFFER]
private

Definition at line 81 of file uvc_cam.h.

enum uvc_cam::Cam::mode_t uvc_cam::Cam::mode
int uvc_cam::Cam::motion_threshold_count
private

Definition at line 72 of file uvc_cam.h.

int uvc_cam::Cam::motion_threshold_luminance
private

Definition at line 72 of file uvc_cam.h.

const unsigned uvc_cam::Cam::NUM_BUFFER = 2
staticprivate

Definition at line 80 of file uvc_cam.h.

v4l2_requestbuffers uvc_cam::Cam::rb
private

Definition at line 77 of file uvc_cam.h.

unsigned char* uvc_cam::Cam::rgb_frame
private

Definition at line 83 of file uvc_cam.h.

v4l2_streamparm uvc_cam::Cam::streamparm
private

Definition at line 76 of file uvc_cam.h.

v4l2_timecode uvc_cam::Cam::timecode
private

Definition at line 79 of file uvc_cam.h.

CSU32 uvc_cam::Cam::UVC_CTRL_DATA_TYPE_BITMASK = 5
private

Definition at line 134 of file uvc_cam.h.

CSU32 uvc_cam::Cam::UVC_CTRL_DATA_TYPE_BOOLEAN = 3
private

Definition at line 132 of file uvc_cam.h.

CSU32 uvc_cam::Cam::UVC_CTRL_DATA_TYPE_ENUM = 4
private

Definition at line 133 of file uvc_cam.h.

CSU32 uvc_cam::Cam::UVC_CTRL_DATA_TYPE_RAW = 0
private

Definition at line 129 of file uvc_cam.h.

CSU32 uvc_cam::Cam::UVC_CTRL_DATA_TYPE_SIGNED = 1
private

Definition at line 130 of file uvc_cam.h.

CSU32 uvc_cam::Cam::UVC_CTRL_DATA_TYPE_UNSIGNED = 2
private

Definition at line 131 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_BACKLIGHT_COMPENSATION_NEW = V4L2_CID_BASE_NEW + 28
private

Definition at line 92 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_BACKLIGHT_COMPENSATION_OLD = V4L2_CID_PRIVATE_BASE_OLD + 0
private

Definition at line 113 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_BASE_EXTCTR = 0x0A046D01
private

Definition at line 135 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_BASE_LOGITECH = V4L2_CID_BASE_EXTCTR
private

Definition at line 136 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_BASE_NEW = V4L2_CTRL_CLASS_USER_NEW | 0x900
private

Definition at line 87 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_CAMERA_CLASS_BASE_NEW = V4L2_CTRL_CLASS_CAMERA_NEW | 0x900
private

Definition at line 96 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_CAMERA_CLASS_LAST = V4L2_CID_CAMERA_CLASS_BASE_NEW + 13
private

Definition at line 109 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_DISABLE_PROCESSING_LOGITECH = V4L2_CID_BASE_LOGITECH + 0x70
private

Definition at line 143 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_EXPOSURE_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 2
private

Definition at line 98 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_EXPOSURE_ABSOLUTE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 11
private

Definition at line 124 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_EXPOSURE_AUTO_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 1
private

Definition at line 97 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_EXPOSURE_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD + 10
private

Definition at line 123 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_EXPOSURE_AUTO_PRIORITY_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW+3
private

Definition at line 99 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_FOCUS_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 10
private

Definition at line 106 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_FOCUS_ABSOLUTE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 5
private

Definition at line 118 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_FOCUS_AUTO_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 12
private

Definition at line 108 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_FOCUS_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD + 4
private

Definition at line 117 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_FOCUS_LOGITECH = V4L2_CID_BASE_LOGITECH + 3
private

Definition at line 140 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_FOCUS_RELATIVE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 11
private

Definition at line 107 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_FOCUS_RELATIVE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 6
private

Definition at line 119 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_HUE_AUTO_NEW = V4L2_CID_BASE_NEW + 25
private

Definition at line 89 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_HUE_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD + 3
private

Definition at line 116 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_LAST_EXTCTR = V4L2_CID_RAW_BITS_PER_PIXEL_LOGITECH
private

Definition at line 145 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_LAST_NEW = V4L2_CID_BASE_NEW + 29
private

Definition at line 93 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_LED1_FREQUENCY_LOGITECH = V4L2_CID_BASE_LOGITECH + 5
private

Definition at line 142 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_LED1_MODE_LOGITECH = V4L2_CID_BASE_LOGITECH + 4
private

Definition at line 141 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PAN_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 8
private

Definition at line 104 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PAN_RELATIVE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 4
private

Definition at line 100 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PAN_RELATIVE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 7
private

Definition at line 120 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PAN_RESET_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 6
private

Definition at line 102 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PANTILT_RESET_LOGITECH = V4L2_CID_BASE_LOGITECH + 2
private

Definition at line 139 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PANTILT_RESET_OLD = V4L2_CID_PRIVATE_BASE_OLD + 9
private

Definition at line 122 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_POWER_LINE_FREQUENCY_NEW = V4L2_CID_BASE_NEW + 24
private

Definition at line 88 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_POWER_LINE_FREQUENCY_OLD = V4L2_CID_PRIVATE_BASE_OLD + 1
private

Definition at line 114 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PRIVATE_BASE_OLD = 0x08000000
private

Definition at line 112 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_PRIVATE_LAST = V4L2_CID_WHITE_BALANCE_TEMP_OLD + 1
private

Definition at line 127 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_RAW_BITS_PER_PIXEL_LOGITECH = V4L2_CID_BASE_LOGITECH + 0x71
private

Definition at line 144 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_SHARPNESS_NEW = V4L2_CID_BASE_NEW + 27
private

Definition at line 91 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_SHARPNESS_OLD = V4L2_CID_PRIVATE_BASE_OLD + 2
private

Definition at line 115 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_TILT_ABSOLUTE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 9
private

Definition at line 105 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_TILT_RELATIVE_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 5
private

Definition at line 101 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_TILT_RELATIVE_OLD = V4L2_CID_PRIVATE_BASE_OLD + 8
private

Definition at line 121 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_TILT_RESET_NEW = V4L2_CID_CAMERA_CLASS_BASE_NEW + 7
private

Definition at line 103 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_WHITE_BALANCE_TEMP_AUTO_OLD = V4L2_CID_PRIVATE_BASE_OLD+12
private

Definition at line 125 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_WHITE_BALANCE_TEMP_OLD = V4L2_CID_PRIVATE_BASE_OLD + 13
private

Definition at line 126 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CID_WHITE_BALANCE_TEMPERATURE_NEW = V4L2_CID_BASE_NEW + 26
private

Definition at line 90 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CTRL_CLASS_CAMERA_NEW = 0x009A0000
private

Definition at line 95 of file uvc_cam.h.

CSU32 uvc_cam::Cam::V4L2_CTRL_CLASS_USER_NEW = 0x00980000
private

Definition at line 86 of file uvc_cam.h.

unsigned uvc_cam::Cam::width
private

Definition at line 73 of file uvc_cam.h.


The documentation for this class was generated from the following files:


uvc_camera
Author(s): Ken Tossell
autogenerated on Sat Jun 8 2019 17:54:12