summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/camera_private.h4
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--src/camera.c47
-rw-r--r--test/multimedia_camera_test.c2
4 files changed, 21 insertions, 34 deletions
diff --git a/include/camera_private.h b/include/camera_private.h
index 53ab932..ecaf45b 100644
--- a/include/camera_private.h
+++ b/include/camera_private.h
@@ -47,8 +47,8 @@ typedef struct _camera_cb_info_s {
gpointer user_cb[MUSE_CAMERA_EVENT_TYPE_NUM];
gpointer user_data[MUSE_CAMERA_EVENT_TYPE_NUM];
gchar recv_msg[MUSE_CAMERA_MSG_MAX_LENGTH];
- GCond *api_cond;
- GMutex *api_mutex;
+ GCond api_cond[MUSE_CAMERA_API_MAX];
+ GMutex api_mutex[MUSE_CAMERA_API_MAX];
gint *api_activating;
gint *api_ret;
tbm_bufmgr bufmgr;
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index 51102ba..73da928 100644
--- a/packaging/capi-media-camera.spec
+++ b/packaging/capi-media-camera.spec
@@ -3,7 +3,7 @@
Name: capi-media-camera
Summary: A Camera API
-Version: 0.2.31
+Version: 0.2.32
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/camera.c b/src/camera.c
index 05378f2..2b60665 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -1493,10 +1493,9 @@ CB_HANDLER_EXIT:
static camera_cb_info_s *_client_callback_new(gint sockfd)
{
camera_cb_info_s *cb_info = NULL;
- GCond *tmp_cond = NULL;
- GMutex *tmp_mutex = NULL;
gint *tmp_activating = NULL;
gint *tmp_ret = NULL;
+ gint i = 0;
g_return_val_if_fail(sockfd > 0, NULL);
@@ -1511,16 +1510,9 @@ static camera_cb_info_s *_client_callback_new(gint sockfd)
g_mutex_init(&cb_info->idle_event_mutex);
g_cond_init(&cb_info->idle_event_cond);
- tmp_cond = g_new0(GCond, MUSE_CAMERA_API_MAX);
- if (tmp_cond == NULL) {
- LOGE("tmp_cond failed");
- goto ErrorExit;
- }
-
- tmp_mutex = g_new0(GMutex, MUSE_CAMERA_API_MAX);
- if (tmp_mutex == NULL) {
- LOGE("tmp_mutex failed");
- goto ErrorExit;
+ for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
+ g_mutex_init(&cb_info->api_mutex[i]);
+ g_cond_init(&cb_info->api_cond[i]);
}
tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
@@ -1550,8 +1542,6 @@ static camera_cb_info_s *_client_callback_new(gint sockfd)
}
cb_info->fd = sockfd;
- cb_info->api_cond = tmp_cond;
- cb_info->api_mutex = tmp_mutex;
cb_info->api_activating = tmp_activating;
cb_info->api_ret = tmp_ret;
@@ -1578,6 +1568,11 @@ ErrorExit:
cb_info->msg_handler_thread = NULL;
}
+ for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
+ g_mutex_clear(&cb_info->api_mutex[i]);
+ g_cond_clear(&cb_info->api_cond[i]);
+ }
+
g_mutex_clear(&cb_info->msg_handler_mutex);
g_cond_clear(&cb_info->msg_handler_cond);
g_mutex_clear(&cb_info->idle_event_mutex);
@@ -1592,14 +1587,6 @@ ErrorExit:
cb_info = NULL;
}
- if (tmp_cond) {
- g_free(tmp_cond);
- tmp_cond = NULL;
- }
- if (tmp_mutex) {
- g_free(tmp_mutex);
- tmp_mutex = NULL;
- }
if (tmp_activating) {
g_free(tmp_activating);
tmp_activating = NULL;
@@ -1614,6 +1601,8 @@ ErrorExit:
static void _client_callback_destroy(camera_cb_info_s *cb_info)
{
+ gint i = 0;
+
g_return_if_fail(cb_info != NULL);
LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
@@ -1635,6 +1624,12 @@ static void _client_callback_destroy(camera_cb_info_s *cb_info)
g_queue_free(cb_info->msg_queue);
cb_info->msg_queue = NULL;
+
+ for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
+ g_mutex_clear(&cb_info->api_mutex[i]);
+ g_cond_clear(&cb_info->api_cond[i]);
+ }
+
g_mutex_clear(&cb_info->msg_handler_mutex);
g_cond_clear(&cb_info->msg_handler_cond);
g_mutex_clear(&cb_info->idle_event_mutex);
@@ -1646,14 +1641,6 @@ static void _client_callback_destroy(camera_cb_info_s *cb_info)
tbm_bufmgr_deinit(cb_info->bufmgr);
cb_info->bufmgr = NULL;
}
- if (cb_info->api_cond) {
- g_free(cb_info->api_cond);
- cb_info->api_cond = NULL;
- }
- if (cb_info->api_mutex) {
- g_free(cb_info->api_mutex);
- cb_info->api_mutex = NULL;
- }
if (cb_info->api_activating) {
g_free(cb_info->api_activating);
cb_info->api_activating = NULL;
diff --git a/test/multimedia_camera_test.c b/test/multimedia_camera_test.c
index fcfd7e6..1ef98ce 100644
--- a/test/multimedia_camera_test.c
+++ b/test/multimedia_camera_test.c
@@ -949,7 +949,7 @@ static void setting_menu(gchar buf)
break;
case 'F': /* Getting > Get Facing direction */
g_print("* Get facing direction of camera module\n");
- err = camera_get_facing_direction(hcamcorder->camera, &idx);
+ err = camera_get_facing_direction(hcamcorder->camera, (camera_facing_direction_e *)&idx);
if (CAMERA_ERROR_NONE == err)
g_print("* Facing direction : %s(%d)\n", facing_direction[idx], idx);
else