fix(uvc osx): pu API support
This commit is contained in:
		
							parent
							
								
									ea24c5fb38
								
							
						
					
					
						commit
						20b6026789
					
				@ -313,18 +313,69 @@ MYNTEYE_API std::string get_video_name(const device &device) {
 | 
				
			|||||||
MYNTEYE_API bool pu_control_range(
 | 
					MYNTEYE_API bool pu_control_range(
 | 
				
			||||||
    const device &device, Option option, int32_t *min, int32_t *max,
 | 
					    const device &device, Option option, int32_t *min, int32_t *max,
 | 
				
			||||||
    int32_t *def) {
 | 
					    int32_t *def) {
 | 
				
			||||||
  MYNTEYE_UNUSED(device);
 | 
					  struct device &dev = const_cast<struct device &> (device);
 | 
				
			||||||
  MYNTEYE_UNUSED(option);
 | 
					  switch (option) {
 | 
				
			||||||
  MYNTEYE_UNUSED(min);
 | 
					    case Option::GAIN: {
 | 
				
			||||||
  MYNTEYE_UNUSED(max);
 | 
					      *max = dev.getMaxCameraSetting(GAIN);
 | 
				
			||||||
 | 
					      *min = dev.getMinCameraSetting(GAIN);
 | 
				
			||||||
 | 
					      *def = dev.getDefaultCameraSetting(GAIN);
 | 
				
			||||||
 | 
					    } break;
 | 
				
			||||||
 | 
					    case Option::BRIGHTNESS: {
 | 
				
			||||||
 | 
					      *max = dev.getMaxCameraSetting(BRIGHTNESS);
 | 
				
			||||||
 | 
					      *min = dev.getMinCameraSetting(BRIGHTNESS);
 | 
				
			||||||
 | 
					      *def = dev.getDefaultCameraSetting(BRIGHTNESS);
 | 
				
			||||||
 | 
					    } break;
 | 
				
			||||||
 | 
					    case Option::CONTRAST: {
 | 
				
			||||||
 | 
					      *max = dev.getMaxCameraSetting(CONTRAST);
 | 
				
			||||||
 | 
					      *min = dev.getMinCameraSetting(CONTRAST);
 | 
				
			||||||
 | 
					      *def = dev.getDefaultCameraSetting(CONTRAST);
 | 
				
			||||||
 | 
					    } break;
 | 
				
			||||||
 | 
					    default: {
 | 
				
			||||||
 | 
					      LOG(WARNING) << __func__
 | 
				
			||||||
 | 
					                   << " failed: the option "
 | 
				
			||||||
 | 
					                   << static_cast<int>(option) << "is invalid!";
 | 
				
			||||||
 | 
					    } break;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
MYNTEYE_API bool pu_control_query(
 | 
					MYNTEYE_API bool pu_control_query(
 | 
				
			||||||
    const device &device, Option option, pu_query query, int32_t *value) {
 | 
					    const device &device, Option option, pu_query query, int32_t *value) {
 | 
				
			||||||
  MYNTEYE_UNUSED(device);
 | 
					  struct device &dev = const_cast<struct device &> (device);
 | 
				
			||||||
  MYNTEYE_UNUSED(option);
 | 
					  if (query == PU_QUERY_SET) {
 | 
				
			||||||
  MYNTEYE_UNUSED(query);
 | 
					    switch (option) {
 | 
				
			||||||
  MYNTEYE_UNUSED(value);
 | 
					      case Option::GAIN:
 | 
				
			||||||
 | 
					        return dev.setCameraSetting(GAIN, *value);
 | 
				
			||||||
 | 
					      case Option::BRIGHTNESS:
 | 
				
			||||||
 | 
					        return dev.setCameraSetting(BRIGHTNESS, *value);
 | 
				
			||||||
 | 
					      case Option::CONTRAST:
 | 
				
			||||||
 | 
					        return dev.setCameraSetting(CONTRAST, *value);
 | 
				
			||||||
 | 
					      default: {
 | 
				
			||||||
 | 
					        LOG(WARNING) << __func__
 | 
				
			||||||
 | 
					                    << " failed: the option "
 | 
				
			||||||
 | 
					                    << static_cast<int>(option) << "is invalid!";
 | 
				
			||||||
 | 
					      } return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } else if (query == PU_QUERY_GET) {
 | 
				
			||||||
 | 
					    switch (option) {
 | 
				
			||||||
 | 
					      case Option::GAIN:
 | 
				
			||||||
 | 
					        *value = dev.getCameraSetting(GAIN);
 | 
				
			||||||
 | 
					      case Option::BRIGHTNESS:
 | 
				
			||||||
 | 
					        *value = dev.getCameraSetting(BRIGHTNESS);
 | 
				
			||||||
 | 
					      case Option::CONTRAST:
 | 
				
			||||||
 | 
					        *value = dev.getCameraSetting(CONTRAST);
 | 
				
			||||||
 | 
					      default: {
 | 
				
			||||||
 | 
					        LOG(WARNING) << __func__
 | 
				
			||||||
 | 
					                    << " failed: the option "
 | 
				
			||||||
 | 
					                    << static_cast<int>(option) << "is invalid!";
 | 
				
			||||||
 | 
					      } return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    LOG(WARNING) << __func__
 | 
				
			||||||
 | 
					                   << " failed: the query "
 | 
				
			||||||
 | 
					                   << static_cast<int>(query) << "is invalid!";
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user