X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmm_camcorder_attribute.c;h=4a10fb8db1dc0ec400e21f6da3b18c0bc1f9b71c;hb=refs%2Ftags%2Faccepted%2Ftizen%2Fivi%2F20160606.121123;hp=2e001fffdc5639f0be59ba16f2edcc92a8a83bf4;hpb=ff2cc16f25619abaf7b0523bda7a93641dbbca19;p=platform%2Fcore%2Fmultimedia%2Flibmm-camcorder.git diff --git a/src/mm_camcorder_attribute.c b/src/mm_camcorder_attribute.c index 2e001ff..4a10fb8 100644 --- a/src/mm_camcorder_attribute.c +++ b/src/mm_camcorder_attribute.c @@ -698,7 +698,7 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) "display-surface", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - {(void*)MM_DISPLAY_SURFACE_X}, + {(void*)MM_DISPLAY_SURFACE_OVERLAY}, MM_ATTRS_VALID_TYPE_INT_ARRAY, {0}, {0}, @@ -733,7 +733,7 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) MM_ATTRS_FLAG_RW, {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, - {.int_min = 0}, + {.int_min = 1}, {.int_max = _MMCAMCORDER_MAX_INT}, _mmcamcorder_commit_display_rect, }, @@ -744,7 +744,7 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) MM_ATTRS_FLAG_RW, {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, - {.int_min = 0}, + {.int_min = 1}, {.int_max = _MMCAMCORDER_MAX_INT}, _mmcamcorder_commit_display_rect, }, @@ -1359,6 +1359,61 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) }, //110 { + MM_CAM_CAMERA_PAN_MECHA, + "camera-pan-mecha", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + {.int_min = 0}, + {.int_max = -1}, + _mmcamcorder_commit_camera_pan, + }, + { + MM_CAM_CAMERA_PAN_ELEC, + "camera-pan-elec", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + {.int_min = 0}, + {.int_max = -1}, + _mmcamcorder_commit_camera_pan, + }, + { + MM_CAM_CAMERA_TILT_MECHA, + "camera-tilt-mecha", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + {.int_min = 0}, + {.int_max = -1}, + _mmcamcorder_commit_camera_tilt, + }, + { + MM_CAM_CAMERA_TILT_ELEC, + "camera-tilt-elec", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + {.int_min = 0}, + {.int_max = -1}, + _mmcamcorder_commit_camera_tilt, + }, + { + MM_CAM_CAMERA_PTZ_TYPE, + "camera-ptz-type", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_ARRAY, + {0}, + {0}, + _mmcamcorder_commit_camera_ptz_type, + }, + { MM_CAM_VIDEO_WIDTH, "video-width", MMF_VALUE_TYPE_INT, @@ -1420,8 +1475,8 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) MM_ATTRS_FLAG_RW, {(void*)MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_BITRATE}, MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - _MMCAMCORDER_MAX_INT, + {.int_min = 0}, + {.int_max = _MMCAMCORDER_MAX_INT}, _mmcamcorder_commit_encoded_preview_bitrate, }, { @@ -1431,10 +1486,11 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) MM_ATTRS_FLAG_RW, {(void*)MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_GOP_INTERVAL}, MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - _MMCAMCORDER_MAX_INT, + {.int_min = 0}, + {.int_max = _MMCAMCORDER_MAX_INT}, _mmcamcorder_commit_encoded_preview_gop_interval, }, + //120 { MM_CAM_RECORDER_TAG_ENABLE, "recorder-tag-enable", @@ -1468,7 +1524,6 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) {.int_max = _MMCAMCORDER_MAX_INT}, _mmcamcorder_commit_pid_for_sound_focus, }, - //120 { MM_CAM_ROOT_DIRECTORY, "root-directory", @@ -1479,6 +1534,28 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) {0}, {0}, NULL, + }, + { + MM_CAM_SOUND_STREAM_TYPE, + "sound-stream-type", + MMF_VALUE_TYPE_STRING, + MM_ATTRS_FLAG_RW, + {(void*)NULL}, + MM_ATTRS_VALID_TYPE_NONE, + {0}, + {0}, + NULL, + }, + { + MM_CAM_SOUND_STREAM_INDEX, + "sound-stream-index", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)-1}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + {.int_min = -1}, + {.int_max = _MMCAMCORDER_MAX_INT}, + _mmcamcorder_commit_sound_stream_info, } }; @@ -2137,7 +2214,7 @@ bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const m hcamcorder->resolution_changed = FALSE; - if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) { + if (g_mutex_trylock(&hcamcorder->restart_preview_lock)) { _mmcam_dbg_log("restart preview"); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", TRUE); @@ -2145,6 +2222,13 @@ bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const m _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY); + /* check decoder recreation */ + if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { + _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + g_mutex_unlock(&hcamcorder->restart_preview_lock); + return FALSE; + } + /* get preview format */ sc->info_image->preview_format = preview_format; sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format); @@ -2156,7 +2240,7 @@ bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const m _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING); /* unlock */ - pthread_mutex_unlock(&(hcamcorder->restart_preview_lock)); + g_mutex_unlock(&hcamcorder->restart_preview_lock); } else { _mmcam_dbg_err("currently locked for preview restart"); return FALSE; @@ -2225,7 +2309,7 @@ bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const hcamcorder->resolution_changed = FALSE; - if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) { + if (g_mutex_trylock(&hcamcorder->restart_preview_lock)) { _mmcam_dbg_log("restart preview"); _mmcam_dbg_log("set empty buffers"); @@ -2235,6 +2319,13 @@ bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY); + /* check decoder recreation */ + if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { + _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + g_mutex_unlock(&hcamcorder->restart_preview_lock); + return FALSE; + } + /* get preview format */ sc->info_image->preview_format = preview_format; sc->fourcc = _mmcamcorder_get_fourcc(sc->info_image->preview_format, codec_type, hcamcorder->use_zero_copy_format); @@ -2247,7 +2338,7 @@ bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_PLAYING); /* unlock */ - pthread_mutex_unlock(&(hcamcorder->restart_preview_lock)); + g_mutex_unlock(&hcamcorder->restart_preview_lock); } else { _mmcam_dbg_err("currently locked for preview restart"); return FALSE; @@ -2342,6 +2433,195 @@ bool _mmcamcorder_commit_camera_zoom (MMHandleType handle, int attr_idx, const m } +bool _mmcamcorder_commit_camera_ptz_type(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + _MMCamcorderSubContext *sc = NULL; + int current_state = MM_CAMCORDER_STATE_NONE; + + GstCameraControl *CameraControl = NULL; + GstCameraControlChannel *CameraControlChannel = NULL; + const GList *controls = NULL; + const GList *item = NULL; + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + + _mmcam_dbg_log("ptz type : %d", value->value.i_val); + + current_state = _mmcamcorder_get_state(handle); + if (current_state < MM_CAMCORDER_STATE_PREPARE || + current_state == MM_CAMCORDER_STATE_CAPTURING) { + _mmcam_dbg_err("invalid state[%d]", current_state); + return FALSE; + } + + if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { + if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { + _mmcam_dbg_log("Can't cast Video source into camera control."); + return FALSE; + } + + CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); + if (CameraControl == NULL) { + _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + return FALSE; + } + + controls = gst_camera_control_list_channels(CameraControl); + if (controls == NULL) { + _mmcam_dbg_err("gst_camera_control_list_channels failed"); + return FALSE; + } + + for (item = controls ; item && item->data ; item = item->next) { + CameraControlChannel = item->data; + _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label); + if (!strcmp(CameraControlChannel->label, "ptz")) { + if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) { + _mmcam_dbg_warn("set ptz type %d done", value->value.i_val); + return TRUE; + } else { + _mmcam_dbg_err("failed to set ptz type %d", value->value.i_val); + return FALSE; + } + } + } + + if (item == NULL) { + _mmcam_dbg_warn("failed to find tilt control channel"); + } + } + + return FALSE; +} + + +bool _mmcamcorder_commit_camera_pan(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + _MMCamcorderSubContext *sc = NULL; + int current_state = MM_CAMCORDER_STATE_NONE; + + GstCameraControl *CameraControl = NULL; + GstCameraControlChannel *CameraControlChannel = NULL; + const GList *controls = NULL; + const GList *item = NULL; + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + + _mmcam_dbg_log("pan : %d", value->value.i_val); + + current_state = _mmcamcorder_get_state(handle); + if (current_state < MM_CAMCORDER_STATE_PREPARE || + current_state == MM_CAMCORDER_STATE_CAPTURING) { + _mmcam_dbg_err("invalid state[%d]", current_state); + return FALSE; + } + + if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { + if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { + _mmcam_dbg_log("Can't cast Video source into camera control."); + return FALSE; + } + + CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); + if (CameraControl == NULL) { + _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + return FALSE; + } + + controls = gst_camera_control_list_channels(CameraControl); + if (controls == NULL) { + _mmcam_dbg_err("gst_camera_control_list_channels failed"); + return FALSE; + } + + for (item = controls ; item && item->data ; item = item->next) { + CameraControlChannel = item->data; + _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label); + if (!strcmp(CameraControlChannel->label, "pan")) { + if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) { + _mmcam_dbg_warn("set pan %d done", value->value.i_val); + return TRUE; + } else { + _mmcam_dbg_err("failed to set pan %d", value->value.i_val); + return FALSE; + } + } + } + + if (item == NULL) { + _mmcam_dbg_warn("failed to find pan control channel"); + } + } + + return FALSE; +} + + +bool _mmcamcorder_commit_camera_tilt(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + _MMCamcorderSubContext *sc = NULL; + int current_state = MM_CAMCORDER_STATE_NONE; + + GstCameraControl *CameraControl = NULL; + GstCameraControlChannel *CameraControlChannel = NULL; + const GList *controls = NULL; + const GList *item = NULL; + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + + _mmcam_dbg_log("tilt : %d", value->value.i_val); + + current_state = _mmcamcorder_get_state(handle); + if (current_state < MM_CAMCORDER_STATE_PREPARE || + current_state == MM_CAMCORDER_STATE_CAPTURING) { + _mmcam_dbg_err("invalid state[%d]", current_state); + return FALSE; + } + + if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { + if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { + _mmcam_dbg_log("Can't cast Video source into camera control."); + return FALSE; + } + + CameraControl = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); + if (CameraControl == NULL) { + _mmcam_dbg_err("cast CAMERA_CONTROL failed"); + return FALSE; + } + + controls = gst_camera_control_list_channels(CameraControl); + if (controls == NULL) { + _mmcam_dbg_err("gst_camera_control_list_channels failed"); + return FALSE; + } + + for (item = controls ; item && item->data ; item = item->next) { + CameraControlChannel = item->data; + _mmcam_dbg_log("CameraControlChannel->label %s", CameraControlChannel->label); + if (!strcmp(CameraControlChannel->label, "tilt")) { + if (gst_camera_control_set_value(CameraControl, CameraControlChannel, value->value.i_val)) { + _mmcam_dbg_warn("set tilt %d done", value->value.i_val); + return TRUE; + } else { + _mmcam_dbg_err("failed to set tilt %d", value->value.i_val); + return FALSE; + } + } + } + + if (item == NULL) { + _mmcam_dbg_warn("failed to find tilt control channel"); + } + } + + return FALSE; +} + + bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, const mmf_value_t *value) { MMHandleType attr = 0; @@ -2955,11 +3235,8 @@ bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, cons } if (sc->info_video) { - if (sc->info_video->filename) { - free(sc->info_video->filename); - sc->info_video->filename = NULL; - } - sc->info_video->filename = strdup(filename); + SAFE_G_FREE(sc->info_video->filename); + sc->info_video->filename = g_strdup(filename); if (sc->info_video->filename == NULL) { _mmcam_dbg_err("failed to strdup filename [%s]", filename); return FALSE; @@ -3268,21 +3545,12 @@ bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const #ifdef HAVE_WAYLAND } else if (!strcmp(videosink_name, "waylandsink")) { MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)p_handle; - GstContext *context = NULL; - context = gst_wayland_display_handle_context_new((struct wl_display *)wl_info->display); - if (context) { - gst_element_set_context(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, context); - } else { - _mmcam_dbg_warn("gst_wayland_display_handle_context_new failed"); - } + _mmcam_dbg_log("wayland global surface id : %d", wl_info->global_surface_id); - gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)wl_info->surface); + 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); + wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height); #endif /* HAVE_WAYLAND */ } else { _mmcam_dbg_warn("Commit : Nothing to commit with this element[%s]", videosink_name); @@ -3330,7 +3598,7 @@ bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const m _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name); - if (!strcmp(videosink_name, "xvimagesink")) { + if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) { _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); return TRUE; @@ -3362,7 +3630,7 @@ bool _mmcamcorder_commit_display_rotation(MMHandleType handle, int attr_idx, con return TRUE; } - return _mmcamcorder_set_display_rotation(handle, value->value.i_val); + return _mmcamcorder_set_display_rotation(handle, value->value.i_val, _MMCAMCORDER_VIDEOSINK_SINK); } @@ -3387,7 +3655,7 @@ bool _mmcamcorder_commit_display_flip(MMHandleType handle, int attr_idx, const m return TRUE; } - return _mmcamcorder_set_display_flip(handle, value->value.i_val); + return _mmcamcorder_set_display_flip(handle, value->value.i_val, _MMCAMCORDER_VIDEOSINK_SINK); } @@ -3423,8 +3691,8 @@ bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, cons return FALSE; } - if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "evasimagesink") || - !strcmp(videosink_name, "evaspixmapsink")) { + if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") || + !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 TRUE; @@ -3468,10 +3736,10 @@ bool _mmcamcorder_commit_display_geometry_method (MMHandleType handle, int attr_ return FALSE; } - if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "evasimagesink") || - !strcmp(videosink_name, "evaspixmapsink")) { + if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") || + !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); + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method); return TRUE; } else { _mmcam_dbg_warn("videosink[%s] does not support geometry method.", videosink_name); @@ -3484,6 +3752,7 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m { int current_state = MM_CAMCORDER_STATE_NONE; int method = 0; + int ret = MM_ERROR_NONE; const char *videosink_name = NULL; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); @@ -3522,7 +3791,7 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m return FALSE; } - if (!strcmp(videosink_name, "xvimagesink") || + if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink") || !strcmp(videosink_name, "evaspixmapsink")) { int rect_x = 0; int rect_y = 0; @@ -3574,14 +3843,23 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m } 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); - g_object_set(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, - "dst-roi-x", rect_x, - "dst-roi-y", rect_y, - "dst-roi-w", rect_width, - "dst-roi-h", rect_height, - NULL); + _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), + rect_x, rect_y, rect_width, rect_height); + if (!ret) { + _mmcam_dbg_err("FAILED : could not set render rectangle."); + return FALSE; + } + } else { + g_object_set(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, + "dst-roi-x", rect_x, + "dst-roi-y", rect_y, + "dst-roi-w", rect_width, + "dst-roi-h", rect_height, + NULL); + } } return TRUE; @@ -3627,7 +3905,7 @@ bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const } zoom = value->value.i_val; - if (!strcmp(videosink_name, "xvimagesink")) { + if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "waylandsink")) { vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst; MMCAMCORDER_G_OBJECT_SET(vs_element, "zoom", (float)(zoom + 1)); @@ -3694,7 +3972,6 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); int strobe_type, mslVal, newVal, cur_value; int current_state = MM_CAMCORDER_STATE_NONE; - int set_flash_state = -1; if (hcamcorder == NULL) { _mmcam_dbg_err("NULL handle"); @@ -3714,7 +3991,7 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va int flash_brightness = 0; /* get current flash brightness */ - if (_mmcamcorder_get_device_flash_brightness(&flash_brightness) != MM_ERROR_NONE) { + if (_mmcamcorder_get_device_flash_brightness(hcamcorder->gdbus_conn, &flash_brightness) != MM_ERROR_NONE) { _mmcam_dbg_err("_mmcamcorder_get_device_flash_brightness failed"); hcamcorder->error_code = MM_ERROR_COMMON_INVALID_PERMISSION; return FALSE; @@ -3729,14 +4006,7 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va _mmcam_dbg_err("other module already turned on flash. avoid to set flash mode here."); return FALSE; } else { - /* flash is OFF state, this case will set flash state key */ - if (mslVal == MM_CAMCORDER_STROBE_MODE_OFF) { - set_flash_state = VCONFKEY_CAMERA_FLASH_STATE_OFF; - } else { - set_flash_state = VCONFKEY_CAMERA_FLASH_STATE_ON; - } - - _mmcam_dbg_log("keep going, and will set flash state key %d", set_flash_state); + _mmcam_dbg_log("keep going"); } } @@ -3744,13 +4014,6 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); - - if (set_flash_state != -1) { - _mmcam_dbg_log("set VCONFKEY_CAMERA_FLASH_STATE : %d", set_flash_state); - vconf_set_int(VCONFKEY_CAMERA_FLASH_STATE, set_flash_state); - vconf_set_int(VCONFKEY_CAMERA_PID, (int)getpid()); - } - return TRUE; } else if (current_state == MM_CAMCORDER_STATE_CAPTURING) { _mmcam_dbg_warn("invalid state[capturing]"); @@ -3812,12 +4075,6 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va } } - if (bret == TRUE && set_flash_state != -1) { - _mmcam_dbg_log("set VCONFKEY_CAMERA_FLASH_STATE : %d", set_flash_state); - vconf_set_int(VCONFKEY_CAMERA_FLASH_STATE, set_flash_state); - vconf_set_int(VCONFKEY_CAMERA_PID, (int)getpid()); - } - return bret; } @@ -3899,6 +4156,12 @@ bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, c _mmcamcorder_gst_set_state(handle, sc->element[_MMCAMCORDER_MAIN_PIPE].gst, GST_STATE_READY); + /* check decoder recreation */ + if (!_mmcamcorder_recreate_decoder_for_encoded_preview(handle)) { + _mmcam_dbg_err("_mmcamcorder_recreate_decoder_for_encoded_preview failed"); + return FALSE; + } + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "empty-buffers", FALSE); } @@ -4137,6 +4400,39 @@ bool _mmcamcorder_commit_pid_for_sound_focus(MMHandleType handle, int attr_idx, } +bool _mmcamcorder_commit_sound_stream_info(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + char *stream_type = NULL; + int stream_type_len = 0; + _MMCamcorderSubContext *sc = NULL; + + if ((void *)handle == NULL) { + _mmcam_dbg_warn("handle is NULL"); + return FALSE; + } + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + if (!sc || !sc->encode_element || + !sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) { + _mmcam_dbg_log("audiosrc element is not initialized, it will be set later"); + return TRUE; + } + + mm_camcorder_get_attributes(handle, NULL, + MMCAM_SOUND_STREAM_TYPE, &stream_type, &stream_type_len, + NULL); + + if (stream_type == NULL) { + _mmcam_dbg_err("stream type is not set"); + return FALSE; + } + + _mmcam_dbg_log("Commit : sound stream info - type %s", stream_type); + + return _mmcamcorder_set_sound_stream_info(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst, stream_type, value->value.i_val); +} + + static bool __mmcamcorder_attrs_is_supported(MMHandleType handle, int idx) {