static void __mmcamcorder_deinit_handle(mmf_camcorder_t *hcamcorder);
static gint __mmcamcorder_init_configure_video_capture(mmf_camcorder_t *hcamcorder);
static gint __mmcamcorder_init_configure_audio(mmf_camcorder_t *hcamcorder);
+static gint __mmcamcorder_init_configure_common(mmf_camcorder_t *hcamcorder);
static void __mmcamcorder_deinit_configure(mmf_camcorder_t *hcamcorder);
static gboolean __mmcamcorder_init_gstreamer(camera_conf *conf);
static void __mmcamcorder_get_system_info(mmf_camcorder_t *hcamcorder);
int rcmd_fmt_recording = MM_PIXEL_FORMAT_NV12;
int rcmd_dpy_rotation = MM_DISPLAY_ROTATION_270;
int play_capture_sound = TRUE;
- int camera_device_count = MM_VIDEO_DEVICE_NUM;
int camera_default_flip = MM_FLIP_NONE;
int camera_facing_direction = MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR;
char *err_attr_name = NULL;
return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
}
+ if (hcamcorder->is_network) {
+ snprintf(conf_file_name, sizeof(conf_file_name), "%s_network.ini",
+ CONFIGURE_CTRL_FILE_PREFIX);
+ } else {
#ifdef _MMCAMCORDER_CAMERA_CONF_MGR_SUPPORT
- snprintf(devicetype, sizeof(devicetype), "%d", hcamcorder->device_type);
- memset(&hcamcorder->conf_device_info, 0x00, sizeof(camera_conf_device_info_s));
- ret_conf = camera_conf_mgr_get_ids(devicetype, __MMCAMCORDER_DEVICE_TYPE_STRING_LEN,
- &hcamcorder->conf_device_info);
- if (ret_conf != CAMERA_CONF_MGR_ERROR_NONE) {
- MMCAM_LOG_ERROR("Device [%s] is not found", devicetype);
- return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
- }
+ snprintf(devicetype, sizeof(devicetype), "%d", hcamcorder->device_type);
+ memset(&hcamcorder->conf_device_info, 0x00, sizeof(camera_conf_device_info_s));
+ ret_conf = camera_conf_mgr_get_ids(devicetype, __MMCAMCORDER_DEVICE_TYPE_STRING_LEN,
+ &hcamcorder->conf_device_info);
+ if (ret_conf != CAMERA_CONF_MGR_ERROR_NONE) {
+ MMCAM_LOG_ERROR("Device [%s] is not found", devicetype);
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ }
- snprintf(conf_file_name, sizeof(conf_file_name), "%s_%s_%s.ini",
- CONFIGURE_CTRL_FILE_PREFIX, hcamcorder->conf_device_info.vendor_id,
- hcamcorder->conf_device_info.product_id);
+ snprintf(conf_file_name, sizeof(conf_file_name), "%s_%s_%s.ini",
+ CONFIGURE_CTRL_FILE_PREFIX, hcamcorder->conf_device_info.vendor_id,
+ hcamcorder->conf_device_info.product_id);
- MMCAM_LOG_INFO("Load control configure file [%d][%s][%s]", hcamcorder->device_type,
- conf_file_name, hcamcorder->conf_device_info.node);
+ MMCAM_LOG_INFO("device info : node[%s]",
+ hcamcorder->conf_device_info.node);
#else
- snprintf(conf_file_name, sizeof(conf_file_name), "%s%d.ini",
- CONFIGURE_CTRL_FILE_PREFIX, hcamcorder->device_type);
- MMCAM_LOG_INFO("Load control configure file [%d][%s]", hcamcorder->device_type, conf_file_name);
+ snprintf(conf_file_name, sizeof(conf_file_name), "%s%d.ini",
+ CONFIGURE_CTRL_FILE_PREFIX, hcamcorder->device_type);
#endif
+ }
+
+ MMCAM_LOG_INFO("Load control configure file [%d][%s]",
+ hcamcorder->device_type, conf_file_name);
ret = _mmcamcorder_conf_get_info((MMHandleType)hcamcorder,
CONFIGURE_TYPE_CTRL, (const char *)conf_file_name, &hcamcorder->conf_ctrl);
"PlayCaptureSound",
&play_capture_sound);
- _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
- CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
- "DeviceCount",
- &camera_device_count);
-
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_ctrl,
CONFIGURE_CATEGORY_CTRL_CAMERA,
"FacingDirection",
"SupportZSL",
&hcamcorder->support_zsl_capture);
- MMCAM_LOG_INFO("Recommend fmt[cap:%d,rec:%d], dpy rot %d, cap snd %d, dev cnt %d, cam facing dir %d, step denom %d, support zsl %d",
+ MMCAM_LOG_INFO("Recommend fmt[cap:%d,rec:%d], dpy rot %d, cap snd %d, cam facing dir %d, step denom %d, support zsl %d",
rcmd_fmt_capture, rcmd_fmt_recording, rcmd_dpy_rotation,
- play_capture_sound, camera_device_count, camera_facing_direction,
+ play_capture_sound, camera_facing_direction,
hcamcorder->brightness_step_denominator, hcamcorder->support_zsl_capture);
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
&hcamcorder->support_media_packet_preview_cb);
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+ "SupportExtraPreview",
+ &hcamcorder->support_extra_preview);
+
+ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT,
"UseVideoconvert",
&hcamcorder->use_videoconvert);
+ _mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+ "MeasurePreviewFPS",
+ &hcamcorder->measure_preview_fps);
+
ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL,
MMCAM_CAMERA_WIDTH, &resolution_width,
MMCAM_CAMERA_HEIGHT, &resolution_height,
return MM_ERROR_CAMCORDER_INTERNAL;
}
- MMCAM_LOG_INFO("ZeroCopy %d, UserBuffer %d, Videoconvert %d, MPPreviewCb %d",
+ MMCAM_LOG_INFO("ZC %d, UB %d, VC %d, MPPC %d, EP %d, MPFPS %d",
hcamcorder->use_zero_copy_format, hcamcorder->support_user_buffer,
- hcamcorder->use_videoconvert, hcamcorder->support_media_packet_preview_cb);
+ hcamcorder->use_videoconvert, hcamcorder->support_media_packet_preview_cb,
+ hcamcorder->support_extra_preview, hcamcorder->measure_preview_fps);
MMCAM_LOG_INFO("res : %d X %d, Default FPS by resolution : %d",
resolution_width, resolution_height, fps_info.int_array.def);
}
ret = mm_camcorder_set_attributes((MMHandleType)hcamcorder, &err_attr_name,
- MMCAM_CAMERA_DEVICE_COUNT, camera_device_count,
MMCAM_CAMERA_FACING_DIRECTION, camera_facing_direction,
MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, rcmd_fmt_capture,
MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING, rcmd_fmt_recording,
static gint __mmcamcorder_init_configure_audio(mmf_camcorder_t *hcamcorder)
{
int ret = MM_ERROR_NONE;
- int camera_device_count = 0;
if (!hcamcorder) {
MMCAM_LOG_ERROR("NULL handle");
return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
}
+ ret = _mmcamcorder_init_attr_from_configure((MMHandleType)hcamcorder, MM_CAMCONVERT_CATEGORY_AUDIO);
+ if (ret != MM_ERROR_NONE) {
+ MMCAM_LOG_ERROR("there is no audio device");
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ }
+
+ return ret;
+}
+
+
+static gint __mmcamcorder_init_configure_common(mmf_camcorder_t *hcamcorder)
+{
+ int ret = MM_ERROR_NONE;
+ int device_count = 0;
+ const char *videosrc_name = NULL;
+ const char *audiosrc_name = NULL;
+ type_element *SrcElement = NULL;
+
+ if (!hcamcorder) {
+ MMCAM_LOG_ERROR("NULL handle");
+ return MM_ERROR_CAMCORDER_NOT_INITIALIZED;
+ }
+
+ /* Device count */
_mmcamcorder_conf_get_value_int((MMHandleType)hcamcorder, hcamcorder->conf_main,
CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
"DeviceCount",
- &camera_device_count);
+ &device_count);
+
+ /* Videosrc element name */
+ _mmcamcorder_conf_get_element((MMHandleType)hcamcorder, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT,
+ "VideosrcElement",
+ &SrcElement);
+ _mmcamcorder_conf_get_value_element_name(SrcElement, &videosrc_name);
+
+ /* Audiosrc element name */
+ _mmcamcorder_conf_get_element((MMHandleType)hcamcorder, hcamcorder->conf_main,
+ CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT,
+ "AudiosrcElement",
+ &SrcElement);
+ _mmcamcorder_conf_get_value_element_name(SrcElement, &audiosrc_name);
+
+ MMCAM_LOG_INFO("Device count[%d], Videosrc[%s], Audiosrc[%s]",
+ device_count, videosrc_name, audiosrc_name);
ret = mm_camcorder_set_attributes((MMHandleType)hcamcorder, NULL,
- MMCAM_CAMERA_DEVICE_COUNT, camera_device_count,
+ MMCAM_CAMERA_DEVICE_COUNT, device_count,
+ MMCAM_VIDEOSRC_ELEMENT_NAME, videosrc_name, videosrc_name ? strlen(videosrc_name) : 0,
+ MMCAM_AUDIOSRC_ELEMENT_NAME, audiosrc_name, audiosrc_name ? strlen(audiosrc_name) : 0,
NULL);
- if (ret != MM_ERROR_NONE) {
- MMCAM_LOG_ERROR("Set device count FAILED");
- return MM_ERROR_CAMCORDER_INTERNAL;
- }
-
- ret = _mmcamcorder_init_attr_from_configure((MMHandleType)hcamcorder, MM_CAMCONVERT_CATEGORY_AUDIO);
- if (ret != MM_ERROR_NONE) {
- MMCAM_LOG_ERROR("there is no audio device");
- return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
- }
+ if (ret != MM_ERROR_NONE)
+ MMCAM_LOG_ERROR("Set FAILED[0x%x]", ret);
return ret;
}
MMCAM_LOG_WARNING("DPM handle %p", hcamcorder->dpm_handle);
+ ret = __mmcamcorder_init_configure_common(hcamcorder);
+ if (ret != MM_ERROR_NONE)
+ goto _ERR_DEFAULT_VALUE_INIT;
+
if (hcamcorder->device_type != MM_VIDEO_DEVICE_NONE) {
ret = __mmcamcorder_init_configure_video_capture(hcamcorder);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
goto _ERR_DEFAULT_VALUE_INIT;
- }
/* add DPM camera policy changed callback */
if (hcamcorder->dpm_handle) {
#endif /* _MMCAMCORDER_MM_RM_SUPPORT */
} else {
ret = __mmcamcorder_init_configure_audio(hcamcorder);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
goto _ERR_DEFAULT_VALUE_INIT;
- }
}
traceBegin(TTRACE_TAG_CAMERA, "MMCAMCORDER:CREATE:INIT_GSTREAMER");
}
}
+int _mmcamcorder_get_focus_level(MMHandleType handle, int *level)
+{
+ GstCameraControl *control = NULL;
+ _MMCamcorderSubContext *sc = NULL;
+ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle);
+
+ mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+ mmf_return_val_if_fail(level, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder);
+ mmf_return_val_if_fail(sc, MM_ERROR_CAMCORDER_NOT_INITIALIZED);
+
+ if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) {
+ MMCAM_LOG_ERROR("Can't cast Video source into camera control.");
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ }
+
+ control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst);
+ if (!control) {
+ MMCAM_LOG_ERROR("cast CAMERA_CONTROL failed");
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ }
+
+ if (!gst_camera_control_get_focus_level(control, level)) {
+ MMCAM_LOG_ERROR("get focus level failed");
+ return MM_ERROR_CAMCORDER_NOT_SUPPORTED;
+ }
+
+ MMCAM_LOG_INFO("focus level[%d]", *level);
+
+ return MM_ERROR_NONE;
+}
+
/*-----------------------------------------------
| CAMCORDER INTERNAL LOCAL |
break;
case MM_CAMCORDER_MODE_VIDEO_CAPTURE:
+ /* fall through */
default:
ret = _mmcamcorder_create_preview_pipeline(handle);
if (ret != MM_ERROR_NONE)
return ret;
- /* connect capture signal */
if (!sc->bencbin_capture) {
ret = _mmcamcorder_connect_capture_signal(handle);
if (ret != MM_ERROR_NONE)
return ret;
}
+
+ if (hcamcorder->support_extra_preview &&
+ _mmcamcorder_connect_extra_preview_stream(handle) != MM_ERROR_NONE)
+ MMCAM_LOG_WARNING("connect extra preview stream signal failed");
break;
}