From f0032f32473be1373ade05bd9a7417e4e60ba707 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 10 May 2023 14:23:59 +0900 Subject: camera_test: Add new menu for capture format - Minor change : Rename menu from "Picture format" to "Preview format". : Do not show menu when quit testsuite. : Clean up log. [Version] 0.4.102 [Issue Type] Test Change-Id: I207e6efcf47ff638a21151454516d4a29f3a3f63 Signed-off-by: Jeongmo Yang --- packaging/capi-media-camera.spec | 2 +- test/camera_test.c | 33 ++++++++++++++++++++++----------- test/camera_test_headed.c | 2 -- test/camera_test_headless.c | 2 -- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index c8682f5..b16d768 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.4.101 +Version: 0.4.102 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/camera_test.c b/test/camera_test.c index c2fb5c4..17d8b66 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -686,6 +686,12 @@ static bool preview_format_cb(camera_pixel_format_e mode, void *user_data) return true; } +static bool capture_format_cb(camera_pixel_format_e mode, void *user_data) +{ + g_print("\t%d. %s\n", mode, image_fmt[mode]); + return true; +} + static bool white_balance_cb(camera_attr_whitebalance_e mode, void *user_data) { g_print("\t%d. %s\n", mode, wb[mode]); @@ -835,7 +841,8 @@ void print_menu() g_print("\t 'r' Rotate camera input \n"); g_print("\t 'f' Flip camera input \n"); g_print("\t 'j' Jpeg quality \n"); - g_print("\t 'p' Picture format \n"); + g_print("\t 'p' Preview format \n"); + g_print("\t 'C' Capture format \n"); g_print("\t 'E' EXIF orientation \n"); g_print("\t 'F' Get facing direction of camera module\n"); g_print("\t 's' Extra preview stream format\n"); @@ -889,7 +896,6 @@ static void main_menu(gchar buf) case '1': /* Capture */ hcamcorder->is_multishot = FALSE; camera_attr_set_image_quality(hcamcorder->camera, 100); - camera_set_capture_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_JPEG); camera_start_capture(hcamcorder->camera, capturing_cb, capture_completed_cb, hcamcorder); break; case '2': /* multishot Capture */ @@ -902,7 +908,6 @@ static void main_menu(gchar buf) err = scanf("%d", &count); flush_stdin(); camera_attr_set_image_quality(hcamcorder->camera, 100); - camera_set_capture_format(hcamcorder->camera, CAMERA_PIXEL_FORMAT_JPEG); camera_start_continuous_capture(hcamcorder->camera, count, interval, capturing_cb, NULL, NULL); sleep(3); camera_start_preview(hcamcorder->camera); @@ -1195,8 +1200,8 @@ static void setting_menu(gchar buf) flush_stdin(); bret = camera_attr_set_image_quality(hcamcorder->camera, idx); break; - case 'p': /* Setting > Picture format */ - g_print("* Picture format!\n"); + case 'p': /* Setting > Preview format */ + g_print("* Preview format!\n"); camera_foreach_supported_preview_format(hcamcorder->camera, preview_format_cb, NULL); err = scanf("%d", &idx); flush_stdin(); @@ -1204,6 +1209,13 @@ static void setting_menu(gchar buf) bret = camera_set_preview_format(hcamcorder->camera, idx); CHECK_MM_ERROR(camera_start_preview(hcamcorder->camera)); break; + case 'C': /* Setting > Capture format */ + g_print("* Capture format!\n"); + camera_foreach_supported_capture_format(hcamcorder->camera, capture_format_cb, NULL); + err = scanf("%d", &idx); + flush_stdin(); + bret = camera_set_capture_format(hcamcorder->camera, idx); + break; case 'E': /* Setting > EXIF orientation */ g_print("* EXIF Orientation\n"); g_print("\t 1. TOP_LEFT\n"); @@ -1736,10 +1748,10 @@ gboolean cmd_input(GIOChannel *channel, GIOCondition condition, gpointer data) if (buf) { g_strstrip(buf); - g_print("\n\tMenu Status : %d\n", hcamcorder->menu_state); switch (hcamcorder->menu_state) { case MENU_STATE_INIT: - mode_change(buf[0]); + if (!mode_change(buf[0])) + return FALSE; break; case MENU_STATE_MAIN: main_menu(buf[0]); @@ -1882,12 +1894,11 @@ static gboolean mode_change(gchar buf) hcamcorder->menu_state = MENU_STATE_DEVICE_MANAGER; return TRUE; case 'q': - g_print("\t Quit Camcorder Testsuite!!\n"); quit_test(); return FALSE; default: - g_print("\t Invalid media type(%c)\n", buf); - return FALSE; + g_print("\t Invalid command(%c)\n", buf); + return TRUE; } g_print("\n[camcorder_create - type %d, device %d]\n", camera_type, camera_device); @@ -1901,7 +1912,7 @@ static gboolean mode_change(gchar buf) if (err != 0) { g_print("\n\tmmcamcorder_create = 0x%x\n", err); - return FALSE; + return TRUE; } set_display(hcamcorder); diff --git a/test/camera_test_headed.c b/test/camera_test_headed.c index 4dac241..77f8044 100644 --- a/test/camera_test_headed.c +++ b/test/camera_test_headed.c @@ -182,8 +182,6 @@ int main(int argc, char **argv) bret = appcore_efl_main("camera_test_headed", &argc, &argv, &ops); - g_print("\n\treturn appcore_efl : %d\n\n", bret); - g_free(handle); g_io_channel_unref(stdin_channel); diff --git a/test/camera_test_headless.c b/test/camera_test_headless.c index aa74fbd..f86cb35 100644 --- a/test/camera_test_headless.c +++ b/test/camera_test_headless.c @@ -52,8 +52,6 @@ int main(int argc, char **argv) g_main_loop_run(g_mainloop_camera_test); - g_print("\n\treturn main loop\n\n"); - g_main_loop_unref(g_mainloop_camera_test); g_free(handle); -- cgit v1.2.3