Add new internal APIs for extra preview stream format
[platform/core/api/camera.git] / test / camera_test.c
index 3d061da..3b134a6 100644 (file)
@@ -932,6 +932,7 @@ static void print_menu()
                g_print("\t     'p' Picture 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");
                g_print("\t  >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n");
                g_print("\t     'v' Visible \n");
                g_print("\t     'o' Output mode \n");
@@ -1099,6 +1100,9 @@ static void setting_menu(gchar buf)
        int height = 0;
        int result = 0;
        int set_bridge = 0;
+       int stream_id;
+       int pixel_format;
+       int fps;
 
        switch (buf) {
        /* Camera setting */
@@ -1310,7 +1314,7 @@ static void setting_menu(gchar buf)
                else
                        camera_attr_set_tag_orientation(hcamcorder->camera, idx);
                break;
-       case 'F': /* Getting > Get Facing direction */
+       case 'F': /* Setting > Get Facing direction */
                g_print("* Get facing direction of camera module\n");
                err = camera_get_facing_direction(hcamcorder->camera, (camera_facing_direction_e *)&idx);
                if (CAMERA_ERROR_NONE == err)
@@ -1318,6 +1322,32 @@ static void setting_menu(gchar buf)
                else
                        g_print("* Error : %d\n", err);
                break;
+       case 's': /* Setting > Set extra preview stream format */
+               g_print("* Set extra preview stream format\n");
+
+               g_print("\tstream_id,pixel format[NV12:0,H264:15,VP8:18],width,height,fps : ");
+               err = scanf("%d,%d,%d,%d,%d", &stream_id, &pixel_format, &width, &height, &fps);
+               flush_stdin();
+
+               err = camera_set_extra_preview_stream_format(hcamcorder->camera,
+                       stream_id, pixel_format, width, height, fps);
+               if (err != CAMERA_ERROR_NONE) {
+                       g_print("* Set Error : 0x%x\n", err);
+                       break;
+               }
+
+               pixel_format = width = height = fps = -1;
+
+               err = camera_get_extra_preview_stream_format(hcamcorder->camera,
+                       stream_id, &pixel_format, &width, &height, &fps);
+               if (err != CAMERA_ERROR_NONE) {
+                       g_print("* Get Error : 0x%x\n", err);
+                       break;
+               }
+
+               g_print("\tGet stream_id[%d],pixel format[%d],res[%dx%d],fps[%d]\n",
+                       stream_id, pixel_format, width, height, fps);
+               break;
                /* Display / Filter setting */
        case 'v': /* Display visible */
                g_print("* Display visible setting !\n");