#include <muse_core.h>
#include <muse_client.h>
#include <dlog.h>
-#include <Elementary.h>
#include <tbm_surface_internal.h>
-#include <Evas.h>
-#include <Ecore_Wayland.h>
-#include <wayland-client.h>
-#include <tizen-extension-client-protocol.h>
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
-#include <mm_evas_renderer.h>
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
#include <gio/gio.h>
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "TIZEN_N_CAMERA"
+#define MODULE_NAME "camera"
/* for device changed callback */
static GMutex g_cam_dev_state_changed_cb_lock;
static int g_cam_dev_state_changed_cb_id;
static GDBusConnection *g_cam_dev_state_changed_cb_conn;
static guint g_cam_dev_state_changed_cb_subscribe_id;
+static GMutex g_cam_idle_event_lock;
-
-static void __global(void *data, struct wl_registry *registry,
- uint32_t name, const char *interface, uint32_t version)
-{
- struct tizen_surface **tz_surface = NULL;
-
- if (!data) {
- LOGE("NULL data");
- return;
- }
-
- tz_surface = (struct tizen_surface **)data;
-
- if (!interface) {
- LOGW("NULL interface");
- return;
- }
-
- /*LOGI("interface %s", interface);*/
-
- if (strcmp(interface, "tizen_surface") == 0) {
- LOGD("binding tizen surface for wayland");
-
- *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
- if (*tz_surface == NULL)
- LOGE("failed to bind");
-
- LOGD("done");
- }
-
- return;
-}
-
-static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
-{
- LOGD("enter");
- return;
-}
-
-static const struct wl_registry_listener _camera_wl_registry_listener = {
- __global,
- __global_remove
-};
-
-void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
-{
- if (!data) {
- LOGE("NULL data");
- return;
- }
-
- *((unsigned int *)data) = id;
-
- LOGD("[CLIENT] got parent_id [%u] from server", id);
-
- return;
-}
-
-static const struct tizen_resource_listener _camera_tz_resource_listener = {
- __parent_id_getter
-};
-
-int _camera_get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
+static void _camera_msg_send(int api, int *fds, camera_cb_info_s *cb_info,
+ int *ret, int timeout);
+static void _camera_msg_send_param1(int api, camera_cb_info_s *cb_info,
+ int *ret, camera_msg_param *param, int timeout);
+static void _camera_msg_send_param2_int(int api, camera_cb_info_s *cb_info,
+ int *ret, camera_msg_param *param0, camera_msg_param *param1, int timeout);
+static void _camera_msg_return_buffer(int ret_fd, camera_cb_info_s *cb_info);
+static bool _camera_import_tbm_fd(tbm_bufmgr bufmgr, int fd, tbm_bo *bo, tbm_bo_handle *bo_handle);
+static void _camera_release_imported_bo(tbm_bo *bo);
+static void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_fd,
+ tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame);
+static int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
+ camera_media_packet_data *mp_data, media_packet_h *packet);
+static int _camera_media_packet_data_create(int ret_fd, int *tfd, int num_buffer_fd, tbm_bo bo,
+ tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data);
+static void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info);
+static gboolean _camera_allocate_preview_buffer(camera_h camera);
+static void _camera_release_preview_buffer(camera_h camera);
+
+
+static gboolean _camera_allocate_preview_buffer(camera_h camera)
{
+ int i = 0;
int ret = CAMERA_ERROR_NONE;
- Ecore_Wl_Window *window = NULL;
- struct wl_display *display = NULL;
- struct wl_display *display_wrapper = NULL;
- struct wl_surface *surface = NULL;
- struct wl_registry *registry = NULL;
- struct wl_event_queue *queue = NULL;
- struct tizen_surface *tz_surface = NULL;
- struct tizen_resource *tz_resource = NULL;
+ int format = CAMERA_PIXEL_FORMAT_INVALID;
+ int width = 0;
+ int height = 0;
+ int buffer_size = 0;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ camera_cb_info_s *cb_info = NULL;
- if (!obj || !wl_info) {
- LOGE("NULL parameter %p %p", obj, wl_info);
- return CAMERA_ERROR_INVALID_OPERATION;
+ if (!pc || !pc->cb_info) {
+ LOGE("invalid pointer %p %p", pc, pc ? pc->cb_info : NULL);
+ return FALSE;
}
- window = elm_win_wl_window_get(obj);
- if (!window) {
- LOGE("failed to get wayland window");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
- }
+ cb_info = pc->cb_info;
- ecore_wl_window_video_has(window, EINA_TRUE);
+ LOGD("Enter");
- surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
- if (!surface) {
- LOGE("failed to get wayland surface");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
+ /* get preview info and calculate size */
+ ret = camera_get_preview_format(camera, &format);
+ if (ret != CAMERA_ERROR_NONE) {
+ LOGE("get preview format failed 0x%x", ret);
+ return FALSE;
}
- display = (struct wl_display *)ecore_wl_display_get();
- if (!display) {
- LOGE("failed to get wayland display");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
+ ret = camera_get_preview_resolution(camera, &width, &height);
+ if (ret != CAMERA_ERROR_NONE) {
+ LOGE("get preview resolution failed 0x%x", ret);
+ return FALSE;
}
- display_wrapper = wl_proxy_create_wrapper(display);
- if (!display_wrapper) {
- LOGE("failed to create wl display wrapper");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
- }
+ LOGD("preview %dx%d, format %d", width, height, format);
- queue = wl_display_create_queue(display);
- if (!queue) {
- LOGE("failed to create wl display queue");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
+ switch (format) {
+ case CAMERA_PIXEL_FORMAT_INVZ:
+ buffer_size = width * height;
+ break;
+ case CAMERA_PIXEL_FORMAT_NV12:
+ case CAMERA_PIXEL_FORMAT_I420:
+ buffer_size = (width * height * 3) >> 1;
+ break;
+ case CAMERA_PIXEL_FORMAT_YUYV:
+ case CAMERA_PIXEL_FORMAT_UYVY:
+ buffer_size = width * height * 2;
+ break;
+ default:
+ LOGE("unhandled format %d", format);
+ goto _ALLOCATE_PREVIEW_BUFFER_FAILED;
}
- wl_proxy_set_queue((struct wl_proxy *)display_wrapper, queue);
-
- registry = wl_display_get_registry(display_wrapper);
- if (!registry) {
- LOGE("failed to get wayland registry");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
- }
+ LOGD("buffer size %d, num %d", buffer_size, MUSE_NUM_FD);
- wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
+ for (i = 0 ; i < MUSE_NUM_FD ; i++) {
+ cb_info->bos[i] = tbm_bo_alloc(cb_info->bufmgr, buffer_size, TBM_BO_DEFAULT);
+ if (!cb_info->bos[i]) {
+ LOGE("bo alloc failed [%d,i:%d]", buffer_size, i);
+ goto _ALLOCATE_PREVIEW_BUFFER_FAILED;
+ }
- wl_display_dispatch_queue(display, queue);
- wl_display_roundtrip_queue(display, queue);
+ cb_info->fds[i] = tbm_bo_export_fd(cb_info->bos[i]);
+ if (cb_info->fds[i] < 0) {
+ LOGE("export fd failed [%d,i:%d] errno %d", buffer_size, i, errno);
+ goto _ALLOCATE_PREVIEW_BUFFER_FAILED;
+ }
- if (!tz_surface) {
- LOGE("failed to get tizen surface");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
+ LOGD("bo %p, fd %d", cb_info->bos[i], cb_info->fds[i]);
}
- /* Get parent_id which is unique in a entire systemw. */
- tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
- if (!tz_resource) {
- LOGE("failed to get tizen resurce");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- goto _DONE;
- }
+ LOGD("Done");
- wl_info->parent_id = 0;
+ return TRUE;
- tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
+_ALLOCATE_PREVIEW_BUFFER_FAILED:
+ _camera_release_preview_buffer(camera);
+ return FALSE;
+}
- wl_display_roundtrip_queue(display, queue);
- if (wl_info->parent_id > 0) {
- int rotation = 0;
- Ecore_Evas *ecore_evas = NULL;
- ret = CAMERA_ERROR_NONE;
+static void _camera_release_preview_buffer(camera_h camera)
+{
+ int i = 0;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ camera_cb_info_s *cb_info = NULL;
- wl_info->evas_obj = obj;
+ if (!pc || !pc->cb_info) {
+ LOGE("invalid pointer %p %p", pc, pc ? pc->cb_info : NULL);
+ return;
+ }
- evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
- &wl_info->window_width, &wl_info->window_height);
+ LOGD("Enter");
- ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
- if (ecore_evas) {
- rotation = ecore_evas_rotation_get(ecore_evas);
- if (rotation == 90 || rotation == 270) {
- int temp = wl_info->window_width;
+ cb_info = pc->cb_info;
- LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
+ /* close exported fd and bos */
+ for (i = 0 ; i < MUSE_NUM_FD ; i++) {
+ LOGD("unref bo %p, close fd %d", cb_info->bos[i], cb_info->fds[i]);
- wl_info->window_width = wl_info->window_height;
- wl_info->window_height = temp;
- }
+ if (cb_info->bos[i]) {
+ tbm_bo_unref(cb_info->bos[i]);
+ cb_info->bos[i] = NULL;
} else {
- LOGW("failed to get ecore_evas.. skip rotation check");
+ break;
}
- LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
- wl_info->evas_obj, rotation, wl_info->parent_id,
- wl_info->window_x, wl_info->window_y,
- wl_info->window_width, wl_info->window_height);
- } else {
- ret = CAMERA_ERROR_INVALID_OPERATION;
- LOGE("failed to get parent id");
- }
-
-_DONE:
- if (tz_surface) {
- tizen_surface_destroy(tz_surface);
- tz_surface = NULL;
- }
-
- if (tz_resource) {
- tizen_resource_destroy(tz_resource);
- tz_resource = NULL;
- }
-
- if (registry) {
- wl_registry_destroy(registry);
- registry = NULL;
- }
-
- if (queue) {
- wl_event_queue_destroy(queue);
- queue = NULL;
+ if (cb_info->fds[i] >= 0) {
+ close(cb_info->fds[i]);
+ cb_info->fds[i] = -1;
+ }
}
- if (display_wrapper) {
- wl_proxy_wrapper_destroy(display_wrapper);
- display_wrapper = NULL;
- }
+ LOGD("Done");
- return ret;
+ return;
}
}
-static int _camera_import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
+static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv_msg, int *tfd)
+{
+ int i = 0;
+ int ret = 0;
+ int ret_fd = -1;
+ int preview_fd = -1;
+ int num_buffer_fd = 0;
+ unsigned char *buf_pos = NULL;
+
+ tbm_bo bo = NULL;
+ tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
+ tbm_bo_handle bo_handle = {.ptr = NULL};
+ tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
+ tbm_bo data_bo = NULL;
+ tbm_bo_handle data_bo_handle = {.ptr = NULL};
+
+ camera_msg_param param;
+ camera_preview_data_s frame;
+ camera_stream_data_s *stream = NULL;
+ camera_media_packet_data *mp_data = NULL;
+ media_packet_h pkt = NULL;
+ media_packet_h pkt_evas = NULL;
+
+ /* tfd[0]: MMCamcorderVideoStreamDataType
+ tfd[1]: data_bo or zero copy bo[0]
+ tfd[2]: zero copy bo[1]
+ tfd[3]: zero copy bo[2] */
+
+ if (!cb_info || !recv_msg || !tfd) {
+ LOGE("invalid param %p %p %p", cb_info, recv_msg, tfd);
+ return;
+ }
+
+ muse_camera_msg_get(preview_fd, recv_msg);
+ muse_camera_msg_get(num_buffer_fd, recv_msg);
+
+ /*LOGD("preview_fd %d, num_buffer_fd %d", preview_fd, num_buffer_fd);*/
+
+ memset(&frame, 0x0, sizeof(camera_preview_data_s));
+
+ if (tfd[0] < 0) {
+ LOGE("invalid fd %d", tfd[0]);
+ return;
+ }
+
+ ret_fd = preview_fd;
+ CAMERA_MSG_PARAM_SET(param, INT, ret_fd);
+
+ if (num_buffer_fd < 0 || num_buffer_fd > BUFFER_MAX_PLANE_NUM) {
+ LOGE("invalid num buffer fd %d", num_buffer_fd);
+ goto _PREVIEW_CB_HANDLER_DONE;
+ }
+
+ if (num_buffer_fd == 0 && tfd[1] >= 0) {
+ /* import tbm data_bo and get virtual address */
+ if (!_camera_import_tbm_fd(cb_info->bufmgr, tfd[1], &data_bo, &data_bo_handle)) {
+ LOGE("failed to import data fd %d", tfd[1]);
+ goto _PREVIEW_CB_HANDLER_DONE;
+ }
+ }
+
+ /* import tbm bo and get virtual address */
+ if (!_camera_import_tbm_fd(cb_info->bufmgr, tfd[0], &bo, &bo_handle)) {
+ LOGE("failed to import fd %d", tfd[0]);
+ goto _PREVIEW_CB_HANDLER_DONE;
+ }
+
+ buf_pos = (unsigned char *)bo_handle.ptr;
+
+ /* get stream info */
+ stream = (camera_stream_data_s *)buf_pos;
+
+ for (i = 0 ; i < num_buffer_fd ; i++) {
+ /* import buffer bo and get virtual address */
+ if (!_camera_import_tbm_fd(cb_info->bufmgr, tfd[i + 1], &buffer_bo[i], &buffer_bo_handle[i])) {
+ LOGE("failed to import buffer fd %d", tfd[i + 1]);
+ goto _PREVIEW_CB_HANDLER_DONE;
+ }
+ }
+
+ /* call preview callback */
+ if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
+ _camera_preview_frame_create(stream, num_buffer_fd, buffer_bo_handle, &data_bo_handle, &frame);
+
+ ((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
+ cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
+ }
+
+ if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
+ ret = _camera_media_packet_data_create(ret_fd, tfd, num_buffer_fd, bo, buffer_bo, data_bo, &mp_data);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt_evas);
+ if (ret != CAMERA_ERROR_NONE) {
+ LOGE("create pkt for evas failed");
+ _camera_media_packet_data_release(mp_data, cb_info);
+ mp_data = NULL;
+ }
+ }
+ }
+
+ /* call media packet callback */
+ if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
+ ret = _camera_media_packet_data_create(ret_fd, tfd, num_buffer_fd, bo, buffer_bo, data_bo, &mp_data);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ ((camera_media_packet_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW])(pkt,
+ cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
+ } else {
+ _camera_media_packet_data_release(mp_data, cb_info);
+ mp_data = NULL;
+ }
+ }
+ }
+
+ /* call evas renderer */
+ if (pkt_evas) {
+ if (cb_info->run_evas_render) {
+ mm_display_interface_evas_render(cb_info->dp_interface, pkt_evas);
+ } else {
+ LOGW("evas renderer is stopped, skip this buffer...");
+ media_packet_destroy(pkt_evas);
+ }
+ pkt_evas = NULL;
+ }
+
+ /* send message for preview callback return */
+ if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
+ _camera_msg_send(MUSE_CAMERA_API_PREVIEW_CB_RETURN, NULL, cb_info, NULL, 0);
+
+_PREVIEW_CB_HANDLER_DONE:
+ if (mp_data == NULL) {
+ /* release imported bo */
+ for (i = 0 ; i < num_buffer_fd && i < BUFFER_MAX_PLANE_NUM ; i++)
+ _camera_release_imported_bo(&buffer_bo[i]);
+
+ /* unmap and unref tbm bo */
+ _camera_release_imported_bo(&data_bo);
+ _camera_release_imported_bo(&bo);
+
+ /* close imported fd */
+ for (i = 0 ; i < MUSE_NUM_FD ; i++) {
+ if (tfd[i] >= 0) {
+ close(tfd[i]);
+ tfd[i] = -1;
+ } else {
+ break;
+ }
+ }
+
+ /* return buffer */
+ _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
+
+ /*LOGD("return buffer Done");*/
+ }
+
+ return;
+}
+
+
+static void __camera_event_handler_capture(camera_cb_info_s *cb_info, char *recv_msg, int *tfd)
+{
+ int i = 0;
+ int tfd_index = 0;
+ int capture_fd_main = 0;
+ int capture_fd_post = 0;
+ int capture_fd_thumb = 0;
+ unsigned char *buf_pos = NULL;
+
+ camera_image_data_s *rImage = NULL;
+ camera_image_data_s *rPostview = NULL;
+ camera_image_data_s *rThumbnail = NULL;
+
+ tbm_bo bo_main = NULL;
+ tbm_bo bo_post = NULL;
+ tbm_bo bo_thumb = NULL;
+ tbm_bo_handle bo_main_handle = {.ptr = NULL};
+ tbm_bo_handle bo_post_handle = {.ptr = NULL};
+ tbm_bo_handle bo_thumb_handle = {.ptr = NULL};
+
+ if (!cb_info || !recv_msg || !tfd) {
+ LOGE("invalid param %p %p %p", cb_info, recv_msg, tfd);
+ return;
+ }
+
+ muse_camera_msg_get(capture_fd_main, recv_msg);
+ muse_camera_msg_get(capture_fd_post, recv_msg);
+ muse_camera_msg_get(capture_fd_thumb, recv_msg);
+
+ LOGD("capture fd %d %d %d, received fd %d %d %d",
+ capture_fd_main, capture_fd_post, capture_fd_thumb,
+ tfd[0], tfd[1], tfd[2]);
+
+ if (capture_fd_main < 0 || tfd[tfd_index] < 0) {
+ LOGE("invalid main fd %d %d", capture_fd_main, tfd[tfd_index]);
+ goto _CAPTURE_CB_HANDLER_DONE;
+ }
+
+ if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] == NULL) {
+ LOGW("NULL callback");
+ goto _CAPTURE_CB_HANDLER_DONE;
+ }
+
+ /* import tbm bo and get virtual address */
+ if (!_camera_import_tbm_fd(cb_info->bufmgr, tfd[tfd_index], &bo_main, &bo_main_handle)) {
+ LOGE("failed to import fd [%d] for main", tfd[tfd_index]);
+ goto _CAPTURE_CB_HANDLER_DONE;
+ }
+
+ buf_pos = (unsigned char *)bo_main_handle.ptr;
+ rImage = (camera_image_data_s *)buf_pos;
+ rImage->data = buf_pos + sizeof(camera_image_data_s);
+ if (rImage->exif && rImage->exif_size > 0) {
+ rImage->exif = rImage->data + rImage->size;
+ } else {
+ rImage->exif = NULL;
+ rImage->exif_size = 0;
+ }
+
+ LOGD("image info %dx%d, size %d, EXIF info %p, size %d",
+ rImage->width, rImage->height, rImage->size, rImage->exif, rImage->exif_size);
+
+ if (capture_fd_post >= 0) {
+ /* import tbm bo and get virtual address */
+ tfd_index++;
+ if (_camera_import_tbm_fd(cb_info->bufmgr, tfd[tfd_index], &bo_post, &bo_post_handle)) {
+ buf_pos = (unsigned char *)bo_post_handle.ptr;
+ rPostview = (camera_image_data_s *)buf_pos;
+ LOGD("rPostview->size : %d", rPostview->size);
+ rPostview->data = buf_pos + sizeof(camera_image_data_s);
+ } else {
+ LOGE("failed to import fd [i:%d][%d] for postview", tfd_index, tfd[tfd_index]);
+ }
+ }
+
+ if (capture_fd_thumb >= 0) {
+ /* import tbm bo and get virtual address */
+ tfd_index++;
+ if (_camera_import_tbm_fd(cb_info->bufmgr, tfd[tfd_index], &bo_thumb, &bo_thumb_handle)) {
+ buf_pos = (unsigned char *)bo_thumb_handle.ptr;
+ rThumbnail = (camera_image_data_s *)buf_pos;
+ LOGD("rThumbnail->size : %d", rThumbnail->size);
+ rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
+ } else {
+ LOGE("failed to import fd [%d] for thumbnail", tfd[tfd_index]);
+ }
+ }
+
+ ((camera_capturing_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE])(rImage,
+ rPostview, rThumbnail, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE]);
+
+_CAPTURE_CB_HANDLER_DONE:
+ /* return buffer */
+ if (capture_fd_main >= 0) {
+ _camera_release_imported_bo(&bo_main);
+ _camera_msg_return_buffer(capture_fd_main, cb_info);
+ }
+
+ if (capture_fd_post >= 0) {
+ _camera_release_imported_bo(&bo_post);
+ _camera_msg_return_buffer(capture_fd_post, cb_info);
+ }
+
+ if (capture_fd_thumb >= 0) {
+ _camera_release_imported_bo(&bo_thumb);
+ _camera_msg_return_buffer(capture_fd_thumb, cb_info);
+ }
+
+ for (i = 0 ; i < MUSE_NUM_FD ; i++) {
+ if (tfd[i] >= 0) {
+ LOGD("close %d", tfd[i]);
+ close(tfd[i]);
+ tfd[i] = -1;
+ } else {
+ break;
+ }
+ }
+
+ LOGD("return buffer done");
+
+ return;
+}
+
+
+static void __camera_event_handler_face_detection(camera_cb_info_s *cb_info, char *recv_msg, int *tfd)
+{
+ int count = 0;
+ int face_fd = -1;
+ camera_detected_face_s *faces = NULL;
+
+ tbm_bo bo = NULL;
+ tbm_bo_handle bo_handle = {.ptr = NULL};
+
+ if (!cb_info || !recv_msg || !tfd) {
+ LOGE("invalid param %p %p %p", cb_info, recv_msg, tfd);
+ return;
+ }
+
+ muse_camera_msg_get(count, recv_msg);
+ muse_camera_msg_get(face_fd, recv_msg);
+
+ if (count >= 0 && cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]) {
+ LOGD("FACE_DETECTION - count %d, fd %d", count, tfd[0]);
+
+ if (tfd[0] >= 0) {
+ if (_camera_import_tbm_fd(cb_info->bufmgr, tfd[0], &bo, &bo_handle)) {
+ /* set face info */
+ faces = bo_handle.ptr;
+ }
+
+ close(tfd[0]);
+ tfd[0] = -1;
+ }
+
+ ((camera_face_detected_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION])(faces,
+ count, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+
+ /* release bo */
+ _camera_release_imported_bo(&bo);
+ } else {
+ LOGW("skip face detection message [count %d, fd %d, cb %p]",
+ count, tfd[0], cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
+ }
+
+ /* return buffer */
+ _camera_msg_return_buffer(face_fd, cb_info);
+
+ return;
+}
+
+
+static bool _camera_import_tbm_fd(tbm_bufmgr bufmgr, int fd, tbm_bo *bo, tbm_bo_handle *bo_handle)
{
tbm_bo tmp_bo = NULL;
tbm_bo_handle tmp_bo_handle = {NULL, };
- if (!bufmgr || !bo || !bo_handle || !tbm_key) {
- LOGE("invalid parameter - %p %p %p, key %d",
- bufmgr, bo, bo_handle, tbm_key);
+ if (!bufmgr || !bo || !bo_handle || fd < 0) {
+ LOGE("invalid parameter - %p %p %p, fd %d",
+ bufmgr, bo, bo_handle, fd);
return false;
}
- tmp_bo = tbm_bo_import(bufmgr, tbm_key);
+ tmp_bo = tbm_bo_import_fd(bufmgr, (tbm_fd)fd);
if (tmp_bo == NULL) {
- LOGE("import failed - key %d", tbm_key);
+ LOGE("import failed - fd %d", fd);
return false;
}
g_mutex_unlock(&(cb_info->api_mutex[api]));
- if (ret != CAMERA_ERROR_NONE) {
+ if (ret != CAMERA_ERROR_NONE)
LOGE("api %d : error 0x%x", api, ret);
- if (ret == CAMERA_ERROR_SOUND_POLICY)
- LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY is deprecated and will be removed from next release.");
- else if (ret == CAMERA_ERROR_SOUND_POLICY_BY_CALL)
- LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_CALL is deprecated and will be removed from next release.");
- else if (ret == CAMERA_ERROR_SOUND_POLICY_BY_ALARM)
- LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_ALARM is deprecated and will be removed from next release.");
- }
-
return ret;
}
-static void _camera_msg_send(int api, camera_cb_info_s *cb_info,
+static void _camera_msg_send(int api, int *fds, camera_cb_info_s *cb_info,
int *ret, int timeout)
{
int send_ret = 0;
__camera_update_api_waiting(cb_info, api, 1);
g_mutex_lock(&cb_info->fd_lock);
- send_ret = muse_core_msg_send(cb_info->fd, msg);
+ send_ret = muse_core_msg_send_fd(cb_info->fd, fds, msg);
g_mutex_unlock(&cb_info->fd_lock);
}
int *ret, camera_msg_param *param, int timeout)
{
int send_ret = 0;
+ int array_length;
char *msg = NULL;
if (!cb_info || !param) {
param->type, param->name, param->value.value_STRING,
NULL);
break;
+ case MUSE_TYPE_ARRAY:
+ array_length = param->value_size / sizeof(int) + \
+ (param->value_size % sizeof(int) ? 1 : 0);
+
+ msg = muse_core_msg_new(api,
+ param->type, param->name, array_length, param->value.value_ARRAY,
+ NULL);
+ break;
default:
LOGE("unknown type %d", param->type);
break;
}
+static void _camera_msg_send_param2_int(int api, camera_cb_info_s *cb_info,
+ int *ret, camera_msg_param *param0, camera_msg_param *param1, int timeout)
+{
+ int func_ret = CAMERA_ERROR_NONE;
+ int send_ret = 0;
+ char *msg = NULL;
+
+ if (!cb_info || !param0 || !param1) {
+ LOGE("invalid ptr %p %p %p : api %d",
+ cb_info, param0, param1, api);
+ func_ret = CAMERA_ERROR_INVALID_PARAMETER;
+ goto _SEND_PARAM2_INT_DONE;
+ }
+
+ /*LOGD("api %d, param0 [%s:%d], param1 [%s:%d]",
+ api,
+ param0->name, param0->value.value_INT,
+ param1->name, param1->value.value_INT);*/
+
+ msg = muse_core_msg_new(api,
+ param0->type, param0->name, param0->value.value_INT,
+ param1->type, param1->name, param1->value.value_INT,
+ NULL);
+ if (!msg) {
+ LOGE("msg failed: api %d", api);
+ func_ret = CAMERA_ERROR_OUT_OF_MEMORY;
+ goto _SEND_PARAM2_INT_DONE;
+ }
+
+ /*LOGD("send msg [%s]", msg);*/
+
+ if (cb_info->is_server_connected) {
+ __camera_update_api_waiting(cb_info, api, 1);
+
+ g_mutex_lock(&cb_info->fd_lock);
+ send_ret = muse_core_msg_send(cb_info->fd, msg);
+ g_mutex_unlock(&cb_info->fd_lock);
+ }
+
+ if (send_ret < 0) {
+ LOGE("msg send failed");
+
+ func_ret = CAMERA_ERROR_INVALID_OPERATION;
+ } else {
+ func_ret = _camera_client_wait_for_cb_return(api, cb_info, timeout);
+ }
+
+ __camera_update_api_waiting(cb_info, api, -1);
+
+ muse_core_msg_free(msg);
+
+_SEND_PARAM2_INT_DONE:
+ if (ret)
+ *ret = func_ret;
+
+ return;
+}
+
+
+static void _camera_msg_return_buffer(int ret_fd, camera_cb_info_s *cb_info)
+{
+ camera_msg_param param;
+
+ if (ret_fd < 0) {
+ LOGW("invalid fd %d", ret_fd);
+ return;
+ }
+
+ CAMERA_MSG_PARAM_SET(param, INT, ret_fd);
+
+ _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
+
+ return;
+}
+
+
int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
{
if (in_format <= MM_PIXEL_FORMAT_INVALID ||
case MM_PIXEL_FORMAT_NV12T:
*out_format = TBM_FORMAT_NV12;
break;
+//LCOV_EXCL_START
case MM_PIXEL_FORMAT_NV16:
*out_format = TBM_FORMAT_NV16;
break;
default:
LOGE("invalid in_format %d", in_format);
return CAMERA_ERROR_INVALID_PARAMETER;
+//LCOV_EXCL_STOP
}
return CAMERA_ERROR_NONE;
case MM_PIXEL_FORMAT_NV12T:
*mimetype = MEDIA_FORMAT_NV12;
break;
+//LCOV_EXCL_START
case MM_PIXEL_FORMAT_NV16:
*mimetype = MEDIA_FORMAT_NV16;
break;
default:
LOGE("invalid in_format %d", in_format);
return CAMERA_ERROR_INVALID_PARAMETER;
+//LCOV_EXCL_STOP
}
return CAMERA_ERROR_NONE;
}
-void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
+static void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_fd,
tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
{
int total_size = 0;
frame->timestamp = stream->timestamp;
frame->num_of_planes = stream->num_planes;
- if (num_buffer_key == 0) {
+ if (num_buffer_fd == 0) {
+//LCOV_EXCL_START
/* non-zero copy */
if (!data_bo_handle || !data_bo_handle->ptr) {
LOGE("NULL pointer");
frame->data.encoded_plane.data = buf_pos;
frame->data.encoded_plane.size = stream->data.encoded.length_data;
total_size = stream->data.encoded.length_data;
+ } else if (stream->format == MM_PIXEL_FORMAT_INVZ) {
+ frame->data.depth_plane.data = buf_pos;
+ frame->data.depth_plane.size = stream->data.depth.length_data;
+ total_size = stream->data.depth.length_data;
+ } else if (stream->format == MM_PIXEL_FORMAT_RGBA ||
+ stream->format == MM_PIXEL_FORMAT_ARGB) {
+ frame->data.rgb_plane.data = buf_pos;
+ frame->data.rgb_plane.size = stream->data.rgb.length_data;
+ total_size = stream->data.rgb.length_data;
} else {
switch (stream->num_planes) {
case 1:
break;
}
}
+//LCOV_EXCL_STOP
} else {
/* zero copy */
switch (stream->num_planes) {
+//LCOV_EXCL_START
case 1:
frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
frame->data.single_plane.size = stream->data.yuv420.length_yuv;
total_size = stream->data.yuv420.length_yuv;
break;
+//LCOV_EXCL_STOP
case 2:
frame->data.double_plane.y = buffer_bo_handle[0].ptr;
- if (stream->num_planes == (unsigned int)num_buffer_key)
+ if (stream->num_planes == (unsigned int)num_buffer_fd)
frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
else
frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
stream->data.yuv420sp.length_uv;
break;
case 3:
+//LCOV_EXCL_START
frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
- if (stream->num_planes == (unsigned int)num_buffer_key) {
+ if (stream->num_planes == (unsigned int)num_buffer_fd) {
frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
} else {
stream->data.yuv420p.length_u + \
stream->data.yuv420p.length_v;
break;
+//LCOV_EXCL_STOP
default:
break;
}
return;
}
-int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
+static int _camera_media_packet_data_create(int ret_fd, int *tfd, int num_buffer_fd, tbm_bo bo,
tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data)
{
int i = 0;
int ret = CAMERA_ERROR_NONE;
camera_media_packet_data *tmp_mp_data = NULL;
+ if (!tfd) {
+ LOGE("NULL tfd");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
if (*mp_data == NULL) {
tmp_mp_data = g_new0(camera_media_packet_data, 1);
if (tmp_mp_data) {
- tmp_mp_data->tbm_key = tbm_key;
- tmp_mp_data->num_buffer_key = num_buffer_key;
+ tmp_mp_data->ret_fd = ret_fd;
+ tmp_mp_data->fd = tfd[0];
+ tmp_mp_data->num_buffer_fd = num_buffer_fd;
tmp_mp_data->bo = bo;
- tmp_mp_data->data_bo = data_bo;
- tmp_mp_data->ref_cnt++;
- for (i = 0 ; i < num_buffer_key ; i++)
- tmp_mp_data->buffer_bo[i] = buffer_bo[i];
+ if (data_bo) {
+ /* non-zero copy */
+ tmp_mp_data->data_bo = data_bo;
+ tmp_mp_data->data_fd = tfd[1];
+ } else {
+ /* zero copy */
+ for (i = 0 ; i < num_buffer_fd ; i++) {
+ tmp_mp_data->buffer_bo[i] = buffer_bo[i];
+ tmp_mp_data->buffer_fd[i] = (tbm_fd)tfd[i + 1];
+ }
+ }
+
+ tmp_mp_data->ref_cnt++;
*mp_data = tmp_mp_data;
/*LOGD("mp_data %p", tmp_mp_data);*/
return ret;
}
-void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
+static void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
{
int i = 0;
- int tbm_key = 0;
- camera_msg_param param;
if (!mp_data || !cb_info) {
LOGE("NULL pointer %p %p", mp_data, cb_info);
mp_data->ref_cnt--;
LOGD("ref count %d", mp_data->ref_cnt);
} else {
- /* release imported bo */
- for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
+ /* release imported bo and close imported fd */
+ for (i = 0 ; i < mp_data->num_buffer_fd ; i++) {
tbm_bo_unref(mp_data->buffer_bo[i]);
mp_data->buffer_bo[i] = NULL;
+
+ close(mp_data->buffer_fd[i]);
+ mp_data->buffer_fd[i] = -1;
}
- /* unref tbm bo */
+ /* unref tbm bo and close imported fd */
+ close(mp_data->fd);
+ mp_data->fd = -1;
_camera_release_imported_bo(&mp_data->bo);
+
+ if (mp_data->data_bo && mp_data->data_fd >= 0) {
+ close(mp_data->data_fd);
+ mp_data->data_fd = -1;
+ }
_camera_release_imported_bo(&mp_data->data_bo);
/* return buffer */
- tbm_key = mp_data->tbm_key;
-
- CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
-
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
+ _camera_msg_return_buffer(mp_data->ret_fd, cb_info);
g_free(mp_data);
mp_data = NULL;
return;
}
-int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
+static int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
camera_media_packet_data *mp_data, media_packet_h *packet)
{
media_packet_h pkt = NULL;
uint32_t bo_format = 0;
int ret = 0;
int i = 0;
- int num_buffer_key = 0;
+ int num_buffer_fd = 0;
tbm_bo *buffer_bo = NULL;
if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
buffer_bo = mp_data->buffer_bo;
- num_buffer_key = mp_data->num_buffer_key;
+ num_buffer_fd = mp_data->num_buffer_fd;
/* create tbm surface */
for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
- if (num_buffer_key > 0) {
+ if (num_buffer_fd > 0) {
switch (bo_format) {
case TBM_FORMAT_NV12:
case TBM_FORMAT_NV21:
tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
tsurf_info.planes[0].offset = 0;
- if (num_buffer_key == 1)
+ if (num_buffer_fd == 1)
tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
break;
+//LCOV_EXCL_START
case TBM_FORMAT_YUV420:
case TBM_FORMAT_YVU420:
tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
tsurf_info.planes[0].offset = 0;
- if (num_buffer_key == 1) {
+ if (num_buffer_fd == 1) {
tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
}
break;
default:
break;
+//LCOV_EXCL_STOP
}
- tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
+ tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_fd);
} else if (mp_data->data_bo) {
+//LCOV_EXCL_START
switch (bo_format) {
case TBM_FORMAT_NV12:
case TBM_FORMAT_NV21:
}
tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, &mp_data->data_bo, 1);
+//LCOV_EXCL_STOP
}
/*LOGD("tbm surface %p", tsurf);*/
}
tsurf = NULL;
}
} else {
- LOGE("tbm surface failed. %dx%d, format %d, num_buffer_key %d, data_bo %p",
- stream->width, stream->height, stream->format, num_buffer_key, mp_data->data_bo);
+ LOGE("tbm surface failed. %dx%d, format %d, num_buffer_fd %d, data_bo %p",
+ stream->width, stream->height, stream->format, num_buffer_fd, mp_data->data_bo);
}
if (pkt) {
return MEDIA_PACKET_FINALIZE;
}
-static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
+static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event, int *tfd)
{
int param1 = 0;
int param2 = 0;
- int tbm_key = 0;
- tbm_bo bo = NULL;
- tbm_bo_handle bo_handle = {NULL, };
- camera_msg_param param;
if (!recv_msg || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
g_mutex_unlock(&cb_info->user_cb_mutex[event]);
LOGW("NULL callback for event %d, return here", event);
return;
- } else {
- /* do not return in this case, because return buffer message should be sent. */
- LOGW("NULL callback for event %d, NOT return here", event);
}
+
+ /* return buffer message should be sent for some events.
+ - MUSE_CAMERA_EVENT_TYPE_PREVIEW
+ - MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW
+ - MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION
+ - MUSE_CAMERA_EVENT_TYPE_CAPTURE
+ */
}
switch (event) {
break;
case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
- {
- int i = 0;
- int ret = 0;
- int num_buffer_key = 0;
- int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
- int data_key = 0;
- unsigned char *buf_pos = NULL;
-
- tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
- tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
- tbm_bo data_bo = NULL;
- tbm_bo_handle data_bo_handle = {.ptr = NULL};
-
- camera_preview_data_s frame;
- camera_stream_data_s *stream = NULL;
- camera_media_packet_data *mp_data = NULL;
- media_packet_h pkt = NULL;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- media_packet_h pkt_evas = NULL;
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
- muse_camera_msg_get(tbm_key, recv_msg);
- muse_camera_msg_get(num_buffer_key, recv_msg);
- muse_camera_msg_get_array(buffer_key, recv_msg);
- muse_camera_msg_get(data_key, recv_msg);
-
- memset(&frame, 0x0, sizeof(camera_preview_data_s));
-
- if (tbm_key <= 0) {
- LOGE("invalid key %d", tbm_key);
- break;
- }
-
- CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
-
- if (num_buffer_key < 0 || num_buffer_key > BUFFER_MAX_PLANE_NUM) {
- LOGE("invalid num buffer key %d", num_buffer_key);
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
- break;
- }
-
- if (data_key > 0) {
- /* import tbm data_bo and get virtual address */
- if (!_camera_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
- LOGE("failed to import data key %d", data_key);
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
- break;
- }
- }
-
- /* import tbm bo and get virtual address */
- if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
- LOGE("failed to import key %d", tbm_key);
- _camera_release_imported_bo(&data_bo);
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
- break;
- }
-
- buf_pos = (unsigned char *)bo_handle.ptr;
-
- /* get stream info */
- stream = (camera_stream_data_s *)buf_pos;
-
- for (i = 0 ; i < num_buffer_key ; i++) {
- /* import buffer bo and get virtual address */
- if (!_camera_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
- LOGE("failed to import buffer key %d", buffer_key[i]);
-
- /* release imported bo */
- _camera_release_imported_bo(&data_bo);
- _camera_release_imported_bo(&bo);
-
- for (i -= 1 ; i >= 0 ; i--)
- _camera_release_imported_bo(&buffer_bo[i]);
-
- /* send return buffer */
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
-
- return;
- }
- }
-
- /* call preview callback */
- if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
- _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
-
- ((camera_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW])(&frame,
- cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
- }
-
- if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
-
- if (ret == CAMERA_ERROR_NONE) {
- ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt_evas);
- if (ret != CAMERA_ERROR_NONE) {
- LOGE("create pkt for evas failed");
- _camera_media_packet_data_release(mp_data, cb_info);
- mp_data = NULL;
- }
- }
-#else /* TIZEN_FEATURE_EVAS_RENDERER */
- LOGW("evas renderer is not supported");
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
- }
-
- /* call media packet callback */
- if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
- ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
-
- if (ret == CAMERA_ERROR_NONE) {
- ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
-
- if (ret == CAMERA_ERROR_NONE) {
- ((camera_media_packet_preview_cb)cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW])(pkt,
- cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
- } else {
- _camera_media_packet_data_release(mp_data, cb_info);
- mp_data = NULL;
- }
- }
- }
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- /* call evas renderer */
- if (pkt_evas) {
- g_mutex_lock(&cb_info->evas_mutex);
- if (cb_info->run_evas_render) {
- mm_evas_renderer_write(pkt_evas, cb_info->evas_info);
- } else {
- LOGW("evas renderer is stopped, skip this buffer...");
- media_packet_destroy(pkt_evas);
- }
- pkt_evas = NULL;
- g_mutex_unlock(&cb_info->evas_mutex);
- }
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
- /* send message for preview callback return */
- if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
- _camera_msg_send(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info, NULL, 0);
-
- if (mp_data == NULL) {
- /* release imported bo */
- for (i = 0 ; i < num_buffer_key ; i++)
- _camera_release_imported_bo(&buffer_bo[i]);
-
- /* unmap and unref tbm bo */
- _camera_release_imported_bo(&data_bo);
- _camera_release_imported_bo(&bo);
-
- /* return buffer */
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
-
- /*LOGD("return buffer Done");*/
- }
- }
+ __camera_event_handler_preview(cb_info, recv_msg, tfd);
break;
+//LCOV_EXCL_START
case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
{
int percent = 0;
muse_camera_msg_get(previous, recv_msg);
muse_camera_msg_get(current, recv_msg);
- LOGW("INTERRUPTED - policy %d, state previous %d, current %d",
- policy, previous, current);
-
- if (policy == CAMERA_POLICY_SOUND)
- LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND is deprecated and will be removed from next release.");
- else if (policy == CAMERA_POLICY_SOUND_BY_CALL)
- LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_CALL is deprecated and will be removed from next release.");
- else if (policy == CAMERA_POLICY_SOUND_BY_ALARM)
- LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_ALARM is deprecated and will be removed from next release.");
+ LOGW("INTERRUPTED - policy %d, state %d -> %d", policy, previous, current);
((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
(camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
muse_camera_msg_get(policy, recv_msg);
muse_camera_msg_get(state, recv_msg);
- LOGW("INTERRUPT_STARTED - policy %d, state %d", policy, state);
-
- if (policy == CAMERA_POLICY_SOUND)
- LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND is deprecated and will be removed from next release.");
- else if (policy == CAMERA_POLICY_SOUND_BY_CALL)
- LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_CALL is deprecated and will be removed from next release.");
- else if (policy == CAMERA_POLICY_SOUND_BY_ALARM)
- LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_ALARM is deprecated and will be removed from next release.");
-
- ((camera_interrupt_started_cb)cb_info->user_cb[event])((camera_policy_e)policy,
- (camera_state_e)state, cb_info->user_data[event]);
- }
- break;
- case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
- {
- int count = 0;
- camera_detected_face_s *faces = NULL;
-
- muse_camera_msg_get(count, recv_msg);
- muse_camera_msg_get(tbm_key, recv_msg);
-
- if (count >= 0 && cb_info->user_cb[event]) {
- LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
-
- if (tbm_key > 0) {
-
- if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
- /* set face info */
- faces = bo_handle.ptr;
- }
- }
-
- ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
-
- /* release bo */
- _camera_release_imported_bo(&bo);
- } else {
- LOGW("skip face detection message [count %d, key %d, cb %p",
- count, tbm_key, cb_info->user_cb[event]);
- }
+ LOGW("INTERRUPT_STARTED - policy %d, state %d", policy, state);
- /* return buffer */
- if (tbm_key > 0) {
- CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
- /*LOGD("return buffer done");*/
- }
+ ((camera_interrupt_started_cb)cb_info->user_cb[event])((camera_policy_e)policy,
+ (camera_state_e)state, cb_info->user_data[event]);
}
break;
+ case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
+ __camera_event_handler_face_detection(cb_info, recv_msg, tfd);
+ break;
case MUSE_CAMERA_EVENT_TYPE_ERROR:
{
int error = 0;
LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
- if (error == CAMERA_ERROR_SOUND_POLICY)
- LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY is deprecated and will be removed from next release.");
- else if (error == CAMERA_ERROR_SOUND_POLICY_BY_CALL)
- LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_CALL is deprecated and will be removed from next release.");
- else if (error == CAMERA_ERROR_SOUND_POLICY_BY_ALARM)
- LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_ALARM is deprecated and will be removed from next release.");
-
((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
(camera_state_e)current_state, cb_info->user_data[event]);
}
break;
+//LCOV_EXCL_STOP
case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
/* fall through */
case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
/* fall through */
case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
/* fall through */
+//LCOV_EXCL_START
case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
/* fall through */
case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
LOGW("stop foreach callback for event %d", event);
}
break;
+//LCOV_EXCL_STOP
case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
- {
- camera_image_data_s *rImage = NULL;
- camera_image_data_s *rPostview = NULL;
- camera_image_data_s *rThumbnail = NULL;
- unsigned char *buf_pos = NULL;
- int tbm_key_main = 0;
- int tbm_key_post = 0;
- int tbm_key_thumb = 0;
- tbm_bo bo_main = NULL;
- tbm_bo bo_post = NULL;
- tbm_bo bo_thumb = NULL;
- tbm_bo_handle bo_main_handle = {NULL, };
- tbm_bo_handle bo_post_handle = {NULL, };
- tbm_bo_handle bo_thumb_handle = {NULL, };
-
- muse_camera_msg_get(tbm_key_main, recv_msg);
- muse_camera_msg_get(tbm_key_post, recv_msg);
- muse_camera_msg_get(tbm_key_thumb, recv_msg);
-
- /*
- LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
- tbm_key_main, tbm_key_post, tbm_key_thumb);
- */
-
- if (tbm_key_main <= 0) {
- LOGE("invalid key %d", tbm_key_main);
- break;
- }
-
- if (cb_info->user_cb[event] == NULL) {
- LOGW("NULL callback");
- goto _EVENT_CAPTURE_DONE;
- }
-
- /* import tbm bo and get virtual address */
- if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle)) {
- LOGE("failed to import key [%d] for main", tbm_key_main);
- goto _EVENT_CAPTURE_DONE;
- }
-
- buf_pos = (unsigned char *)bo_main_handle.ptr;
- rImage = (camera_image_data_s *)buf_pos;
- rImage->data = buf_pos + sizeof(camera_image_data_s);
- if (rImage->exif && rImage->exif_size > 0) {
- rImage->exif = rImage->data + rImage->size;
- } else {
- rImage->exif = NULL;
- rImage->exif_size = 0;
- }
-
- LOGD("image info %dx%d, size %d, EXIF info %p, size %d",
- rImage->width, rImage->height, rImage->size, rImage->exif, rImage->exif_size);
-
- if (tbm_key_post > 0) {
- /* import tbm bo and get virtual address */
- if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle)) {
- buf_pos = (unsigned char *)bo_post_handle.ptr;
- rPostview = (camera_image_data_s *)buf_pos;
- LOGD("rPostview->size : %d", rPostview->size);
- rPostview->data = buf_pos + sizeof(camera_image_data_s);
- } else {
- LOGE("failed to import key [%d] for postview", tbm_key_post);
- }
- }
-
- if (tbm_key_thumb > 0) {
- /* import tbm bo and get virtual address */
- if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle)) {
- buf_pos = (unsigned char *)bo_thumb_handle.ptr;
- rThumbnail = (camera_image_data_s *)buf_pos;
- LOGD("rThumbnail->size : %d", rThumbnail->size);
- rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
- } else {
- LOGE("failed to import key [%d] for thumbnail", tbm_key_thumb);
- }
- }
-
- ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
-
- /* unmap and unref tbm bo */
- _camera_release_imported_bo(&bo_main);
-
-_EVENT_CAPTURE_DONE:
- /* return buffer */
- tbm_key = tbm_key_main;
-
- CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
-
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
-
- if (tbm_key_post > 0) {
- /* unmap and unref tbm bo */
- _camera_release_imported_bo(&bo_post);
-
- /* return buffer */
- param.value.value_INT = tbm_key_post;
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
- }
-
- if (tbm_key_thumb > 0) {
- /* unmap and unref tbm bo */
- _camera_release_imported_bo(&bo_thumb);
-
- /* return buffer */
- param.value.value_INT = tbm_key_thumb;
- _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0);
- }
-
- LOGD("return buffer done");
- }
+ __camera_event_handler_capture(cb_info, recv_msg, tfd);
break;
default:
LOGW("unhandled event %d", event);
return;
}
-static bool _camera_idle_event_callback(void *data)
+static gboolean _camera_idle_event_callback(gpointer data)
{
camera_cb_info_s *cb_info = NULL;
camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
if (cam_idle_event == NULL) {
LOGE("cam_idle_event is NULL");
- return false;
+ return FALSE;
}
/* lock event */
- g_mutex_lock(&cam_idle_event->event_mutex);
+ g_mutex_lock(&g_cam_idle_event_lock);
cb_info = cam_idle_event->cb_info;
if (cb_info == NULL) {
LOGW("camera cb_info is NULL. event %p %d", cam_idle_event, cam_idle_event->event);
+ g_mutex_unlock(&g_cam_idle_event_lock);
goto IDLE_EVENT_CALLBACK_DONE;
}
/* remove event from list */
- g_mutex_lock(&cb_info->idle_event_mutex);
-
if (cb_info->idle_event_list)
cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
- /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
- g_mutex_unlock(&cb_info->idle_event_mutex);
+ g_mutex_unlock(&g_cam_idle_event_lock);
/* user callback */
- _camera_client_user_callback(cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
-
- /* send signal for waiting thread */
- g_cond_signal(&cb_info->idle_event_cond);
+ _camera_client_user_callback(cb_info, cam_idle_event->recv_msg, cam_idle_event->event, cam_idle_event->tfd);
IDLE_EVENT_CALLBACK_DONE:
- /* unlock and release event */
- g_mutex_unlock(&cam_idle_event->event_mutex);
- g_mutex_clear(&cam_idle_event->event_mutex);
-
+ /* release event */
g_free(cam_idle_event);
cam_idle_event = NULL;
- return false;
+ return FALSE;
}
-static void *_camera_msg_handler_func(gpointer data)
+static gpointer _camera_msg_handler_func(gpointer data)
{
int api = 0;
int type = 0;
} else if (api == MUSE_CAMERA_CB_EVENT) {
switch (cam_msg->event_class) {
case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
- _camera_client_user_callback(cb_info, cam_msg->recv_msg, cam_msg->event);
+ _camera_client_user_callback(cb_info, cam_msg->recv_msg, cam_msg->event, cam_msg->tfd);
break;
case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
cam_idle_event = g_new0(camera_idle_event_s, 1);
cam_idle_event->event = cam_msg->event;
cam_idle_event->cb_info = cb_info;
- g_mutex_init(&cam_idle_event->event_mutex);
+
strncpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg) - 1);
+ memcpy(cam_idle_event->tfd, cam_msg->tfd, sizeof(cam_idle_event->tfd));
/*LOGD("t:%d add camera event[%d, %p] to IDLE", type, cam_msg->event, cam_idle_event);*/
- g_mutex_lock(&cb_info->idle_event_mutex);
+ g_mutex_lock(&g_cam_idle_event_lock);
cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
- g_mutex_unlock(&cb_info->idle_event_mutex);
+ g_mutex_unlock(&g_cam_idle_event_lock);
g_idle_add_full(G_PRIORITY_DEFAULT,
(GSourceFunc)_camera_idle_event_callback,
{
camera_idle_event_s *cam_idle_event = NULL;
GList *list = NULL;
- gint64 end_time = 0;
if (cb_info == NULL) {
LOGE("cb_info is NULL");
return;
}
- g_mutex_lock(&cb_info->idle_event_mutex);
+ g_mutex_lock(&g_cam_idle_event_lock);
if (cb_info->idle_event_list == NULL) {
LOGD("No remained idle event");
- g_mutex_unlock(&cb_info->idle_event_mutex);
+ g_mutex_unlock(&g_cam_idle_event_lock);
return;
}
continue;
}
- if (!g_mutex_trylock(&cam_idle_event->event_mutex)) {
- LOGW("lock failed, %p event is calling now", cam_idle_event);
+ if (g_idle_remove_by_data(cam_idle_event)) {
+ LOGW("remove idle event %p done", cam_idle_event);
- end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
+ cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
- if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
- LOGW("signal received");
- else
- LOGW("timeout");
+ g_free(cam_idle_event);
+ cam_idle_event = NULL;
continue;
}
cam_idle_event->cb_info = NULL;
cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
-
- g_mutex_unlock(&cam_idle_event->event_mutex);
}
g_list_free(cb_info->idle_event_list);
cb_info->idle_event_list = NULL;
- g_mutex_unlock(&cb_info->idle_event_mutex);
+ g_mutex_unlock(&g_cam_idle_event_lock);
return;
}
-static void __camera_add_msg_to_queue(camera_cb_info_s *cb_info, int api, int event, int event_class, char *msg)
+static void __camera_add_msg_to_queue(camera_cb_info_s *cb_info, int api, int event, int event_class, char *msg, int *tfd)
{
camera_message_s *cam_msg = NULL;
cam_msg->event = event;
cam_msg->event_class = event_class;
+ if (tfd && tfd[0] >= 0)
+ memcpy(cam_msg->tfd, tfd, sizeof(cam_msg->tfd));
+
strncpy(cam_msg->recv_msg, msg, sizeof(cam_msg->recv_msg) - 1);
/*LOGD("add camera message to queue : api %d, event %d, event_class %d", api, event, event_class);*/
}
-static void __camera_process_msg(camera_cb_info_s *cb_info, char *msg)
+static void __camera_process_msg(camera_cb_info_s *cb_info, char *msg, int *tfd)
{
int ret = CAMERA_ERROR_NONE;
int api = -1;
g_mutex_unlock(&cb_info->api_mutex[api]);
} else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
- __camera_add_msg_to_queue(cb_info, api, event, event_class, msg);
+ __camera_add_msg_to_queue(cb_info, api, event, event_class, msg, tfd);
} else {
LOGW("unknown camera api %d, class %d", api, api_class);
}
}
-static void *_camera_msg_recv_func(gpointer data)
+static gpointer _camera_msg_recv_func(gpointer data)
{
+ int i = 0;
int recv_length = 0;
- int single_length = 0;
- int remained_length = 0;
+ int tfd[MUSE_NUM_FD] = {-1, -1, -1, -1};
char *recv_msg = NULL;
- char *single_msg = NULL;
- char *remained_msg = NULL;
- int num_msg = 0;
- int cur_pos = 0;
- int prev_pos = 0;
camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
if (!cb_info) {
return NULL;
}
- LOGD("start");
-
- single_msg = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
- if (!single_msg) {
- LOGE("single_msg malloc failed");
- return NULL;
- }
+ LOGD("start - fd : %d", cb_info->fd);
recv_msg = cb_info->recv_msg;
while (g_atomic_int_get(&cb_info->msg_recv_running)) {
- recv_length = muse_core_msg_recv(cb_info->fd, recv_msg);
+ for (i = 0 ; i < MUSE_NUM_FD ; i++)
+ tfd[i] = -1;
+
+ recv_length = muse_core_msg_recv_fd(cb_info->fd, recv_msg, MUSE_MSG_MAX_LENGTH, tfd);
if (recv_length <= 0) {
cb_info->is_server_connected = FALSE;
LOGE("receive msg failed - server disconnected");
break;
}
- cur_pos = 0;
- prev_pos = 0;
- num_msg = 0;
-
- /*LOGD("recv msg : %s, length : %d", recv_msg, recv_length);*/
-
- /* Need to split the combined entering msgs */
- for (cur_pos = 0 ; cur_pos < recv_length ; cur_pos++) {
- if (recv_msg[cur_pos] == '}') {
- single_length = cur_pos - prev_pos + 1;
-
- if (single_length < MUSE_CAMERA_MSG_MAX_LENGTH) {
- /* check remained msg */
- if (remained_length > 0) {
- if (remained_msg) {
- strncpy(single_msg, remained_msg, remained_length);
- strncpy(single_msg + remained_length, recv_msg + prev_pos, single_length);
- single_msg[remained_length + single_length] = '\0';
-
- free(remained_msg);
- remained_msg = NULL;
- } else {
- strncpy(single_msg, recv_msg + prev_pos, single_length);
- single_msg[single_length] = '\0';
- LOGE("lost msg [%s], skip...", single_msg);
- }
-
- remained_length = 0;
- } else {
- strncpy(single_msg, recv_msg + prev_pos, single_length);
- single_msg[single_length] = '\0';
- }
+ /*
+ if (tfd[0] >= 0)
+ LOGD("%d %d %d %d", tfd[0], tfd[1], tfd[2], tfd[3]);
+ */
- if (single_msg[0] == '{') {
- num_msg++;
- /*LOGD("splitted msg : [%s], Index : %d", single_msg, num_msg);*/
- /* process each message */
- __camera_process_msg(cb_info, single_msg);
- } else {
- LOGE("invalid msg [%s]", single_msg);
- }
- } else {
- LOGE("too long message [len %d] skip...", single_length);
- }
+ recv_msg[recv_length] = '\0';
- prev_pos = cur_pos + 1;
- }
- }
+ /*LOGD("recv msg : %s, length : %d", recv_msg, recv_length);*/
- /* check incompleted message */
- if (recv_msg[recv_length - 1] != '}') {
- remained_length = recv_length - prev_pos;
+ __camera_process_msg(cb_info, recv_msg, tfd);
+ }
- LOGW("incompleted message [len %d]", remained_length);
+ LOGD("client cb exit - server connected %d", cb_info->is_server_connected);
- if (remained_msg) {
- free(remained_msg);
- remained_msg = NULL;
- }
+ if (!cb_info->is_server_connected) {
+ char *error_msg = NULL;
- remained_msg = (char *)malloc(remained_length + 1);
- if (remained_msg) {
- strncpy(remained_msg, recv_msg + prev_pos, remained_length);
- remained_msg[remained_length] = '\0';
- } else {
- LOGE("failed to alloc for remained msg");
- }
- } else {
- remained_length = 0;
+ if (cb_info->bufmgr == NULL) {
+ LOGE("No need to send error(handle is not created)");
+ return NULL;
}
- }
- LOGD("client cb exit - server connected %d", cb_info->is_server_connected);
+ if (cb_info->fd < 0) {
+ LOGE("fd is closed in client side");
+ return NULL;
+ }
- if (!cb_info->is_server_connected) {
/* send error msg for server disconnection */
- char *error_msg = muse_core_msg_new(MUSE_CAMERA_CB_EVENT,
+ error_msg = muse_core_msg_new(MUSE_CAMERA_CB_EVENT,
MUSE_TYPE_INT, "error", CAMERA_ERROR_SERVICE_DISCONNECTED,
MUSE_TYPE_INT, "current_state", CAMERA_STATE_NONE,
NULL);
if (!error_msg) {
LOGE("error_msg failed");
- goto CB_HANDLER_EXIT;
+ return NULL;
}
__camera_add_msg_to_queue(cb_info,
MUSE_CAMERA_CB_EVENT,
MUSE_CAMERA_EVENT_TYPE_ERROR,
MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
- error_msg);
+ error_msg,
+ NULL);
muse_core_msg_free(error_msg);
error_msg = NULL;
LOGE("add error msg for service disconnection done");
}
-CB_HANDLER_EXIT:
- if (single_msg) {
- free(single_msg);
- single_msg = NULL;
- }
-
- if (remained_msg) {
- free(remained_msg);
- remained_msg = NULL;
- }
-
return NULL;
}
}
g_mutex_init(&cb_info->fd_lock);
- g_mutex_init(&cb_info->idle_event_mutex);
- g_cond_init(&cb_info->idle_event_cond);
g_mutex_init(&cb_info->mp_data_mutex);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- g_mutex_init(&cb_info->evas_mutex);
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
for (i = 0 ; i < MUSE_CAMERA_EVENT_TYPE_NUM ; i++)
g_mutex_init(&cb_info->user_cb_mutex[i]);
cb_info->fd = sockfd;
cb_info->preview_cb_flag = 0;
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- cb_info->evas_info = NULL;
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
/* message receive thread */
g_atomic_int_set(&cb_info->msg_recv_running, 1);
goto ErrorExit;
}
+ /* initialize fd */
+ for (i = 0 ; i < MUSE_NUM_FD ; i++)
+ cb_info->fds[i] = -1;
+
cb_info->is_server_connected = TRUE;
return cb_info;
-
+//LCOV_EXCL_START
ErrorExit:
if (cb_info) {
__destroy_msg_handler_thread(&cb_info->msg_handler_info);
g_mutex_clear(&cb_info->user_cb_mutex[i]);
g_mutex_clear(&cb_info->fd_lock);
- g_mutex_clear(&cb_info->idle_event_mutex);
- g_cond_clear(&cb_info->idle_event_cond);
g_mutex_clear(&cb_info->mp_data_mutex);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- g_mutex_clear(&cb_info->evas_mutex);
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
g_mutex_clear(&cb_info->api_mutex[i]);
}
return NULL;
+//LCOV_EXCL_STOP
}
static void _camera_client_callback_destroy(camera_cb_info_s *cb_info)
g_mutex_clear(&cb_info->user_cb_mutex[i]);
g_mutex_clear(&cb_info->fd_lock);
- g_mutex_clear(&cb_info->idle_event_mutex);
- g_cond_clear(&cb_info->idle_event_cond);
g_mutex_clear(&cb_info->mp_data_mutex);
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- g_mutex_clear(&cb_info->evas_mutex);
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
g_mutex_clear(&cb_info->api_mutex[i]);
cb_info->pkt_fmt = NULL;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- if (cb_info->evas_info)
- mm_evas_renderer_destroy(&cb_info->evas_info);
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
+ if (cb_info->dp_interface) {
+ mm_display_interface_deinit(cb_info->dp_interface);
+ cb_info->dp_interface = NULL;
+ }
cb_info->preview_cb_flag = 0;
return;
}
-
+//LCOV_EXCL_START
int _camera_start_evas_rendering(camera_h camera)
{
- int ret = CAMERA_ERROR_NONE;
camera_cli_s *pc = (camera_cli_s *)camera;
if (!pc || !pc->cb_info) {
return CAMERA_ERROR_NONE;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- g_mutex_lock(&pc->cb_info->evas_mutex);
-
/* set evas render flag as RUN */
pc->cb_info->run_evas_render = true;
- ret = CAMERA_ERROR_NONE;
-
- g_mutex_unlock(&pc->cb_info->evas_mutex);
-#else /* TIZEN_FEATURE_EVAS_RENDERER */
- LOGW("evas renderer is not supported");
- ret = CAMERA_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
- return ret;
+ return CAMERA_ERROR_NONE;
}
return CAMERA_ERROR_NONE;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- g_mutex_lock(&pc->cb_info->evas_mutex);
-
/* set evas render flag as STOP and release buffers */
pc->cb_info->run_evas_render = false;
- ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_display_interface_evas_flush(pc->cb_info->dp_interface, keep_screen);
+ if (ret == MM_ERROR_NONE) {
+ ret = CAMERA_ERROR_NONE;
+ } else {
LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
ret = CAMERA_ERROR_INVALID_OPERATION;
}
- g_mutex_unlock(&pc->cb_info->evas_mutex);
-#else /* TIZEN_FEATURE_EVAS_RENDERER */
- LOGW("evas renderer is not supported");
- ret = CAMERA_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
-
return ret;
}
-
+//LCOV_EXCL_STOP
int _camera_independent_request(int api, int device_type, const char *key, int *value)
{
int ret = CAMERA_ERROR_NONE;
int sock_fd = -1;
+ int module_index = -1;
char *msg = NULL;
char recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH] = {'\0',};
return CAMERA_ERROR_INVALID_OPERATION;
}
+ if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
+ LOGE("muse client get module index failed");
+ ret = CAMERA_ERROR_INVALID_OPERATION;
+ goto _REQUEST_EXIT;
+ }
+
msg = muse_core_msg_new(api,
- MUSE_TYPE_INT, "module", MUSE_CAMERA,
+ MUSE_TYPE_INT, "module", module_index,
MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
0);
if (!msg) {
goto _REQUEST_EXIT;
}
- ret = muse_core_msg_recv(sock_fd, recv_msg);
+ ret = muse_core_msg_recv(sock_fd, recv_msg, MUSE_CAMERA_MSG_MAX_LENGTH);
if (ret <= 0) {
LOGE("recv msg failed %d", errno);
ret = CAMERA_ERROR_INVALID_OPERATION;
char *send_msg = NULL;
int send_ret = 0;
int ret = CAMERA_ERROR_NONE;
- int pid = 0;
camera_cli_s *pc = NULL;
tbm_bufmgr bufmgr = NULL;
muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
- muse_core_api_module_e muse_module = MUSE_CAMERA;
+ int module_index = -1;
int device_type = (int)device;
if (!camera) {
goto ErrorExit;
}
- pid = getpid();
+ if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
+ LOGE("muse client get module index failed");
+ ret = CAMERA_ERROR_INVALID_OPERATION;
+ goto ErrorExit;
+ }
send_msg = muse_core_msg_new(api,
- MUSE_TYPE_INT, "module", muse_module,
+ MUSE_TYPE_INT, "module", module_index,
MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
- MUSE_TYPE_INT, "pid", pid,
0);
if (!send_msg) {
pc->cb_info->api_waiting[MUSE_CAMERA_API_CREATE] = 0;
if (ret == CAMERA_ERROR_NONE) {
+ int preview_format = CAMERA_PIXEL_FORMAT_INVALID;
+ int user_buffer_supported = 0;
intptr_t handle = 0;
+
muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
if (handle == 0) {
LOGE("Receiving Handle Failed!!");
goto ErrorExit;
}
+ muse_camera_msg_get(preview_format, pc->cb_info->recv_msg);
+ muse_camera_msg_get(user_buffer_supported, pc->cb_info->recv_msg);
+
pc->remote_handle = handle;
pc->cb_info->bufmgr = bufmgr;
+ pc->cb_info->preview_format = preview_format;
+ pc->cb_info->dp_info.type = CAMERA_DISPLAY_TYPE_NONE;
+ pc->cb_info->user_buffer_supported = (gboolean)user_buffer_supported;
- ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
- if (ret != CAMERA_ERROR_NONE) {
- LOGE("init display failed 0x%x", ret);
- goto ErrorExit;
- }
+ LOGD("default preview format %d, user buffer %d",
+ preview_format, user_buffer_supported);
- LOGD("camera create 0x%x", pc->remote_handle);
*camera = (camera_h)pc;
+
+ /* get display interface handle */
+ if (mm_display_interface_init(&pc->cb_info->dp_interface) != MM_ERROR_NONE)
+ LOGW("display interface init failed");
} else {
goto ErrorExit;
}
return ret;
-
+//LCOV_EXCL_START
ErrorExit:
if (bufmgr) {
tbm_bufmgr_deinit(bufmgr);
if (pc) {
if (pc->cb_info) {
+ int temp_fd = pc->cb_info->fd;
+
+ /* pc->cb_info->fd should be closed,
+ because g_thread_join for msg_recv_thread is not returned
+ in _camera_client_callback_destroy. */
+ if (temp_fd > -1) {
+ pc->cb_info->fd = -1;
+ muse_client_close(temp_fd);
+ }
+
_camera_client_callback_destroy(pc->cb_info);
pc->cb_info = NULL;
}
LOGE("camera create error : 0x%x", ret);
return ret;
+//LCOV_EXCL_STOP
}
LOGD("Enter");
if (pc->cb_info->is_server_connected)
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
else
LOGW("server disconnected. release resource without send message.");
pc = NULL;
}
+ LOGD("ret : 0x%x", ret);
+
return ret;
}
int ret = CAMERA_ERROR_NONE;
muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
camera_cli_s *pc = (camera_cli_s *)camera;
+ camera_state_e current_state = CAMERA_STATE_NONE;
if (!pc || !pc->cb_info) {
LOGE("NULL handle");
return CAMERA_ERROR_INVALID_PARAMETER;
}
- LOGD("Enter");
+ LOGD("Enter : preview format %d, display type %d",
+ pc->cb_info->preview_format, pc->cb_info->dp_info.type);
+
+ ret = camera_get_state(camera, ¤t_state);
+ if (ret != CAMERA_ERROR_NONE) {
+ LOGE("failed to get current state 0x%x", ret);
+ return ret;
+ }
+
+ if (pc->cb_info->preview_format == CAMERA_PIXEL_FORMAT_INVZ &&
+ pc->cb_info->dp_info.type != CAMERA_DISPLAY_TYPE_NONE) {
+ LOGE("CAMERA_DISPLAY_TYPE_NONE[current %d] should be set with INVZ format",
+ pc->cb_info->dp_info.type);
+ return CAMERA_ERROR_INVALID_OPERATION;
+ }
+
+ if (current_state == CAMERA_STATE_CREATED && pc->cb_info->user_buffer_supported) {
+ if (!_camera_allocate_preview_buffer(camera))
+ return CAMERA_ERROR_INVALID_OPERATION;
+
+ _camera_msg_send(api, pc->cb_info->fds, pc->cb_info, &ret, CAMERA_CB_NO_TIMEOUT);
+ } else {
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_NO_TIMEOUT);
+ }
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_NO_TIMEOUT);
if (ret == CAMERA_ERROR_NONE && CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
ret = _camera_start_evas_rendering(camera);
if (ret != CAMERA_ERROR_NONE) {
LOGE("stop preview because of error");
- _camera_msg_send(MUSE_CAMERA_API_STOP_PREVIEW, pc->cb_info, NULL, 0);
+ _camera_msg_send(MUSE_CAMERA_API_STOP_PREVIEW, NULL, pc->cb_info, NULL, 0);
}
}
LOGD("Enter");
+//LCOV_EXCL_START
if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
ret = camera_get_state(camera, ¤t_state);
if (ret != CAMERA_ERROR_NONE) {
return ret;
}
}
-
+//LCOV_EXCL_STOP
/* send stop preview message */
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
- if (ret != CAMERA_ERROR_NONE &&
- current_state == CAMERA_STATE_PREVIEW) {
+ if (ret == CAMERA_ERROR_NONE) {
+ if (pc->cb_info->user_buffer_supported)
+ _camera_release_preview_buffer(camera);
+ } else if (current_state == CAMERA_STATE_PREVIEW) {
LOGW("restart evas rendering");
_camera_start_evas_rendering(camera);
}
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*device_count = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DEVICE_COUNT];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*state = (camera_state_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_STATE];
return CAMERA_ERROR_INVALID_PARAMETER;
}
- LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ LOGD("Enter, remote_handle : %td", pc->remote_handle);
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
{
+ int mm_ret = MM_ERROR_NONE;
int ret = CAMERA_ERROR_NONE;
- void *set_display_handle = NULL;
- Evas_Object *obj = NULL;
- const char *object_type = NULL;
camera_cli_s *pc = (camera_cli_s *)camera;
camera_cb_info_s *cb_info = NULL;
- muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
camera_state_e current_state = CAMERA_STATE_NONE;
camera_msg_param param;
- char *msg = NULL;
- int length = 0;
+ muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
+ muse_camera_display_info_s *dp_info = NULL;
if (!pc || !pc->cb_info) {
LOGE("NULL handle");
}
cb_info = (camera_cb_info_s *)pc->cb_info;
+ dp_info = &cb_info->dp_info;
ret = camera_get_state(camera, ¤t_state);
if (ret != CAMERA_ERROR_NONE) {
return CAMERA_ERROR_INVALID_STATE;
}
- LOGD("Enter - display : %p", display);
-
- if (type == CAMERA_DISPLAY_TYPE_NONE) {
- set_display_handle = 0;
- LOGD("display type NONE");
- } else {
- obj = (Evas_Object *)display;
- object_type = evas_object_type_get(obj);
- if (object_type) {
- if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
- /* get wayland parent id */
- if (_camera_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
- LOGE("failed to get wayland info");
- return CAMERA_ERROR_INVALID_OPERATION;
- }
-
- set_display_handle = (void *)&pc->wl_info;
- LOGD("display type OVERLAY : handle %p", set_display_handle);
- } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
- /* evas object surface */
- set_display_handle = (void *)display;
- LOGD("display type EVAS : handle %p", set_display_handle);
-
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
- g_mutex_lock(&cb_info->evas_mutex);
-
- if (cb_info->evas_info) {
- LOGW("destroy existed evas renderer %p", cb_info->evas_info);
- ret = mm_evas_renderer_destroy(&cb_info->evas_info);
- if (ret != MM_ERROR_NONE) {
- LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
- g_mutex_unlock(&cb_info->evas_mutex);
- return CAMERA_ERROR_INVALID_OPERATION;
- }
- }
-
- /* create evas renderer */
- ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
- if (ret == MM_ERROR_NONE) {
- camera_flip_e flip = CAMERA_FLIP_NONE;
- camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
- camera_rotation_e rotation = CAMERA_ROTATION_NONE;
- bool visible = 0;
- int x = 0;
- int y = 0;
- int width = 0;
- int height = 0;
-
- camera_get_display_flip(camera, &flip);
- camera_get_display_mode(camera, &mode);
- camera_get_display_rotation(camera, &rotation);
- camera_is_display_visible(camera, &visible);
- camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
-
- LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
- flip, mode, rotation, visible, x, y, width, height);
-
- ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
- ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
- ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
- ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
-
- if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
- ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
- }
-
- g_mutex_unlock(&cb_info->evas_mutex);
+ LOGD("Enter - type : %d, display : %p", type, display);
- if (ret != MM_ERROR_NONE) {
- LOGE("mm_evas_renderer error 0x%x", ret);
- return CAMERA_ERROR_INVALID_OPERATION;
- }
-#else /* TIZEN_FEATURE_EVAS_RENDERER */
- LOGE("EVAS surface is not supported");
- return CAMERA_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
- } else {
- LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
- return CAMERA_ERROR_INVALID_PARAMETER;
- }
- } else {
- LOGE("failed to get evas object type from %p", obj);
- return CAMERA_ERROR_INVALID_PARAMETER;
+ if (type != CAMERA_DISPLAY_TYPE_NONE) {
+ /* check display interface handle */
+ if (!cb_info->dp_interface) {
+ LOGE("display interface not supported");
+ return CAMERA_ERROR_NOT_SUPPORTED;
}
- }
-
- pc->display_handle = (intptr_t)set_display_handle;
-
- if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
- int send_ret = 0;
-
- length = sizeof(camera_wl_info_s) / sizeof(int) + \
- (sizeof(camera_wl_info_s) % sizeof(int) ? 1 : 0);
- msg = muse_core_msg_new(api,
- MUSE_TYPE_INT, "type", type,
- MUSE_TYPE_ARRAY, "wl_info", length, (int *)&pc->wl_info,
- NULL);
- if (!msg) {
- LOGE("msg creation failed: api %d", api);
- return CAMERA_ERROR_OUT_OF_MEMORY;
+ mm_ret = mm_display_interface_set_display(cb_info->dp_interface, type, display, &dp_info->parent_id);
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("[INVALID_OPERATION] set display failed[0x%x]", mm_ret);
+ return CAMERA_ERROR_INVALID_OPERATION;
}
- if (pc->cb_info->is_server_connected) {
- __camera_update_api_waiting(pc->cb_info, api, 1);
-
- g_mutex_lock(&pc->cb_info->fd_lock);
- send_ret = muse_core_msg_send(pc->cb_info->fd, msg);
- g_mutex_unlock(&pc->cb_info->fd_lock);
+ if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
+ mm_ret = mm_display_interface_get_window_rect(cb_info->dp_interface, &dp_info->window_rect);
+
+ LOGD("ret 0x%x, parent_id %d, window rect %d,%d,%dx%d",
+ ret, dp_info->parent_id, dp_info->window_rect.x, dp_info->window_rect.y,
+ dp_info->window_rect.width, dp_info->window_rect.height);
+ } else if (type == CAMERA_DISPLAY_TYPE_EVAS) {
+//LCOV_EXCL_START
+ camera_flip_e flip = CAMERA_FLIP_NONE;
+ camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
+ camera_rotation_e rotation = CAMERA_ROTATION_NONE;
+ bool visible = 0;
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+
+ camera_get_display_flip(camera, &flip);
+ camera_get_display_mode(camera, &mode);
+ camera_get_display_rotation(camera, &rotation);
+ camera_is_display_visible(camera, &visible);
+ camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
+
+ LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
+ flip, mode, rotation, visible, x, y, width, height);
+
+ mm_ret = mm_display_interface_evas_set_flip(cb_info->dp_interface, flip);
+ mm_ret |= mm_display_interface_evas_set_mode(cb_info->dp_interface, mode);
+ mm_ret |= mm_display_interface_evas_set_rotation(cb_info->dp_interface, rotation);
+ mm_ret |= mm_display_interface_evas_set_visible(cb_info->dp_interface, visible);
+
+ if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
+ mm_ret |= mm_display_interface_evas_set_roi_area(cb_info->dp_interface, x, y, width, height);
+//LCOV_EXCL_STOP
}
+ }
- if (send_ret < 0) {
- LOGE("message send failed");
- ret = CAMERA_ERROR_INVALID_OPERATION;
- } else {
- ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
- }
+ if (mm_ret != MM_ERROR_NONE) {
+ LOGE("mm_ret 0x%x failed", mm_ret);
+ return CAMERA_ERROR_INVALID_OPERATION;
+ }
- __camera_update_api_waiting(pc->cb_info, api, -1);
+ dp_info->type = type;
- muse_core_msg_free(msg);
+ CAMERA_MSG_PARAM_SET_ARRAY(param, ARRAY, dp_info, sizeof(muse_camera_display_info_s));
- LOGD("wayland parent id : %d, window %d,%d,%dx%d",
- pc->wl_info.parent_id, pc->wl_info.window_x, pc->wl_info.window_y,
- pc->wl_info.window_width, pc->wl_info.window_height);
- } else {
- CAMERA_MSG_PARAM_SET(param, INT, type);
+ _camera_msg_send_param1(api, cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
- _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
+ if (ret == CAMERA_ERROR_NONE) {
+ if (type == CAMERA_DISPLAY_TYPE_EVAS)
+ SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
}
- if (ret != CAMERA_ERROR_NONE)
- LOGE("set display error 0x%x", ret);
- else if (type == CAMERA_DISPLAY_TYPE_EVAS)
- SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
-
return ret;
}
return CAMERA_ERROR_INVALID_PARAMETER;
}
- LOGD("Enter - capture_format %d", set_format);
+ LOGD("Enter - format %d", set_format);
CAMERA_MSG_PARAM_SET(param, INT, set_format);
_camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
+ if (ret == CAMERA_ERROR_NONE)
+ pc->cb_info->preview_format = set_format;
+
LOGD("ret : 0x%x", ret);
return ret;
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*width = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION] >> 16;
return CAMERA_ERROR_INVALID_PARAMETER;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
- g_mutex_lock(&pc->cb_info->evas_mutex);
-
- ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
-
- g_mutex_unlock(&pc->cb_info->evas_mutex);
-
+ ret = mm_display_interface_evas_set_rotation(pc->cb_info->dp_interface, rotation);
if (ret != MM_ERROR_NONE) {
LOGE("failed to set rotation for evas surface 0x%x", ret);
return CAMERA_ERROR_INVALID_OPERATION;
}
}
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
CAMERA_MSG_PARAM_SET(param, INT, set_rotation);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*rotation = (camera_rotation_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_ROTATION];
return CAMERA_ERROR_INVALID_PARAMETER;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
- g_mutex_lock(&pc->cb_info->evas_mutex);
-
- ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
-
- g_mutex_unlock(&pc->cb_info->evas_mutex);
-
+ ret = mm_display_interface_evas_set_flip(pc->cb_info->dp_interface, flip);
if (ret != MM_ERROR_NONE) {
LOGE("failed to set flip for evas surface 0x%x", ret);
return CAMERA_ERROR_INVALID_OPERATION;
}
}
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
CAMERA_MSG_PARAM_SET(param, INT, set_flip);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*flip = (camera_flip_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_FLIP];
return CAMERA_ERROR_INVALID_PARAMETER;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
- g_mutex_lock(&pc->cb_info->evas_mutex);
-
- ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
-
- g_mutex_unlock(&pc->cb_info->evas_mutex);
-
+ ret = mm_display_interface_evas_set_visible(pc->cb_info->dp_interface, visible);
if (ret != MM_ERROR_NONE) {
LOGE("failed to set visible for evas surface 0x%x", ret);
return CAMERA_ERROR_INVALID_OPERATION;
}
}
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
CAMERA_MSG_PARAM_SET(param, INT, set_visible);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- _camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*visible = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE];
return CAMERA_ERROR_INVALID_PARAMETER;
}
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
- g_mutex_lock(&pc->cb_info->evas_mutex);
-
- ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
-
- g_mutex_unlock(&pc->cb_info->evas_mutex);
-
+ ret = mm_display_interface_evas_set_mode(pc->cb_info->dp_interface, mode);
if (ret != MM_ERROR_NONE) {
LOGE("failed to set geometry for evas surface 0x%x", ret);
return CAMERA_ERROR_INVALID_OPERATION;
}
}
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
CAMERA_MSG_PARAM_SET(param, INT, set_mode);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*mode = (camera_display_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_MODE];
return CAMERA_ERROR_INVALID_PARAMETER;
}
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*hint = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*width = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION] >> 16;
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*format = (camera_pixel_format_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CAPTURE_FORMAT];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*format = (camera_pixel_format_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PREVIEW_FORMAT];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*facing_direction = (camera_facing_direction_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_FACING_DIRECTION];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_PREVIEW]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_ERROR]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_ERROR]);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
}
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*width = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION] >> 16;
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*angle = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_LENS_ORIENTATION];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*mode = (camera_attr_theater_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_THEATER_MODE];
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("Finish, return :%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*fps = (camera_attr_fps_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PREVIEW_FPS];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*quality = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_IMAGE_QUALITY];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*bitrate = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*interval = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL];
return CAMERA_ERROR_INVALID_PARAMETER;
}
- LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ LOGD("Enter, remote_handle : %td", pc->remote_handle);
CAMERA_MSG_PARAM_SET(param, INT, zoom);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ LOGD("Enter, remote_handle : %td", pc->remote_handle);
CAMERA_MSG_PARAM_SET(param, INT, set_mode);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
}
+int camera_attr_set_hue(camera_h camera, int level)
+{
+ int ret = CAMERA_ERROR_NONE;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HUE;
+ camera_msg_param param;
+
+ if (!pc || !pc->cb_info) {
+ LOGE("NULL handle");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("Enter");
+
+ CAMERA_MSG_PARAM_SET(param, INT, level);
+
+ _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
+
+ LOGD("ret : 0x%x", ret);
+
+ return ret;
+}
+
+
int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
{
int ret = CAMERA_ERROR_NONE;
return CAMERA_ERROR_INVALID_PARAMETER;
}
- LOGD("Enter, remote_handle : %x", pc->remote_handle);
+ LOGD("Enter, remote_handle : %td", pc->remote_handle);
CAMERA_MSG_PARAM_SET(param, STRING, software);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*zoom = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ZOOM];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE][0];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*mode = (camera_attr_af_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_AF_MODE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*mode = (camera_attr_exposure_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EXPOSURE_MODE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*value = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EXPOSURE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE][0];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*iso = (camera_attr_iso_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ISO];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_BRIGHTNESS];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE][0];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_CONTRAST];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE][0];
}
+int camera_attr_get_hue(camera_h camera, int *level)
+{
+ int ret = CAMERA_ERROR_NONE;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HUE;
+
+ if (!pc || !pc->cb_info || !level) {
+ LOGE("NULL pointer %p %p", pc, level);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("Enter");
+
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+ if (ret == CAMERA_ERROR_NONE)
+ *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_HUE];
+
+ LOGD("ret : 0x%x", ret);
+
+ return ret;
+}
+
+
+int camera_attr_get_hue_range(camera_h camera, int *min, int *max)
+{
+ int ret = CAMERA_ERROR_NONE;
+ camera_cli_s *pc = (camera_cli_s *)camera;
+ muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HUE_RANGE;
+
+ if (!pc || !pc->cb_info || !min || !max) {
+ LOGE("NULL pointer %p %p %p", pc, min, max);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ LOGD("Enter");
+
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+
+ if (ret == CAMERA_ERROR_NONE) {
+ *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_HUE_RANGE][0];
+ *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_HUE_RANGE][1];
+ LOGD("min %d, max %d", *min, *max);
+ }
+
+ LOGD("ret : 0x%x", ret);
+
+ return ret;
+}
+
+
int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
{
int ret = CAMERA_ERROR_NONE;
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*wb = (camera_attr_whitebalance_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*effect = (camera_attr_effect_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EFFECT];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*mode = (camera_attr_scene_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_SCENE_MODE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*enable = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_TAG];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*description = strdup(pc->cb_info->get_string[MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*orientation = (camera_attr_tag_orientation_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_TAG_ORIENTATION];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*software = strdup(pc->cb_info->get_string[MUSE_CAMERA_GET_STRING_TAG_SOFTWARE]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*latitude = pc->cb_info->get_geotag[0];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*mode = (camera_attr_flash_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_FLASH_MODE];
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
- LOGD("Enter, handle :%x", pc->remote_handle);
+ LOGD("Enter, handle :%td", pc->remote_handle);
return ret;
}
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*rotation = (camera_rotation_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_STREAM_ROTATION];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*flip = (camera_flip_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_STREAM_FLIP];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*mode = (camera_attr_hdr_mode_e)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_HDR_MODE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
g_mutex_lock(&pc->cb_info->user_cb_mutex[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS]);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*enabled = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*enabled = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*enabled = (bool)pc->cb_info->get_int[MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret < 0) {
LOGE("error is occurred 0x%x", ret);
int ret = CAMERA_ERROR_NONE;
camera_cli_s *pc = (camera_cli_s *)camera;
muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
- camera_msg_param param;
- int set_move_type = (int)move_type;
- int value = 0;
+ camera_msg_param param0;
+ camera_msg_param param1;
if (!pc || !pc->cb_info) {
LOGE("NULL handle");
LOGD("Enter");
- value = (set_move_type << 16) | pan_step;
- CAMERA_MSG_PARAM_SET(param, INT, value);
+ CAMERA_MSG_PARAM_SET(param0, INT, move_type);
+ CAMERA_MSG_PARAM_SET(param1, INT, pan_step);
- _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
+ _camera_msg_send_param2_int(api, pc->cb_info, &ret,
+ ¶m0, ¶m1, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*pan_step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_PAN];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE][0];
int ret = CAMERA_ERROR_NONE;
camera_cli_s *pc = (camera_cli_s *)camera;
muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
- camera_msg_param param;
- int set_move_type = (int)move_type;
- int value = 0;
+ camera_msg_param param0;
+ camera_msg_param param1;
if (!pc || !pc->cb_info) {
LOGE("NULL handle");
LOGD("Enter");
- value = (set_move_type << 16) | tilt_step;
- CAMERA_MSG_PARAM_SET(param, INT, value);
+ CAMERA_MSG_PARAM_SET(param0, INT, move_type);
+ CAMERA_MSG_PARAM_SET(param1, INT, tilt_step);
- _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT);
+ _camera_msg_send_param2_int(api, pc->cb_info, &ret,
+ ¶m0, ¶m1, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE)
*tilt_step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_TILT];
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE][0];
pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
LOGD("ret : 0x%x", ret);
LOGD("Enter");
-#ifdef TIZEN_FEATURE_EVAS_RENDERER
if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
- g_mutex_lock(&pc->cb_info->evas_mutex);
-
- ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
-
- g_mutex_unlock(&pc->cb_info->evas_mutex);
-
+ ret = mm_display_interface_evas_set_roi_area(pc->cb_info->dp_interface, x, y, width, height);
if (ret != MM_ERROR_NONE) {
LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
return CAMERA_ERROR_INVALID_OPERATION;
}
}
-#endif /* TIZEN_FEATURE_EVAS_RENDERER */
length = sizeof(set_display_roi_area) / sizeof(int) + \
(sizeof(set_display_roi_area) % sizeof(int) ? 1 : 0);
LOGD("Enter");
- _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
+ _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT);
if (ret == CAMERA_ERROR_NONE) {
*x = pc->cb_info->get_display_roi_area[0];