int GetSupportedFormat(int index)
{
+ camera_device_info_s *d = NULL;
+
if (g_device_info_list.count < 1) {
cout << "no available camera device" << endl;
return CAMERA_ERROR_DEVICE_NOT_SUPPORTED;
}
+ d = &g_device_info_list.device_info[index];
+
/* set preview format */
- g_preview_format.stream_format = g_device_info_list.device_info[index].format_list.formats[0];
- g_preview_format.stream_resolution.width = g_device_info_list.device_info[index].preview_list.resolutions[0].width;
- g_preview_format.stream_resolution.height = g_device_info_list.device_info[index].preview_list.resolutions[0].height;
- g_preview_format.stream_fps = 15;
+ g_preview_format.stream_format = d->format_list.formats[0];
+ g_preview_format.stream_resolution.width = d->preview_list.resolutions[0].width;
+ g_preview_format.stream_resolution.height = d->preview_list.resolutions[0].height;
+ g_preview_format.stream_fps = d->preview_fps_list[0].fps[0];
g_preview_format.stream_rotation = CAMERA_ROTATION_0;
- g_preview_format.capture_format = g_device_info_list.device_info[index].format_list.formats[0];
- g_preview_format.capture_resolution.width = g_device_info_list.device_info[index].capture_list.resolutions[0].width;
- g_preview_format.capture_resolution.height = g_device_info_list.device_info[index].capture_list.resolutions[0].height;
+ g_preview_format.capture_format = d->format_list.formats[0];
+ g_preview_format.capture_resolution.width = d->capture_list.resolutions[0].width;
+ g_preview_format.capture_resolution.height = d->capture_list.resolutions[0].height;
g_preview_format.capture_quality = 95;
/* set video format */
- g_video_format.stream_format = g_device_info_list.device_info[index].format_list.formats[0];
- g_video_format.stream_resolution.width = g_device_info_list.device_info[index].video_list.resolutions[0].width;
- g_video_format.stream_resolution.height = g_device_info_list.device_info[index].video_list.resolutions[0].height;
- g_video_format.stream_fps = 15;
+ g_video_format.stream_format = d->format_list.formats[0];
+ g_video_format.stream_resolution.width = d->video_list.resolutions[0].width;
+ g_video_format.stream_resolution.height = d->video_list.resolutions[0].height;
+ g_video_format.stream_fps = d->video_fps_list[0].fps[0];;
g_video_format.stream_rotation = CAMERA_ROTATION_0;
- g_video_format.capture_format = g_device_info_list.device_info[index].format_list.formats[0];
- g_video_format.capture_resolution.width = g_device_info_list.device_info[index].capture_list.resolutions[0].width;
- g_video_format.capture_resolution.height = g_device_info_list.device_info[index].capture_list.resolutions[0].height;
+ g_video_format.capture_format = d->format_list.formats[0];
+ g_video_format.capture_resolution.width = d->capture_list.resolutions[0].width;
+ g_video_format.capture_resolution.height = d->capture_list.resolutions[0].height;
g_video_format.capture_quality = 95;
return CAMERA_ERROR_NONE;
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_add_message_callback(g_hal_handle, _MessageCb, nullptr, &cb_id);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_add_message_callback(g_hal_handle, _MessageCb, nullptr, &cb_id);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
ASSERT_EQ(ret, CAMERA_ERROR_NONE);
+ GetSupportedFormat(0);
+
ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);