[capi-media-camera] Add for muse Daemonizer 01/46101/4
authorsejong123.park <sejong123.park@samsung.com>
Sun, 16 Aug 2015 19:37:25 +0000 (04:37 +0900)
committersejong123.park <sejong123.park@samsung.com>
Sun, 16 Aug 2015 19:48:24 +0000 (04:48 +0900)
Change-Id:If4bcea0bc3c21e0786a830264d2dd2429b75d216
Signed-off-by: sejong123.park <sejong123.park@samsung.com>
include/camera_internal.h
packaging/capi-media-camera.spec
src/camera_internal.c

index b04c992..ca47b96 100644 (file)
@@ -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);
+
+/**
  * @}
  */
 
index bb36929..aecfb06 100755 (executable)
@@ -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
-
index 026e53c..9db01a2 100644 (file)
@@ -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;
+}
+
+