camera_test: Add menu for extra preview test 06/280206/3 accepted/tizen/unified/20220829.215641 submit/tizen/20220829.030011
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 25 Aug 2022 08:05:33 +0000 (17:05 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 26 Aug 2022 10:57:24 +0000 (19:57 +0900)
[Version] 0.4.87
[Issue Type] Update

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

index 505ec6a..fff5121 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-camera
 Summary:    A Camera API
-Version:    0.4.86
+Version:    0.4.87
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index a188c7a..8ca3544 100644 (file)
@@ -1757,6 +1757,41 @@ cam_handle_t *init_handle()
 }
 
 
+static void __enable_extra_preview_and_callback(camera_h camera)
+{
+       int err = 0;
+       int stream_id = 0;
+       int width = 0;
+       int height = 0;
+       int fps = 0;
+       int pixel_format = 0;
+
+       g_print("\n\t- Format list");
+       g_print("\n\t0:NV12, 1:NV12T, 2:NV16, 3:NV21, 4:YUYV, 5:UYVY, 6:422P, 7:I420, 8:YV12, 9:RGB565, 10:RGB888");
+       g_print("\n\t11:RGBA, 12:ARGB, 13:ENCODED(JPEG), 14:INTERLEAVED_JPEG_UYVY, 15:H264, 16:INVZ, 17:MJPEG, 18:VP8, 19:VP9");
+       g_print("\n\tSet extra preview format[stream_id width height fps format] : ");
+
+       err = scanf("%d %d %d %d %d", &stream_id, &width, &height, &fps, &pixel_format);
+       flush_stdin();
+
+       err = camera_set_extra_preview_stream_format(camera, stream_id, pixel_format, width, height, fps);
+       if (err != CAMERA_ERROR_NONE) {
+               g_print("\n\tcamera_set_extra_preview_stream_format failed[0x%x]\n", err);
+               return;
+       }
+
+       err = camera_set_extra_preview_cb(camera, _camera_extra_preview_cb, camera);
+       if (err != CAMERA_ERROR_NONE) {
+               g_print("\n\tcamera_set_extra_preview_cb failed[0x%x]\n", err);
+               return;
+       }
+
+       g_print("\n\tDump extra preview data to file - NO[0], YES[Others] : ");
+       err = scanf("%d", &g_camera_extra_preview_cb_dump);
+       flush_stdin();
+}
+
+
 /**
  * This function is to change camcorder mode.
  *
@@ -1770,6 +1805,7 @@ static gboolean mode_change(gchar buf)
 {
        int err = 0;
        int camera_type = 0;
+       int enable_extra_preview = 0;
 
        switch (buf) {
        case '1':
@@ -1801,7 +1837,6 @@ static gboolean mode_change(gchar buf)
                        }
 
                        hcamcorder->type = camera_device;
-
                        break;
                }
                break;
@@ -1845,6 +1880,15 @@ static gboolean mode_change(gchar buf)
        /*camera_set_display_flip(hcamcorder->camera, CAMERA_FLIP_VERTICAL);*/
        /*camera_set_preview_cb(hcamcorder->camera, _preview_cb, hcamcorder->camera);*/
 
+       if (camera_is_supported_extra_preview(hcamcorder->camera)) {
+               g_print("\n\tEnable extra preview callback - NO[0], YES[Others] : ");
+               err = scanf("%d", (int *)&enable_extra_preview);
+               flush_stdin();
+
+               if (enable_extra_preview)
+                       __enable_extra_preview_and_callback(hcamcorder->camera);
+       }
+
        camera_start_preview(hcamcorder->camera);
 
        gettimeofday(&current_time, NULL);