#include <gst/video/colorbalance.h>
#include <gst/video/cameracontrol.h>
#include <gst/video/videooverlay.h>
+#ifdef HAVE_WAYLAND
+#include <gst/wayland/wayland.h>
+#endif
/*-----------------------------------------------------------------------
| MACRO DEFINITIONS: |
-----------------------------------------------------------------------*/
#define MMCAMCORDER_DEFAULT_CAMERA_WIDTH 640
#define MMCAMCORDER_DEFAULT_CAMERA_HEIGHT 480
+#define MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_BITRATE (1024*1024*10)
+#define MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_GOP_INTERVAL 1000
/*---------------------------------------------------------------------------------------
| GLOBAL VARIABLE DEFINITIONS for internal |
MM_ATTRS_FLAG_RW, /* Flag */
{(void*)MM_CAMCORDER_MODE_VIDEO_CAPTURE}, /* Default value */
MM_ATTRS_VALID_TYPE_INT_RANGE, /* Validity type */
- {MM_CAMCORDER_MODE_VIDEO_CAPTURE}, /* Validity val1 (min, *array,...) */
- {MM_CAMCORDER_MODE_AUDIO}, /* Validity val2 (max, count, ...) */
+ {.int_min = MM_CAMCORDER_MODE_VIDEO_CAPTURE}, /* Validity val1 (min, *array,...) */
+ {.int_max = MM_CAMCORDER_MODE_AUDIO}, /* Validity val2 (max, count, ...) */
NULL, /* Runtime setting function of the attribute */
},
{
MMF_VALUE_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void*)MM_AUDIO_DEVICE_MIC},
- MM_ATTRS_VALID_TYPE_INT_RANGE,
+ MM_ATTRS_VALID_TYPE_INT_ARRAY,
+ {NULL},
{0},
- {MM_AUDIO_DEVICE_NUM-1},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_VIDEO_DEVICE_NUM},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_VIDEO_DEVICE_NONE},
- {MM_VIDEO_DEVICE_NUM},
+ {.int_min = MM_VIDEO_DEVICE_NONE},
+ {.int_max = MM_VIDEO_DEVICE_NUM},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)8000},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)2},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {1},
- {2},
+ {.int_min = 1},
+ {.int_max = 2},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)1},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- {0},
- {10.0},
+ {.double_min = 0.0},
+ {.double_max = 10.0},
_mmcamcorder_commit_audio_volume,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
- {MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY},
+ {.int_min = MM_AUDIOROUTE_USE_EXTERNAL_SETTING},
+ {.int_max = MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY},
_mmcamcorder_commit_audio_input_route,
},
{
MM_ATTRS_FLAG_RW,
{(void*)1},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_filter,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_filter,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_filter,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_filter,
},
//20
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_filter,
},
{
MM_ATTRS_FLAG_RW,
{(void*)1},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.double_min = 0.0},
+ {.double_max = _MMCAMCORDER_MAX_DOUBLE},
_mmcamcorder_commit_camera_recording_motion_rate,
},
{
MMF_VALUE_TYPE_INT,
MM_ATTRS_FLAG_RW,
{(void*)30},
- MM_ATTRS_VALID_TYPE_INT_ARRAY,
- {0},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
{0},
+ {1024},
_mmcamcorder_commit_camera_fps,
},
{
MM_ATTRS_FLAG_RW,
{(void*)10},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_camera_zoom,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_camera_zoom,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_camera_capture_mode,
},
{
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {1},
+ {.int_min = 0},
+ {.int_max = 1},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {1},
+ {.int_min = 0},
+ {.int_max = 1},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
// 40
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)95},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_image_encoder_quality,
},
{
MM_ATTRS_FLAG_RW,
{(void*)1},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_capture_count,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {1},
+ {.int_min = 0},
+ {.int_max = 1},
_mmcamcorder_commit_capture_break_cont_shot,
},
{
"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},
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_display_rect,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_display_rect,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_display_rect,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_display_rect,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_DISPLAY_ROTATION_NONE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_DISPLAY_ROTATION_NONE},
- {MM_DISPLAY_ROTATION_270},
+ {.int_min = MM_DISPLAY_ROTATION_NONE},
+ {.int_max = MM_DISPLAY_ROTATION_270},
_mmcamcorder_commit_display_rotation,
},
{ // 60
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_DISPLAY_SCALE_DEFAULT},
- {MM_DISPLAY_SCALE_TRIPLE_LENGTH},
+ {.int_min = MM_DISPLAY_SCALE_DEFAULT},
+ {.int_max = MM_DISPLAY_SCALE_TRIPLE_LENGTH},
_mmcamcorder_commit_display_scale,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_DISPLAY_METHOD_LETTER_BOX},
- {MM_DISPLAY_METHOD_CUSTOM_ROI},
+ {.int_min = MM_DISPLAY_METHOD_LETTER_BOX},
+ {.int_max = MM_DISPLAY_METHOD_CUSTOM_ROI},
_mmcamcorder_commit_display_geometry_method,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {1},
+ {.int_min = 0},
+ {.int_max = 1},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- {-360},
- {360},
+ {.double_min = -360.0},
+ {.double_max = 360.0},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- {-360},
- {360},
+ {.double_min = -360.0},
+ {.double_max = 360.0},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- {-999999},
- {999999},
+ {.double_min = -999999.0},
+ {.double_max = 999999.0},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_strobe,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_strobe,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_detect,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_detect,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {-1},
+ {.int_min = 0},
+ {.int_max = -1},
_mmcamcorder_commit_detect,
},
//80
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {1},
+ {.int_min = 0},
+ {.int_max = 1},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_camera_af_touch_area,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_camera_af_touch_area,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_camera_af_touch_area,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {_MMCAMCORDER_MAX_INT},
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
_mmcamcorder_commit_camera_af_touch_area,
},
{
MM_ATTRS_FLAG_RW,
{(void*)0},
MM_ATTRS_VALID_TYPE_DOUBLE_RANGE,
- {0},
- {1000},
+ {.double_min = 0.0},
+ {.double_max = 1000.0},
_mmcamcorder_commit_camera_capture_mode,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_PIXEL_FORMAT_YUYV},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_PIXEL_FORMAT_NV12},
- {(MM_PIXEL_FORMAT_NUM-1)},
+ {.int_min = MM_PIXEL_FORMAT_NV12},
+ {.int_max = (MM_PIXEL_FORMAT_NUM-1)},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_PIXEL_FORMAT_NV12},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_PIXEL_FORMAT_NV12},
- {(MM_PIXEL_FORMAT_NUM-1)},
+ {.int_min = MM_PIXEL_FORMAT_NV12},
+ {.int_max = (MM_PIXEL_FORMAT_NUM-1)},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {1},
+ {.int_min = 0},
+ {.int_max = 1},
NULL,
},
// 90
MM_ATTRS_FLAG_RW,
{(void*)TRUE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {0},
- {1},
+ {.int_min = 0},
+ {.int_max = 1},
_mmcamcorder_commit_capture_sound_enable,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_DISPLAY_ROTATION_270},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_DISPLAY_ROTATION_NONE},
- {MM_DISPLAY_ROTATION_270},
+ {.int_min = MM_DISPLAY_ROTATION_NONE},
+ {.int_max = MM_DISPLAY_ROTATION_270},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {FALSE},
- {TRUE},
+ {.int_min = FALSE},
+ {.int_max = TRUE},
_mmcamcorder_commit_audio_disable,
},
{
MM_ATTRS_FLAG_RW,
{(void*)TRUE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {FALSE},
- {TRUE},
+ {.int_min = FALSE},
+ {.int_max = TRUE},
_mmcamcorder_commit_display_evas_do_scaling,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
- {MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT},
+ {.int_min = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR},
+ {.int_max = MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_FLIP_NONE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_FLIP_NONE},
- {MM_FLIP_BOTH},
+ {.int_min = MM_FLIP_NONE},
+ {.int_max = MM_FLIP_BOTH},
_mmcamcorder_commit_display_flip,
},
{
MM_ATTRS_FLAG_RW,
{(void*)MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
- {MM_CAMCORDER_TAG_VIDEO_ORT_270},
+ {.int_min = MM_CAMCORDER_TAG_VIDEO_ORT_NONE},
+ {.int_max = MM_CAMCORDER_TAG_VIDEO_ORT_270},
NULL,
},
//110
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {FALSE},
- {TRUE},
+ {.int_min = FALSE},
+ {.int_max = TRUE},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {FALSE},
- {TRUE},
+ {.int_min = FALSE},
+ {.int_max = TRUE},
NULL,
},
{
MM_ATTRS_FLAG_RW,
{(void*)FALSE},
MM_ATTRS_VALID_TYPE_INT_RANGE,
- {FALSE},
- {TRUE},
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
+ },
+ {
+ MM_CAM_ENCODED_PREVIEW_BITRATE,
+ "encoded-preview-bitrate",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_BITRATE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_encoded_preview_bitrate,
+ },
+ {
+ MM_CAM_ENCODED_PREVIEW_GOP_INTERVAL,
+ "encoded-preview-gop-interval",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)MMCAMCORDER_DEFAULT_ENCODED_PREVIEW_GOP_INTERVAL},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = 0},
+ {.int_max = _MMCAMCORDER_MAX_INT},
+ _mmcamcorder_commit_encoded_preview_gop_interval,
+ },
+ {
+ MM_CAM_RECORDER_TAG_ENABLE,
+ "recorder-tag-enable",
+ MMF_VALUE_TYPE_INT,
+ MM_ATTRS_FLAG_RW,
+ {(void*)FALSE},
+ MM_ATTRS_VALID_TYPE_INT_RANGE,
+ {.int_min = FALSE},
+ {.int_max = TRUE},
+ NULL,
+ },
+ {
+ MM_CAM_DISPLAY_SOCKET_PATH,
+ "display-socket-path",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {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,
+ },
+ //120
+ {
+ MM_CAM_ROOT_DIRECTORY,
+ "root-directory",
+ MMF_VALUE_TYPE_STRING,
+ MM_ATTRS_FLAG_RW,
+ {(void*)NULL},
+ MM_ATTRS_VALID_TYPE_NONE,
+ {0},
+ {0},
NULL,
}
};
{
MMHandleType attrs = 0;
int ret = MM_ERROR_NONE;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
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 (ret == MM_ERROR_NONE) {
+ hcamcorder->error_code = MM_ERROR_NONE;
ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args);
}
_MMCAMCORDER_UNLOCK_CMD(handle);
if (ret != MM_ERROR_NONE) {
+ 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);
+ 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);
}
attr = MMF_CAMCORDER_ATTRS(handle);
mmf_return_val_if_fail(attr, FALSE);
- _mmcam_dbg_log("(%d)", attr_idx);
+ /*_mmcam_dbg_log("(%d)", attr_idx);*/
current_state = _mmcamcorder_get_state(handle);
if (current_state <= MM_CAMCORDER_STATE_PREPARE) {
return TRUE;
}
- control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst );
- gst_camera_control_set_capture_command( control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT );
-
- _mmcam_dbg_warn( "Commit Break continuous shot : Set command OK. current state[%d]", current_state );
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control) {
+ gst_camera_control_set_capture_command(control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT);
+ _mmcam_dbg_warn("Commit Break continuous shot : Set command OK. current state[%d]", current_state);
+ } else {
+ _mmcam_dbg_warn("cast CAMERA_CONTROL failed");
+ }
} else {
_mmcam_dbg_warn( "Commit Break continuous shot : No effect. value[%d],current state[%d]", ivalue, current_state );
}
bool _mmcamcorder_commit_camera_fps (MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
+ MMCamAttrsInfo fps_info;
+ int resolution_width = 0;
+ int resolution_height = 0;
+ int i;
+ int ret;
+
_mmcam_dbg_log("FPS(%d)", value->value.i_val);
- return TRUE;
+
+ ret = mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_WIDTH, &resolution_width,
+ MMCAM_CAMERA_HEIGHT, &resolution_height,
+ NULL);
+
+ if(ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("FAILED : coult not get resolution values.");
+ return FALSE;
+ }
+
+ ret = mm_camcorder_get_fps_list_by_resolution(handle, resolution_width, resolution_height, &fps_info);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_err("FAILED : coult not get FPS values by resolution.");
+ return FALSE;
+ }
+
+ for (i = 0 ; i < fps_info.int_array.count ; i++) {
+ if(value->value.i_val == fps_info.int_array.array[i]) {
+ return TRUE;
+ }
+ }
+
+ _mmcam_dbg_err("FAILED : %d is not supported FPS", value->value.i_val);
+ return FALSE;
}
NULL);
if (current_state == MM_CAMCORDER_STATE_PREPARE) {
- if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) {
+ if (hcamcorder->resolution_changed == FALSE) {
+ _mmcam_dbg_log("no need to restart preview");
+ return TRUE;
+ }
+
+ hcamcorder->resolution_changed = FALSE;
+
+ 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);
_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;
mmf_return_val_if_fail(attr, FALSE);
_mmcam_dbg_log("Height(%d)", value->value.i_val);
- current_state = _mmcamcorder_get_state( handle);
+ current_state = _mmcamcorder_get_state(handle);
if (current_state > MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state);
sc->info_video->preview_height = height;
if (current_state == MM_CAMCORDER_STATE_PREPARE) {
- if (!pthread_mutex_trylock(&(hcamcorder->restart_preview_lock))) {
+ if (hcamcorder->resolution_changed == FALSE) {
+ _mmcam_dbg_log("no need to restart preview");
+ return TRUE;
+ }
+
+ hcamcorder->resolution_changed = FALSE;
+
+ if (g_mutex_trylock(&hcamcorder->restart_preview_lock)) {
_mmcam_dbg_log("restart preview");
_mmcam_dbg_log("set empty buffers");
_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;
}
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
+
ret = gst_camera_control_set_zoom(control, zoom_type, zoom_level);
if (ret) {
_mmcam_dbg_log("Succeed in operating Zoom[%d].", zoom_level);
}
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
mslVal = value->value.i_val;
set_focus_mode = _mmcamcorder_convert_msl_to_sensor( handle, attr_idx, mslVal );
if (!(flags & MM_ATTRS_FLAG_MODIFIED)) {
if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) {
- if (gst_camera_control_set_focus(control, set_focus_mode, cur_focus_range)) {
- _mmcam_dbg_log("Succeed in setting AF mode[%d]", mslVal);
- return TRUE;
+ if (set_focus_mode != cur_focus_mode) {
+ if (gst_camera_control_set_focus(control, set_focus_mode, cur_focus_range)) {
+ _mmcam_dbg_log("Succeed in setting AF mode[%d]", mslVal);
+ return TRUE;
+ } else {
+ _mmcam_dbg_warn("Failed to set AF mode[%d]", mslVal);
+ }
} else {
- _mmcam_dbg_warn("Failed to set AF mode[%d]", mslVal);
+ _mmcam_dbg_log("No need to set AF mode. Current[%d]", mslVal);
+ return TRUE;
}
} else {
- _mmcam_dbg_err("failed to get focus mode");
- return FALSE;
+ _mmcam_dbg_warn("Failed to get AF mode, so do not set new AF mode[%d]", mslVal);
}
}
} else {
int current_state = MM_CAMCORDER_STATE_NONE;
int mslVal = 0;
int newVal = 0;
+ int cur_focus_mode = 0;
+ int cur_focus_range = 0;
int msl_mode = MM_CAMCORDER_FOCUS_MODE_NONE;
int converted_mode = 0;
newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal);
current_state = _mmcamcorder_get_state(handle);
- if (current_state < MM_CAMCORDER_STATE_READY) {
- _mmcam_dbg_log("af scan range will be changed later.(state=%d)", current_state);
+ if (current_state < MM_CAMCORDER_STATE_PREPARE) {
+ _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
return TRUE;
}
}
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FOCUS_MODE, &msl_mode, NULL);
converted_mode = _mmcamcorder_convert_msl_to_sensor( handle, MM_CAM_CAMERA_FOCUS_MODE, msl_mode );
- if (gst_camera_control_set_focus(control, converted_mode, newVal)) {
- //_mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal );
- return TRUE;
+ if (gst_camera_control_get_focus(control, &cur_focus_mode, &cur_focus_range)) {
+ if ((newVal != cur_focus_range) || (converted_mode != cur_focus_mode)) {
+ if (gst_camera_control_set_focus(control, converted_mode, newVal)) {
+ //_mmcam_dbg_log("Succeed in setting AF mode[%d]", mslVal);
+ return TRUE;
+ } else {
+ _mmcam_dbg_warn("Failed to set AF mode[%d]", mslVal);
+ }
+ } else {
+ //_mmcam_dbg_log("No need to set AF mode. Current[%d]", mslVal);
+ return TRUE;
+ }
} else {
- _mmcam_dbg_warn( "Failed to set AF mode[%d]", mslVal );
+ _mmcam_dbg_warn("Failed to get AF mode, so do not set new AF mode[%d]", mslVal);
}
} else {
_mmcam_dbg_log("pointer of video src is null");
}
+
return FALSE;
}
+
bool _mmcamcorder_commit_camera_af_touch_area (MMHandleType handle, int attr_idx, const mmf_value_t *value)
{
_MMCamcorderSubContext *sc = NULL;
GstCameraControl *control = NULL;
- GstCameraControlRectType set_area = { 0, 0, 0, 0 }, get_area = { 0, 0, 0, 0 };
+ GstCameraControlRectType set_area = { 0, 0, 0, 0 };
+ GstCameraControlRectType get_area = { 0, 0, 0, 0 };
int current_state = MM_CAMCORDER_STATE_NONE;
int ret = FALSE;
gboolean do_set = FALSE;
- MMCamAttrsInfo info_y, info_w, info_h;
+ MMCamAttrsInfo info_y;
+ MMCamAttrsInfo info_w;
+ MMCamAttrsInfo info_h;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
- if (!sc)
+ if (!sc) {
return TRUE;
+ }
_mmcam_dbg_log("(%d)", attr_idx);
- current_state = _mmcamcorder_get_state( handle);
-
- if( current_state < MM_CAMCORDER_STATE_PREPARE )
- {
+ current_state = _mmcamcorder_get_state(handle);
+ if (current_state < MM_CAMCORDER_STATE_PREPARE) {
_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state);
return TRUE;
}
ret = mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
- NULL);
- if( ret != MM_ERROR_NONE )
- {
- _mmcam_dbg_warn( "Failed to get FOCUS MODE.[%x]", ret );
+ MMCAM_CAMERA_FOCUS_MODE, &focus_mode,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ _mmcam_dbg_warn("Failed to get FOCUS MODE.[%x]", ret);
return FALSE;
}
- if ((focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO ) && (focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS))
- {
- _mmcam_dbg_warn( "Focus mode is NOT TOUCH AUTO or CONTINUOUS(current[%d]). return FALSE", focus_mode );
+ if ((focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO) && (focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS)) {
+ _mmcam_dbg_warn("Focus mode is NOT TOUCH AUTO or CONTINUOUS(current[%d]). return FALSE", focus_mode);
return FALSE;
}
- if( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst )
- {
- if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst))
- {
+ 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 TRUE;
}
- switch( attr_idx )
- {
- case MM_CAM_CAMERA_AF_TOUCH_X:
- mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_Y, &info_y);
- mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_WIDTH, &info_w);
- mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
- if( !( (info_y.flag|info_w.flag|info_h.flag) & MM_ATTRS_FLAG_MODIFIED) )
- {
- set_area.x = value->value.i_val;
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
- MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
- MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
- NULL);
- do_set = TRUE;
- }
- else
- {
- _mmcam_dbg_log( "Just store AF area[x:%d]", value->value.i_val );
- return TRUE;
- }
- break;
- case MM_CAM_CAMERA_AF_TOUCH_Y:
- mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_WIDTH, &info_w);
- mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
- if( !( (info_w.flag|info_h.flag) & MM_ATTRS_FLAG_MODIFIED) )
- {
- set_area.y = value->value.i_val;
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
- MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
- MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
- NULL);
- do_set = TRUE;
- }
- else
- {
- _mmcam_dbg_log( "Just store AF area[y:%d]", value->value.i_val );
- return TRUE;
- }
- break;
- case MM_CAM_CAMERA_AF_TOUCH_WIDTH:
- mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
- if( !( info_h.flag & MM_ATTRS_FLAG_MODIFIED) )
- {
- set_area.width = value->value.i_val;
- mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
- MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
- MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
- NULL);
- do_set = TRUE;
- }
- else
- {
- _mmcam_dbg_log( "Just store AF area[width:%d]", value->value.i_val );
- return TRUE;
- }
- break;
- case MM_CAM_CAMERA_AF_TOUCH_HEIGHT:
- set_area.height = value->value.i_val;
+ memset(&info_y, 0x0, sizeof(MMCamAttrsInfo));
+ memset(&info_w, 0x0, sizeof(MMCamAttrsInfo));
+ memset(&info_h, 0x0, sizeof(MMCamAttrsInfo));
+
+ switch (attr_idx) {
+ case MM_CAM_CAMERA_AF_TOUCH_X:
+ mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_Y, &info_y);
+ mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_WIDTH, &info_w);
+ mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
+ if (!((info_y.flag|info_w.flag|info_h.flag) & MM_ATTRS_FLAG_MODIFIED)) {
+ set_area.x = value->value.i_val;
mm_camcorder_get_attributes(handle, NULL,
- MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
- MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
- MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
- NULL);
+ MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
+ MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
+ MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
+ NULL);
do_set = TRUE;
- break;
- default:
- break;
+ } else {
+ _mmcam_dbg_log("Just store AF area[x:%d]", value->value.i_val);
+ return TRUE;
+ }
+ break;
+ case MM_CAM_CAMERA_AF_TOUCH_Y:
+ mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_WIDTH, &info_w);
+ mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
+ if (!((info_w.flag|info_h.flag) & MM_ATTRS_FLAG_MODIFIED)) {
+ set_area.y = value->value.i_val;
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
+ MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
+ MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
+ NULL);
+ do_set = TRUE;
+ } else {
+ _mmcam_dbg_log( "Just store AF area[y:%d]", value->value.i_val );
+ return TRUE;
+ }
+ break;
+ case MM_CAM_CAMERA_AF_TOUCH_WIDTH:
+ mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_TOUCH_HEIGHT, &info_h);
+ if (!(info_h.flag & MM_ATTRS_FLAG_MODIFIED)) {
+ set_area.width = value->value.i_val;
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
+ MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
+ MMCAM_CAMERA_AF_TOUCH_HEIGHT, &set_area.height,
+ NULL);
+ do_set = TRUE;
+ } else {
+ _mmcam_dbg_log("Just store AF area[width:%d]", value->value.i_val);
+ return TRUE;
+ }
+ break;
+ case MM_CAM_CAMERA_AF_TOUCH_HEIGHT:
+ set_area.height = value->value.i_val;
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_AF_TOUCH_X, &set_area.x,
+ MMCAM_CAMERA_AF_TOUCH_Y, &set_area.y,
+ MMCAM_CAMERA_AF_TOUCH_WIDTH, &set_area.width,
+ NULL);
+ do_set = TRUE;
+ break;
+ default:
+ break;
}
- if( do_set )
- {
+ if (do_set) {
+ _MMCamcorderVideoInfo *info = sc->info_video;
+
+ if (info == NULL) {
+ _mmcam_dbg_err("video info is NULL");
+ return FALSE;
+ }
+
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
+
+ /* convert area */
+ if (current_state >= MM_CAMCORDER_STATE_RECORDING && info->support_dual_stream == FALSE &&
+ (info->preview_width != info->video_width || info->preview_height != info->video_height)) {
+ float ratio_width = 0.0;
+ float ratio_height = 0.0;
+
+ if (info->preview_width != 0 && info->preview_height != 0) {
+ ratio_width = (float)info->video_width / (float)info->preview_width;
+ ratio_height = (float)info->video_height / (float)info->preview_height;
- ret = gst_camera_control_get_auto_focus_area( control, &get_area );
- if( !ret )
- {
+ _mmcam_dbg_log("original area %d,%d,%dx%d, resolution ratio : width %f, height %f",
+ set_area.x, set_area.y, set_area.width, set_area.height, ratio_width, ratio_height);
+
+ set_area.x = (int)((float)set_area.x * ratio_width);
+ set_area.y = (int)((float)set_area.y * ratio_height);
+ set_area.width = (int)((float)set_area.width * ratio_width);
+ set_area.height = (int)((float)set_area.height * ratio_height);
+
+ if (set_area.width <= 0) {
+ set_area.width = 1;
+ }
+ if (set_area.height <= 0) {
+ set_area.height = 1;
+ }
+
+ _mmcam_dbg_log("converted area %d,%d,%dx%d",
+ set_area.x, set_area.y, set_area.width, set_area.height);
+ } else {
+ _mmcam_dbg_warn("invalid preview size %dx%d, skip AF area converting",
+ info->preview_width, info->preview_height);
+ }
+ }
+
+ ret = gst_camera_control_get_auto_focus_area(control, &get_area);
+ if (!ret) {
_mmcam_dbg_warn( "Failed to get AF area" );
return FALSE;
}
- if( get_area.x == set_area.x && get_area.y == set_area.y )
- // width and height are not supported now.
- // get_area.width == set_area.width && get_area.height == set_area.height
- {
- _mmcam_dbg_log( "No need to set AF area[x,y:%d,%d]", get_area.x, get_area.y );
+ /* width and height are not supported now */
+ if (get_area.x == set_area.x && get_area.y == set_area.y) {
+ _mmcam_dbg_log("No need to set AF area[x,y:%d,%d]",
+ get_area.x, get_area.y);
return TRUE;
}
- ret = gst_camera_control_set_auto_focus_area( control, set_area );
- if( ret )
- {
- _mmcam_dbg_log( "Succeed to set AF area[%d,%d,%dx%d]", set_area.x, set_area.y, set_area.width, set_area.height );
+ ret = gst_camera_control_set_auto_focus_area(control, set_area);
+ if (ret) {
+ _mmcam_dbg_log("Succeed to set AF area[%d,%d,%dx%d]",
+ set_area.x, set_area.y, set_area.width, set_area.height);
return TRUE;
- }
- else
- {
- _mmcam_dbg_warn( "Failed to set AF area[%d,%d,%dx%d]", set_area.x, set_area.y, set_area.width, set_area.height );
+ } else {
+ _mmcam_dbg_warn("Failed to set AF area[%d,%d,%dx%d]",
+ set_area.x, set_area.y, set_area.width, set_area.height);
}
}
- }
- else
- {
+ } else {
_mmcam_dbg_log("pointer of video src is null");
}
}
control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
ret = gst_camera_control_set_exposure(control, exposure_type, newVal1, newVal2);
if (ret) {
}
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
+
if (gst_camera_control_get_wdr(control, &cur_value)) {
if (newVal != cur_value) {
if (gst_camera_control_set_wdr(control, newVal)) {
/* get string */
filename = mmf_value_get_string(value, &size);
+ if (filename == NULL) {
+ _mmcam_dbg_err("NULL filename");
+ return FALSE;
+ }
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;
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);
return FALSE;
}
- _mmcam_dbg_log("label(%s): MSL(%d)->Sensor(%d)", control_label, mslNewVal, newVal);
+ /*_mmcam_dbg_log("label(%s): MSL(%d)->Sensor(%d)", control_label, mslNewVal, newVal);*/
if (!GST_IS_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
_mmcam_dbg_log("Can't cast Video source into color balance.");
}
balance = GST_COLOR_BALANCE(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (balance == NULL) {
+ _mmcam_dbg_err("cast COLOR_BALANCE failed");
+ return FALSE;
+ }
+
controls = gst_color_balance_list_channels(balance);
if (controls == NULL) {
_mmcam_dbg_log("There is no list of colorbalance controls");
}
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
+
ret = gst_camera_control_set_exposure(control, GST_CAMERA_CONTROL_PROGRAM_MODE, newVal, 0);
if (ret) {
_mmcam_dbg_log("Succeed in setting program mode[%d].", mslVal);
if (p_handle) {
/* get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
+ if (videosink_name == NULL) {
+ _mmcam_dbg_err("Please check videosink element in configuration file");
+ return FALSE;
+ }
+
_mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
if (!strcmp(videosink_name, "xvimagesink") ||
} 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;
+ 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");
+ }
+
+ gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), (guintptr)wl_info->surface);
+ 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);
+#endif /* HAVE_WAYLAND */
} else {
_mmcam_dbg_warn("Commit : Nothing to commit with this element[%s]", videosink_name);
return FALSE;
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
+ if (videosink_name == NULL) {
+ _mmcam_dbg_err("Please check videosink element in configuration file");
+ return FALSE;
+ }
+
_mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name);
if (!strcmp(videosink_name, "xvimagesink")) {
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);
}
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);
}
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
- if (!strcmp(videosink_name, "xvimagesink") ||
+ if (videosink_name == NULL) {
+ _mmcam_dbg_err("Please check videosink element in configuration file");
+ return FALSE;
+ }
+
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "evasimagesink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
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);
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
- if (!strcmp(videosink_name, "xvimagesink") ||
+ if (videosink_name == NULL) {
+ _mmcam_dbg_err("Please check videosink element in configuration file");
+ return FALSE;
+ }
+
+ if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "evasimagesink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
method = value->value.i_val;
MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-geometry-method", method);
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
+ if (videosink_name == NULL) {
+ _mmcam_dbg_err("Please check videosink element in configuration file");
+ return FALSE;
+ }
+
if (!strcmp(videosink_name, "xvimagesink") ||
!strcmp(videosink_name, "evaspixmapsink")) {
int rect_x = 0;
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
+ if (videosink_name == NULL) {
+ _mmcam_dbg_err("Please check videosink element in configuration file");
+ return FALSE;
+ }
+
zoom = value->value.i_val;
if (!strcmp(videosink_name, "xvimagesink")) {
vs_element = sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst;
/* Get videosink name */
_mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name);
+ if (videosink_name == NULL) {
+ _mmcam_dbg_err("Please check videosink element in configuration file");
+ return FALSE;
+ }
+
if (!strcmp(videosink_name, "evaspixmapsink")) {
MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "origin-size", !do_scaling);
_mmcam_dbg_log("Set origin-size to %d", !(value->value.i_val));
{
bool bret = FALSE;
_MMCamcorderSubContext *sc = NULL;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
int strobe_type, mslVal, newVal, cur_value;
int current_state = MM_CAMCORDER_STATE_NONE;
+ if (hcamcorder == NULL) {
+ _mmcam_dbg_err("NULL handle");
+ return FALSE;
+ }
+
sc = MMF_CAMCORDER_SUBCONTEXT(handle);
if (!sc)
return TRUE;
- _mmcam_dbg_log( "Commit : strobe attribute(%d)", attr_idx );
+ /*_mmcam_dbg_log( "Commit : strobe attribute(%d)", attr_idx );*/
- //status check
- current_state = _mmcamcorder_get_state( handle);
+ mslVal = value->value.i_val;
+ /* check flash state */
+ if (attr_idx == MM_CAM_STROBE_MODE) {
+ int flash_brightness = 0;
+
+ /* get current flash brightness */
+ 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;
+ }
+
+ _mmcam_dbg_log("flash brightness %d", flash_brightness);
+
+ if (flash_brightness > 0 &&
+ mslVal != MM_CAMCORDER_STROBE_MODE_OFF) {
+ /* other module already turned on flash */
+ hcamcorder->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY;
+ _mmcam_dbg_err("other module already turned on flash. avoid to set flash mode here.");
+ return FALSE;
+ } else {
+ _mmcam_dbg_log("keep going");
+ }
+ }
+
+ /* check state */
+ 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);
return TRUE;
} else if (current_state == MM_CAMCORDER_STATE_CAPTURING) {
_mmcam_dbg_warn("invalid state[capturing]");
+ hcamcorder->error_code = MM_ERROR_CAMCORDER_INVALID_STATE;
return FALSE;
}
- mslVal = value->value.i_val;
-
switch (attr_idx) {
case MM_CAM_STROBE_CONTROL:
strobe_type = GST_CAMERA_CONTROL_STROBE_CONTROL;
bret = FALSE;
} else {
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
if (gst_camera_control_get_strobe(control, strobe_type, &cur_value)) {
if (newVal != cur_value) {
return FALSE;
}
- _mmcam_dbg_log("Commit : HDR Capture %d", value->value.i_val);
+ /*_mmcam_dbg_log("Commit : HDR Capture %d", value->value.i_val);*/
/* check whether set or not */
if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) {
return TRUE;
}
- _mmcam_dbg_log("Commit : detect attribute(%d)", attr_idx);
+ /*_mmcam_dbg_log("Commit : detect attribute(%d)", attr_idx);*/
/* state check */
current_state = _mmcamcorder_get_state( handle);
bret = FALSE;
} else {
control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (control == NULL) {
+ _mmcam_dbg_err("cast CAMERA_CONTROL failed");
+ return FALSE;
+ }
if (gst_camera_control_get_detect(control, detect_type, ¤t_value)) {
if (current_value == set_value) {
}
+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;
+}
+
+
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 )
+static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args)
{
#define INIT_VALUE -1
#define CHECK_COUNT 3
- mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle);
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
MMHandleType attrs = 0;
int ret = MM_ERROR_NONE;
- int i = 0, j = 0;
+ int i = 0;
+ int j = 0;
const char *name = NULL;
const char *check_pair_name[CHECK_COUNT][3] = {
{MMCAM_CAMERA_WIDTH, MMCAM_CAMERA_HEIGHT, "MMCAM_CAMERA_WIDTH and HEIGHT"},
return MM_ERROR_CAMCORDER_INVALID_ARGUMENT;
}
+ if (!strcmp(check_pair_name[i][0], MMCAM_CAMERA_WIDTH)) {
+ int current_width = 0;
+ int current_height = 0;
+
+ mm_camcorder_get_attributes(handle, NULL,
+ MMCAM_CAMERA_WIDTH, ¤t_width,
+ MMCAM_CAMERA_HEIGHT, ¤t_height,
+ NULL);
+
+ if (current_width != check_pair_value[i][0] ||
+ current_height != check_pair_value[i][1]) {
+ hcamcorder->resolution_changed = TRUE;
+ } else {
+ hcamcorder->resolution_changed = FALSE;
+ }
+
+ _mmcam_dbg_log("resolution changed : %d", hcamcorder->resolution_changed);
+ }
+
if (err_name) {
free(err_name);
err_name = NULL;
switch (info.validity_type) {
case MM_ATTRS_VALID_TYPE_INT_ARRAY:
- _mmcam_dbg_log("int array count %d", info.int_array.count)
+ /*
+ _mmcam_dbg_log("int array count %d", info.int_array.count);
+ */
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) {
return FALSE;
}
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY:
- _mmcam_dbg_log("double array count %d", info.double_array.count)
+ /*
+ _mmcam_dbg_log("double array count %d", info.double_array.count);
+ */
if (info.double_array.count <= 1) {
return FALSE;
}
break;
case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE:
+ /*
_mmcam_dbg_log("double range min %lf, max %lf",info.int_range.min, info.int_range.max);
+ */
if (info.double_range.min >= info.double_range.max) {
return FALSE;
}