#include <string.h>
#include <mm.h>
#include <mm_camcorder.h>
+#ifdef HAVE_WAYLAND
+#include <mm_camcorder_mused.h>
+#endif /* HAVE_WAYLAND */
#include <mm_types.h>
#include <camera.h>
#include <camera_internal.h>
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;
+
+#ifdef HAVE_WAYLAND
+ ret = mm_camcorder_mused_get_video_caps(handle->mm_handle, caps);
+ if(ret != MM_ERROR_NONE) {
+ return __convert_camera_error_code(__func__, ret);
+ }
+#endif /* HAVE_WAYLAND */
+
+ return CAMERA_ERROR_NONE;
+}
+
+int camera_set_shm_socket_path_for_mused(camera_h camera, char *socket_path)
+{
+ int ret = MM_ERROR_NONE;
+ camera_s *handle = (camera_s *)camera;
+
+ if (camera == NULL) {
+ LOGE("NULL handle");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (socket_path == NULL) {
+ LOGE("NULL pointer for socket_path");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("var : %s", socket_path);
+
+ ret = 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;
+}
+
+