summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2017-06-09 18:41:09 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2017-06-14 18:20:45 +0900
commitbec2b4d9f92be830c8a14feed7387ac85d8dc766 (patch)
tree1a7834f02b3c030f25e254c951c01f6e8295f284
parent62981f1d482aedee867cb2a7b289a8244b5f57bc (diff)
downloadrecorder-bec2b4d9f92be830c8a14feed7387ac85d8dc766.tar.gz
recorder-bec2b4d9f92be830c8a14feed7387ac85d8dc766.tar.bz2
recorder-bec2b4d9f92be830c8a14feed7387ac85d8dc766.zip
The application can only get callback after interrupt is completed, it means that there is no way to know the internal interrupt handling status for application. This patch provides the APIs to get callback when interrupt is started. [Version] 0.3.3 [Profile] Common [Issue Type] Update [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20170608.1] Change-Id: Ie9a68a5db4c5aa1498e68c01773627680da43f7e Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--include/recorder.h42
-rw-r--r--packaging/capi-media-recorder.spec2
-rw-r--r--src/recorder.c73
3 files changed, 113 insertions, 4 deletions
diff --git a/include/recorder.h b/include/recorder.h
index c0e2c4a..f64c79d 100644
--- a/include/recorder.h
+++ b/include/recorder.h
@@ -247,7 +247,8 @@ typedef void (*recorder_device_state_changed_cb)(recorder_type_e type, recorder_
/**
* @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
@@ -256,6 +257,17 @@ typedef void (*recorder_device_state_changed_cb)(recorder_type_e type, recorder_
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
@@ -1030,8 +1042,7 @@ int recorder_unset_state_changed_cb(recorder_h recorder);
* @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.
@@ -1048,6 +1059,31 @@ int recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb cal
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
diff --git a/packaging/capi-media-recorder.spec b/packaging/capi-media-recorder.spec
index 52d7a2a..4671832 100644
--- a/packaging/capi-media-recorder.spec
+++ b/packaging/capi-media-recorder.spec
@@ -1,6 +1,6 @@
Name: capi-media-recorder
Summary: A Recorder API
-Version: 0.3.2
+Version: 0.3.3
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/recorder.c b/src/recorder.c
index de81bd5..38f833f 100644
--- a/src/recorder.c
+++ b/src/recorder.c
@@ -239,6 +239,27 @@ static void _recorder_client_user_callback(recorder_cb_info_s *cb_info, char *re
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;
@@ -2345,6 +2366,58 @@ int recorder_unset_interrupted_cb(recorder_h recorder)
}
+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;