/* log level */
int g_mmcam_log_level = CAMERA_LOG_LEVEL_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 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
+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 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,
+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 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)
+static gboolean __camera_allocate_preview_buffer(camera_h camera)
{
int i = 0;
int ret = CAMERA_ERROR_NONE;
return TRUE;
_ALLOCATE_PREVIEW_BUFFER_FAILED:
- _camera_release_preview_buffer(camera);
+ __camera_release_preview_buffer(camera);
return FALSE;
}
-static void _camera_release_preview_buffer(camera_h camera)
+static void __camera_release_preview_buffer(camera_h camera)
{
int i = 0;
camera_cli_s *pc = (camera_cli_s *)camera;
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)) {
+ if (!__camera_import_tbm_fd(cb_info->bufmgr, tfd[1], &data_bo, &data_bo_handle)) {
CAM_LOG_ERROR("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)) {
+ if (!__camera_import_tbm_fd(cb_info->bufmgr, tfd[0], &bo, &bo_handle)) {
CAM_LOG_ERROR("failed to import fd %d", tfd[0]);
goto _PREVIEW_CB_HANDLER_DONE;
}
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])) {
+ if (!__camera_import_tbm_fd(cb_info->bufmgr, tfd[i + 1], &buffer_bo[i], &buffer_bo_handle[i])) {
CAM_LOG_ERROR("failed to import buffer fd %d", tfd[i + 1]);
goto _PREVIEW_CB_HANDLER_DONE;
}
}
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);
+ 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);
+ ret = __camera_media_packet_create(cb_info, stream, mp_data, &pkt_evas);
if (ret != CAMERA_ERROR_NONE) {
CAM_LOG_ERROR("create pkt for evas failed");
- _camera_media_packet_data_release(mp_data, cb_info);
+ __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);
+ 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);
+ 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);
+ __camera_media_packet_data_release(mp_data, cb_info);
mp_data = NULL;
}
}
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]);
+ __camera_release_imported_bo(&buffer_bo[i]);
/* unmap and unref tbm bo */
- _camera_release_imported_bo(&data_bo);
- _camera_release_imported_bo(&bo);
+ __camera_release_imported_bo(&data_bo);
+ __camera_release_imported_bo(&bo);
/* close imported fd */
for (i = 0 ; i < MUSE_NUM_FD ; i++) {
}
/* import tbm bo and get virtual address */
- if (!_camera_import_tbm_fd(cb_info->bufmgr, tfd[tfd_index], &bo_main, &bo_main_handle)) {
+ if (!__camera_import_tbm_fd(cb_info->bufmgr, tfd[tfd_index], &bo_main, &bo_main_handle)) {
CAM_LOG_ERROR("failed to import fd [%d] for main", tfd[tfd_index]);
goto _CAPTURE_CB_HANDLER_DONE;
}
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)) {
+ 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;
CAM_LOG_INFO("rPostview->size : %d", rPostview->size);
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)) {
+ 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;
CAM_LOG_INFO("rThumbnail->size : %d", rThumbnail->size);
_CAPTURE_CB_HANDLER_DONE:
/* return buffer */
if (capture_fd_main >= 0) {
- _camera_release_imported_bo(&bo_main);
+ __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_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_release_imported_bo(&bo_thumb);
_camera_msg_return_buffer(capture_fd_thumb, cb_info);
}
CAM_LOG_INFO("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)) {
+ if (__camera_import_tbm_fd(cb_info->bufmgr, tfd[0], &bo, &bo_handle)) {
/* set face info */
faces = bo_handle.ptr;
}
count, cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
/* release bo */
- _camera_release_imported_bo(&bo);
+ __camera_release_imported_bo(&bo);
} else {
CAM_LOG_WARNING("skip face detection message [count %d, fd %d, cb %p]",
count, tfd[0], cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION]);
}
-static bool _camera_import_tbm_fd(tbm_bufmgr bufmgr, int fd, tbm_bo *bo, tbm_bo_handle *bo_handle)
+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, };
return true;
}
-static void _camera_release_imported_bo(tbm_bo *bo)
+static void __camera_release_imported_bo(tbm_bo *bo)
{
if (!bo || !(*bo)) {
CAM_LOG_DEBUG("NULL bo");
return;
}
-static int _camera_client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
+static int __camera_client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
{
int ret = CAMERA_ERROR_NONE;
gint64 end_time;
*ret = CAMERA_ERROR_INVALID_OPERATION;
} else {
if (ret)
- *ret = _camera_client_wait_for_cb_return(api, cb_info, timeout);
+ *ret = __camera_client_wait_for_cb_return(api, cb_info, timeout);
}
__camera_update_api_waiting(cb_info, api, -1);
*ret = CAMERA_ERROR_INVALID_OPERATION;
} else {
if (ret)
- *ret = _camera_client_wait_for_cb_return(api, cb_info, timeout);
+ *ret = __camera_client_wait_for_cb_return(api, cb_info, timeout);
}
__camera_update_api_waiting(cb_info, api, -1);
func_ret = CAMERA_ERROR_INVALID_OPERATION;
} else {
- func_ret = _camera_client_wait_for_cb_return(api, cb_info, timeout);
+ func_ret = __camera_client_wait_for_cb_return(api, cb_info, timeout);
}
__camera_update_api_waiting(cb_info, api, -1);
}
-static int _camera_media_packet_data_create(int ret_fd, int *tfd, int num_buffer_fd, 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;
return ret;
}
-static 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;
close(mp_data->fd);
mp_data->fd = -1;
- _camera_release_imported_bo(&mp_data->bo);
+ __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);
+ __camera_release_imported_bo(&mp_data->data_bo);
/* return buffer */
_camera_msg_return_buffer(mp_data->ret_fd, cb_info);
return;
}
-static 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;
if (ret != MEDIA_PACKET_ERROR_NONE) {
CAM_LOG_ERROR("media_packet_set_extra failed");
- _camera_media_packet_data_release(mp_data, cb_info);
+ __camera_media_packet_data_release(mp_data, cb_info);
media_packet_destroy(pkt);
} else {
g_mutex_lock(&cb_info->mp_data_mutex);
- _camera_media_packet_data_release(mp_data, cb_info);
+ __camera_media_packet_data_release(mp_data, cb_info);
mp_data = NULL;
g_mutex_unlock(&cb_info->mp_data_mutex);
return MEDIA_PACKET_FINALIZE;
}
-static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event, int *tfd)
+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;
return;
}
-static gboolean _camera_idle_event_callback(gpointer 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;
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, cam_idle_event->tfd);
+ __camera_client_user_callback(cb_info, cam_idle_event->recv_msg, cam_idle_event->event, cam_idle_event->tfd);
IDLE_EVENT_CALLBACK_DONE:
/* release event */
return FALSE;
}
-static gpointer _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, cam_msg->tfd);
+ __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);
g_mutex_unlock(&g_cam_idle_event_lock);
g_idle_add_full(G_PRIORITY_DEFAULT,
- (GSourceFunc)_camera_idle_event_callback,
+ (GSourceFunc)__camera_idle_event_callback,
(gpointer)cam_idle_event,
NULL);
break;
}
-static void _camera_deactivate_idle_event_all(camera_cb_info_s *cb_info)
+static void __camera_deactivate_idle_event_all(camera_cb_info_s *cb_info)
{
camera_idle_event_s *cam_idle_event = NULL;
GList *list = NULL;
}
-static gpointer _camera_msg_recv_func(gpointer data)
+static gpointer __camera_msg_recv_func(gpointer data)
{
int i = 0;
int recv_length = 0;
g_atomic_int_set(&handler_info->running, 1);
handler_info->thread = g_thread_try_new(thread_name,
- _camera_msg_handler_func, (gpointer)handler_info, NULL);
+ __camera_msg_handler_func, (gpointer)handler_info, NULL);
if (handler_info->thread == NULL) {
CAM_LOG_ERROR("t:%d thread failed", type);
}
-static camera_cb_info_s *_camera_client_callback_new(gint sockfd)
+static camera_cb_info_s *__camera_client_callback_new(gint sockfd)
{
camera_cb_info_s *cb_info = NULL;
gint i = 0;
/* message receive thread */
g_atomic_int_set(&cb_info->msg_recv_running, 1);
cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
- _camera_msg_recv_func, (gpointer)cb_info, NULL);
+ __camera_msg_recv_func, (gpointer)cb_info, NULL);
if (cb_info->msg_recv_thread == NULL) {
CAM_LOG_ERROR("message receive thread creation failed");
goto ErrorExit;
//LCOV_EXCL_STOP
}
-static void _camera_client_callback_destroy(camera_cb_info_s *cb_info)
+static void __camera_client_callback_destroy(camera_cb_info_s *cb_info)
{
int i = 0;
goto ErrorExit;
}
- pc->cb_info = _camera_client_callback_new(sock_fd);
+ pc->cb_info = __camera_client_callback_new(sock_fd);
if (pc->cb_info == NULL) {
CAM_LOG_ERROR("cb_info alloc failed");
ret = CAMERA_ERROR_OUT_OF_MEMORY;
CAM_LOG_INFO("cb info : %d", pc->cb_info->fd);
- ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
+ ret = __camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
pc->cb_info->api_waiting[MUSE_CAMERA_API_CREATE] = 0;
/* pc->cb_info->fd should be closed,
because g_thread_join for msg_recv_thread is not returned
- in _camera_client_callback_destroy. */
+ 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);
+ __camera_client_callback_destroy(pc->cb_info);
pc->cb_info = NULL;
}
g_free(pc);
CAM_LOG_WARNING("server disconnected. release resource without send message.");
if (ret == CAMERA_ERROR_NONE) {
- _camera_deactivate_idle_event_all(pc->cb_info);
- _camera_client_callback_destroy(pc->cb_info);
+ __camera_deactivate_idle_event_all(pc->cb_info);
+ __camera_client_callback_destroy(pc->cb_info);
pc->cb_info = NULL;
g_free(pc);
}
if (current_state == CAMERA_STATE_CREATED && pc->cb_info->user_buffer_supported) {
- if (!_camera_allocate_preview_buffer(camera))
+ 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);
if (ret == CAMERA_ERROR_NONE) {
if (pc->cb_info->user_buffer_supported)
- _camera_release_preview_buffer(camera);
+ __camera_release_preview_buffer(camera);
} else if (current_state == CAMERA_STATE_PREVIEW) {
CAM_LOG_WARNING("restart evas rendering");
_camera_start_evas_rendering(camera);
CAM_LOG_ERROR("message send failed");
ret = CAMERA_ERROR_INVALID_OPERATION;
} else {
- ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
+ ret = __camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
}
__camera_update_api_waiting(pc->cb_info, api, -1);
CAM_LOG_ERROR("message send failed");
ret = CAMERA_ERROR_INVALID_OPERATION;
} else {
- ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
+ ret = __camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT);
}
__camera_update_api_waiting(pc->cb_info, api, -1);