{0},
{0},
NULL,
+ },
+ {
+ MM_CAM_PID_FOR_SOUND_FOCUS,
+ "pid-for-sound-focus",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_pid_for_sound_focus,
+ },
+ {
+ MM_CAM_ROOT_DIRECTORY,
+ "root-directory",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
+ NULL,
}
};
if (sc->encode_element && sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst) {
_mmcam_dbg_log("new file location set.[%s] filesink %p", filename, sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst);
- MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", filename);
+ MMCAMCORDER_G_OBJECT_SET_POINTER(sc->encode_element[_MMCAMCORDER_ENCSINK_SINK].gst, "location", filename);
_mmcam_dbg_log("new file location set.(%s)", filename);
} else {
_mmcam_dbg_log("element is not created yet. [%s] will be set later...", filename);
} else if (!strcmp(videosink_name, "evasimagesink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
_mmcam_dbg_log("Commit : Set evas object [%p]", p_handle);
- MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle);
+ MMCAMCORDER_G_OBJECT_SET_POINTER(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle);
#ifdef HAVE_WAYLAND
} else if (!strcmp(videosink_name, "waylandsink")) {
MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)p_handle;
}
+bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, const mmf_value_t *value)
+{
+ bool bret = FALSE;
+ int pid_current = 0;
+ int pid_new = 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;
+ }
+
+ pid_new = value->value.i_val;
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_PID_FOR_SOUND_FOCUS, &pid_current,
+ NULL);
+
+ _mmcam_dbg_log("Commit : pid_for_sound_focus - pid new %dm current %d", pid_new, pid_current);
+
+ /* unregister sound focus before set new one */
+ if (pid_current > 0) {
+ if (hcamcorder->sound_focus_register) {
+ 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 (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;
+ } else {
+ _mmcam_dbg_log("_mm_session_util_read_information failed. skip sound focus function.");
+ hcamcorder->sound_focus_register = FALSE;
+ }
+
+ if (hcamcorder->sound_focus_register) {
+ 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,
+ pid_new,
+ "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;
+}
+
+
static bool
__mmcamcorder_attrs_is_supported(MMHandleType handle, int idx)
{