bool BbCameraFocusControl::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const { if (m_session->state() == QCamera::UnloadedState) return false; if (mode == QCameraFocus::FocusPointAuto) { return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS); } else if (mode == QCameraFocus::FocusPointCenter) { return camera_has_feature(m_session->handle(), CAMERA_FEATURE_REGIONFOCUS); } else if (mode == QCameraFocus::FocusPointFaceDetection) { return false; //TODO: implement via custom region in combination with face detection in viewfinder } else if (mode == QCameraFocus::FocusPointCustom) { return camera_has_feature(m_session->handle(), CAMERA_FEATURE_REGIONFOCUS); } return false; }
bool BbCameraFocusControl::isFocusModeSupported(QCameraFocus::FocusModes mode) const { if (m_session->state() == QCamera::UnloadedState) return false; if (mode == QCameraFocus::HyperfocalFocus) return false; //TODO how to check? else if (mode == QCameraFocus::ManualFocus) return camera_has_feature(m_session->handle(), CAMERA_FEATURE_MANUALFOCUS); else if (mode == QCameraFocus::AutoFocus) return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS); else if (mode == QCameraFocus::MacroFocus) return camera_has_feature(m_session->handle(), CAMERA_FEATURE_MACROFOCUS); else if (mode == QCameraFocus::ContinuousFocus) return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS); return false; }
static void bb10camera_detect(MSWebCamManager *obj) { camera_error_t error; camera_handle_t handle; error = camera_open(CAMERA_UNIT_FRONT, CAMERA_MODE_RW, &handle); if (error == CAMERA_EOK) { if (camera_has_feature(handle, CAMERA_FEATURE_VIDEO)) { if (camera_can_feature(handle, CAMERA_FEATURE_VIDEO)) { MSWebCam *cam = ms_web_cam_new(&ms_bb10_camera_desc); cam->name = ms_strdup("BB10 Front Camera"); ms_message("[bb10_capture] camera added: %s", cam->name); ms_web_cam_manager_add_cam(obj, cam); camera_close(handle); } else { ms_warning("[bb10_capture] front camera has video feature but can't do it..."); } } else { ms_warning("[bb10_capture] front camera doesn't have video feature"); } } else { ms_warning("[bb10_capture] Can't open front camera: %s", error_to_string(error)); } error = camera_open(CAMERA_UNIT_REAR, CAMERA_MODE_RW, &handle); if (error == CAMERA_EOK) { if (camera_has_feature(handle, CAMERA_FEATURE_VIDEO)) { if (camera_can_feature(handle, CAMERA_FEATURE_VIDEO)) { MSWebCam *cam = ms_web_cam_new(&ms_bb10_camera_desc); cam->name = ms_strdup("BB10 Rear Camera"); ms_message("[bb10_capture] camera added: %s", cam->name); ms_web_cam_manager_add_cam(obj, cam); camera_close(handle); } else { ms_warning("[bb10_capture] rear camera has video feature but can't do it..."); } } else { ms_warning("[bb10_capture] rear camera doesn't have video feature"); } } else { ms_warning("[bb10_capture] Can't open rear camera: %s", error_to_string(error)); } }
bool BbCameraFlashControl::isFlashModeSupported(QCameraExposure::FlashModes mode) const { bool supportsVideoLight = false; if (m_session->handle() != CAMERA_HANDLE_INVALID) { supportsVideoLight = camera_has_feature(m_session->handle(), CAMERA_FEATURE_VIDEOLIGHT); } return (mode == QCameraExposure::FlashOff || mode == QCameraExposure::FlashOn || mode == QCameraExposure::FlashAuto || ((mode == QCameraExposure::FlashVideoLight) && supportsVideoLight)); }