Code clean up for camera_test.c 22/272622/1
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 22 Mar 2022 02:16:30 +0000 (11:16 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 22 Mar 2022 02:16:30 +0000 (11:16 +0900)
Change-Id: I8f0680bcaad6d30af73d1871c2f682309ae51aad
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
test/camera_test.c

index 9115cb8..98dfdbb 100644 (file)
@@ -139,7 +139,7 @@ static media_bridge_h bridge;
   -----------------------------------------------------------------------*/
 enum {
        MODE_VIDEO_CAPTURE, /* recording and image capture mode */
-       MODE_AUDIO,     /* audio recording*/
+       MODE_AUDIO,         /* audio recording*/
        MODE_NUM,
 };
 
@@ -158,10 +158,10 @@ enum {
 typedef struct _cam_handle {
        camera_h camera;
        int type;
-       int is_multishot;                           /* flag for multishot mode */
-       int stillshot_count;                        /* stillshot count */
-       int multishot_count;                        /* multishot count */
-       char file_path[MAX_FILE_PATH_LENGTH];  /* file path for captured data */
+       int is_multishot;                       /* flag for multishot mode */
+       int stillshot_count;                    /* stillshot count */
+       int multishot_count;                    /* multishot count */
+       char file_path[MAX_FILE_PATH_LENGTH];   /* file path for captured data */
        int menu_state;
        unsigned long long elapsed_time;
 } cam_handle_t;
@@ -460,22 +460,16 @@ static void _camera_error_cb(int error, camera_state_e current_state, void *user
        default:
                break;
        }
-
-       return;
 }
 
 static void _camera_state_changed_cb(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data)
 {
        g_print("\n\tcamera state changed %d -> %d\n", previous, current);
-
-       return;
 }
 
 static void _camera_device_state_changed_cb(camera_device_e device, camera_device_state_e state, void *user_data)
 {
        g_print("\n\tcamera device[%d] state changed to %d\n", device, state);
-
-       return;
 }
 
 static void _camera_device_connection_changed_cb(camera_device_s *device, bool is_connected, void *user_data)
@@ -487,23 +481,17 @@ static void _camera_device_connection_changed_cb(camera_device_s *device, bool i
 
        g_print("\n\tcamera device changed[is_connected:%d][Type:%d,index:%d,name:%s,id:%s,exstreamnum:%d]\n",
                is_connected, device->type, device->index, device->name, device->id, device->extra_stream_num);
-
-       return;
 }
 
 static void _camera_interrupted_cb(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data)
 {
        g_print("\n\tcamera interrupted callback called[state %d -> %d, policy %d]\n",
                previous, current, policy);
-
-       return;
 }
 
 static void _camera_interrupt_started_cb(camera_policy_e policy, camera_state_e state, void *user_data)
 {
        g_print("\n\tcamera interrupt started callback called[state %d, policy %d]\n", state, policy);
-
-       return;
 }
 
 static void _dump_preview_data(camera_preview_data_s *frame, const char *file_name)
@@ -812,13 +800,12 @@ 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("\tface detected!! - count %d\n", count);
        int i;
 
+       g_print("\tface detected!! - count %d\n", count);
+
        for (i = 0 ; i < count ; i++)
                g_print("\t%d] %dx%d\n", faces[i].id, faces[i].x, faces[i].y);
-
-       return;
 }
 
 static void _file_write(char *path, void *data, int size)
@@ -843,8 +830,6 @@ static void _file_write(char *path, void *data, int size)
        } else {
                g_print("\n\topen error! [%s], errno %d\n", path, errno);
        }
-
-       return;
 }
 
 static void capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data)
@@ -863,15 +848,11 @@ static void capturing_cb(camera_image_data_s* image, camera_image_data_s* postvi
 
                _file_write(m_filename, image->data, image->size);
        }
-
-       return;
 }
 
 static void capture_completed_cb(void *user_data)
 {
        camera_start_preview(hcamcorder->camera);
-
-       return;
 }
 
 static void print_menu()
@@ -981,8 +962,6 @@ static void print_menu()
        }
 
        g_print("\tCommand >> ");
-
-       return;
 }
 
 
@@ -1096,8 +1075,6 @@ static void main_menu(gchar buf)
                g_print("\t Invalid input \n");
                break;
        }
-
-       return;
 }
 
 
@@ -1676,12 +1653,10 @@ static void setting_menu(gchar buf)
        case 'n': /* file path */
                g_print("* File path !\n");
                g_print("\n Input file path to save captured data(string) : ");
-               if (fgets(hcamcorder->file_path, sizeof(hcamcorder->file_path), stdin)) {
-                       hcamcorder->file_path[strlen(hcamcorder->file_path) - 1] = '\0';
+               if (fgets(hcamcorder->file_path, sizeof(hcamcorder->file_path), stdin))
                        g_print("\ncaptured data will be saved in [%s]\n", hcamcorder->file_path);
-               } else {
+               else
                        g_print("\nset file path failed\n");
-               }
                break;
        case 'm': /* media bridge */
                g_print("* Media Bridge !\n");
@@ -1707,8 +1682,6 @@ static void setting_menu(gchar buf)
        }
 
        g_print("\t bret : 0x%x \n", bret);
-
-       return;
 }
 
 
@@ -1764,8 +1737,6 @@ static void device_state_menu(gchar buf)
                g_print("\n\tinvalid input[%c]\n", buf);
                break;
        }
-
-       return;
 }
 
 static void device_list_menu(gchar buf)
@@ -1824,8 +1795,6 @@ static void device_list_menu(gchar buf)
                g_print("\n\tinvalid input[%c]\n", buf);
                break;
        }
-
-       return;
 }
 
 
@@ -1981,7 +1950,7 @@ static gboolean mode_change(gchar buf)
 
        if (err != 0) {
                g_print("\n\tmmcamcorder_create = 0x%x\n", err);
-               return -1;
+               return FALSE;
        }
 
        while (!check) {