Update code for count 0 of face detection 55/112855/1
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 2 Feb 2017 06:32:13 +0000 (15:32 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 3 Feb 2017 05:37:17 +0000 (14:37 +0900)
[Version] 0.2.93
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20170131.2]

Change-Id: I464820eaef8b9ebc5c2a9f257d7b365f05a922ce
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/capi-media-camera.spec
src/camera.c
test/camera_test.c

index c7baf6c..cc04db4 100644 (file)
@@ -1,7 +1,7 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.2.92
-Release:    1
+Version:    0.2.93
+Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 7088bf3..77f7912 100644 (file)
@@ -1329,36 +1329,28 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m
                        muse_camera_msg_get(count, recv_msg);
                        muse_camera_msg_get(tbm_key, recv_msg);
 
-                       if (count > 0 && tbm_key > 0) {
+                       if (count >= 0) {
                                LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
 
-                               if (!_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
-                                       break;
-
-                               /* set face info */
-                               faces = bo_handle.ptr;
-
-                               ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
-
-#if 0
-                               {
-                                       int i = 0;
+                               if (tbm_key > 0) {
 
-                                       for (i = 0 ; i < count ; i++) {
-                                               LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
-                                                    i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
+                                       if (_camera_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
+                                               /* set face info */
+                                               faces = bo_handle.ptr;
                                        }
                                }
-#endif
+
+                               ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
 
                                /* release bo */
                                _camera_release_imported_bo(&bo);
 
                                /* return buffer */
-                               CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
-                               _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
-
-                               /*LOGD("return buffer done");*/
+                               if (tbm_key > 0) {
+                                       CAMERA_MSG_PARAM_SET(param, INT, tbm_key);
+                                       _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, &param, 0);
+                                       /*LOGD("return buffer done");*/
+                               }
                        } else {
                                LOGE("invalid message - count %d, key %d", count, tbm_key);
                        }
index 7cb2630..8e4616f 100644 (file)
@@ -566,7 +566,7 @@ static bool strobe_mode_cb(camera_attr_flash_mode_e mode, void *user_data)
 
 static void _face_detected(camera_detected_face_s *faces, int count, void *user_data)
 {
-       g_print("face detected!!\n");
+       g_print("face detected!! - count %d\n", count);
        int i;
 
        for (i = 0 ; i < count ; i++)
@@ -1147,16 +1147,21 @@ static void setting_menu(gchar buf)
                }
                break;
        case 'l': /* Setting > Face detection setting */
-               g_print("* Face detect mode !\n");
-               flush_stdin();
-               for (i = 0 ; i < 2 ; i++)
-                       g_print("\t %d. %s \n", i+1, detection_mode[i]);
-               err = scanf("%d", &idx);
                if (camera_is_supported_face_detection(hcamcorder->camera)) {
-                       if (idx >= 0 && idx < 2)
+                       g_print("* Face detect mode !\n");
+                       flush_stdin();
+                       for (i = 0 ; i < 2 ; i++)
+                               g_print("\t %d. %s \n", i, detection_mode[i]);
+                       err = scanf("%d", &idx);
+                       if (idx == 0)
+                               bret = camera_stop_face_detection(hcamcorder->camera);
+                       else if (idx == 1)
                                bret = camera_start_face_detection(hcamcorder->camera, _face_detected, NULL);
-               } else
+                       else
+                               g_print("\n invalid input [%d]\n\n", idx);
+               } else {
                        g_print("face detection_not supported");
+               }
                break;
        case 'k': /* Setting > Anti-handshake */
                g_print("*Anti-handshake !\n");