#define MMCAMCORDER_DEFAULT_CAMERA_HEIGHT 480
#define MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_BITRATE (1024*1024*10)
#define MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_GOP_INTERVAL 1000
+#define MMCAMCORDER_DEFAULT_REPLAY_GAIN_REFERENCE_LEVEL 89.0
/*---------------------------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS for internal |
static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, int height);
static int __mmcamcorder_set_conf_to_valid_info(MMHandleType handle);
static int __mmcamcorder_release_conf_valid_info(MMHandleType handle);
-static bool __mmcamcorder_attrs_is_supported(MMHandleType handle, int idx);
static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args);
/*=======================================================================
| GLOBAL FUNCTION DEFINITIONS: |
-----------------------------------------------------------------------*/
MMHandleType
-_mmcamcorder_alloc_attribute(MMHandleType handle, MMCamPreset *info)
+_mmcamcorder_alloc_attribute(MMHandleType handle)
{
_mmcam_dbg_log("");
"camera-device-name",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"audio-volume",
MMF_VALUE_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- {(void*)1},
+ {.value_double = 1.0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
{.double_min = 0.0},
{.double_max = 10.0},
"camera-recording-motion-rate",
MMF_VALUE_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- {(void*)1},
+ {.value_double = 1.0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
{.double_min = 0.0},
{.double_max = _MMCAMCORDER_MAX_DOUBLE},
"display-handle",
MMF_VALUE_TYPE_DATA,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"target-filename",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"tag-image-description",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"tag-software",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"tag-latitude",
MMF_VALUE_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- {(void*)0},
+ {.value_double = 0.0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
{.double_min = -360.0},
{.double_max = 360.0},
"tag-longitude",
MMF_VALUE_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- {(void*)0},
+ {.value_double = 0.0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
{.double_min = -360.0},
{.double_max = 360.0},
"tag-altitude",
MMF_VALUE_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- {(void*)0},
+ {.value_double = 0.0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
{.double_min = -999999.0},
{.double_max = 999999.0},
"camera-focal-length",
MMF_VALUE_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- {(void*)0},
+ {.value_double = 0.0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
{.double_min = 0.0},
{.double_max = 1000.0},
"tag-gps-time-stamp",
MMF_VALUE_TYPE_DOUBLE,
MM_ATTRS_FLAG_RW,
- {(void*)0},
+ {.value_double = 0.0},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"tag-gps-date-stamp",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"tag-gps-processing-method",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"captured-screennail",
MMF_VALUE_TYPE_DATA,
MM_ATTRS_FLAG_READABLE,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"captured-exif-raw-data",
MMF_VALUE_TYPE_DATA,
MM_ATTRS_FLAG_READABLE,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"display-evas-surface-sink",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_READABLE,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"display-socket-path",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
NULL,
},
{
- MM_CAM_PID_FOR_SOUND_FOCUS,
- "pid-for-sound-focus",
+ MM_CAM_CLIENT_PID,
+ "client-pid",
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,
+ NULL,
},
{
MM_CAM_ROOT_DIRECTORY,
"root-directory",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"sound-stream-type",
MMF_VALUE_TYPE_STRING,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"display-reuse-element",
MMF_VALUE_TYPE_DATA,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
"gdbus-connection",
MMF_VALUE_TYPE_DATA,
MM_ATTRS_FLAG_RW,
- {(void*)NULL},
+ {NULL},
MM_ATTRS_VALID_TYPE_NONE,
{0},
{0},
NULL,
+ },
+ {
+ MM_CAM_AUDIO_REPLAY_GAIN_ENABLE,
+ "audio-replay-gain-enable",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = 1},
+ _mmcamcorder_commit_audio_replay_gain,
+ },
+ {
+ MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL,
+ "audio-replay-gain-reference-level",
+ MMF_VALUE_TYPE_DOUBLE,
+ MM_ATTRS_FLAG_RW,
+ {.value_double = MMCAMCORDER_DEFAULT_REPLAY_GAIN_REFERENCE_LEVEL},
+ MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
+ {.double_min = 0.0},
+ {.double_max = 150.0},
+ _mmcamcorder_commit_audio_replay_gain,
}
};
__mmcamcorder_set_conf_to_valid_info(handle);
for (idx = 0; idx < attr_count; idx++) {
-/* _mmcam_dbg_log("Valid type [%s:%d, %d, %d]", cam_attrs_const_info[idx].name, cam_attrs_const_info[idx].validity_type
- , cam_attrs_const_info[idx].validity_value1, cam_attrs_const_info[idx].validity_value2);
+ mm_cam_attr_construct_info *attr_info = &hcamcorder->cam_attrs_const_info[idx];
+
+/*
+ _mmcam_dbg_log("Valid type [%s:%d, %d, %d]",
+ attr_info->name, attr_info->validity_type,
+ attr_info->validity_value1, attr_info->validity_value2);
*/
- mmf_attrs_set_valid_type(attrs, idx, hcamcorder->cam_attrs_const_info[idx].validity_type);
+ mmf_attrs_set_valid_type(attrs, idx, attr_info->validity_type);
- switch (hcamcorder->cam_attrs_const_info[idx].validity_type) {
+ switch (attr_info->validity_type) {
case MM_ATTRS_VALID_TYPE_INT_ARRAY:
- if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array &&
- hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
+ if (attr_info->validity_value_1.int_array &&
+ attr_info->validity_value_2.count > 0) {
mmf_attrs_set_valid_array(attrs, idx,
- (const int *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_array),
- hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
- hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
+ (const int *)(attr_info->validity_value_1.int_array),
+ attr_info->validity_value_2.count,
+ attr_info->default_value.value_int);
}
break;
case MM_ATTRS_VALID_TYPE_INT_RANGE:
mmf_attrs_set_valid_range(attrs, idx,
- hcamcorder->cam_attrs_const_info[idx].validity_value_1.int_min,
- hcamcorder->cam_attrs_const_info[idx].validity_value_2.int_max,
- hcamcorder->cam_attrs_const_info[idx].default_value.value_int);
+ attr_info->validity_value_1.int_min,
+ attr_info->validity_value_2.int_max,
+ attr_info->default_value.value_int);
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
- if (hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array &&
- hcamcorder->cam_attrs_const_info[idx].validity_value_2.count > 0) {
+ if (attr_info->validity_value_1.double_array &&
+ attr_info->validity_value_2.count > 0) {
mmf_attrs_set_valid_double_array(attrs, idx,
- (const double *)(hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_array),
- hcamcorder->cam_attrs_const_info[idx].validity_value_2.count,
- hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
+ (const double *)(attr_info->validity_value_1.double_array),
+ attr_info->validity_value_2.count,
+ attr_info->default_value.value_double);
}
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
mmf_attrs_set_valid_double_range(attrs, idx,
- hcamcorder->cam_attrs_const_info[idx].validity_value_1.double_min,
- hcamcorder->cam_attrs_const_info[idx].validity_value_2.double_max,
- hcamcorder->cam_attrs_const_info[idx].default_value.value_double);
+ attr_info->validity_value_1.double_min,
+ attr_info->validity_value_2.double_max,
+ attr_info->default_value.value_double);
+ ((mmf_attrs_t *)attrs)->items[idx].value.value.d_val = attr_info->default_value.value_double;
break;
case MM_ATTRS_VALID_TYPE_NONE:
break;
hcamcorder->cam_attrs_const_info = NULL;
_mmcam_dbg_log("released attribute info");
}
+
+ return;
}
{
MMHandleType attrs = 0;
int ret = MM_ERROR_NONE;
+ int err_index = 0;
+ char *tmp_err_attr_name = NULL;
mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
va_list var_args_copy;
mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
- /*mmf_return_val_if_fail(err_attr_name, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);*/
if (!_MMCAMCORDER_TRYLOCK_CMD(handle)) {
_mmcam_dbg_err("Another command is running.");
attrs = MMF_CAMCORDER_ATTRS(handle);
if (attrs) {
- ret = __mmcamcorder_check_valid_pair(handle, err_attr_name, attribute_name, var_args);
+ ret = __mmcamcorder_check_valid_pair(handle, &tmp_err_attr_name, attribute_name, var_args);
} else {
- _mmcam_dbg_err("handle 0x%x, attrs is NULL, attr name [%s]", handle, attribute_name);
+ _mmcam_dbg_err("handle %p, attrs is NULL, attr name [%s]", handle, attribute_name);
ret = MM_ERROR_CAMCORDER_NOT_INITIALIZED;
}
if (ret == MM_ERROR_NONE) {
hcamcorder->error_code = MM_ERROR_NONE;
/* In 64bit environment, unexpected result is returned if var_args is used again. */
- ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args_copy);
+ ret = mm_attrs_set_valist(attrs, &tmp_err_attr_name, attribute_name, var_args_copy);
}
va_end(var_args_copy);
_MMCAMCORDER_UNLOCK_CMD(handle);
if (ret != MM_ERROR_NONE) {
+ if (ret == MM_ERROR_COMMON_OUT_OF_RANGE) {
+ if (mm_attrs_get_index(attrs, tmp_err_attr_name, &err_index) == MM_ERROR_NONE &&
+ _mmcamcorder_check_supported_attribute(handle, err_index)) {
+ _mmcam_dbg_err("[%s] is supported, but value is invalid",
+ tmp_err_attr_name ? tmp_err_attr_name : "NULL");
+ ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
+ }
+ }
+
if (hcamcorder->error_code != MM_ERROR_NONE) {
- _mmcam_dbg_err("error_code is not NONE. origin 0x%x, modified 0x%x", ret, hcamcorder->error_code);
+ _mmcam_dbg_err("error_code is set. ret 0x%x -> modified 0x%x", ret, hcamcorder->error_code);
ret = hcamcorder->error_code;
hcamcorder->error_code = MM_ERROR_NONE;
}
_mmcam_dbg_err("failed error code 0x%x - handle %p", ret, (mmf_camcorder_t *)handle);
}
+ if (tmp_err_attr_name) {
+ if (!err_attr_name) {
+ _mmcam_dbg_err("set attribute[%s] error, but err name is NULL", tmp_err_attr_name);
+ free(tmp_err_attr_name);
+ tmp_err_attr_name = NULL;
+ } else {
+ *err_attr_name = tmp_err_attr_name;
+ }
+ }
+
return ret;
}
mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle);
for (i = 0 ; i < ARRAY_SIZE(attr_idxs) ; i++) {
- if (__mmcamcorder_attrs_is_supported((MMHandleType)attr, attr_idxs[i]))
+ if (_mmcamcorder_check_supported_attribute(handle, attr_idxs[i]))
mmf_attribute_set_modified(&(attr->items[attr_idxs[i]]));
}
}
_mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink")) {
- _mmcam_dbg_log("Commit : Set XID[%x]", *(int*)(p_handle));
- gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int*)(p_handle));
+ _mmcam_dbg_log("Commit : Set XID[%x]", *(int *)(p_handle));
+ gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int *)(p_handle));
} else if (!strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) {
_mmcam_dbg_log("Commit : Set evas object [%p]", p_handle);
MMCAMCORDER_G_OBJECT_SET_POINTER(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle);
- } else if (!strcmp(videosink_name, "waylandsink")) {
- MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)p_handle;
-
- _mmcam_dbg_log("wayland global surface id : %d", wl_info->global_surface_id);
-
- gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)wl_info->global_surface_id);
- gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
- wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height);
+ } else if (!strcmp(videosink_name, "tizenwlsink")) {
+ _mmcam_dbg_log("wayland global surface id : %d", *(int *)(p_handle));
+ gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)*(int *)(p_handle));
} else {
_mmcam_dbg_warn("Commit : Nothing to commit with this element[%s]", videosink_name);
return FALSE;
_mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) {
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink")) {
_mmcam_dbg_log("Commit : display mode [%d]", value->value.i_val);
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-mode", value->value.i_val);
} else {
return FALSE;
}
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
!strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink")) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "visible", value->value.i_val);
_mmcam_dbg_log("Set visible [%d] done.", value->value.i_val);
return FALSE;
}
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
!strcmp(videosink_name, "evaspixmapsink") || !strcmp(videosink_name, "evasimagesink")) {
method = value->value.i_val;
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method);
bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
int current_state = MM_CAMCORDER_STATE_NONE;
- int method = 0;
int ret = MM_ERROR_NONE;
const char *videosink_name = NULL;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- /* check current method */
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_DISPLAY_GEOMETRY_METHOD, &method,
- NULL);
- if (method != MM_DISPLAY_METHOD_CUSTOM_ROI) {
- _mmcam_dbg_log("current method[%d] is not supported rect", method);
- return FALSE;
- }
-
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
if (videosink_name == NULL) {
return FALSE;
}
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") ||
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
int rect_x = 0;
int rect_y = 0;
if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
_mmcam_dbg_log("RECT(x,y,w,h) = (%d,%d,%d,%d)", rect_x, rect_y, rect_width, rect_height);
- if (!strcmp(videosink_name, "waylandsink")) {
- ret = gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
+ if (!strcmp(videosink_name, "tizenwlsink")) {
+ ret = gst_video_overlay_set_display_roi_area(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst),
rect_x, rect_y, rect_width, rect_height);
if (!ret) {
- _mmcam_dbg_err("FAILED : could not set render rectangle.");
+ _mmcam_dbg_err("FAILED : could not set display roi area.");
return FALSE;
}
} else {
}
zoom = value->value.i_val;
- if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) {
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "tizenwlsink")) {
vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1));
}
-bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, const mmf_value_t *value)
-{
- int new_pid = 0;
- int ret = 0;
- int current_state = MM_CAMCORDER_STATE_NONE;
- mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
-
- mmf_return_val_if_fail(hcamcorder && value, FALSE);
-
- /* state check */
- current_state = _mmcamcorder_get_state(handle);
- if (current_state > MM_CAMCORDER_STATE_NULL) {
- _mmcam_dbg_log("invalid state %d", current_state);
- hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
- return FALSE;
- }
-
- new_pid = value->value.i_val;
-
- _mmcam_dbg_warn("Commit : pid %d, current focus id %d, subscribe id %u",
- new_pid, hcamcorder->sound_focus_id, hcamcorder->sound_focus_subscribe_id);
-
- /* unregister sound focus and unsubscribe sound signal before set new one */
- 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;
- }
-
- ret = _mm_session_util_read_information(new_pid, &hcamcorder->session_type, &hcamcorder->session_flags);
- if (ret == MM_ERROR_NONE) {
- if (hcamcorder->session_type == MM_SESSION_TYPE_REPLACED_BY_STREAM) {
- hcamcorder->sound_focus_register = FALSE;
- _mmcam_dbg_warn("no need to use sound focus internally");
- } else {
- ret = mm_sound_focus_get_id(&hcamcorder->sound_focus_id);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_focus_get_id failed");
- hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
- return FALSE;
- }
-
- ret = mm_sound_register_focus_for_session(hcamcorder->sound_focus_id,
- new_pid, "media", _mmcamcorder_sound_focus_cb, hcamcorder);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("mm_sound_register_focus_for_session failed 0x%x", ret);
- hcamcorder->sound_focus_id = 0;
- hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
- return FALSE;
- }
-
- hcamcorder->sound_focus_register = TRUE;
-
- _mmcam_dbg_log("mm_sound_register_focus_for_session done - id %d, session type %d, flags 0x%x",
- hcamcorder->sound_focus_id, hcamcorder->session_type, hcamcorder->session_flags);
- }
- } else {
- hcamcorder->session_type = 0;
- hcamcorder->session_flags = 0;
- hcamcorder->sound_focus_register = TRUE;
-
- _mmcam_dbg_warn("read session info failed. sound focus watch cb will be set.");
-
- ret = mm_sound_subscribe_signal_for_daemon(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS,
- new_pid, &hcamcorder->sound_focus_subscribe_id,
- (mm_sound_signal_callback)_mmcamcorder_sound_signal_callback, (void*)hcamcorder);
- if (ret != MM_ERROR_NONE) {
- _mmcam_dbg_err("subscribe sound signal failed [0x%x]", ret);
- hcamcorder->error_code = MM_ERROR_POLICY_BLOCKED;
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-
bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
int stream_index = 0;
return FALSE;
}
- /* unset watch callback if existed */
- _mmcamcorder_sound_signal_callback(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, 1, (void *)handle);
-
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
if (!sc || !sc->encode_element ||
!sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
return TRUE;
}
-
-static bool __mmcamcorder_attrs_is_supported(MMHandleType handle, int idx)
+bool _mmcamcorder_commit_audio_replay_gain(MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
- mmf_attrs_t *attr = (mmf_attrs_t*)handle;
- int flag;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ mmf_return_val_if_fail(hcamcorder && value, FALSE);
+
+ if (attr_idx == MM_CAM_AUDIO_REPLAY_GAIN_ENABLE) {
+ /* Replay gain enable */
+ int current_state = MM_CAMCORDER_STATE_NONE;
+ int audio_disable = FALSE;
- if (mm_attrs_get_flags(handle, idx, &flag) == MM_ERROR_NONE) {
- if (flag == MM_ATTRS_FLAG_NONE)
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state >= MM_CAMCORDER_STATE_RECORDING) {
+ _mmcam_dbg_err("Can not set replay gain enable [state : %d]", current_state);
+ hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
return FALSE;
- } else {
- return FALSE;
- }
+ }
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_AUDIO_DISABLE, &audio_disable,
+ NULL);
- if (attr->items[idx].value_spec.type == MM_ATTRS_VALID_TYPE_INT_RANGE) {
- int min, max;
- mm_attrs_get_valid_range((MMHandleType)attr, idx, &min, &max);
- if (max < min)
+ if (audio_disable) {
+ _mmcam_dbg_err("audio is disabled");
+ hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION;
return FALSE;
- } else if (attr->items[idx].value_spec.type == MM_ATTRS_VALID_TYPE_INT_ARRAY) {
- int count;
- int *array;
- mm_attrs_get_valid_array((MMHandleType)attr, idx, &count, &array);
- if (count == 0)
+ }
+
+ _mmcam_dbg_log("set replay gain enable : %d", value->value.i_val);
+ } else if (attr_idx == MM_CAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL) {
+ /* Replay gain reference level */
+ int replay_gain_enable = FALSE;
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_AUDIO_REPLAY_GAIN_ENABLE, &replay_gain_enable,
+ NULL);
+
+ if (replay_gain_enable == FALSE) {
+ _mmcam_dbg_err("replay gain is disabled");
+ hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_CONDITION;
return FALSE;
+ }
+
+ _mmcam_dbg_log("set reference level for replay gain : %lf dB", value->value.d_val);
+ } else {
+ _mmcam_dbg_err("unknown attribute id %d", attr_idx);
+ return FALSE;
}
return TRUE;
_mmcam_dbg_log("attribute count(%d)", attr->count);
for (i = 0 ; i < ARRAY_SIZE(attr_idxs_default) ; i++) {
- if (__mmcamcorder_attrs_is_supported((MMHandleType)attr, attr_idxs_default[i]))
+ if (_mmcamcorder_check_supported_attribute(handle, attr_idxs_default[i]))
mmf_attribute_set_modified(&(attr->items[attr_idxs_default[i]]));
}
/* Set extra if scene mode is NORMAL */
if (scene_mode == MM_CAMCORDER_SCENE_MODE_NORMAL) {
for (i = 0 ; i < ARRAY_SIZE(attr_idxs_extra) ; i++) {
- if (__mmcamcorder_attrs_is_supported((MMHandleType)attr, attr_idxs_extra[i]))
+ if (_mmcamcorder_check_supported_attribute(handle, attr_idxs_extra[i]))
mmf_attribute_set_modified(&(attr->items[attr_idxs_extra[i]]));
}
} else {
/* Set scene mode if scene mode is NOT NORMAL */
- if (__mmcamcorder_attrs_is_supported((MMHandleType)attr, MM_CAM_FILTER_SCENE_MODE))
+ if (_mmcamcorder_check_supported_attribute(handle, MM_CAM_FILTER_SCENE_MODE))
mmf_attribute_set_modified(&(attr->items[MM_CAM_FILTER_SCENE_MODE]));
}
_mmcam_dbg_log("attribute count(%d)", attr->count);
for (i = 0 ; i < ARRAY_SIZE(attr_idxs) ; i++) {
- if (__mmcamcorder_attrs_is_supported((MMHandleType)attr, attr_idxs[i]))
+ if (_mmcamcorder_check_supported_attribute(handle, attr_idxs[i]))
mmf_attribute_set_modified(&(attr->items[attr_idxs[i]]));
}
/*
_mmcam_dbg_log("int array count %d", info.int_array.count);
*/
- if (info.int_array.count <= 1)
+ if (info.int_array.count < 1)
return FALSE;
break;
case MM_ATTRS_VALID_TYPE_INT_RANGE:
/*
_mmcam_dbg_log("int range min %d, max %d",info.int_range.min, info.int_range.max);
*/
- if (info.int_range.min >= info.int_range.max)
+ if (info.int_range.min > info.int_range.max)
return FALSE;
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
/*
_mmcam_dbg_log("double array count %d", info.double_array.count);
*/
- if (info.double_array.count <= 1)
+ if (info.double_array.count < 1)
return FALSE;
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: