summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsejong123.park <sejong123.park@samsung.com>2015-08-17 04:37:25 +0900
committersejong123.park <sejong123.park@samsung.com>2015-08-17 04:48:24 +0900
commitd2743fe219c79f48172ca6c65b40da047c528179 (patch)
tree08fbda517ec1ca0bd9b450b220296d9f3feb8b7a
parent9f9b7f0b1c84c648f6e62ff10cc12b6e02e8ebac (diff)
downloadcamera-d2743fe219c79f48172ca6c65b40da047c528179.tar.gz
camera-d2743fe219c79f48172ca6c65b40da047c528179.tar.bz2
camera-d2743fe219c79f48172ca6c65b40da047c528179.zip
[capi-media-camera] Add for muse Daemonizer
Change-Id:If4bcea0bc3c21e0786a830264d2dd2429b75d216 Signed-off-by: sejong123.park <sejong123.park@samsung.com>
-rw-r--r--include/camera_internal.h58
-rwxr-xr-xpackaging/capi-media-camera.spec5
-rw-r--r--src/camera_internal.c85
3 files changed, 144 insertions, 4 deletions
diff --git a/include/camera_internal.h b/include/camera_internal.h
index b04c992..ca47b96 100644
--- a/include/camera_internal.h
+++ b/include/camera_internal.h
@@ -219,6 +219,64 @@ int camera_get_x11_display_mode(camera_h camera, camera_display_mode_e *mode);
int camera_set_x11_display_pixmap(camera_h camera, camera_x11_pixmap_updated_cb callback, void *user_data);
/**
+ * @brief Registers a callback function to be invoked when camera needs updated xid.
+ * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE
+ * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY.
+ * @param[in] camera The handle to the camera
+ * @param[in] type The type of the display
+ * @param[in] display_handle The handle of the created display
+ *
+ * @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 Invalid operation
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create().
+ * @post camera_set_mused_display() will be invoked.
+ *
+ * @see camera_set_mused_display()
+ */
+int camera_set_mused_display(camera_h camera, camera_display_type_e type, void *display_handle);
+
+/**
+ * @brief Registers a callback function to be invoked when camera needs updated xid.
+ * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE
+ * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY.
+ * @param[in] camera The handle to the camera
+ * @param[in] caps The caps information of the server's video element
+ *
+ * @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 Invalid operation
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create().
+ * @post camera_get_video_caps() will be invoked.
+ *
+ * @see camera_get_video_caps()
+ */
+int camera_get_video_caps(camera_h camera, char **caps);
+
+/**
+ * @brief Registers a callback function to be invoked when camera needs updated xid.
+ * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE
+ * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY.
+ * @param[in] camera The handle to the camera
+ * @param[in] socket_path The socket file path for the display data ipc
+ *
+ * @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 Invalid operation
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create().
+ * @post camera_set_shm_socket_path_for_mused() will be invoked.
+ *
+ * @see camera_set_shm_socket_path_for_mused()
+ */
+int camera_set_shm_socket_path_for_mused(camera_h camera, char *socket_path);
+
+/**
* @}
*/
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index bb36929..aecfb06 100755
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -3,7 +3,7 @@
Name: capi-media-camera
Summary: A Camera library in Tizen C API
-Version: 0.2.3
+Version: 0.2.4
Release: 0
Group: Multimedia/API
License: Apache-2.0
@@ -77,16 +77,13 @@ cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name}
%postun -p /sbin/ldconfig
-
%files
%manifest capi-media-camera.manifest
%{_libdir}/libcapi-media-camera.so.*
%{_datadir}/license/%{name}
-
%files devel
%{_includedir}/media/camera.h
%{_includedir}/media/camera_internal.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-media-camera.so
-
diff --git a/src/camera_internal.c b/src/camera_internal.c
index 026e53c..9db01a2 100644
--- a/src/camera_internal.c
+++ b/src/camera_internal.c
@@ -20,6 +20,7 @@
#include <string.h>
#include <mm.h>
#include <mm_camcorder.h>
+#include <mm_camcorder_mused.h>
#include <mm_types.h>
#include <camera.h>
#include <camera_internal.h>
@@ -106,3 +107,87 @@ int camera_set_x11_display_pixmap(camera_h camera, camera_x11_pixmap_updated_cb
return __convert_camera_error_code(__func__, ret);
}
+int camera_set_mused_display(camera_h camera, camera_display_type_e type, void *display_handle)
+{
+ int ret = MM_ERROR_NONE;
+ int set_surface = MM_DISPLAY_SURFACE_X;
+ camera_s *handle = NULL;
+ void *set_handle = NULL;
+
+ if (camera == NULL) {
+ LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (type != CAMERA_DISPLAY_TYPE_NONE && display_handle == NULL) {
+ LOGE("display type[%d] is not NONE, but display handle is NULL", type);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ handle = (camera_s *)camera;
+ handle->display_type = type;
+ handle->display_handle = display_handle;
+
+ switch(type) {
+ case CAMERA_DISPLAY_TYPE_OVERLAY:
+ set_surface = MM_DISPLAY_SURFACE_X;
+ set_handle = &(handle->display_handle);
+ LOGD("display type OVERLAY : handle %p", (int)handle->display_handle);
+ break;
+ case CAMERA_DISPLAY_TYPE_EVAS:
+ set_surface = MM_DISPLAY_SURFACE_EVAS;
+ set_handle = display_handle;
+ break;
+ case CAMERA_DISPLAY_TYPE_NONE:
+ default:
+ set_surface = MM_DISPLAY_SURFACE_NULL;
+ handle->display_handle = NULL;
+ break;
+ }
+
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_DISPLAY_DEVICE, MM_DISPLAY_DEVICE_MAINLCD,
+ MMCAM_DISPLAY_SURFACE, set_surface,
+ NULL);
+
+ if (ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE) {
+ ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *),
+ NULL);
+ }
+
+ return __convert_camera_error_code(__func__, ret);
+}
+
+int camera_get_video_caps(camera_h camera, char **caps)
+{
+ int ret;
+ camera_s *handle = (camera_s *)camera;
+
+ ret = mm_camcorder_mused_get_video_caps(handle->mm_handle, caps);
+ if(ret != MM_ERROR_NONE) {
+ return __convert_camera_error_code(__func__, ret);
+ }
+
+ return CAMERA_ERROR_NONE;
+}
+
+int camera_set_shm_socket_path_for_mused(camera_h camera, char *socket_path)
+{
+ int ret;
+ camera_s *handle = (camera_s *)camera;
+
+ LOGE("var : %s", socket_path);
+ mm_camcorder_set_attributes(handle->mm_handle, NULL,
+ MMCAM_DISPLAY_SHM_SOCKET_PATH, socket_path, strlen(socket_path),
+ NULL);
+
+ if (ret != MM_ERROR_NONE) {
+ LOGE("error set shm socket path attribute 0x%x", ret);
+ return __convert_camera_error_code(__func__, ret);
+ }
+
+ return CAMERA_ERROR_NONE;
+}
+
+