#include <asm/types.h>
#include <system_info.h>
-#include <mm_session.h>
-#include <mm_session_private.h>
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
#include <murphy/common/glib-glue.h>
#define __MMCAMCORDER_RESOURCE_WAIT_TIME 5
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+#define __MMCAMCORDER_DBUS_OBJECT "/org/tizen/MMCamcorder"
+#define __MMCAMCORDER_DBUS_INTERFACE_CAMERA "org.tizen.MMCamcorder.Camera"
+#define __MMCAMCORDER_DBUS_INTERFACE_RECORDER "org.tizen.MMCamcorder.Recorder"
+#define __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED "DeviceStateChanged"
+
+enum {
+ CAMERA_DEVICE_STATE_NULL = 0, /**< Not opened */
+ CAMERA_DEVICE_STATE_OPENED, /**< Opened */
+ CAMERA_DEVICE_STATE_WORKING /**< Now previewing or capturing or is being used for video recording */
+};
+
+enum {
+ RECORDER_TYPE_AUDIO = 0, /**< Audio only recorder */
+ RECORDER_TYPE_VIDEO /**< Video recorder (audio is optional) */
+};
+
+enum {
+ RECORDER_DEVICE_STATE_NULL = 0, /**< No recorder is working */
+ RECORDER_DEVICE_STATE_RECORDING, /**< Now recording */
+ RECORDER_DEVICE_STATE_PAUSED /**< All recordings are paused */
+};
+
/*---------------------------------------------------------------------------------------
| LOCAL FUNCTION PROTOTYPES: |
const char *ConfCtrlFile = NULL;
mmf_camcorder_t *hcamcorder = NULL;
type_element *EvasSurfaceElement = NULL;
-#ifdef _MMCAMCORDER_MURPHY_SUPPORT
- gint64 end_time = 0;
-#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
_mmcam_dbg_log("Entered");
g_cond_init(&hcamcorder->task_thread_cond);
hcamcorder->task_thread_state = _MMCAMCORDER_SOUND_STATE_NONE;
+ if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
+ /* init for gdbus */
+ g_mutex_init(&hcamcorder->gdbus_info_sound.sync_mutex);
+ g_cond_init(&hcamcorder->gdbus_info_sound.sync_cond);
+ g_mutex_init(&hcamcorder->gdbus_info_solo_sound.sync_mutex);
+ g_cond_init(&hcamcorder->gdbus_info_solo_sound.sync_cond);
+ }
+
/* create task thread */
hcamcorder->task_thread = g_thread_try_new("MMCAM_TASK_THREAD",
(GThreadFunc)_mmcamcorder_util_task_thread_func, (gpointer)hcamcorder, NULL);
hcamcorder->device_type = info->videodev_type;
_mmcam_dbg_warn("Device Type : %d", hcamcorder->device_type);
- if (MM_ERROR_NONE == _mm_session_util_read_information(-1, &hcamcorder->session_type, &hcamcorder->session_flags)) {
- _mmcam_dbg_log("use sound focus function.");
- hcamcorder->sound_focus_register = TRUE;
-
- if (MM_ERROR_NONE != mm_sound_focus_get_id(&hcamcorder->sound_focus_id)) {
- _mmcam_dbg_err("mm_sound_focus_get_uniq failed");
- ret = MM_ERROR_POLICY_BLOCKED;
- goto _ERR_DEFAULT_VALUE_INIT;
- }
-
- ret = mm_sound_register_focus_for_session(hcamcorder->sound_focus_id,
- getpid(), "media", _mmcamcorder_sound_focus_cb, hcamcorder);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_register_focus failed");
- ret = MM_ERROR_POLICY_BLOCKED;
- goto _ERR_DEFAULT_VALUE_INIT;
- }
-
- _mmcam_dbg_log("mm_sound_register_focus done - id %d, session type %d, flags 0x%x",
- hcamcorder->sound_focus_id, hcamcorder->session_type, hcamcorder->session_flags);
- } else {
- _mmcam_dbg_log("_mm_session_util_read_information failed. skip sound focus function.");
- hcamcorder->sound_focus_register = FALSE;
- }
-
/* Get Camera Configure information from Camcorder INI file */
ret = _mmcamcorder_conf_get_info((MMHandleType)hcamcorder, CONFIGURE_TYPE_MAIN, CONFIGURE_MAIN_FILE, &hcamcorder->conf_main);
if (ret != MM_ERROR_NONE) {
goto _ERR_DEFAULT_VALUE_INIT;
}
- /* get DPM context for camera/microphone restriction */
- hcamcorder->dpm_context = dpm_context_create();
- if (hcamcorder->dpm_context) {
- hcamcorder->dpm_policy = dpm_context_acquire_restriction_policy(hcamcorder->dpm_context);
- if (hcamcorder->dpm_policy == NULL) {
- _mmcam_dbg_err("dpm_context_acquire_restriction_policy failed");
- dpm_context_destroy(hcamcorder->dpm_context);
- hcamcorder->dpm_context = NULL;
- }
+ /* init for gdbus */
+ hcamcorder->gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
+ if (hcamcorder->gdbus_conn == NULL) {
+ _mmcam_dbg_err("failed to get gdbus");
+ ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+ goto _ERR_DEFAULT_VALUE_INIT;
}
- _mmcam_dbg_warn("DPM context %p, policy %p", hcamcorder->dpm_context, hcamcorder->dpm_policy);
+ /* get DPM handle for camera/microphone restriction */
+ hcamcorder->dpm_handle = dpm_manager_create();
+
+ _mmcam_dbg_warn("DPM handle %p", hcamcorder->dpm_handle);
if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
}
/* add DPM camera policy changed callback */
- if (hcamcorder->dpm_context) {
- ret = dpm_context_add_policy_changed_cb(hcamcorder->dpm_context, "camera",
+ if (hcamcorder->dpm_handle) {
+ ret = dpm_add_policy_changed_cb(hcamcorder->dpm_handle, "camera",
_mmcamcorder_dpm_camera_policy_changed_cb, (void *)hcamcorder, &hcamcorder->dpm_camera_cb_id);
if (ret != DPM_ERROR_NONE) {
_mmcam_dbg_err("add DPM changed cb failed, keep going...");
_MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
if (hcamcorder->resource_manager.is_connected == FALSE) {
+ gint64 end_time = 0;
+
/* wait for resource manager connected */
_mmcam_dbg_log("resource manager is not connected. wait for signal...");
_mmcamcorder_resource_manager_deinit(&hcamcorder->resource_manager);
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
- /* unregister sound focus */
- if (hcamcorder->sound_focus_register && hcamcorder->sound_focus_id > 0) {
- if (MM_ERROR_NONE != mm_sound_unregister_focus(hcamcorder->sound_focus_id)) {
- _mmcam_dbg_err("mm_sound_unregister_focus[id %d] failed", hcamcorder->sound_focus_id);
- } else {
- _mmcam_dbg_log("mm_sound_unregister_focus[id %d] done", hcamcorder->sound_focus_id);
- }
- } else {
- _mmcam_dbg_warn("no need to unregister sound focus[%d, id %d]",
- hcamcorder->sound_focus_register, hcamcorder->sound_focus_id);
- }
-
/* release DPM related handle */
- if (hcamcorder->dpm_context) {
- _mmcam_dbg_log("release DPM context %p, camera changed cb id %d",
- hcamcorder->dpm_context, hcamcorder->dpm_camera_cb_id);
+ if (hcamcorder->dpm_handle) {
+ _mmcam_dbg_log("release DPM handle %p, camera changed cb id %d",
+ hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id);
/* remove camera policy changed callback */
if (hcamcorder->dpm_camera_cb_id > 0) {
- dpm_context_remove_policy_changed_cb(hcamcorder->dpm_context, hcamcorder->dpm_camera_cb_id);
+ dpm_remove_policy_changed_cb(hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id);
hcamcorder->dpm_camera_cb_id = 0;
} else {
_mmcam_dbg_warn("invalid dpm camera cb id %d", hcamcorder->dpm_camera_cb_id);
}
- if (hcamcorder->dpm_policy) {
- dpm_context_release_restriction_policy(hcamcorder->dpm_context, hcamcorder->dpm_policy);
- hcamcorder->dpm_policy = NULL;
- }
-
- dpm_context_destroy(hcamcorder->dpm_context);
- hcamcorder->dpm_context = NULL;
+ dpm_manager_destroy(hcamcorder->dpm_handle);
+ hcamcorder->dpm_handle = NULL;
}
/* Remove attributes */
g_cond_clear(&hcamcorder->snd_info.open_cond);
g_mutex_clear(&hcamcorder->restart_preview_lock);
+ if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
+ g_mutex_clear(&hcamcorder->gdbus_info_sound.sync_mutex);
+ g_cond_clear(&hcamcorder->gdbus_info_sound.sync_cond);
+ g_mutex_clear(&hcamcorder->gdbus_info_solo_sound.sync_mutex);
+ g_cond_clear(&hcamcorder->gdbus_info_solo_sound.sync_cond);
+ }
+
if (hcamcorder->conf_ctrl)
_mmcamcorder_conf_release_info((MMHandleType)hcamcorder, &hcamcorder->conf_ctrl);
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM = MM_CAMCORDER_STATE_NULL;
#ifdef _MMCAMCORDER_RM_SUPPORT
int iret = RM_OK;
#endif /* _MMCAMCORDER_RM_SUPPORT */
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM) {
+ if (state != MM_CAMCORDER_STATE_NULL) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
/* de-initialize resource manager */
+ _MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
+
ret = _mmcamcorder_resource_manager_deinit(&hcamcorder->resource_manager);
if (ret != MM_ERROR_NONE)
_mmcam_dbg_err("failed to de-initialize resource manager 0x%x", ret);
+
+ _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
/* Remove idle function which is not called yet */
/* Remove messages which are not called yet */
_mmcamcorder_remove_message_all(handle);
- /* unregister sound focus */
- if (hcamcorder->sound_focus_register && hcamcorder->sound_focus_id > 0) {
- if (mm_sound_unregister_focus(hcamcorder->sound_focus_id) != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_unregister_focus[id %d] failed",
- hcamcorder->sound_focus_id);
- } else {
- _mmcam_dbg_log("mm_sound_unregister_focus[id %d] done",
- hcamcorder->sound_focus_id);
- }
- } else {
- _mmcam_dbg_log("no need to unregister sound focus.[%d, id %d]",
- hcamcorder->sound_focus_register, hcamcorder->sound_focus_id);
+ /* unset remained watch cb */
+ if (hcamcorder->sound_focus_watch_id > 0) {
+ mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id);
+ _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id);
+ hcamcorder->sound_focus_watch_id = 0;
+ }
+
+ /* unregister sound focus and unsubscribe sound signal */
+ _mmcam_dbg_log("sound focus id %d, sound signal subscribe id %u",
+ hcamcorder->sound_focus_id, hcamcorder->sound_focus_subscribe_id);
+
+ if (hcamcorder->sound_focus_id > 0) {
+ mm_sound_unregister_focus(hcamcorder->sound_focus_id);
+ _mmcam_dbg_log("unregister sound focus done");
+ hcamcorder->sound_focus_id = 0;
+ }
+
+ if (hcamcorder->sound_focus_subscribe_id > 0) {
+ mm_sound_unsubscribe_signal(hcamcorder->sound_focus_subscribe_id);
+ _mmcam_dbg_log("unsubscribe sound signal done");
+ hcamcorder->sound_focus_subscribe_id = 0;
}
+
#ifdef _MMCAMCORDER_RM_SUPPORT
if (hcamcorder->rm_handle != 0) {
iret = rm_unregister(hcamcorder->rm_handle);
hcamcorder->software_version = NULL;
}
- /* release DPM related handle */
- if (hcamcorder->dpm_context) {
- _mmcam_dbg_log("release DPM context %p, camera changed cb id %d",
- hcamcorder->dpm_context, hcamcorder->dpm_camera_cb_id);
+ /* release DPM handle */
+ if (hcamcorder->dpm_handle) {
+ _mmcam_dbg_log("release DPM handle %p, camera changed cb id %d",
+ hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id);
/* remove camera policy changed callback */
if (hcamcorder->dpm_camera_cb_id > 0) {
- dpm_context_remove_policy_changed_cb(hcamcorder->dpm_context, hcamcorder->dpm_camera_cb_id);
+ dpm_remove_policy_changed_cb(hcamcorder->dpm_handle, hcamcorder->dpm_camera_cb_id);
hcamcorder->dpm_camera_cb_id = 0;
} else {
_mmcam_dbg_warn("invalid dpm camera cb id %d", hcamcorder->dpm_camera_cb_id);
}
- if (hcamcorder->dpm_policy) {
- dpm_context_release_restriction_policy(hcamcorder->dpm_context, hcamcorder->dpm_policy);
- hcamcorder->dpm_policy = NULL;
- }
-
- dpm_context_destroy(hcamcorder->dpm_context);
- hcamcorder->dpm_context = NULL;
+ dpm_manager_destroy(hcamcorder->dpm_handle);
+ hcamcorder->dpm_handle = NULL;
}
/* join task thread */
g_mutex_clear(&hcamcorder->task_thread_lock);
g_cond_clear(&hcamcorder->task_thread_cond);
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+ g_mutex_clear(&hcamcorder->gdbus_info_sound.sync_mutex);
+ g_cond_clear(&hcamcorder->gdbus_info_sound.sync_cond);
+ g_mutex_clear(&hcamcorder->gdbus_info_solo_sound.sync_mutex);
+ g_cond_clear(&hcamcorder->gdbus_info_solo_sound.sync_cond);
+ }
+
+ g_object_unref(hcamcorder->gdbus_conn);
+ hcamcorder->gdbus_conn = NULL;
+
/* Release handle */
memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t));
free(hcamcorder);
int ret = MM_ERROR_NONE;
int ret_sound = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM = MM_CAMCORDER_STATE_NULL;
- int state_TO = MM_CAMCORDER_STATE_READY;
int display_surface_type = MM_DISPLAY_SURFACE_OVERLAY;
int pid_for_sound_focus = 0;
double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE;
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM) {
+ if (state != MM_CAMCORDER_STATE_NULL) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
/* sound focus */
if (hcamcorder->sound_focus_register) {
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_PID_FOR_SOUND_FOCUS, &pid_for_sound_focus,
- NULL);
-
- if (pid_for_sound_focus == 0) {
- pid_for_sound_focus = getpid();
- _mmcam_dbg_warn("pid for sound focus is not set, use my pid %d", pid_for_sound_focus);
- }
-
/* acquire sound focus or set sound focus watch callback */
- hcamcorder->acquired_focus = 0;
- hcamcorder->sound_focus_watch_id = 0;
-
- /* check session flags */
if (hcamcorder->session_flags & MM_SESSION_OPTION_PAUSE_OTHERS) {
/* acquire sound focus */
_mmcam_dbg_log("PAUSE_OTHERS - acquire sound focus");
if (ret_sound != MM_ERROR_NONE) {
_mmcam_dbg_err("mm_sound_acquire_focus failed [0x%x]", ret_sound);
- /* TODO: MM_ERROR_POLICY_BLOCKED_BY_CALL, MM_ERROR_POLICY_BLOCKED_BY_ALARM*/
ret = MM_ERROR_POLICY_BLOCKED;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
/* do nothing */
_mmcam_dbg_log("SESSION_UNINTERRUPTIBLE - do nothing for sound focus");
} else {
+ /* unset remained watch cb */
+ if (hcamcorder->sound_focus_watch_id > 0) {
+ mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id);
+ _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id);
+ hcamcorder->sound_focus_watch_id = 0;
+ }
+
/* set sound focus watch callback */
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_PID_FOR_SOUND_FOCUS, &pid_for_sound_focus,
+ NULL);
+
+ if (pid_for_sound_focus == 0) {
+ pid_for_sound_focus = getpid();
+ _mmcam_dbg_warn("pid for sound focus is not set, use my pid %d", pid_for_sound_focus);
+ }
+
_mmcam_dbg_log("ETC - set sound focus watch callback - pid %d", pid_for_sound_focus);
ret_sound = mm_sound_set_focus_watch_callback_for_session(pid_for_sound_focus,
if (ret_sound != MM_ERROR_NONE) {
_mmcam_dbg_err("mm_sound_set_focus_watch_callback failed [0x%x]", ret_sound);
- /* TODO: MM_ERROR_POLICY_BLOCKED_BY_CALL, MM_ERROR_POLICY_BLOCKED_BY_ALARM*/
ret = MM_ERROR_POLICY_BLOCKED;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
int dpm_camera_state = DPM_ALLOWED;
-#ifdef _MMCAMCORDER_MURPHY_SUPPORT
- gint64 end_time = 0;
-#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
/* check camera policy from DPM */
- if (hcamcorder->dpm_policy) {
- if (dpm_restriction_get_camera_state(hcamcorder->dpm_policy, &dpm_camera_state) == DPM_ERROR_NONE) {
+ if (hcamcorder->dpm_handle) {
+ if (dpm_restriction_get_camera_state(hcamcorder->dpm_handle, &dpm_camera_state) == DPM_ERROR_NONE) {
_mmcam_dbg_log("DPM camera state %d", dpm_camera_state);
if (dpm_camera_state == DPM_DISALLOWED) {
_mmcam_dbg_err("CAMERA DISALLOWED by DPM");
_mmcam_dbg_err("get DPM camera state failed, keep going...");
}
} else {
- _mmcam_dbg_warn("NULL dpm_policy");
+ _mmcam_dbg_warn("NULL dpm_handle");
}
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+ ret = _mmcamcorder_resource_create_resource_set(&hcamcorder->resource_manager);
+ if (ret != MM_ERROR_NONE) {
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
+
hcamcorder->resource_manager.acquire_count = 0;
/* prepare resource manager for camera */
_mmcam_dbg_err("could not acquire resources");
- _mmcamcorder_resource_manager_unprepare(&hcamcorder->resource_manager);
-
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- if (hcamcorder->resource_manager.acquire_count > 0) {
+ if (hcamcorder->resource_manager.acquire_remain > 0) {
+ gint64 end_time = 0;
+
_mmcam_dbg_warn("wait for resource state change");
/* wait for resource state change */
goto _ERR_CAMCORDER_CMD;
}
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_READY);
+
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
+ int value = hcamcorder->device_type << 16 | CAMERA_DEVICE_STATE_OPENED;
+
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_CAMERA, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, value);
+ }
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
} else if (ret_resource != MM_ERROR_NONE) {
_mmcam_dbg_err("failed to release resource, ret_resource(0x%x)", ret_resource);
}
-
- ret_resource = _mmcamcorder_resource_manager_unprepare(&hcamcorder->resource_manager);
- if (ret_resource != MM_ERROR_NONE)
- _mmcam_dbg_err("failed to unprepare resource manager, ret_resource(0x%x)", ret_resource);
}
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
- if (hcamcorder->sound_focus_register) {
- if (hcamcorder->sound_focus_watch_id > 0) {
- if (mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id) != MM_ERROR_NONE) {
- _mmcam_dbg_warn("mm_sound_unset_focus_watch_callback[id %d] failed", hcamcorder->sound_focus_watch_id);
- } else {
- _mmcam_dbg_warn("mm_sound_unset_focus_watch_callback[id %d] done", hcamcorder->sound_focus_watch_id);
- }
- }
+ if (hcamcorder->sound_focus_watch_id > 0) {
+ mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id);
+ _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id);
+ hcamcorder->sound_focus_watch_id = 0;
+ }
- if (hcamcorder->acquired_focus > 0) {
- if (mm_sound_release_focus(0, hcamcorder->acquired_focus, NULL) != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_release_focus[focus %d] failed", hcamcorder->acquired_focus);
- } else {
- _mmcam_dbg_err("mm_sound_release_focus[focus %d] done", hcamcorder->acquired_focus);
- }
- }
+ if (hcamcorder->acquired_focus > 0) {
+ mm_sound_release_focus(0, hcamcorder->acquired_focus, NULL);
+ _mmcam_dbg_warn("release sound focus [focus %d] done", hcamcorder->acquired_focus);
+ hcamcorder->acquired_focus = 0;
}
+
#ifdef _MMCAMCORDER_RM_SUPPORT
if (hcamcorder->rm_handle) {
if (hcamcorder->returned_devices.allocated_num > 0) {
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM = MM_CAMCORDER_STATE_READY;
- int state_TO = MM_CAMCORDER_STATE_NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM) {
+ if (state != MM_CAMCORDER_STATE_READY) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
- if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE &&
+ hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_RM) {
+ gint64 end_time = 0;
+
+ _mmcam_dbg_log("lock resource");
+ _MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
+
/* release resource */
ret = _mmcamcorder_resource_manager_release(&hcamcorder->resource_manager);
if (ret == MM_ERROR_RESOURCE_INVALID_STATE) {
} else if (ret != MM_ERROR_NONE) {
_mmcam_dbg_err("failed to release resource, ret(0x%x)", ret);
ret = MM_ERROR_CAMCORDER_INTERNAL;
+
+ _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
+ _mmcam_dbg_log("unlock resource");
+
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- _MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
- ret = _mmcamcorder_resource_manager_unprepare(&hcamcorder->resource_manager);
+
+ if (hcamcorder->resource_manager.acquire_remain < hcamcorder->resource_manager.acquire_count) {
+ /* wait for resource release */
+ _mmcam_dbg_log("resource is not released all. wait for signal...");
+
+ end_time = g_get_monotonic_time() + (__MMCAMCORDER_RESOURCE_WAIT_TIME * G_TIME_SPAN_SECOND);
+
+ _MMCAMCORDER_RESOURCE_WAIT_UNTIL(hcamcorder, end_time);
+ }
_MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
- if (ret != MM_ERROR_NONE)
- _mmcam_dbg_err("failed to unprepare resource manager, ret(0x%x)", ret);
+ _mmcam_dbg_log("unlock resource");
}
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
hcamcorder->sound_focus_register, hcamcorder->session_flags, hcamcorder->state_change_by_system);
/* release sound focus or unset sound focus watch callback */
- if (hcamcorder->sound_focus_register) {
- int ret_sound = MM_ERROR_NONE;
-
- _mmcam_dbg_log("state_change_by_system %d, session flag 0x%x, acquired_focus %d, sound_focus_id %d, sound_focus_watch_id %d",
- hcamcorder->state_change_by_system, hcamcorder->session_flags, hcamcorder->acquired_focus,
- hcamcorder->sound_focus_id, hcamcorder->sound_focus_watch_id);
+ _mmcam_dbg_log("by_system %d, flag 0x%x, acquired_focus %d, focus_id %d, watch_id %d",
+ hcamcorder->state_change_by_system, hcamcorder->session_flags, hcamcorder->acquired_focus,
+ hcamcorder->sound_focus_id, hcamcorder->sound_focus_watch_id);
- if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_FOCUS &&
- hcamcorder->sound_focus_watch_id > 0) {
- ret_sound = mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id);
- if (ret_sound != MM_ERROR_NONE) {
- _mmcam_dbg_warn("mm_sound_unset_focus_watch_callback failed [0x%x]", ret_sound);
- } else {
- _mmcam_dbg_warn("mm_sound_unset_focus_watch_callback done");
- }
- } else {
- _mmcam_dbg_warn("no need to unset watch callback.[state_change_by_system %d, sound_focus_watch_id %d]",
- hcamcorder->state_change_by_system, hcamcorder->sound_focus_watch_id);
+ if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_FOCUS) {
+ if (hcamcorder->sound_focus_watch_id > 0) {
+ mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id);
+ _mmcam_dbg_warn("unset sound focus watch cb [id %d] done", hcamcorder->sound_focus_watch_id);
+ hcamcorder->sound_focus_watch_id = 0;
}
if (hcamcorder->acquired_focus > 0) {
- ret_sound = mm_sound_release_focus(0, hcamcorder->acquired_focus, NULL);
- if (ret_sound != MM_ERROR_NONE) {
- _mmcam_dbg_warn("mm_sound_release_focus failed [0x%x]", ret_sound);
- } else {
- _mmcam_dbg_log("mm_sound_release_focus done");
- }
- } else {
- _mmcam_dbg_warn("no need to release focus - current acquired focus %d", hcamcorder->acquired_focus);
+ mm_sound_release_focus(0, hcamcorder->acquired_focus, NULL);
+ _mmcam_dbg_warn("release sound focus [focus %d] done", hcamcorder->acquired_focus);
+ hcamcorder->acquired_focus = 0;
}
+ } else {
+ _mmcam_dbg_warn("state change by focus. so, no need to unset watch callback");
+ /* acquired focus will be released automatically */
+ hcamcorder->acquired_focus = 0;
+ }
+
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
+ int value = hcamcorder->device_type << 16 | CAMERA_DEVICE_STATE_NULL;
+
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_CAMERA, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, value);
}
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_NULL);
return MM_ERROR_NONE;
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM = MM_CAMCORDER_STATE_READY;
- int state_TO = MM_CAMCORDER_STATE_PREPARE;
_MMCamcorderSubContext *sc = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM) {
+ if (state != MM_CAMCORDER_STATE_READY) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
hcamcorder->error_code = MM_ERROR_NONE;
/* set attributes related sensor */
- if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
- /* init for gdbus */
- hcamcorder->gdbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
- if (hcamcorder->gdbus_conn == NULL) {
- _mmcam_dbg_err("failed to get gdbus");
- ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
-
- g_mutex_init(&hcamcorder->gdbus_info_sound.sync_mutex);
- g_cond_init(&hcamcorder->gdbus_info_sound.sync_cond);
- g_mutex_init(&hcamcorder->gdbus_info_solo_sound.sync_mutex);
- g_cond_init(&hcamcorder->gdbus_info_solo_sound.sync_cond);
-
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO)
_mmcamcorder_set_attribute_to_camsensor(handle);
- }
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_PREVIEW_START);
if (ret != MM_ERROR_NONE) {
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_PREPARE);
+
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE) {
+ int value = hcamcorder->device_type << 16 | CAMERA_DEVICE_STATE_WORKING;
+
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_CAMERA, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, value);
+ }
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM = MM_CAMCORDER_STATE_PREPARE;
- int state_TO = MM_CAMCORDER_STATE_READY;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM) {
+ if (state != MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
if (ret != MM_ERROR_NONE)
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_READY);
if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
+ int value = hcamcorder->device_type << 16 | CAMERA_DEVICE_STATE_OPENED;
+
+ /* unsubscribe remained unsubscribed signal */
g_mutex_lock(&hcamcorder->gdbus_info_sound.sync_mutex);
if (hcamcorder->gdbus_info_sound.subscribe_id > 0) {
_mmcam_dbg_warn("subscribe_id[%u] is remained. remove it.", hcamcorder->gdbus_info_sound.subscribe_id);
}
g_mutex_unlock(&hcamcorder->gdbus_info_solo_sound.sync_mutex);
- g_object_unref(hcamcorder->gdbus_conn);
- hcamcorder->gdbus_conn = NULL;
-
- g_mutex_clear(&hcamcorder->gdbus_info_sound.sync_mutex);
- g_cond_clear(&hcamcorder->gdbus_info_sound.sync_cond);
- g_mutex_clear(&hcamcorder->gdbus_info_solo_sound.sync_mutex);
- g_cond_clear(&hcamcorder->gdbus_info_solo_sound.sync_cond);
+ /* emit signal for camera device state */
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_CAMERA, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, value);
}
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
int state_FROM_0 = MM_CAMCORDER_STATE_PREPARE;
int state_FROM_1 = MM_CAMCORDER_STATE_RECORDING;
int state_FROM_2 = MM_CAMCORDER_STATE_PAUSED;
- int state_TO = MM_CAMCORDER_STATE_CAPTURING;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
/* Do not change state when recording snapshot capture */
if (state == state_FROM_0)
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_CAPTURING);
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM = MM_CAMCORDER_STATE_CAPTURING;
- int state_TO = MM_CAMCORDER_STATE_PREPARE;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
_mmcam_dbg_log("");
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM) {
+ if (state != MM_CAMCORDER_STATE_CAPTURING) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
if (ret != MM_ERROR_NONE)
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_PREPARE);
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM1 = MM_CAMCORDER_STATE_PREPARE;
- int state_FROM2 = MM_CAMCORDER_STATE_PAUSED;
- int state_TO = MM_CAMCORDER_STATE_RECORDING;
int dpm_mic_state = DPM_ALLOWED;
+ int device_state = 0;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM1 && state != state_FROM2) {
+ if (state != MM_CAMCORDER_STATE_PREPARE && state != MM_CAMCORDER_STATE_PAUSED) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
hcamcorder->error_code = MM_ERROR_NONE;
/* check mic policy from DPM */
- if (hcamcorder->dpm_policy) {
- if (dpm_restriction_get_microphone_state(hcamcorder->dpm_policy, &dpm_mic_state) == DPM_ERROR_NONE) {
+ if (hcamcorder->dpm_handle) {
+ if (dpm_restriction_get_microphone_state(hcamcorder->dpm_handle, &dpm_mic_state) == DPM_ERROR_NONE) {
_mmcam_dbg_log("DPM mic state %d", dpm_mic_state);
if (dpm_mic_state == DPM_DISALLOWED) {
_mmcam_dbg_err("MIC DISALLOWED by DPM");
_mmcam_dbg_err("get DPM mic state failed, keep going...");
}
} else {
- _mmcam_dbg_warn("NULL dpm_policy");
+ _mmcam_dbg_warn("NULL dpm_handle");
}
ret = hcamcorder->command((MMHandleType)hcamcorder, _MMCamcorder_CMD_RECORD);
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_RECORDING);
+
+ if (state == MM_CAMCORDER_STATE_PREPARE)
+ device_state = RECORDER_DEVICE_STATE_NULL << 8 | RECORDER_DEVICE_STATE_RECORDING;
+ else
+ device_state = RECORDER_DEVICE_STATE_PAUSED << 8 | RECORDER_DEVICE_STATE_RECORDING;
+
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE)
+ device_state = RECORDER_TYPE_VIDEO << 16 | device_state;
+ else
+ device_state = RECORDER_TYPE_AUDIO << 16 | device_state;
+
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_RECORDER, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, device_state);
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM = MM_CAMCORDER_STATE_RECORDING;
- int state_TO = MM_CAMCORDER_STATE_PAUSED;
+ int device_state = 0;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM) {
+ if (state != MM_CAMCORDER_STATE_RECORDING) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
if (ret != MM_ERROR_NONE)
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_PAUSED);
+
+ device_state = RECORDER_DEVICE_STATE_RECORDING << 8 | RECORDER_DEVICE_STATE_PAUSED;
+
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE)
+ device_state = RECORDER_TYPE_VIDEO << 16 | device_state;
+ else
+ device_state = RECORDER_TYPE_AUDIO << 16 | device_state;
+
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_RECORDER, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, device_state);
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM1 = MM_CAMCORDER_STATE_RECORDING;
- int state_FROM2 = MM_CAMCORDER_STATE_PAUSED;
- int state_TO = MM_CAMCORDER_STATE_PREPARE;
+ int device_state = 0;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM1 && state != state_FROM2) {
+ if (state != MM_CAMCORDER_STATE_RECORDING && state != MM_CAMCORDER_STATE_PAUSED) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
if (ret != MM_ERROR_NONE)
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_PREPARE);
+
+ if (state == MM_CAMCORDER_STATE_RECORDING)
+ device_state = RECORDER_DEVICE_STATE_RECORDING << 8 | RECORDER_DEVICE_STATE_NULL;
+ else
+ device_state = RECORDER_DEVICE_STATE_PAUSED << 8 | RECORDER_DEVICE_STATE_NULL;
+
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE)
+ device_state = RECORDER_TYPE_VIDEO << 16 | device_state;
+ else
+ device_state = RECORDER_TYPE_AUDIO << 16 | device_state;
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_RECORDER, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, device_state);
+
+ _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
return MM_ERROR_NONE;
{
int ret = MM_ERROR_NONE;
int state = MM_CAMCORDER_STATE_NONE;
- int state_FROM1 = MM_CAMCORDER_STATE_RECORDING;
- int state_FROM2 = MM_CAMCORDER_STATE_PAUSED;
- int state_TO = MM_CAMCORDER_STATE_PREPARE;
+ int device_state = 0;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
}
state = _mmcamcorder_get_state(handle);
- if (state != state_FROM1 && state != state_FROM2) {
+ if (state != MM_CAMCORDER_STATE_RECORDING && state != MM_CAMCORDER_STATE_PAUSED) {
_mmcam_dbg_err("Wrong state(%d)", state);
ret = MM_ERROR_CAMCORDER_INVALID_STATE;
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
if (ret != MM_ERROR_NONE)
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- _mmcamcorder_set_state(handle, state_TO);
+ _mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_PREPARE);
+
+ if (state == MM_CAMCORDER_STATE_RECORDING)
+ device_state = RECORDER_DEVICE_STATE_RECORDING << 8 | RECORDER_DEVICE_STATE_NULL;
+ else
+ device_state = RECORDER_DEVICE_STATE_PAUSED << 8 | RECORDER_DEVICE_STATE_NULL;
+
+ if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE)
+ device_state = RECORDER_TYPE_VIDEO << 16 | device_state;
+ else
+ device_state = RECORDER_TYPE_AUDIO << 16 | device_state;
+
+ _mmcamcorder_emit_dbus_signal(hcamcorder->gdbus_conn, __MMCAMCORDER_DBUS_OBJECT,
+ __MMCAMCORDER_DBUS_INTERFACE_RECORDER, __MMCAMCORDER_DBUS_SIGNAL_STATE_CHANGED, device_state);
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
}
} else {
gboolean b_commiting = FALSE;
+ storage_state_e storage_state = STORAGE_STATE_UNMOUNTABLE;
if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) {
mmf_return_val_if_fail(sc->info_video, GST_BUS_PASS);
switch (err->code) {
case GST_RESOURCE_ERROR_WRITE:
- _mmcam_dbg_err("File write error");
- hcamcorder->error_code = MM_ERROR_FILE_WRITE;
+ storage_get_state(hcamcorder->storage_info.id, &storage_state);
+ if (storage_state == STORAGE_STATE_REMOVED ||
+ storage_state == STORAGE_STATE_UNMOUNTABLE) {
+ _mmcam_dbg_err("storage was removed! [storage state %d]", storage_state);
+ hcamcorder->error_code = MM_ERROR_OUT_OF_STORAGE;
+ } else {
+ _mmcam_dbg_err("File write error, storage state %d", storage_state);
+ hcamcorder->error_code = MM_ERROR_FILE_WRITE;
+ }
+
+ if (sc->ferror_send == FALSE) {
+ sc->ferror_send = TRUE;
+ } else {
+ _mmcam_dbg_err("error was already sent");
+ _MMCAMCORDER_UNLOCK(hcamcorder);
+ goto DROP_MESSAGE;
+ }
break;
case GST_RESOURCE_ERROR_NO_SPACE_LEFT:
_mmcam_dbg_err("No left space");
void _mmcamcorder_sound_focus_cb(int id, mm_sound_focus_type_e focus_type,
mm_sound_focus_state_e focus_state, const char *reason_for_change,
- const char *additional_info, void *user_data)
+ int option, const char *additional_info, void *user_data)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(user_data);
int current_state = MM_CAMCORDER_STATE_NONE;
}
-void _mmcamcorder_sound_focus_watch_cb(mm_sound_focus_type_e focus_type, mm_sound_focus_state_e focus_state,
+void _mmcamcorder_sound_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data)
+{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(user_data);
+
+ mmf_return_if_fail(hcamcorder);
+
+ _mmcam_dbg_log("sound signal %d - value %d", signal, value);
+
+ _MMCAMCORDER_LOCK_ASM(hcamcorder);
+
+ if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS && value == 1) {
+ _mmcam_dbg_log("watch cb id %d", hcamcorder->sound_focus_watch_id);
+
+ /* unregister watch callback */
+ if (hcamcorder->sound_focus_watch_id > 0) {
+ mm_sound_unset_focus_watch_callback(hcamcorder->sound_focus_watch_id);
+ _mmcam_dbg_log("unset watch cb done");
+ hcamcorder->sound_focus_watch_id = 0;
+ }
+ }
+
+ _MMCAMCORDER_UNLOCK_ASM(hcamcorder);
+
+ _mmcam_dbg_warn("done");
+
+ return;
+}
+
+
+void _mmcamcorder_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e focus_state,
const char *reason_for_change, const char *additional_info, void *user_data)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(user_data);
return;
}
- _mmcam_dbg_log("sound focus watch callback : focus state %d, reason %s",
- focus_state, reason_for_change ? reason_for_change : "N/A");
+ _mmcam_dbg_log("sound focus watch callback : id %d, focus state %d, reason %s",
+ id, 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.");