static GMutex g_cam_idle_event_lock;
/* log level */
-int g_mmcam_log_level;
+int g_mmcam_log_level = CAMERA_LOG_LEVEL_INFO;
static void _camera_msg_send(int api, int *fds, camera_cb_info_s *cb_info,
int *ret, int timeout);
return CAMERA_ERROR_NONE;
}
-void camera_create_preview_frame(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;
- unsigned char *buf_pos = NULL;
-
- if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
- CAM_LOG_ERROR("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
- return;
- }
-
- /* set frame info */
- if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
- frame->format = MM_PIXEL_FORMAT_UYVY;
- else
- frame->format = stream->format;
-
- frame->width = stream->width;
- frame->height = stream->height;
- frame->timestamp = stream->timestamp;
- frame->num_of_planes = stream->num_planes;
-
- if (num_buffer_fd == 0) {
-//LCOV_EXCL_START
- /* non-zero copy */
- if (!data_bo_handle || !data_bo_handle->ptr) {
- CAM_LOG_ERROR("NULL pointer");
- return;
- }
-
- buf_pos = data_bo_handle->ptr;
-
- if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
- frame->data.encoded_plane.data = buf_pos;
- frame->data.encoded_plane.size = stream->data.encoded.length_data;
- frame->data.encoded_plane.is_delta_frame = (bool)stream->data.encoded.is_delta_frame;
- total_size = stream->data.encoded.length_data;
- } else if (stream->format == MM_PIXEL_FORMAT_ENCODED_MJPEG) {
- 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:
- frame->data.single_plane.yuv = buf_pos;
- frame->data.single_plane.size = stream->data.yuv420.length_yuv;
- total_size = stream->data.yuv420.length_yuv;
- break;
- case 2:
- frame->data.double_plane.y = buf_pos;
- frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
- buf_pos += stream->data.yuv420sp.length_y;
- frame->data.double_plane.uv = buf_pos;
- frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
- total_size = stream->data.yuv420sp.length_y + \
- stream->data.yuv420sp.length_uv;
- break;
- case 3:
- frame->data.triple_plane.y = buf_pos;
- frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
- buf_pos += stream->data.yuv420p.length_y;
- frame->data.triple_plane.u = buf_pos;
- frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
- buf_pos += stream->data.yuv420p.length_u;
- frame->data.triple_plane.v = buf_pos;
- frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
- total_size = stream->data.yuv420p.length_y + \
- stream->data.yuv420p.length_u + \
- stream->data.yuv420p.length_v;
- break;
- default:
- 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_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;
- frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
- frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
- total_size = 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_fd) {
- frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
- frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
- } else {
- frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
- frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
- }
- frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
- frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
- frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
- total_size = stream->data.yuv420p.length_y + \
- stream->data.yuv420p.length_u + \
- stream->data.yuv420p.length_v;
- break;
-//LCOV_EXCL_STOP
- default:
- break;
- }
- }
-
- CAM_LOG_DEBUG("format[%d], res[%dx%d], size[%d], plane num[%d]",
- frame->format, frame->width, frame->height, total_size, frame->num_of_planes);
-
- return;
-}
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)
return CAMERA_ERROR_INVALID_PARAMETER;
}
+ CAM_LOG_INFO("device %d", device);
+
sock_fd = muse_client_new();
if (sock_fd < 0) {
CAM_LOG_ERROR("muse_client_new failed - returned fd %d", sock_fd);
if (ret == CAMERA_ERROR_NONE) {
int preview_format = CAMERA_PIXEL_FORMAT_INVALID;
int user_buffer_supported = 0;
+ int log_level = CAMERA_LOG_LEVEL_INFO;
intptr_t handle = 0;
muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
muse_camera_msg_get(preview_format, pc->cb_info->recv_msg);
muse_camera_msg_get(user_buffer_supported, pc->cb_info->recv_msg);
-
- g_mmcam_log_level = CAMERA_LOG_LEVEL_INFO;
-
-
+ muse_camera_msg_get(log_level, 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;
+ g_mmcam_log_level = log_level;
CAM_LOG_INFO("default preview format %d, user buffer %d, log level %d",
preview_format, user_buffer_supported, g_mmcam_log_level);
#endif
#define LOG_TAG "TIZEN_N_CAMERA"
+/* log level */
+extern int g_mmcam_log_level;
+
//LCOV_EXCL_START
int camera_start_evas_rendering(camera_h camera)
{
return _camera_set_display(camera, MM_DISPLAY_TYPE_OVERLAY_EXT, ecore_wl_window);
}
//LCOV_EXCL_STOP
+
+void camera_create_preview_frame(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;
+ unsigned char *buf_pos = NULL;
+
+ if (!stream || !buffer_bo_handle || !frame) {
+ CAM_LOG_ERROR("invalid param %p,%p,%p", stream, buffer_bo_handle, frame);
+ return;
+ }
+
+ /* set frame info */
+ if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
+ frame->format = MM_PIXEL_FORMAT_UYVY;
+ else
+ frame->format = stream->format;
+
+ frame->width = stream->width;
+ frame->height = stream->height;
+ frame->timestamp = stream->timestamp;
+ frame->num_of_planes = stream->num_planes;
+
+ if (num_buffer_fd == 0) {
+//LCOV_EXCL_START
+ /* non-zero copy */
+ if (!data_bo_handle || !data_bo_handle->ptr) {
+ CAM_LOG_ERROR("NULL pointer");
+ return;
+ }
+
+ buf_pos = data_bo_handle->ptr;
+
+ if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
+ frame->data.encoded_plane.data = buf_pos;
+ frame->data.encoded_plane.size = stream->data.encoded.length_data;
+ frame->data.encoded_plane.is_delta_frame = (bool)stream->data.encoded.is_delta_frame;
+ total_size = stream->data.encoded.length_data;
+ } else if (stream->format == MM_PIXEL_FORMAT_ENCODED_MJPEG) {
+ 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:
+ frame->data.single_plane.yuv = buf_pos;
+ frame->data.single_plane.size = stream->data.yuv420.length_yuv;
+ total_size = stream->data.yuv420.length_yuv;
+ break;
+ case 2:
+ frame->data.double_plane.y = buf_pos;
+ frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
+ buf_pos += stream->data.yuv420sp.length_y;
+ frame->data.double_plane.uv = buf_pos;
+ frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
+ total_size = stream->data.yuv420sp.length_y + \
+ stream->data.yuv420sp.length_uv;
+ break;
+ case 3:
+ frame->data.triple_plane.y = buf_pos;
+ frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
+ buf_pos += stream->data.yuv420p.length_y;
+ frame->data.triple_plane.u = buf_pos;
+ frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
+ buf_pos += stream->data.yuv420p.length_u;
+ frame->data.triple_plane.v = buf_pos;
+ frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
+ total_size = stream->data.yuv420p.length_y + \
+ stream->data.yuv420p.length_u + \
+ stream->data.yuv420p.length_v;
+ break;
+ default:
+ 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_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;
+ frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
+ frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
+ total_size = 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_fd) {
+ frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
+ frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
+ } else {
+ frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
+ frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
+ }
+ frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
+ frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
+ frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
+ total_size = stream->data.yuv420p.length_y + \
+ stream->data.yuv420p.length_u + \
+ stream->data.yuv420p.length_v;
+ break;
+//LCOV_EXCL_STOP
+ default:
+ break;
+ }
+ }
+
+ CAM_LOG_DEBUG("format[%d], res[%dx%d], size[%d], plane num[%d]",
+ frame->format, frame->width, frame->height, total_size, frame->num_of_planes);
+
+ return;
+}