[Release version 0.2.28] Change display routine for Overlay type 06/58306/1 accepted/tizen/mobile/20160202.113057 accepted/tizen/tv/20160202.113115 accepted/tizen/wearable/20160202.113140 submit/tizen/20160201.062702
authorJeongmo Yang <jm80.yang@samsung.com>
Fri, 29 Jan 2016 06:48:26 +0000 (15:48 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 29 Jan 2016 06:48:26 +0000 (15:48 +0900)
Change-Id: Ie8884388b8a9ea1f0fb3e47004bc2be2ef6bd42a
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
CMakeLists.txt
legacy/include/legacy_camera.h
legacy/src/legacy_camera.c [changed mode: 0755->0644]
legacy/src/legacy_camera_internal.c [changed mode: 0755->0644]
muse/include/muse_camera.h [changed mode: 0755->0644]
muse/include/muse_camera_msg.h [changed mode: 0755->0644]
muse/src/muse_camera_dispatcher.c
packaging/mmsvc-camera.spec

index d28da8d..e7ff5c5 100644 (file)
@@ -9,7 +9,7 @@ SET(fw_name "${service}-${submodule}")
 
 PROJECT(${fw_name})
 
-SET(pc_dependents "dlog mm-common mused libtbm")
+SET(pc_dependents "dlog mm-common mused libtbm mm-camcorder")
 
 SET(PC_NAME ${fw_name})
 SET(PC_REQUIRED ${pc_dependents})
index 7a59e89..7cf527e 100644 (file)
@@ -461,7 +461,6 @@ typedef enum
     CAMERA_ATTR_FLASH_MODE_PERMANENT,        /**< Keep turned on until turning off */
 } camera_attr_flash_mode_e;
 
-
 /**
  * @brief Enumeration to preview FPS.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -591,7 +590,7 @@ typedef void (*camera_preview_cb)(MMCamcorderVideoStreamDataType *frame, void *u
  * @see        camera_start_continuous_capture()
  * @see        camera_capture_completed_cb()
  */
-typedef void (*camera_capturing_cb)(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data);
+typedef void (*camera_capturing_cb)(camera_image_data_s *image, camera_image_data_s *postview, camera_image_data_s *thumbnail, void *user_data);
 
 /**
  * @brief Called when the camera capturing completes.
old mode 100755 (executable)
new mode 100644 (file)
index a2b2506..5b1533f
@@ -1087,6 +1087,7 @@ int legacy_camera_get_device_count(camera_h camera, int *device_count)
        return __convert_camera_error_code(__func__, ret);
 }
 
+
 int legacy_camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
 {
        if (camera == NULL) {
@@ -1270,11 +1271,8 @@ int legacy_camera_set_display(camera_h camera, camera_display_type_e type, camer
        int ret = MM_ERROR_NONE;
        int set_surface = MM_DISPLAY_SURFACE_OVERLAY;
        void *set_handle = NULL;
-       camera_s *handle = NULL;
-
-       Evas_Object *obj = NULL;
-       const char *object_type = NULL;
        char *socket_path = NULL;
+       camera_s *handle = NULL;
 
        if (camera == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
@@ -1293,71 +1291,14 @@ int legacy_camera_set_display(camera_h camera, camera_display_type_e type, camer
 
        switch (type) {
        case CAMERA_DISPLAY_TYPE_OVERLAY:
+               handle->display_handle = display;
+               set_surface = MM_DISPLAY_SURFACE_OVERLAY;
+               set_handle = display;
+               break;
        case CAMERA_DISPLAY_TYPE_EVAS:
-               obj = (Evas_Object *)display;
-               object_type = evas_object_type_get(obj);
-               if (object_type) {
-                       if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
-#ifdef HAVE_WAYLAND
-                               MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)malloc(sizeof(MMCamWaylandInfo));
-
-                               if (wl_info == NULL) {
-                                       LOGE("wl_info alloc failed : %d", sizeof(MMCamWaylandInfo));
-                                       return __convert_camera_error_code(__func__, MM_ERROR_CAMCORDER_LOW_MEMORY);
-                               }
-
-                               memset(wl_info, 0x0, sizeof(MMCamWaylandInfo));
-
-                               wl_info->evas_obj = (void *)obj;
-                               wl_info->window = (void *)elm_win_wl_window_get(obj);
-                               wl_info->surface = (void *)ecore_wl_window_surface_get(wl_info->window);
-                               wl_info->display = (void *)ecore_wl_display_get();
-
-                               if (wl_info->window == NULL || wl_info->surface == NULL || wl_info->display == NULL) {
-                                       LOGE("something is NULL %p, %p, %p", wl_info->window, wl_info->surface, wl_info->display);
-                                       free(wl_info);
-                                       return __convert_camera_error_code(__func__, MM_ERROR_CAMCORDER_INTERNAL);
-                               }
-
-                               evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
-                                                             &wl_info->window_width, &wl_info->window_height);
-
-                               if (handle->wl_info) {
-                                       free(handle->wl_info);
-                                       handle->wl_info = NULL;
-                               }
-
-                               /* set wayland info */
-                               handle->wl_info = (void *)wl_info;
-                               set_surface = MM_DISPLAY_SURFACE_OVERLAY;
-                               set_handle = (void *)wl_info;
-
-                               LOGD("wayland obj %p, window %p, surface %p, display %p, size %d,%d,%dx%d",
-                                    wl_info->evas_obj, wl_info->window, wl_info->surface, wl_info->display,
-                                    wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height);
-#else /* HAVE_WAYLAND */
-                               /* x window overlay surface */
-                               handle->display_handle = (void *)elm_win_xwindow_get(obj);
-                               set_surface = MM_DISPLAY_SURFACE_OVERLAY;
-                               set_handle = &(handle->display_handle);
-
-                               LOGD("display type OVERLAY : handle %p, %d", set_handle, (int)handle->display_handle);
-#endif /* HAVE_WAYLAND */
-                       } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
-                               /* evas object surface */
-                               handle->display_handle = display;
-                               set_surface = MM_DISPLAY_SURFACE_EVAS;
-                               set_handle = display;
-
-                               LOGD("display type EVAS : handle %p", set_handle);
-                       } else {
-                               LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
-                               return CAMERA_ERROR_INVALID_PARAMETER;
-                       }
-               } else {
-                       LOGE("failed to get evas object type from %p", obj);
-                       return CAMERA_ERROR_INVALID_PARAMETER;
-               }
+               handle->display_handle = display;
+               set_surface = MM_DISPLAY_SURFACE_EVAS;
+               set_handle = display;
                break;
        case CAMERA_DISPLAY_TYPE_REMOTE:
                set_surface = MM_DISPLAY_SURFACE_REMOTE;
@@ -1373,9 +1314,9 @@ int legacy_camera_set_display(camera_h camera, camera_display_type_e type, camer
        }
 
        ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
-                                         MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
-                                         MMCAM_DISPLAY_SURFACE, set_surface,
-                                         NULL);
+               MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
+               MMCAM_DISPLAY_SURFACE, set_surface,
+               NULL);
 
        if (ret == MM_ERROR_NONE) {
                if (type == CAMERA_DISPLAY_TYPE_REMOTE) {
@@ -1392,8 +1333,8 @@ int legacy_camera_set_display(camera_h camera, camera_display_type_e type, camer
                                                          NULL);
                } else if (type != CAMERA_DISPLAY_TYPE_NONE) {
                        ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
-                                                         MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *),
-                                                         NULL);
+                               MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *),
+                               NULL);
                }
        }
 
@@ -1542,10 +1483,6 @@ int legacy_camera_set_display_rotation(camera_h camera, camera_rotation_e rotati
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       if (rotation > CAMERA_ROTATION_270) {
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
        int ret = MM_ERROR_NONE;
        camera_s *handle = (camera_s *)camera;
 
@@ -1582,10 +1519,6 @@ int legacy_camera_set_display_flip(camera_h camera, camera_flip_e flip)
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       if (flip > CAMERA_FLIP_BOTH) {
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
        int ret = MM_ERROR_NONE;
        camera_s *handle = (camera_s *)camera;
 
@@ -1663,10 +1596,6 @@ int legacy_camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
                return CAMERA_ERROR_INVALID_PARAMETER;
        }
 
-       if (mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
-               return CAMERA_ERROR_INVALID_PARAMETER;
-       }
-
        int ret = MM_ERROR_NONE;
        camera_s *handle = (camera_s *)camera;
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 95a1d0e..500e2bd
@@ -31,6 +31,7 @@ extern "C" {
 #include <stdio.h>
 #include <tbm_bufmgr.h>
 #include "legacy_camera_internal.h"
+#include <mm_camcorder.h>
 
 /**
  * @brief Enumeration for the muse camera apis.
@@ -240,6 +241,9 @@ typedef struct {
        GMutex list_lock;
        GMutex preview_cb_lock;
        GCond preview_cb_cond;
+#ifdef HAVE_WAYLAND
+       MMCamWaylandInfo wl_info;
+#endif /* HAVE_WAYLAND */
 } muse_camera_handle_s;
 
 
old mode 100755 (executable)
new mode 100644 (file)
index dd2737c..60b1348
@@ -337,7 +337,40 @@ typedef const char* STRING;
                int __len__; \
                int *__value__ = (int *)param; \
                __sndMsg__ = muse_core_msg_json_factory_new(api, \
-                                       MUSE_TYPE_INT, #length, length, \
+                                       MUSE_TYPE_ARRAY, #param, \
+                                       datum_size == sizeof(int)? length :  \
+                                       length / sizeof(int) + (length % sizeof(int)?1:0), \
+                                       __value__, \
+                                       0); \
+               __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \
+               if (__len__ <= 0) { \
+                       LOGE("sending message failed"); \
+                       ret = CAMERA_ERROR_INVALID_OPERATION; \
+               } else \
+                       ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \
+               muse_core_msg_json_factory_free(__sndMsg__); \
+       }while(0)
+
+/**
+ * @brief Send the message from proxy to module via ipc, adding an array data and value.
+ * @param[in] api The enumeration of the corresponding api.
+ * @param[in] fd The socket fd that connected to the module via ipc.
+ * @param[in] cb_info The callback information, waiting for the ack from the module.
+ * @param[out] ret The delivered return value from the module to proxy side.
+ * @param[in] param The array data parameter to be included in the message.
+ * @param[in] length The length of the array.
+ * @param[in] datum_size The size of the array.
+ * @param[in] type The data type of the parameter.
+ * @param[in] param2 The 2rd parameter to be included in the message.
+ */
+#define muse_camera_msg_send_array_and_value(api, fd, cb_info, ret, param, length, datum_size, type, param2) \
+       do{     \
+               char *__sndMsg__; \
+               int __len__; \
+               int *__value__ = (int *)param; \
+               type __value2__ = (type)param2; \
+               __sndMsg__ = muse_core_msg_json_factory_new(api, \
+                                       MUSE_TYPE_##type, #param2, __value2__, \
                                        MUSE_TYPE_ARRAY, #param, \
                                        datum_size == sizeof(int)? length :  \
                                        length / sizeof(int) + (length % sizeof(int)?1:0), \
@@ -486,7 +519,6 @@ typedef const char* STRING;
                __sndMsg__ = muse_core_msg_json_factory_new(api, \
                                MUSE_TYPE_INT, PARAM_API_CLASS, class, \
                                MUSE_TYPE_INT, PARAM_RET, ret, \
-                               MUSE_TYPE_INT, #length, length, \
                                MUSE_TYPE_ARRAY, #param, \
                                        datum_size == sizeof(int)? length :  \
                                        length / sizeof(int) + (length % sizeof(int)?1:0), \
index 460209c..371c0f5 100644 (file)
@@ -1297,26 +1297,50 @@ int camera_dispatcher_set_display(muse_module_h module)
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
        static guint stream_id = 0;
        char socket_path[SOCKET_PATH_LENGTH] = {0,};
-       camera_h camera;
+#ifdef HAVE_WAYLAND
+       MMCamWaylandInfo *wl_info = NULL;
+#endif /* HAVE_WAYLAND */
+       camera_display_type_e type = CAMERA_DISPLAY_TYPE_OVERLAY;
+       camera_h camera = NULL;;
 
        muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
 
        LOGD("handle : 0x%x", muse_camera);
 
        camera = muse_camera->camera_handle;
-       stream_id = muse_core_get_atomic_uint();
 
-       snprintf(socket_path, SOCKET_PATH_LENGTH, SOCKET_PATH_BASE, stream_id);
+       muse_camera_msg_get(type, muse_core_client_get_msg(module));
 
-       LOGD("socket_path : %s", socket_path);
+       LOGD("type %d", type);
+#ifdef HAVE_WAYLAND
+       if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
+               wl_info = &muse_camera->wl_info;
+               muse_camera_msg_get_array(wl_info, muse_core_client_get_msg(module));
+
+               LOGD("wayland parent_id : %d, window : %d,%d,%dx%d",
+                       wl_info->parent_id, wl_info->window_x, wl_info->window_y,
+                       wl_info->window_width, wl_info->window_height);
+
+               ret = legacy_camera_set_display(muse_camera->camera_handle, type, (void *)wl_info);
 
-       ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_REMOTE, (void *)socket_path);
-       if (ret != CAMERA_ERROR_NONE) {
                muse_camera_msg_return(api, class, ret, module);
        } else {
-               muse_camera_msg_return1(api, class, ret, module,
-                                       STRING, socket_path);
+#endif /* HAVE_WAYLAND */
+               stream_id = muse_core_get_atomic_uint();
+
+               snprintf(socket_path, SOCKET_PATH_LENGTH, SOCKET_PATH_BASE, stream_id);
+
+               LOGD("socket_path : %s", socket_path);
+
+               ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_REMOTE, (void *)socket_path);
+               if (ret != CAMERA_ERROR_NONE) {
+                       muse_camera_msg_return(api, class, ret, module);
+               } else {
+                       muse_camera_msg_return1(api, class, ret, module, STRING, socket_path);
+               }
+#ifdef HAVE_WAYLAND
        }
+#endif /* HAVE_WAYLAND */
 
        return MUSE_CAMERA_ERROR_NONE;
 }
index 3b679d4..e1a6abe 100755 (executable)
@@ -3,7 +3,7 @@
 
 Name:       mmsvc-camera
 Summary:    A Camera module for muse server
-Version:    0.2.27
+Version:    0.2.28
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0