+bool _mmcamcorder_commit_encoded_preview_bitrate(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ int current_state = MM_CAMCORDER_STATE_NONE;
+ int preview_format = MM_PIXEL_FORMAT_NV12;
+
+ if ((void *)handle == NULL) {
+ _mmcam_dbg_warn("handle is NULL");
+ return FALSE;
+ }
+
+ _mmcam_dbg_log("Commit : encoded preview bitrate - %d", value->value.i_val);
+
+ /* check preview format */
+ mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FORMAT, &preview_format, NULL);
+ if (preview_format != MM_PIXEL_FORMAT_ENCODED_H264) {
+ _mmcam_dbg_err("current preview format[%d] is not encoded format", preview_format);
+ return FALSE;
+ }
+
+ /* check state */
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state < MM_CAMCORDER_STATE_READY) {
+ _mmcam_dbg_log("will be applied when preview starts");
+ return TRUE;
+ }
+
+ return _mmcamcorder_set_encoded_preview_bitrate(handle, value->value.i_val);
+}
+
+
+bool _mmcamcorder_commit_encoded_preview_gop_interval(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ int current_state = MM_CAMCORDER_STATE_NONE;
+ int preview_format = MM_PIXEL_FORMAT_NV12;
+
+ if ((void *)handle == NULL) {
+ _mmcam_dbg_warn("handle is NULL");
+ return FALSE;
+ }
+
+ _mmcam_dbg_log("Commit : encoded preview I-frame interval - %d", value->value.i_val);
+
+ /* check preview format */
+ mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FORMAT, &preview_format, NULL);
+ if (preview_format != MM_PIXEL_FORMAT_ENCODED_H264) {
+ _mmcam_dbg_err("current preview format[%d] is not encoded format", preview_format);
+ return FALSE;
+ }
+
+ /* check state */
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state < MM_CAMCORDER_STATE_READY) {
+ _mmcam_dbg_log("will be applied when preview starts");
+ return TRUE;
+ }
+
+ return _mmcamcorder_set_encoded_preview_gop_interval(handle, value->value.i_val);
+}
+
+
+bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ int new_pid = 0;
+ int current_state = MM_CAMCORDER_STATE_NONE;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_warn("handle is NULL");
+ return FALSE;
+ }
+
+ /* state check */
+ current_state = _mmcamcorder_get_state( handle);
+ if (current_state > MM_CAMCORDER_STATE_NULL) {
+ _mmcam_dbg_log("invalid state %d", current_state);
+ return FALSE;
+ }
+
+ new_pid = value->value.i_val;
+
+ _mmcam_dbg_log("Commit : pid %d, current sound_focus_register %d, sound_focus_id %d",
+ new_pid, hcamcorder->sound_focus_register, hcamcorder->sound_focus_id);
+
+ /* unregister sound focus before set new one */
+ 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_log("no need to unregister sound focus");
+ }
+
+ /* register sound focus */
+ if (hcamcorder->sound_focus_register) {
+ hcamcorder->sound_focus_id = 0;
+ if (MM_ERROR_NONE != mm_sound_focus_get_id(&hcamcorder->sound_focus_id)) {
+ _mmcam_dbg_err("mm_sound_focus_get_uniq failed");
+ hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
+ return FALSE;
+ }
+
+ if (MM_ERROR_NONE != mm_sound_register_focus_for_session(hcamcorder->sound_focus_id,
+ new_pid,
+ "media",
+ _mmcamcorder_sound_focus_cb,
+ hcamcorder)) {
+ _mmcam_dbg_err("mm_sound_register_focus failed");
+ hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
+ return FALSE;
+ }
+
+ _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("no need to register sound focus");
+ }
+
+ return TRUE;
+}
+
+