#define DPM_DISALLOWED 0
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
-#define __MMCAMCORDER_RESOURCE_WAIT_TIME 5
+#define __MMCAMCORDER_RESOURCE_WAIT_TIME 3
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
g_mutex_init(&(hcamcorder->mtsafe).vcapture_cb_lock);
g_mutex_init(&(hcamcorder->mtsafe).vstream_cb_lock);
g_mutex_init(&(hcamcorder->mtsafe).astream_cb_lock);
+ g_mutex_init(&(hcamcorder->mtsafe).mstream_cb_lock);
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
g_cond_init(&(hcamcorder->mtsafe).resource_cond);
g_mutex_init(&(hcamcorder->mtsafe).resource_lock);
if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
/* init for gdbus */
+ hcamcorder->gdbus_info_sound.mm_handle = hcamcorder;
g_mutex_init(&hcamcorder->gdbus_info_sound.sync_mutex);
g_cond_init(&hcamcorder->gdbus_info_sound.sync_cond);
+
+ hcamcorder->gdbus_info_solo_sound.mm_handle = hcamcorder;
g_mutex_init(&hcamcorder->gdbus_info_solo_sound.sync_mutex);
g_cond_init(&hcamcorder->gdbus_info_solo_sound.sync_cond);
}
goto _ERR_DEFAULT_VALUE_INIT;
}
- /* 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;
- }
-
/* get DPM handle for camera/microphone restriction */
hcamcorder->dpm_handle = dpm_manager_create();
_mmcam_dbg_log("DPM camera changed cb id %d", hcamcorder->dpm_camera_cb_id);
}
+
+#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+ /* initialize resource manager */
+ ret = _mmcamcorder_resource_manager_init(&hcamcorder->resource_manager, (void *)hcamcorder);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("failed to initialize resource manager");
+ ret = MM_ERROR_CAMCORDER_INTERNAL;
+ goto _ERR_DEFAULT_VALUE_INIT;
+ }
+#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
} else {
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
}
}
-#ifdef _MMCAMCORDER_MURPHY_SUPPORT
- /* initialize resource manager */
- ret = _mmcamcorder_resource_manager_init(&hcamcorder->resource_manager, (void *)hcamcorder);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("failed to initialize resource manager");
- ret = MM_ERROR_CAMCORDER_INTERNAL;
- goto _ERR_DEFAULT_VALUE_INIT;
- }
-#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
-
traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:CREATE:INIT_GSTREAMER");
ret = __mmcamcorder_gstreamer_init(hcamcorder->conf_main);
}
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
- _MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
+ if (info->videodev_type != MM_VIDEO_DEVICE_NONE) {
+ _MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
- if (hcamcorder->resource_manager.is_connected == FALSE) {
- gint64 end_time = 0;
+ 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...");
+ /* wait for resource manager connected */
+ _mmcam_dbg_log("resource manager is not connected. wait for signal...");
- end_time = g_get_monotonic_time() + (__MMCAMCORDER_RESOURCE_WAIT_TIME * G_TIME_SPAN_SECOND);
+ end_time = g_get_monotonic_time() + (__MMCAMCORDER_RESOURCE_WAIT_TIME * G_TIME_SPAN_SECOND);
- if (_MMCAMCORDER_RESOURCE_WAIT_UNTIL(hcamcorder, end_time)) {
- _mmcam_dbg_warn("signal received");
- } else {
- _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
- _mmcam_dbg_err("timeout");
- ret = MM_ERROR_RESOURCE_INTERNAL;
- goto _ERR_DEFAULT_VALUE_INIT;
+ if (_MMCAMCORDER_RESOURCE_WAIT_UNTIL(hcamcorder, end_time)) {
+ _mmcam_dbg_warn("signal received");
+ } else {
+ _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
+ _mmcam_dbg_err("timeout");
+ ret = MM_ERROR_RESOURCE_INTERNAL;
+ goto _ERR_DEFAULT_VALUE_INIT;
+ }
}
- }
- _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
+ _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
+ }
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
/* Set initial state */
g_mutex_clear(&(hcamcorder->mtsafe).vcapture_cb_lock);
g_mutex_clear(&(hcamcorder->mtsafe).vstream_cb_lock);
g_mutex_clear(&(hcamcorder->mtsafe).astream_cb_lock);
+ g_mutex_clear(&(hcamcorder->mtsafe).mstream_cb_lock);
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
g_cond_clear(&(hcamcorder->mtsafe).resource_cond);
g_mutex_clear(&(hcamcorder->mtsafe).resource_lock);
g_mutex_clear(&(hcamcorder->mtsafe).vcapture_cb_lock);
g_mutex_clear(&(hcamcorder->mtsafe).vstream_cb_lock);
g_mutex_clear(&(hcamcorder->mtsafe).astream_cb_lock);
+ g_mutex_clear(&(hcamcorder->mtsafe).mstream_cb_lock);
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
g_cond_clear(&(hcamcorder->mtsafe).resource_cond);
g_mutex_clear(&(hcamcorder->mtsafe).resource_lock);
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);
char *videosink_element_type = NULL;
const char *videosink_name = NULL;
char *socket_path = NULL;
- int socket_path_len;
+ int socket_path_len = 0;
+ int conn_size = 0;
#ifdef _MMCAMCORDER_RM_SUPPORT
int iret = RM_OK;
+ int preview_format = MM_PIXEL_FORMAT_NV12;
+ int qret = RM_OK;
+ int qret_avail = 0; /* 0: not available, 1: available */
+ rm_consumer_info rci;
+ int app_pid = 0;
+ int resource_count = 0;
#endif /* _MMCAMCORDER_RM_SUPPORT */
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
+ /* Get profile mode and gdbus connection */
mm_camcorder_get_attributes(handle, NULL,
MMCAM_MODE, &hcamcorder->type,
+ MMCAM_GDBUS_CONNECTION, &hcamcorder->gdbus_conn, &conn_size,
NULL);
- /* Get profile mode */
- _mmcam_dbg_log("Profile mode [%d]", hcamcorder->type);
+ if (!hcamcorder->gdbus_conn) {
+ _mmcam_dbg_err("gdbus connection NULL");
+ ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
+
+ _mmcam_dbg_log("Profile mode [%d], gdbus connection [%p]",
+ hcamcorder->type, hcamcorder->gdbus_conn);
mm_camcorder_get_attributes(handle, NULL,
MMCAM_DISPLAY_SURFACE, &display_surface_type,
_mmcam_dbg_log("no need to register sound focus");
}
-#ifdef _MMCAMCORDER_RM_SUPPORT
- int preview_format = MM_PIXEL_FORMAT_NV12;
- int qret = RM_OK;
- int qret_avail = 0; /* 0: not available, 1: available */
- rm_consumer_info rci;
- int app_pid = 0;
- int resource_count = 0;
-
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_PID_FOR_SOUND_FOCUS, &app_pid,
- NULL);
- rci.app_pid = app_pid;
- aul_app_get_appid_bypid(rci.app_pid, rci.app_id, sizeof(rci.app_id));
-
- /* RM register */
- if (hcamcorder->rm_handle == 0) {
- iret = rm_register((rm_resource_cb)_mmcamcorder_rm_callback, (void*)hcamcorder,
- &(hcamcorder->rm_handle), &rci);
- if (iret != RM_OK) {
- _mmcam_dbg_err("rm_register fail");
- ret = MM_ERROR_POLICY_BLOCKED;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
- }
-
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_FORMAT, &preview_format,
- NULL);
-
- if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO && preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
- resource_count = 0;
- memset(&hcamcorder->request_resources, 0x0, sizeof(rm_category_request_s));
- memset(&hcamcorder->returned_devices, 0x0, sizeof(rm_device_return_s));
- hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER;
- _mmcam_dbg_log("request video decoder resource - device category 0x%x", hcamcorder->request_resources.category_id[resource_count]);
-
- resource_count++;
- hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER;
- hcamcorder->request_resources.request_num = resource_count + 1;
- _mmcam_dbg_log("request scaler resource - device category 0x%x", hcamcorder->request_resources.category_id[resource_count]);
-
- qret = rm_query(hcamcorder->rm_handle, RM_QUERY_ALLOCATION, &(hcamcorder->request_resources), &qret_avail);
-
- if (qret != RM_OK || qret_avail != 1) {
- _mmcam_dbg_log("Resource manager main device request fail");
-
- resource_count = 0;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER_SUB;
- _mmcam_dbg_log("request video decoder resource - device category 0x%x", hcamcorder->request_resources.category_id[resource_count]);
-
- resource_count++;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB;
- _mmcam_dbg_log("request scaler resource - device category 0x%x", hcamcorder->request_resources.category_id[resource_count]);
- }
-
- resource_count++;
- hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
- hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_CAMERA;
- hcamcorder->request_resources.request_num = resource_count + 1;
- _mmcam_dbg_log("request camera resource - device category 0x%x", hcamcorder->request_resources.category_id[resource_count]);
-
- iret = rm_allocate_resources(hcamcorder->rm_handle, &(hcamcorder->request_resources), &hcamcorder->returned_devices);
- if (iret != RM_OK) {
- _mmcam_dbg_err("Resource allocation request failed");
- ret = MM_ERROR_POLICY_BLOCKED;
- goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
- }
- }
-#endif /* _MMCAMCORDER_RM_SUPPORT */
-
/* alloc sub context */
hcamcorder->sub_context = _mmcamcorder_alloc_subcontext(hcamcorder->type);
if (!hcamcorder->sub_context) {
ret = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
- goto _ERR_CAMCORDER_CMD;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
/* Set basic configure information */
CONFIGURE_CATEGORY_MAIN_RECORD,
"SupportDualStream",
&(hcamcorder->sub_context->info_video->support_dual_stream));
+
_mmcam_dbg_warn("SupportDualStream [%d]", hcamcorder->sub_context->info_video->support_dual_stream);
}
if (dpm_camera_state == DPM_DISALLOWED) {
_mmcam_dbg_err("CAMERA DISALLOWED by DPM");
ret = MM_ERROR_POLICY_RESTRICTED;
+
+ _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "camera");
+
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
} else {
} else {
_mmcam_dbg_warn("NULL dpm_handle");
}
+
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
ret = _mmcamcorder_resource_create_resource_set(&hcamcorder->resource_manager);
if (ret != MM_ERROR_NONE) {
}
/* prepare resource manager for "video_overlay only if display surface is X" */
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_DISPLAY_SURFACE, &display_surface_type,
- NULL);
-
if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
ret = _mmcamcorder_resource_manager_prepare(&hcamcorder->resource_manager, MM_CAMCORDER_RESOURCE_TYPE_VIDEO_OVERLAY);
if (ret != MM_ERROR_NONE) {
/* acquire resources */
_MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
- if (hcamcorder->resource_manager.rset && _mmcamcorder_resource_manager_acquire(&hcamcorder->resource_manager)) {
+ ret = _mmcamcorder_resource_manager_acquire(&hcamcorder->resource_manager);
+ if (ret != MM_ERROR_NONE) {
_MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
_mmcam_dbg_err("could not acquire resources");
_MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
+
+#ifdef _MMCAMCORDER_RM_SUPPORT
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_PID_FOR_SOUND_FOCUS, &app_pid,
+ NULL);
+ rci.app_pid = app_pid;
+ aul_app_get_appid_bypid(rci.app_pid, rci.app_id, sizeof(rci.app_id));
+
+ /* RM register */
+ if (hcamcorder->rm_handle == 0) {
+ iret = rm_register((rm_resource_cb)_mmcamcorder_rm_callback, (void*)hcamcorder, &(hcamcorder->rm_handle), &rci);
+ if (iret != RM_OK) {
+ _mmcam_dbg_err("rm_register fail");
+ ret = MM_ERROR_POLICY_BLOCKED;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
+ }
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_FORMAT, &preview_format,
+ NULL);
+
+ resource_count = 0;
+ memset(&hcamcorder->request_resources, 0x0, sizeof(rm_category_request_s));
+ memset(&hcamcorder->returned_devices, 0x0, sizeof(rm_device_return_s));
+
+ if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER;
+
+ _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER);
+
+ resource_count++;
+ }
+
+ if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
+ hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER;
+
+ _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER);
+
+ resource_count++;
+ }
+
+ hcamcorder->request_resources.request_num = resource_count;
+
+ if (resource_count > 0) {
+ qret = rm_query(hcamcorder->rm_handle, RM_QUERY_ALLOCATION, &(hcamcorder->request_resources), &qret_avail);
+ if (qret != RM_OK || qret_avail != 1) {
+ _mmcam_dbg_log("rm query failed. retry with sub devices");
+
+ resource_count = 0;
+
+ if (preview_format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_VIDEO_DECODER_SUB;
+ _mmcam_dbg_log("request dec rsc - category 0x%x", RM_CATEGORY_VIDEO_DECODER_SUB);
+ resource_count++;
+ }
+
+ if (display_surface_type == MM_DISPLAY_SURFACE_OVERLAY) {
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_SCALER_SUB;
+ _mmcam_dbg_log("request scaler rsc - category 0x%x", RM_CATEGORY_SCALER_SUB);
+ resource_count++;
+ }
+ }
+ }
+
+ hcamcorder->request_resources.state[resource_count] = RM_STATE_EXCLUSIVE;
+ hcamcorder->request_resources.category_id[resource_count] = RM_CATEGORY_CAMERA;
+
+ hcamcorder->request_resources.request_num = resource_count + 1;
+ _mmcam_dbg_log("request camera rsc - category 0x%x", RM_CATEGORY_CAMERA);
+
+ iret = rm_allocate_resources(hcamcorder->rm_handle, &(hcamcorder->request_resources), &hcamcorder->returned_devices);
+ if (iret != RM_OK) {
+ _mmcam_dbg_err("Resource allocation request failed");
+ ret = MM_ERROR_POLICY_BLOCKED;
+ goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
+ }
+#endif /* _MMCAMCORDER_RM_SUPPORT */
}
/* create pipeline */
}
}
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
-
-_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
- _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
-
- 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) {
- mm_sound_release_focus(hcamcorder->sound_focus_id, 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) {
if (iret != RM_OK)
_mmcam_dbg_err("Resource deallocation request failed ");
}
+
/* unregister RM */
int ires = rm_unregister(hcamcorder->rm_handle);
if (ires != RM_OK)
}
#endif /* _MMCAMCORDER_RM_SUPPORT*/
+_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
+ _MMCAMCORDER_UNLOCK_CMD(hcamcorder);
+
+ 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) {
+ mm_sound_release_focus(hcamcorder->sound_focus_id, hcamcorder->acquired_focus, NULL);
+ _mmcam_dbg_warn("release sound focus [focus %d] done", hcamcorder->acquired_focus);
+ hcamcorder->acquired_focus = 0;
+ }
+
_ERR_CAMCORDER_CMD_PRECON:
_mmcam_dbg_err("Realize fail (type %d, state %d, ret %x)", hcamcorder->type, state, ret);
_mmcamcorder_set_state(handle, MM_CAMCORDER_STATE_PREPARE);
+ /* set attributes related sensor - after start preview */
+ if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO)
+ _mmcamcorder_set_attribute_to_camsensor2(handle);
+
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
return MM_ERROR_NONE;
_ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK:
- if (hcamcorder->gdbus_conn) {
- 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);
- }
-
_MMCAMCORDER_UNLOCK_CMD(hcamcorder);
_ERR_CAMCORDER_CMD_PRECON:
if (dpm_mic_state == DPM_DISALLOWED) {
_mmcam_dbg_err("MIC DISALLOWED by DPM");
ret = MM_ERROR_COMMON_INVALID_PERMISSION;
+
+ _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "microphone");
+
goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK;
}
} else {
}
+int _mmcamcorder_set_muxed_stream_callback(MMHandleType handle, mm_camcorder_muxed_stream_callback callback, void *user_data)
+{
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ _mmcam_dbg_log("");
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ if (callback == NULL)
+ _mmcam_dbg_warn("Muxed Stream Callback is disabled, because application sets it to NULL");
+
+ if (!_MMCAMCORDER_TRYLOCK_MSTREAM_CALLBACK(hcamcorder)) {
+ _mmcam_dbg_warn("Application's muxed stream callback is running now");
+ return MM_ERROR_CAMCORDER_INVALID_CONDITION;
+ }
+
+ hcamcorder->mstream_cb = callback;
+ hcamcorder->mstream_cb_param = user_data;
+
+ _MMCAMCORDER_UNLOCK_MSTREAM_CALLBACK(hcamcorder);
+
+ return MM_ERROR_NONE;
+}
+
+
int _mmcamcorder_set_video_capture_callback(MMHandleType handle, mm_camcorder_video_capture_callback callback, void *user_data)
{
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
pipeline = sc->element[_MMCAMCORDER_MAIN_PIPE].gst;
if (message->src == (GstObject*)pipeline) {
vnewstate = gst_structure_get_value(gst_message_get_structure(message), "new-state");
- newstate = (GstState)vnewstate->data[0].v_int;
- _mmcam_dbg_log("GST_MESSAGE_STATE_CHANGED[%s]", gst_element_state_get_name(newstate));
+ if (vnewstate) {
+ newstate = (GstState)vnewstate->data[0].v_int;
+ _mmcam_dbg_log("GST_MESSAGE_STATE_CHANGED[%s]", gst_element_state_get_name(newstate));
+ } else {
+ _mmcam_dbg_warn("get new state failed from msg");
+ }
}
}
}
_mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
}
- }
- goto DROP_MESSAGE;
+ goto DROP_MESSAGE;
+ }
}
if (err) {
return;
}
- _mmcam_dbg_log("sound focus callback : focus state %d, reason %s",
+ _mmcam_dbg_warn("sound focus callback : focus state %d, reason %s",
focus_state, reason_for_change ? reason_for_change : "N/A");
if (hcamcorder->session_flags & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
if (focus_state == FOCUS_IS_RELEASED) {
hcamcorder->acquired_focus &= ~focus_type;
- _mmcam_dbg_log("FOCUS is released [type %d, remained focus %d] : Stop pipeline[state:%d]",
+ _mmcam_dbg_warn("FOCUS is released [type %d, remained focus %d] : Stop pipeline[state:%d]",
focus_type, hcamcorder->acquired_focus, current_state);
__mmcamcorder_force_stop(hcamcorder);
- _mmcam_dbg_log("Finish opeartion. Pipeline is released");
+ _mmcam_dbg_warn("Finish opeartion. Pipeline is released");
} else if (focus_state == FOCUS_IS_ACQUIRED) {
_MMCamcorderMsgItem msg;
hcamcorder->acquired_focus |= focus_type;
- _mmcam_dbg_log("FOCUS is acquired [type %d, new focus %d]",
+ _mmcam_dbg_warn("FOCUS is acquired [type %d, new focus %d]",
focus_type, hcamcorder->acquired_focus);
msg.id = MM_MESSAGE_READY_TO_RESUME;
_mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
- _mmcam_dbg_log("Finish opeartion");
+ _mmcam_dbg_warn("Finish opeartion");
} else {
- _mmcam_dbg_log("unknown focus state %d", focus_state);
+ _mmcam_dbg_warn("unknown focus state %d", focus_state);
}
/* restore value */
_MMCAMCORDER_UNLOCK_ASM(hcamcorder);
+ _mmcam_dbg_warn("done");
+
return;
}
mmf_return_if_fail(hcamcorder);
- _mmcam_dbg_log("sound signal %d - value %d", signal, value);
+ _mmcam_dbg_warn("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);
+ _mmcam_dbg_warn("focus id %d, focus watch id %d",
+ hcamcorder->sound_focus_id, hcamcorder->sound_focus_watch_id);
+
+ /* unregister focus related callback */
+ if (hcamcorder->sound_focus_id > 0) {
+ if (hcamcorder->acquired_focus > 0) {
+ mm_sound_release_focus(hcamcorder->sound_focus_id, hcamcorder->acquired_focus, NULL);
+ _mmcam_dbg_warn("release acquired focus [focus %d] done", hcamcorder->acquired_focus);
+ hcamcorder->acquired_focus = 0;
+ }
+
+ mm_sound_unregister_focus(hcamcorder->sound_focus_id);
+ _mmcam_dbg_warn("unregister sound focus done");
+ hcamcorder->sound_focus_id = 0;
+ }
- /* 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");
+ _mmcam_dbg_warn("unset watch cb done");
hcamcorder->sound_focus_watch_id = 0;
}
}
+ /* reset flag not to run sound focus related code since now */
+ hcamcorder->sound_focus_register = FALSE;
+
_MMCAMCORDER_UNLOCK_ASM(hcamcorder);
_mmcam_dbg_warn("done");
return;
}
- _mmcam_dbg_log("sound focus watch callback : id %d, focus state %d, reason %s",
+ _mmcam_dbg_warn("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) {
if (focus_state == FOCUS_IS_RELEASED) {
_MMCamcorderMsgItem msg;
- _mmcam_dbg_log("other process's FOCUS is acquired");
+ _mmcam_dbg_warn("other process's FOCUS is released");
msg.id = MM_MESSAGE_READY_TO_RESUME;
_mmcamcorder_send_message((MMHandleType)hcamcorder, &msg);
- _mmcam_dbg_log("Finish opeartion");
+ _mmcam_dbg_warn("Finish opeartion");
} else if (focus_state == FOCUS_IS_ACQUIRED) {
- _mmcam_dbg_log("other process's FOCUS is released : Stop pipeline[state:%d]", current_state);
+ _mmcam_dbg_warn("other process's FOCUS is acquired : Stop pipeline[state:%d]", current_state);
__mmcamcorder_force_stop(hcamcorder);
- _mmcam_dbg_log("Finish opeartion. Pipeline is released");
+ _mmcam_dbg_warn("Finish opeartion. Pipeline is released");
} else {
- _mmcam_dbg_log("unknown focus state %d", focus_state);
+ _mmcam_dbg_warn("unknown focus state %d", focus_state);
}
/* restore value */
_MMCAMCORDER_UNLOCK_ASM(hcamcorder);
+ _mmcam_dbg_warn("done");
+
return;
}
hcamcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_NORMAL;
_MMCAMCORDER_UNLOCK_ASM(hcamcorder);
+
+ _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "camera");
}
_mmcam_dbg_warn("done");
_mmcam_dbg_warn("Stop recording.");
while ((itr_cnt--) && ((result = _mmcamcorder_commit((MMHandleType)hcamcorder)) != MM_ERROR_NONE)) {
- _mmcam_dbg_warn("Can't commit.(%x)", result);
+ _mmcam_dbg_warn("Can't commit.(%x), cancel it.", result);
+ _mmcamcorder_cancel((MMHandleType)hcamcorder);
}
break;
_MMCAMCORDER_UNLOCK_ASM(hcamcorder);
+ _mmcamcorder_request_dpm_popup(hcamcorder->gdbus_conn, "microphone");
+
return MM_ERROR_POLICY_RESTRICTED;
}
}