Update code for count 0 of face detection
[platform/core/api/camera.git] / test / camera_test.c
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");