* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post If it succeeds, the camera state will be #CAMERA_STATE_CREATED.
*
- * @see camera_destroy()
+ * @see camera_destroy()
*/
int camera_create(camera_device_e device, camera_h *camera);
/**
+ * @brief Changes the camera device.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/camera
+ * @remarks This function can be used to change camera device simply without camera_destroy() and camera_create().\n
+ * If display reuse hint is set by camera_set_display_reuse_hint() before stopping the preview,\n
+ * display handle will be reused and last frame on display can be kept even though camera device is changed.
+ * @param[in] camera The handle to the camera
+ * @param[in] device The hardware camera to access
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED.
+ * @post If it succeeds, the camera attributes and settings will be reset.
+ *
+ * @see camera_set_display_reuse_hint()
+ * @see camera_get_display_reuse_hint()
+ */
+int camera_change_device(camera_h camera, camera_device_e device);
+
+/**
* @brief Destroys the camera handle and releases all its resources.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode);
/**
+ * @brief Sets the hint for display reuse.
+ * @since_tizen 3.0
+ * @details If the hint is set to true, the display will be reused when the camera device is changed with camera_change_device().
+ * @remarks If the current display type is #CAMERA_DISPLAY_TYPE_NONE, this function will return #CAMERA_ERROR_INVALID_OPERATION.
+ * @param[in] camera The handle to the camera
+ * @param[in] hint The hint for display reuse; true - reuse the display, false - do not reuse
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @pre The camera state must be set to #CAMERA_STATE_PREVIEW.
+ * @see camera_get_display_reuse_hint()
+ * @see camera_change_device()
+ */
+int camera_set_display_reuse_hint(camera_h camera, bool hint);
+
+/**
+ * @brief Gets the hint for display reuse.
+ * @since_tizen 3.0
+ * @remarks If the current display type is #CAMERA_DISPLAY_TYPE_NONE, this function will return #CAMERA_ERROR_INVALID_OPERATION.
+ * @param[in] camera The handle to the camera
+ * @param[out] hint The hint for display reuse; true - reuse the display, false - do not reuse
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error
+ * @see camera_get_display_reuse_hint()
+ * @see camera_change_device()
+ */
+int camera_get_display_reuse_hint(camera_h camera, bool *hint);
+
+/**
* @brief Sets the resolution of the captured image.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
Name: capi-media-camera
Summary: A Camera API
-Version: 0.2.64
+Version: 0.2.65
Release: 0
Group: Multimedia/API
License: Apache-2.0
return ret;
}
+
+int camera_change_device(camera_h camera, camera_device_e device)
+{
+ int ret = CAMERA_ERROR_NONE;
+ muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+
+ if (camera == NULL || pc->cb_info == NULL) {
+ LOGE("NULL handle, INVALID_PARAMETER");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ muse_camera_msg_send1(api, pc->cb_info->fd, pc->cb_info, ret, INT, device);
+
+ return ret;
+}
+
+
int camera_destroy(camera_h camera)
{
if (camera == NULL) {
return ret;
}
+
+int camera_set_display_reuse_hint(camera_h camera, bool hint)
+{
+ int ret = CAMERA_ERROR_NONE;
+ int set_hint = (int)hint;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+
+ if (camera == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("set display reuse hint %d", set_hint);
+
+ muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT,
+ pc->cb_info->fd, pc->cb_info, ret, INT, set_hint);
+
+ return ret;
+}
+
+
+int camera_get_display_reuse_hint(camera_h camera, bool *hint)
+{
+ int ret = CAMERA_ERROR_NONE;
+ int get_hint = 0;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
+
+ if (camera == NULL || hint == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (pc->cb_info == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ muse_camera_msg_send(api, pc->cb_info->fd, pc->cb_info, ret);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ muse_camera_msg_get(get_hint, pc->cb_info->recv_msg);
+ *hint = (bool)get_hint;
+
+ LOGD("display reuse hint %d", *hint);
+ } else {
+ LOGE("failed 0x%x", ret);
+ }
+
+ return ret;
+}
+
+
int camera_get_capture_resolution(camera_h camera, int *width, int *height)
{
if (camera == NULL || width == NULL || height == NULL) {
#define EXT_AMR "amr"
#define EXT_MKV "mkv"
-#define TARGET_FILENAME_PATH "/opt/usr/media/"
+#define TARGET_FILENAME_PATH "/home/owner/content/"
#define STILL_CAPTURE_FILE_PATH_NAME TARGET_FILENAME_PATH"StillshotCapture"
#define MULTI_CAPTURE_FILE_PATH_NAME TARGET_FILENAME_PATH"MultishotCapture"
#define IMAGE_CAPTURE_THUMBNAIL_PATH TARGET_FILENAME_PATH"thumbnail.jpg"
-----------------------------------------------------------------------*/
typedef struct _cam_handle {
camera_h camera;
+ int type;
int mode; /* image(capture)/video(recording) mode */
int isMultishot; /* flag for multishot mode */
int stillshot_count; /* total stillshot count */
g_print("\t '1' Stillshot test\n");
g_print("\t '2' Multishot test\n");
g_print("\t '3' Setting\n");
+ g_print("\t '4' Change device (Rear <-> Front)\n");
g_print("\t 'b' back\n");
g_print("\t=======================================\n");
}
g_print("\t '5' Exposure mode \n");
g_print("\t '6' Exposure value \n");
g_print("\t '7' F number \n");
+ g_print("\t '8' Display reuse hint \n");
g_print("\t 'i' ISO \n");
g_print("\t 'r' Rotate camera input \n");
g_print("\t 'f' Flip camera input \n");
case '3': /* Setting */
hcamcorder->menu_state = MENU_STATE_SETTING;
break;
+ case '4': /* Change device (Rear <-> Front) */
+ camera_stop_preview(hcamcorder->camera);
+
+ if (hcamcorder->type == CAMERA_DEVICE_CAMERA0) {
+ hcamcorder->type = CAMERA_DEVICE_CAMERA1;
+ } else {
+ hcamcorder->type = CAMERA_DEVICE_CAMERA0;
+ }
+
+ camera_change_device(hcamcorder->camera, hcamcorder->type);
+
+ camera_set_display_mode(hcamcorder->camera, CAMERA_DISPLAY_MODE_LETTER_BOX);
+
+ camera_start_preview(hcamcorder->camera);
+ break;
case 'b': /* back */
camera_stop_preview(hcamcorder->camera);
camera_destroy(hcamcorder->camera);
case '7': /* Setting > F number */
g_print("Not supported !! \n");
break;
+ case '8': /* Setting > Display reuse hint */
+ {
+ bool reuse_hint = false;
+
+ err = camera_get_display_reuse_hint(hcamcorder->camera, &reuse_hint);
+ if (err != CAMERA_ERROR_NONE) {
+ g_print("failed to get display reuse hint 0x%x\n", err);
+ break;
+ }
+
+ g_print("*Display reuse hint : current %d -> set %d\n", reuse_hint, !reuse_hint);
+ reuse_hint = !reuse_hint;
+ err = camera_set_display_reuse_hint(hcamcorder->camera, reuse_hint);
+ g_print("set display reuse hint result : 0x%x\n", err);
+ }
+ break;
case 'i': /* Setting > ISO */
g_print("*ISO !\n");
camera_attr_foreach_supported_iso(hcamcorder->camera, iso_mode_cb, NULL);
switch (buf) {
case '1':
hcamcorder->mode = MODE_VIDEO_CAPTURE;
- cam_info = CAMERA_DEVICE_CAMERA1;
+ hcamcorder->type = cam_info = CAMERA_DEVICE_CAMERA1;
check = TRUE;
break;
case '2':
hcamcorder->mode = MODE_VIDEO_CAPTURE;
- cam_info = CAMERA_DEVICE_CAMERA0;
+ hcamcorder->type = cam_info = CAMERA_DEVICE_CAMERA0;
check = TRUE;
break;
case 'q':