Release version 0.10.20 93/53493/2 accepted/tizen/mobile/20151208.125133 accepted/tizen/tv/20151208.125146 accepted/tizen/wearable/20151208.125206 submit/tizen/20151208.041805
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 7 Dec 2015 09:38:59 +0000 (18:38 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 8 Dec 2015 03:00:31 +0000 (12:00 +0900)
1. Support interrupt code for sound focus

Change-Id: I0c5ab6869b9f92e51c5c5bb54d6deee8b1f91ef4
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/libmm-camcorder.spec
src/include/mm_camcorder_internal.h
src/mm_camcorder_internal.c
src/mm_camcorder_util.c

index d9bd1cf..c4d3913 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.19
+Version:    0.10.20
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 2f64ee0..249c71c 100644 (file)
@@ -674,6 +674,7 @@ typedef struct mmf_camcorder {
        int sound_focus_register;                               /**< Use sound focus internally */
        int sound_focus_id;                                     /**< id for sound focus */
        int sound_focus_watch_id;                               /**< id for sound focus watch */
+       int interrupt_code;                                     /**< Interrupt code */
        int acquired_focus;                                     /**< Current acquired focus */
        int session_type;                                       /**< Session type */
        int session_flags;                                      /**< Session flags */
index 003673f..6f60c16 100644 (file)
@@ -62,6 +62,7 @@ struct sigaction mm_camcorder_sys_old_action;
 #define __MMCAMCORDER_FORCE_STOP_TRY_COUNT      30
 #define __MMCAMCORDER_FORCE_STOP_WAIT_TIME      100000  /* us */
 #define __MMCAMCORDER_SOUND_WAIT_TIMEOUT        3
+#define __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN   64
 
 
 /*---------------------------------------------------------------------------------------
@@ -2510,7 +2511,7 @@ void _mmcamcorder_set_state(MMHandleType handle, int state)
                switch (hcamcorder->state_change_by_system) {
                case _MMCAMCORDER_STATE_CHANGE_BY_ASM:
                        msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM;
-                       msg.param.state.code = MM_ERROR_NONE;
+                       msg.param.state.code = hcamcorder->interrupt_code;
                        break;
                case _MMCAMCORDER_STATE_CHANGE_BY_RM:
                        msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_RM;
@@ -3193,11 +3194,8 @@ void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
                return;
        }
 
-       /* set value to inform a status is changed by asm */
-       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
-
        _mmcam_dbg_log("sound focus callback : focus state %d, reason %s",
-                      focus_state, reason_for_change ? reason_for_change : "N/A");
+                      focus_state, reason_for_change ? reason_for_change : "N/A");
 
        if (hcamcorder->session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
                _mmcam_dbg_warn("session flag is UNINTERRUPTIBLE. do nothing.");
@@ -3206,6 +3204,21 @@ void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
 
        _MMCAMCORDER_LOCK_ASM(hcamcorder);
 
+       /* set value to inform a status is changed by asm */
+       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
+
+       /* check the reason */
+       if (!strncmp(reason_for_change, "ringtone-voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) ||
+           !strncmp(reason_for_change, "ringtone-call", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) ||
+           !strncmp(reason_for_change, "voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) ||
+           !strncmp(reason_for_change, "call-voice", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) {
+               hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_CALL_START;
+       } else if (!strncmp(reason_for_change, "alarm", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) {
+               hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_ALARM_START;
+       } else {
+               hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_MEDIA;
+       }
+
        if (focus_state == FOCUS_IS_RELEASED) {
                hcamcorder->acquired_focus &= ~focus_type;
 
@@ -3255,9 +3268,6 @@ void _mmcamcorder_sound_focus_watch_cb(mm_sound_focus_type_e focus_type, mm_soun
                return;
        }
 
-       /* set value to inform a status is changed by asm */
-       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
-
        _mmcam_dbg_log("sound focus watch callback : focus state %d, reason %s",
                       focus_state, reason_for_change ? reason_for_change : "N/A");
 
@@ -3268,6 +3278,21 @@ void _mmcamcorder_sound_focus_watch_cb(mm_sound_focus_type_e focus_type, mm_soun
 
        _MMCAMCORDER_LOCK_ASM(hcamcorder);
 
+       /* set value to inform a status is changed by asm */
+       hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_ASM;
+
+       /* check the reason */
+       if (!strncmp(reason_for_change, "ringtone-voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) ||
+           !strncmp(reason_for_change, "ringtone-call", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) ||
+           !strncmp(reason_for_change, "voip", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN) ||
+           !strncmp(reason_for_change, "call-voice", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) {
+               hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_CALL_START;
+       } else if (!strncmp(reason_for_change, "alarm", __MMCAMCORDER_FOCUS_CHANGE_REASON_LEN)) {
+               hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_ALARM_START;
+       } else {
+               hcamcorder->interrupt_code = MM_MSG_CODE_INTERRUPTED_BY_MEDIA;
+       }
+
        if (focus_state == FOCUS_IS_RELEASED) {
                _MMCamcorderMsgItem msg;
 
index 5ba8c20..5638dba 100644 (file)
@@ -1078,6 +1078,7 @@ gboolean _mmcamcorder_send_message(MMHandleType handle, _MMCamcorderMsgItem *dat
        {
                case MM_MESSAGE_CAMCORDER_STATE_CHANGED:
                case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM:
+               case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_RM:
                        data->param.union_type = MM_MSG_UNION_STATE;
                        break;
                case MM_MESSAGE_CAMCORDER_RECORDING_STATUS: