/**
* @brief Called when the camera is interrupted by policy.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks This callback is called after interrupt handling is completed.
* @param[in] policy The policy that interrupted the camera
* @param[in] previous The previous state of the camera
* @param[in] current The current state of the camera
typedef void (*camera_interrupted_cb)(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data);
/**
+ * @brief Called when the camera interrupt is started by policy.
+ * @since_tizen 4.0
+ * @remarks This callback is called before interrupt handling is started.
+ * @param[in] policy The policy that is interrupting the camera
+ * @param[in] state The current state of the camera
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see camera_set_interrupt_started_cb()
+ */
+typedef void (*camera_interrupt_started_cb)(camera_policy_e policy, camera_state_e state, void *user_data);
+
+/**
* @brief Called when the camera focus state is changed.
* @details When the camera auto focus completes or a change to the focus state occurs,
* this callback is invoked. \n \n
* @see camera_unset_interrupted_cb()
* @see camera_interrupted_cb()
*/
-int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback,
- void *user_data);
+int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data);
/**
* @brief Unregisters the callback function.
int camera_unset_interrupted_cb(camera_h camera);
/**
+ * @brief Registers a callback function to be called when the camera interrupt is started by policy.
+ * @since_tizen 4.0
+ * @param[in] camera The handle to the camera
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see camera_unset_interrupt_started_cb()
+ * @see camera_interrupt_started_cb()
+ */
+int camera_set_interrupt_started_cb(camera_h camera, camera_interrupt_started_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen 4.0
+ * @param[in] camera The handle to the camera
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see camera_set_interrupt_started_cb()
+ */
+int camera_unset_interrupt_started_cb(camera_h camera);
+
+/**
* @brief Registers a callback function to be called when the auto-focus state changes.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] camera The handle to the camera
Name: capi-media-camera
Summary: A Camera API
-Version: 0.3.1
+Version: 0.3.2
Release: 0
Group: Multimedia/API
License: Apache-2.0
(camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
}
break;
+ case MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED:
+ {
+ int policy = 0;
+ int state = 0;
+
+ muse_camera_msg_get(policy, recv_msg);
+ muse_camera_msg_get(state, recv_msg);
+
+ LOGW("INTERRUPT_STARTED - policy %d, state %d", policy, state);
+
+ if (policy == CAMERA_POLICY_SOUND)
+ LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND is deprecated and will be removed from next release.");
+ else if (policy == CAMERA_POLICY_SOUND_BY_CALL)
+ LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_CALL is deprecated and will be removed from next release.");
+ else if (policy == CAMERA_POLICY_SOUND_BY_ALARM)
+ LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_ALARM is deprecated and will be removed from next release.");
+
+ ((camera_interrupt_started_cb)cb_info->user_cb[event])((camera_policy_e)policy,
+ (camera_state_e)state, cb_info->user_data[event]);
+ }
+ break;
case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
{
int count = 0;
LOGD("return buffer done");
}
break;
- default: /* MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR */
- LOGE("render error");
+ default:
+ LOGW("unhandled event %d", event);
break;
}
}
+int camera_set_interrupt_started_cb(camera_h camera, camera_interrupt_started_cb callback, void *user_data)
+{
+ int ret = CAMERA_ERROR_NONE;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPT_STARTED_CB;
+
+ if (!pc || !pc->cb_info || !callback) {
+ LOGE("NULL pointer %p %p", pc, callback);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("Enter");
+
+ _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = callback;
+ pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = user_data;
+ }
+
+ LOGD("ret : 0x%x", ret);
+
+ return ret;
+}
+
+
+int camera_unset_interrupt_started_cb(camera_h camera)
+{
+ int ret = CAMERA_ERROR_NONE;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPT_STARTED_CB;
+
+ if (!pc || !pc->cb_info) {
+ LOGE("NULL handle");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("Enter");
+
+ _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = NULL;
+ pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED] = NULL;
+ }
+
+ LOGD("ret : 0x%x", ret);
+
+ return ret;
+}
+
+
int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
{
int ret = CAMERA_ERROR_NONE;
return;
}
+static void _camera_interrupt_started_cb(camera_policy_e policy, camera_state_e state, void *user_data)
+{
+ g_print("\ncamera interrupt started callback called[state %d, policy %d]\n", state, policy);
+ return;
+}
+
static bool preview_resolution_cb(int width, int height, void *user_data)
{
resolution_stack *data = (resolution_stack *)user_data;
camera_set_error_cb(hcamcorder->camera, _camera_error_cb, NULL);
camera_set_state_changed_cb(hcamcorder->camera, _camera_state_changed_cb, NULL);
camera_set_interrupted_cb(hcamcorder->camera, _camera_interrupted_cb, NULL);
+ camera_set_interrupt_started_cb(hcamcorder->camera, _camera_interrupt_started_cb, NULL);
camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_LETTER_BOX);
camera_set_error_cb(hcamcorder->camera, _camera_error_cb, NULL);
camera_set_state_changed_cb(hcamcorder->camera, _camera_state_changed_cb, NULL);
camera_set_interrupted_cb(hcamcorder->camera, _camera_interrupted_cb, NULL);
+ camera_set_interrupt_started_cb(hcamcorder->camera, _camera_interrupt_started_cb, NULL);
camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_LETTER_BOX);
/*camera_set_display_rotation(hcamcorder->camera, CAMERA_ROTATION_90);*/
/*camera_set_display_flip(hcamcorder->camera, CAMERA_FLIP_VERTICAL);*/