[Release version 0.2.41] 95/78895/3
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 7 Jul 2016 08:38:50 +0000 (17:38 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 12 Jul 2016 06:28:50 +0000 (15:28 +0900)
1. Add new dispatchers for new APIs
2. Remove unnecessary feature
3. Update code for capture completed callback in case of interrupt

Change-Id: I96874365aaedc31cc59dda588e9366c70c6826ab
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
legacy/CMakeLists.txt
legacy/include/legacy_camera.h
legacy/include/legacy_camera_private.h
legacy/src/legacy_camera.c
legacy/src/legacy_camera_internal.c
muse/CMakeLists.txt
muse/include/muse_camera.h
muse/include/muse_camera_internal.h
muse/src/muse_camera_dispatcher.c
packaging/mmsvc-camera.spec

index ba63123..faa8867 100644 (file)
@@ -29,13 +29,6 @@ IF("${ARCH}" STREQUAL "arm")
     ADD_DEFINITIONS("-DTARGET")
 ENDIF("${ARCH}" STREQUAL "arm")
 
-IF(WAYLAND_SUPPORT)
-    ADD_DEFINITIONS("-DHAVE_WAYLAND")
-ENDIF(WAYLAND_SUPPORT)
-IF(X11_SUPPORT)
-    ADD_DEFINITIONS("-DHAVE_X11")
-ENDIF(X11_SUPPORT)
-
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
index 84d47cd..b97d282 100644 (file)
@@ -1328,6 +1328,11 @@ int legacy_camera_set_display_mode(camera_h camera , camera_display_mode_e mode)
  */
 int legacy_camera_get_display_mode(camera_h camera, camera_display_mode_e *mode);
 
+
+int legacy_camera_set_display_reuse_hint(camera_h camera, int hint);
+
+int legacy_camera_get_display_reuse_hint(camera_h camera, int *hint);
+
 /**
  * @brief Sets the resolution of the captured image.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
index 0108530..0aef5ed 100644 (file)
@@ -55,9 +55,7 @@ typedef struct _camera_s{
        void* user_cb[_CAMERA_EVENT_TYPE_NUM];
        void* user_data[_CAMERA_EVENT_TYPE_NUM];
        void* display_handle;
-#ifdef HAVE_WAYLAND
        MMCamWaylandInfo *wl_info;
-#endif /* #ifdef HAVE_WAYLAND */
        camera_display_type_e display_type;
        unsigned int state;
 
@@ -83,6 +81,8 @@ typedef struct _camera_s{
 
        GList *cb_data_list;
        GMutex idle_cb_lock;
+
+       void *reuse_element;
 } camera_s;
 
 int _camera_get_mm_handle(camera_h camera , MMHandleType *handle);
index 63229dd..b3f3e73 100644 (file)
@@ -29,9 +29,7 @@
 #include <gst/gst.h>
 #include <Evas.h>
 #include <Ecore.h>
-#ifdef HAVE_WAYLAND
 #include <Ecore_Wayland.h>
-#endif /* HAVE_WAYLAND */
 #include <Elementary.h>
 
 #ifdef LOG_TAG
@@ -190,6 +188,7 @@ int __convert_camera_error_code(const char *func, int code)
        default:
                ret = CAMERA_ERROR_INVALID_OPERATION;
                errorstr = "INVALID_OPERATION";
+               break;
        }
 
        if (code != MM_ERROR_NONE) {
@@ -364,9 +363,6 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat
                        break;
                }
 
-               previous_state = handle->state;
-               handle->state = __camera_state_convert(m->state.current );
-
                if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM) {
                        switch (m->state.code) {
                        case MM_MSG_CODE_INTERRUPTED_BY_CALL_START:
@@ -392,11 +388,25 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat
                        LOGW("CAMERA_POLICY_RESOURCE_CONFLICT");
                }
 
+               if (policy != CAMERA_POLICY_NONE &&
+                       handle->state == CAMERA_STATE_CAPTURING) {
+                       handle->state = CAMERA_STATE_CAPTURED;
+                       if (handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) {
+                               ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(CAMERA_STATE_CAPTURING,
+                                       handle->state, policy, handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]);
+                       }
+
+                       if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) {
+                               ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]);
+                       }
+               }
+
+               previous_state = handle->state;
+               handle->state = __camera_state_convert(m->state.current);
+
                if (previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) {
                        ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(previous_state,
-                                                                                                   handle->state,
-                                                                                                   policy,
-                                                                                                   handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]);
+                               handle->state, policy, handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]);
                }
 
                /* should change intermediate state MM_CAMCORDER_STATE_READY is not valid in capi , change to NULL state */
@@ -404,9 +414,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat
                    m->state.current == MM_CAMCORDER_STATE_NULL) {
                        if (handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED]) {
                                ((camera_interrupted_cb)handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED])(policy,
-                                                                                                        previous_state,
-                                                                                                        handle->state,
-                                                                                                        handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]);
+                                       previous_state, handle->state, handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]);
                        } else {
                                LOGW("_CAMERA_EVENT_TYPE_INTERRUPTED cb is NULL");
                        }
@@ -686,12 +694,12 @@ int legacy_camera_destroy(camera_h camera)
        if (ret == MM_ERROR_NONE) {
                _camera_remove_cb_message(handle);
                g_mutex_clear(&handle->idle_cb_lock);
-#ifdef HAVE_WAYLAND
+
                if (handle->wl_info) {
                        free(handle->wl_info);
                        handle->wl_info = NULL;
                }
-#endif /* HAVE_WAYLAND */
+
                free(handle);
        }
 
@@ -1965,6 +1973,42 @@ int legacy_camera_unset_error_cb(camera_h camera)
 }
 
 
+int legacy_camera_set_display_reuse_hint(camera_h camera, int hint)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_s *handle = (camera_s *)camera;
+
+       if (!handle) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+               MMCAM_DISPLAY_REUSE_HINT, hint,
+               NULL);
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_get_display_reuse_hint(camera_h camera, int *hint)
+{
+       int ret = CAMERA_ERROR_NONE;
+       camera_s *handle = (camera_s *)camera;
+
+       if (!handle || !hint) {
+               LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+               return CAMERA_ERROR_INVALID_PARAMETER;
+       }
+
+       ret = mm_camcorder_get_attributes(handle->mm_handle, NULL,
+               MMCAM_DISPLAY_REUSE_HINT, hint,
+               NULL);
+
+       return __convert_camera_error_code(__func__, ret);
+}
+
+
 int legacy_camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb, void *user_data)
 {
        if (camera == NULL || foreach_cb == NULL) {
index 126ef4f..f05fc67 100644 (file)
@@ -38,12 +38,10 @@ int legacy_camera_get_video_caps(camera_h camera, char **caps)
        int ret;
        camera_s *handle = (camera_s *)camera;
 
-#ifdef HAVE_WAYLAND
        ret = mm_camcorder_get_video_caps(handle->mm_handle, caps);
-       if(ret != MM_ERROR_NONE) {
+       if (ret != MM_ERROR_NONE) {
                return __convert_camera_error_code(__func__, ret);
        }
-#endif /* HAVE_WAYLAND */
 
        return CAMERA_ERROR_NONE;
 }
index 25cdcdb..ac4a5fe 100644 (file)
@@ -26,13 +26,6 @@ IF("${ARCH}" STREQUAL "arm")
     ADD_DEFINITIONS("-DTARGET")
 ENDIF("${ARCH}" STREQUAL "arm")
 
-IF(WAYLAND_SUPPORT)
-    ADD_DEFINITIONS("-DHAVE_WAYLAND")
-ENDIF(WAYLAND_SUPPORT)
-IF(X11_SUPPORT)
-    ADD_DEFINITIONS("-DHAVE_X11")
-ENDIF(X11_SUPPORT)
-
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
index f16ea6c..0a40047 100644 (file)
@@ -182,6 +182,8 @@ typedef enum {
        MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA,
        MUSE_CAMERA_API_RETURN_BUFFER,
        MUSE_CAMERA_API_PREVIEW_CB_RETURN, //145
+       MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT,
+       MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT,
        MUSE_CAMERA_API_MAX
 } muse_camera_api_e;
 
index a12a5ec..1637990 100644 (file)
@@ -44,9 +44,7 @@ typedef struct {
        GMutex preview_cb_lock;
        GCond preview_cb_cond;
        guint preview_cb_flag;
-#ifdef HAVE_WAYLAND
        MMCamWaylandInfo wl_info;
-#endif /* HAVE_WAYLAND */
 } muse_camera_handle_s;
 
 
index d99e061..8e61bd4 100644 (file)
@@ -1444,9 +1444,7 @@ int camera_dispatcher_set_display(muse_module_h module)
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
-#ifdef HAVE_WAYLAND
        MMCamWaylandInfo *wl_info = NULL;
-#endif /* HAVE_WAYLAND */
        camera_display_type_e type = CAMERA_DISPLAY_TYPE_NONE;
        camera_h camera = NULL;;
 
@@ -1459,7 +1457,7 @@ int camera_dispatcher_set_display(muse_module_h module)
        muse_camera_msg_get(type, muse_core_client_get_msg(module));
 
        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));
@@ -1472,7 +1470,6 @@ int camera_dispatcher_set_display(muse_module_h module)
 
                muse_camera_msg_return(api, class, ret, module);
        } else {
-#endif /* HAVE_WAYLAND */
                LOGD("NOT overlay type. set NONE type.");
 
                if (type == CAMERA_DISPLAY_TYPE_EVAS) {
@@ -1487,9 +1484,7 @@ int camera_dispatcher_set_display(muse_module_h module)
                ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_NONE, NULL);
 
                muse_camera_msg_return(api, class, ret, module);
-#ifdef HAVE_WAYLAND
        }
-#endif /* HAVE_WAYLAND */
 
        return MUSE_CAMERA_ERROR_NONE;
 }
@@ -4390,6 +4385,47 @@ int camera_dispatcher_preview_cb_return(muse_module_h module)
        return MUSE_CAMERA_ERROR_NONE;
 }
 
+int camera_dispatcher_set_display_reuse_hint(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       int set_hint = 0;
+       muse_camera_handle_s *muse_camera = NULL;
+       muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       muse_camera_msg_get(set_hint, muse_core_client_get_msg(module));
+
+       LOGD("set hint : %d", set_hint);
+
+       ret = legacy_camera_set_display_reuse_hint(muse_camera->camera_handle, (bool)set_hint);
+
+       muse_camera_msg_return(api, class, ret, module);
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
+
+int camera_dispatcher_get_display_reuse_hint(muse_module_h module)
+{
+       int ret = CAMERA_ERROR_NONE;
+       int get_hint = 0;
+       muse_camera_handle_s *muse_camera = NULL;
+       muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
+       muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
+
+       muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
+
+       ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_hint);
+       if (ret == CAMERA_ERROR_NONE) {
+               LOGD("get hint : %d", get_hint);
+               muse_camera_msg_return1(api, class, ret, module, INT, get_hint);
+       } else {
+               muse_camera_msg_return(api, class, ret, module);
+       }
+
+       return MUSE_CAMERA_ERROR_NONE;
+}
 
 int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
        camera_dispatcher_create, /* MUSE_CAMERA_API_CREATE */
@@ -4538,6 +4574,8 @@ int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
        camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */
        camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER, */
        camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN, */
+       camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT, */
+       camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT, */
 };
 
 
index 2de8658..618cead 100644 (file)
@@ -1,9 +1,6 @@
-%bcond_with wayland
-%bcond_with x
-
 Name:       mmsvc-camera
 Summary:    A Camera module for muse server
-Version:    0.2.40
+Version:    0.2.41
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -14,12 +11,7 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(mused)
 BuildRequires:  pkgconfig(mm-camcorder)
 BuildRequires:  pkgconfig(capi-base-common)
-%if %{with x}
-BuildRequires:  pkgconfig(ecore-x)
-%endif
-%if %{with wayland}
 BuildRequires:  pkgconfig(ecore-wayland)
-%endif
 BuildRequires:  pkgconfig(libtbm)
 BuildRequires:  pkgconfig(evas)
 BuildRequires:  pkgconfig(ecore)
@@ -52,17 +44,7 @@ Development related files of a Camera module for muse server.
 export CFLAGS+=" -DTIZEN_DEBUG_ENABLE"
 %endif
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
-%if %{with wayland}
-       -DWAYLAND_SUPPORT=On \
-%else
-       -DWAYLAND_SUPPORT=Off \
-%endif
-%if %{with x}
-       -DX11_SUPPORT=On
-%else
-       -DX11_SUPPORT=Off
-%endif
+%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
 
 make %{?jobs:-j%jobs}