/* * key RIGHT pressed callback * args: * data - pointer to user data * * asserts: * data (device) is not null * * returns: error code */ int key_RIGHT_callback(void *data) { v4l2_dev_t *device = (v4l2_dev_t *) data; /*assertions*/ assert(device != NULL); if(device->has_pantilt_control_id) { int id = V4L2_CID_PAN_RELATIVE; int value = - device->pan_step; v4l2_ctrl_t *control = v4l2core_get_control_by_id(device, id); if(control) { control->value = value; if(v4l2core_set_control_value_by_id(device, id)) fprintf(stderr, "GUVCVIEW: error setting pan/tilt value\n"); return 0; } } return -1; }
/* * key RIGHT pressed callback * args: * data - pointer to user data * * asserts: * none * * returns: error code */ int key_RIGHT_callback(void *data) { if(v4l2core_has_pantilt_id()) { int id = V4L2_CID_PAN_RELATIVE; int value = - v4l2core_get_pan_step(); v4l2_ctrl_t *control = v4l2core_get_control_by_id(id); if(control) { control->value = value; if(v4l2core_set_control_value_by_id(id)) fprintf(stderr, "GUVCVIEW: error setting pan/tilt value\n"); return 0; } } return -1; }