summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2015-04-22 17:06:07 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2015-04-24 16:57:22 +0900
commitf04c5250b9d88de4e9bd4f796ec6b8b013c46abd (patch)
tree00318698497be773370cfc1fc00d7addce7b8661
parent35c0cbe525ced1bc6dc4d2abc4a16c26247b2751 (diff)
downloadcamera-f04c5250b9d88de4e9bd4f796ec6b8b013c46abd.tar.gz
camera-f04c5250b9d88de4e9bd4f796ec6b8b013c46abd.tar.bz2
camera-f04c5250b9d88de4e9bd4f796ec6b8b013c46abd.zip
Change-Id: Iff3ede498e3ccfd081453c2f535e4582e5ab9e50 Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rwxr-xr-xCMakeLists.txt7
-rw-r--r--include/camera_private.h3
-rwxr-xr-xpackaging/capi-media-camera.spec18
-rw-r--r--src/camera.c53
4 files changed, 76 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4909f31..c6cb71d 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,13 @@ 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")
diff --git a/include/camera_private.h b/include/camera_private.h
index 0e27f59..e5f43b2 100644
--- a/include/camera_private.h
+++ b/include/camera_private.h
@@ -55,6 +55,9 @@ 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;
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index 58832b8..52d227a 100755
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -1,6 +1,9 @@
+%bcond_with wayland
+%bcond_with x
+
Name: capi-media-camera
Summary: A Camera library in Tizen C API
-Version: 0.2.0
+Version: 0.2.1
Release: 0
Group: Multimedia/API
License: Apache-2.0
@@ -46,7 +49,18 @@ Development related files.
export CFLAGS+=" -DTIZEN_DEBUG_ENABLE"
%endif
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%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
+
make %{?jobs:-j%jobs}
diff --git a/src/camera.c b/src/camera.c
index 6d6cdb9..7f2b647 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -724,7 +724,8 @@ int camera_create(camera_device_e device, camera_h* camera){
return __convert_camera_error_code(__func__, ret);
}
- int camera_destroy(camera_h camera){
+ int camera_destroy(camera_h camera)
+{
if( camera == NULL ){
LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
return CAMERA_ERROR_INVALID_PARAMETER;
@@ -749,11 +750,16 @@ int camera_create(camera_device_e device, 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);
}
return __convert_camera_error_code(__func__, ret);
-
}
int camera_start_preview(camera_h camera){
@@ -1222,7 +1228,9 @@ int camera_cancel_focusing(camera_h camera){
handle->on_continuous_focusing = false;
return __convert_camera_error_code(__func__, mm_camcorder_stop_focusing(handle->mm_handle));
}
-int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display){
+
+int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
+{
int ret = MM_ERROR_NONE;
int set_surface = MM_DISPLAY_SURFACE_X;
void *set_handle = NULL;
@@ -1255,12 +1263,51 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ
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_X;
+ 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_X;
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;