Add new internal API for Ecore_Wl2_Window 95/236895/2 accepted/tizen/unified/20200625.110556 submit/tizen/20200624.034306
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 23 Jun 2020 07:07:46 +0000 (16:07 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 23 Jun 2020 07:41:57 +0000 (16:41 +0900)
- int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window);

[Version] 0.4.35
[Profile] Common
[Issue Type] New feature

Change-Id: If3abec72b083952afb28d1fb2df09ac1509af1a6
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
include/camera_internal.h
include/camera_private.h
packaging/capi-media-camera.spec
src/camera.c
src/camera_internal.c

index f1728d4..18740ef 100644 (file)
@@ -64,6 +64,30 @@ int camera_start_evas_rendering(camera_h camera);
 int camera_stop_evas_rendering(camera_h camera, bool keep_screen);
 
 /**
+ * @brief Sets the ecore wayland video display.
+ * @since_tizen 6.0
+ * @remarks This function must be called in main thread of the application.
+ *          Otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION by internal restriction.
+ *          To avoid #CAMERA_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
+ *          ecore_thread_main_loop_end() can be used, but deadlock can occur if the main thread is busy.
+ *          So, it's not recommended to use them.
+ * @param[in] camera The handle to the camera
+ * @param[in] ecore_wl_window The ecore wayland window handle
+ * @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 Invalid operation
+ * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED.
+ * @see camera_start_preview()
+ * @see ecore_thread_main_loop_begin()
+ * @see ecore_thread_main_loop_end()
+ */
+int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window);
+
+/**
  * @}
  */
 #ifdef __cplusplus
index 0b79381..b863bbc 100644 (file)
@@ -229,6 +229,7 @@ int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user
 int _camera_start_evas_rendering(camera_h camera);
 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen);
 int _camera_independent_request(int api, int device_type, const char *key, int *value);
+int _camera_set_display(camera_h camera, mm_display_type_e type, void *display);
 
 typedef bool (*camera_supported_cb_param1)(int param, void *user_data);
 typedef bool (*camera_supported_cb_param2)(int param1, int param2, void *user_data);
index a17a973..fb1c103 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.4.34
+Version:    0.4.35
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 6878d5f..34ff1f6 100644 (file)
@@ -3122,7 +3122,8 @@ int camera_cancel_focusing(camera_h camera)
        return ret;
 }
 
-int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
+
+int _camera_set_display(camera_h camera, mm_display_type_e type, void *display)
 {
        int mm_ret = MM_ERROR_NONE;
        int ret = CAMERA_ERROR_NONE;
@@ -3138,12 +3139,12 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
+       if (type > MM_DISPLAY_TYPE_OVERLAY_EXT) {
                LOGE("invalid type %d", type);
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
+       if (type != MM_DISPLAY_TYPE_NONE && display == NULL) {
                LOGE("display type[%d] is not NONE, but display handle is NULL", type);
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
@@ -3164,7 +3165,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
 
        LOGD("Enter - type : %d, display : %p", type, display);
 
-       if (type != CAMERA_DISPLAY_TYPE_NONE) {
+       if (type != MM_DISPLAY_TYPE_NONE) {
                /* check display interface handle */
                if (!cb_info->dp_interface) {
                        LOGE("display interface not supported");
@@ -3180,13 +3181,13 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
                        return CAMERA_ERROR_INVALID_OPERATION;
                }
 
-               if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
+               if (type == MM_DISPLAY_TYPE_OVERLAY) {
                        mm_ret = mm_display_interface_get_window_rect(cb_info->dp_interface, &dp_info->window_rect);
 
                        LOGD("ret 0x%x, parent_id %d, window rect %d,%d,%dx%d",
                                ret, dp_info->parent_id, dp_info->window_rect.x, dp_info->window_rect.y,
                                dp_info->window_rect.width, dp_info->window_rect.height);
-               } else if (type == CAMERA_DISPLAY_TYPE_EVAS) {
+               } else if (type == MM_DISPLAY_TYPE_EVAS) {
 //LCOV_EXCL_START
                        camera_flip_e flip = CAMERA_FLIP_NONE;
                        camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
@@ -3229,7 +3230,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
        _camera_msg_send_param1(api, cb_info, &ret, &param, CAMERA_CB_TIMEOUT);
 
        if (ret == CAMERA_ERROR_NONE) {
-               if (type == CAMERA_DISPLAY_TYPE_EVAS)
+               if (type == MM_DISPLAY_TYPE_EVAS)
                        SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
        }
 
@@ -3237,6 +3238,13 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
 }
 
 
+int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
+{
+       LOGD("type %d, display %p", type, display);
+       return _camera_set_display(camera, (mm_display_type_e)type, display);
+}
+
+
 int camera_set_preview_resolution(camera_h camera, int width, int height)
 {
        int ret = CAMERA_ERROR_NONE;
index ebc96d2..aa8d898 100644 (file)
@@ -39,4 +39,9 @@ int camera_stop_evas_rendering(camera_h camera, bool keep_screen)
 {
        return _camera_stop_evas_rendering(camera, keep_screen);
 }
+
+int camera_set_ecore_wl_display(camera_h camera, void *ecore_wl_window)
+{
+       return _camera_set_display(camera, MM_DISPLAY_TYPE_OVERLAY_EXT, ecore_wl_window);
+}
 //LCOV_EXCL_STOP