/**
* @brief Called when the recorder is interrupted by a policy.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] policy The policy that is interrupting the recorder
+ * @remarks This callback is called after interrupt handling is completed.
+ * @param[in] policy The policy that interrupted the recorder
* @param[in] previous The previous state of the recorder
* @param[in] current The current state of the recorder
* @param[in] user_data The user data passed from the callback registration function
typedef void (*recorder_interrupted_cb)(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data);
/**
+ * @brief Called when the recorder interrupt is started by a policy.
+ * @since_tizen 4.0
+ * @remarks This callback is called before interrupt handling is started.
+ * @param[in] policy The policy that is interrupting the recorder
+ * @param[in] state The current state of the recorder
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see recorder_set_interrupt_started_cb()
+ */
+typedef void (*recorder_interrupt_started_cb)(recorder_policy_e policy, recorder_state_e state, void *user_data);
+
+/**
* @brief Called when audio stream data was being delivered just before storing in the recorded file.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks The callback function holds the same buffer that will be recorded. \n
* @see recorder_unset_interrupted_cb()
* @see recorder_interrupted_cb()
*/
-int recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback,
- void *user_data);
+int recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback, void *user_data);
/**
* @brief Unregisters the callback function.
int recorder_unset_interrupted_cb(recorder_h recorder);
/**
+ * @brief Registers a callback function to be called when the media recorder interrupt is started according to a policy.
+ * @since_tizen 4.0
+ * @param[in] recorder The handle to the media recorder
+ * @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 #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see recorder_unset_interrupt_started_cb()
+ * @see recorder_interrupt_started_cb()
+ */
+int recorder_set_interrupt_started_cb(recorder_h recorder, recorder_interrupt_started_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen 4.0
+ * @param[in] recorder The handle to the media recorder
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RECORDER_ERROR_NONE Successful
+ * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see recorder_set_interrupt_started_cb()
+ */
+int recorder_unset_interrupt_started_cb(recorder_h recorder);
+
+/**
* @brief Registers a callback function to be called when audio stream data is being delivered.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks This callback function holds the same buffer that will be recorded. \n
cb_info->user_data[event]);
break;
}
+ case MUSE_RECORDER_EVENT_TYPE_INTERRUPT_STARTED:
+ {
+ int policy = 0;
+ int state = 0;
+
+ muse_recorder_msg_get(policy, recv_msg);
+ muse_recorder_msg_get(state, recv_msg);
+
+ LOGW("INTERRUPT_STARTED - policy %d, state %d", policy, state);
+
+ if (policy == RECORDER_POLICY_SOUND)
+ LOGW("DEPRECATION WARNING: RECORDER_POLICY_SOUND is deprecated and will be removed from next release.");
+ else if (policy == RECORDER_POLICY_SOUND_BY_CALL)
+ LOGW("DEPRECATION WARNING: RECORDER_POLICY_SOUND_BY_CALL is deprecated and will be removed from next release.");
+ else if (policy == RECORDER_POLICY_SOUND_BY_ALARM)
+ LOGW("DEPRECATION WARNING: RECORDER_POLICY_SOUND_BY_ALARM is deprecated and will be removed from next release.");
+
+ ((recorder_interrupt_started_cb)cb_info->user_cb[event])((recorder_policy_e)policy,
+ (recorder_state_e)state, cb_info->user_data[event]);
+ }
+ break;
case MUSE_RECORDER_EVENT_TYPE_AUDIO_STREAM:
{
int tbm_key = 0;
}
+int recorder_set_interrupt_started_cb(recorder_h recorder, recorder_interrupt_started_cb callback, void *user_data)
+{
+ int ret = RECORDER_ERROR_NONE;
+ recorder_cli_s *pc = (recorder_cli_s *)recorder;
+ muse_recorder_api_e api = MUSE_RECORDER_API_SET_INTERRUPT_STARTED_CB;
+
+ if (!pc || !pc->cb_info || callback == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", RECORDER_ERROR_INVALID_PARAMETER);
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("Enter, handle :%x", pc->remote_handle);
+
+ _recorder_msg_send(api, pc->cb_info, &ret, RECORDER_CB_TIMEOUT);
+
+ if (ret == RECORDER_ERROR_NONE) {
+ pc->cb_info->user_cb[MUSE_RECORDER_EVENT_TYPE_INTERRUPT_STARTED] = callback;
+ pc->cb_info->user_data[MUSE_RECORDER_EVENT_TYPE_INTERRUPT_STARTED] = user_data;
+ }
+
+ LOGD("ret : 0x%x", ret);
+
+ return ret;
+}
+
+
+int recorder_unset_interrupt_started_cb(recorder_h recorder)
+{
+ int ret = RECORDER_ERROR_NONE;
+ muse_recorder_api_e api = MUSE_RECORDER_API_UNSET_INTERRUPT_STARTED_CB;
+ recorder_cli_s *pc = (recorder_cli_s *)recorder;
+
+ if (!pc || !pc->cb_info) {
+ LOGE("NULL handle");
+ return RECORDER_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("ENTER");
+
+ _recorder_msg_send(api, pc->cb_info, &ret, RECORDER_CB_TIMEOUT);
+
+ if (ret == RECORDER_ERROR_NONE) {
+ pc->cb_info->user_cb[MUSE_RECORDER_EVENT_TYPE_INTERRUPT_STARTED] = NULL;
+ pc->cb_info->user_data[MUSE_RECORDER_EVENT_TYPE_INTERRUPT_STARTED] = NULL;
+ }
+
+ LOGD("ret : 0x%x", ret);
+
+ return ret;
+}
+
+
int recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb callback, void *user_data)
{
int ret = RECORDER_ERROR_NONE;