summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2018-04-19 16:50:46 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2018-04-19 16:50:46 +0900
commitf75ae545af3f4580e481e2d0a2164f19b76bdcc9 (patch)
tree876abde1bf3c4289310a7cbb88244b963743a7ba
parent4e9ce6cf52535f2623cfb9c7197128b1a1da5cec (diff)
downloadmm-hal-interface-f75ae545af3f4580e481e2d0a2164f19b76bdcc9.tar.gz
mm-hal-interface-f75ae545af3f4580e481e2d0a2164f19b76bdcc9.tar.bz2
mm-hal-interface-f75ae545af3f4580e481e2d0a2164f19b76bdcc9.zip
[camera] Update interfacesubmit/tizen/20180420.063541
[Version] 0.0.6 [Profile] Common [Issue Type] Update [Dependency module] N/A Change-Id: If02c5ae368efff116f028ff44ee35958ef39070d Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--include/camera/tizen-camera.h24
-rw-r--r--packaging/mm-hal-interface.spec2
-rw-r--r--testcase/camera/camera_hal_interface.c10
-rw-r--r--testcase/camera/camera_hal_interface.h2
-rw-r--r--testcase/camera/camera_hal_tc.cpp160
5 files changed, 109 insertions, 89 deletions
diff --git a/include/camera/tizen-camera.h b/include/camera/tizen-camera.h
index 399ae96..3dbb38d 100644
--- a/include/camera/tizen-camera.h
+++ b/include/camera/tizen-camera.h
@@ -34,8 +34,9 @@ extern "C" {
#define BUFFER_PLANE_MAX 4
#define DEVICE_COUNT_MAX 16
-#define DEVICE_NAME_LENGTH_MAX 32
#define RESOLUTION_COUNT_MAX 10
+#define DEVICE_NAME_LENGTH_MAX 16
+#define DEVICE_NODE_PATH_LENGTH_MAX 16
/**
* @addtogroup TIZEN_CAMERA_HAL_MODULE
@@ -127,8 +128,8 @@ typedef enum camera_pixel_format {
CAMERA_PIXEL_FORMAT_ARGB8888,
/* ENCODED */
- CAMERA_PIXEL_FORMAT_ENCODED_JPEG,
- CAMERA_PIXEL_FORMAT_ENCODED_H264,
+ CAMERA_PIXEL_FORMAT_JPEG,
+ CAMERA_PIXEL_FORMAT_H264,
/* MAX */
CAMERA_PIXEL_FORMAT_MAX
@@ -450,7 +451,8 @@ typedef struct camera_resolution_list {
*/
typedef struct camera_device_info {
uint32_t index;
- const char *name;
+ char name[DEVICE_NAME_LENGTH_MAX];
+ char node_path[DEVICE_NODE_PATH_LENGTH_MAX];
camera_facing_direction_t facing_direction;
camera_format_list_t format_list;
camera_resolution_list_t preview_list;
@@ -459,13 +461,13 @@ typedef struct camera_device_info {
} camera_device_info_t;
/**
- * @brief The structure type of the camera device list.
+ * @brief The structure type of the camera device information list.
* @since_tizen 3.0
*/
-typedef struct camera_device_list {
+typedef struct camera_device_info_list {
uint32_t count;
camera_device_info_t device_info[DEVICE_COUNT_MAX];
-} camera_device_list_t;
+} camera_device_info_list_t;
/**
* @brief Enumeration for the camera message type.
@@ -545,7 +547,7 @@ typedef int (*camera_capture_cb)(camera_buffer_t *main, camera_buffer_t *postvie
typedef struct camera_interface {
int (*init)(void **camera_handle);
int (*deinit)(void *camera_handle);
- int (*get_device_list)(void *camera_handle, camera_device_list_t *device_list);
+ int (*get_device_info_list)(camera_device_info_list_t *device_info_list);
int (*open_device)(void *camera_handle, int device_index);
int (*close_device)(void *camera_handle);
int (*add_message_callback)(void *camera_handle, camera_message_cb callback, void *user_data, uint32_t *cb_id);
@@ -600,14 +602,14 @@ int camera_deinit(void *camera_handle);
/**
* @brief Gets the device list of camera.
* @since_tizen 3.0
- * @param[in] camera_handle The handle to the camera HAL
- * @param[out] device_list The device list of the camera
+ * @param[out] device_info_list The list of the camera device information
* @return @c 0 on success, otherwise a negative error value
* @retval #CAMERA_ERROR_NONE Successful
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory
* @retval #CAMERA_ERROR_DEVICE_NOT_SUPPORTED The feature is not supported
*/
-int camera_get_device_list(void *camera_handle, camera_device_list_t *device_list);
+int camera_get_device_info_list(camera_device_info_list_t *device_info_list);
/**
* @brief Opens camera device.
diff --git a/packaging/mm-hal-interface.spec b/packaging/mm-hal-interface.spec
index 7bb2129..3037c4b 100644
--- a/packaging/mm-hal-interface.spec
+++ b/packaging/mm-hal-interface.spec
@@ -1,6 +1,6 @@
Name: mm-hal-interface
Summary: Multimedia HAL Interface
-Version: 0.0.5
+Version: 0.0.6
Release: 0
Group: Multimedia/Development
License: Apache-2.0
diff --git a/testcase/camera/camera_hal_interface.c b/testcase/camera/camera_hal_interface.c
index a8522ab..cc2f4d7 100644
--- a/testcase/camera/camera_hal_interface.c
+++ b/testcase/camera/camera_hal_interface.c
@@ -60,7 +60,7 @@ int camera_hal_interface_init(camera_hal_interface **h)
if (tmp_h->dl_handle) {
tmp_h->intf.init = dlsym(tmp_h->dl_handle, "camera_init");
tmp_h->intf.deinit = dlsym(tmp_h->dl_handle, "camera_deinit");
- tmp_h->intf.get_device_list = dlsym(tmp_h->dl_handle, "camera_get_device_list");
+ tmp_h->intf.get_device_info_list = dlsym(tmp_h->dl_handle, "camera_get_device_info_list");
tmp_h->intf.open_device = dlsym(tmp_h->dl_handle, "camera_open_device");
tmp_h->intf.close_device = dlsym(tmp_h->dl_handle, "camera_close_device");
tmp_h->intf.add_message_callback = dlsym(tmp_h->dl_handle, "camera_add_message_callback");
@@ -150,7 +150,7 @@ int camera_hal_interface_deinit(camera_hal_interface *h)
}
-int camera_hal_interface_get_device_list(camera_hal_interface *h, camera_device_list_t *device_list)
+int camera_hal_interface_get_device_info_list(camera_hal_interface *h, camera_device_info_list_t *device_info_list)
{
int ret = CAMERA_ERROR_NONE;
@@ -159,10 +159,10 @@ int camera_hal_interface_get_device_list(camera_hal_interface *h, camera_device_
return CAMERA_ERROR_INVALID_PARAMETER;
}
- if (h->intf.get_device_list) {
- ret = h->intf.get_device_list(h->hal_handle, device_list);
+ if (h->intf.get_device_info_list) {
+ ret = h->intf.get_device_info_list(device_info_list);
} else {
- LOGE("camera_get_device_list not implemented");
+ LOGE("camera_get_device_info_list not implemented");
ret = CAMERA_ERROR_NOT_IMPLEMENTED;
}
diff --git a/testcase/camera/camera_hal_interface.h b/testcase/camera/camera_hal_interface.h
index 3323c8b..bf0e880 100644
--- a/testcase/camera/camera_hal_interface.h
+++ b/testcase/camera/camera_hal_interface.h
@@ -27,7 +27,7 @@ typedef struct _camera_hal_interface camera_hal_interface;
int camera_hal_interface_init(camera_hal_interface **h);
int camera_hal_interface_deinit(camera_hal_interface *h);
-int camera_hal_interface_get_device_list(camera_hal_interface *h, camera_device_list_t *device_list);
+int camera_hal_interface_get_device_info_list(camera_hal_interface *h, camera_device_info_list_t *device_info_list);
int camera_hal_interface_open_device(camera_hal_interface *h, int device_index);
int camera_hal_interface_close_device(camera_hal_interface *h);
int camera_hal_interface_add_message_callback(camera_hal_interface *h, camera_message_cb callback, void *user_data, uint32_t *cb_id);
diff --git a/testcase/camera/camera_hal_tc.cpp b/testcase/camera/camera_hal_tc.cpp
index 4f34330..15fe032 100644
--- a/testcase/camera/camera_hal_tc.cpp
+++ b/testcase/camera/camera_hal_tc.cpp
@@ -30,7 +30,7 @@ int preview_check;
int capture_check;
int video_check;
camera_hal_interface *h;
-camera_device_list_t device_list;
+camera_device_info_list_t device_info_list;
camera_format_t preview_format;
camera_format_t video_format;
GMutex msg_cb_lock;
@@ -154,7 +154,7 @@ class CameraHalTest : public testing::Test
return;
}
- ret = camera_hal_interface_get_device_list(h, &device_list);
+ ret = camera_hal_interface_get_device_info_list(h, &device_info_list);
if (ret != CAMERA_ERROR_NONE) {
cout << "get device list failed " << ret << endl;
return;
@@ -177,31 +177,31 @@ class CameraHalTest : public testing::Test
int GetSupportedFormat()
{
- if (device_list.count < 1) {
+ if (device_info_list.count < 1) {
cout << "no available camera device" << endl;
return CAMERA_ERROR_DEVICE_NOT_SUPPORTED;
}
/* set preview format */
- preview_format.stream_format = device_list.device_info[0].format_list.formats[0];
- preview_format.stream_resolution.width = device_list.device_info[0].preview_list.resolutions[0].width;
- preview_format.stream_resolution.height = device_list.device_info[0].preview_list.resolutions[0].height;
+ preview_format.stream_format = device_info_list.device_info[0].format_list.formats[0];
+ preview_format.stream_resolution.width = device_info_list.device_info[0].preview_list.resolutions[0].width;
+ preview_format.stream_resolution.height = device_info_list.device_info[0].preview_list.resolutions[0].height;
preview_format.stream_fps = 15;
preview_format.stream_rotation = CAMERA_ROTATION_0;
preview_format.capture_format = CAMERA_PIXEL_FORMAT_JPEG;
- preview_format.capture_resolution.width = device_list.device_info[0].capture_list.resolutions[0].width;
- preview_format.capture_resolution.height = device_list.device_info[0].capture_list.resolutions[0].height;
+ preview_format.capture_resolution.width = device_info_list.device_info[0].capture_list.resolutions[0].width;
+ preview_format.capture_resolution.height = device_info_list.device_info[0].capture_list.resolutions[0].height;
preview_format.capture_quality = 95;
/* set video format */
- video_format.stream_format = device_list.device_info[0].format_list.formats[0];
- video_format.stream_resolution.width = device_list.device_info[0].video_list.resolutions[0].width;
- video_format.stream_resolution.height = device_list.device_info[0].video_list.resolutions[0].height;
+ video_format.stream_format = device_info_list.device_info[0].format_list.formats[0];
+ video_format.stream_resolution.width = device_info_list.device_info[0].video_list.resolutions[0].width;
+ video_format.stream_resolution.height = device_info_list.device_info[0].video_list.resolutions[0].height;
video_format.stream_fps = 15;
video_format.stream_rotation = CAMERA_ROTATION_0;
video_format.capture_format = CAMERA_PIXEL_FORMAT_JPEG;
- video_format.capture_resolution.width = device_list.device_info[0].capture_list.resolutions[0].width;
- video_format.capture_resolution.height = device_list.device_info[0].capture_list.resolutions[0].height;
+ video_format.capture_resolution.width = device_info_list.device_info[0].capture_list.resolutions[0].width;
+ video_format.capture_resolution.height = device_info_list.device_info[0].capture_list.resolutions[0].height;
video_format.capture_quality = 95;
return CAMERA_ERROR_NONE;
@@ -233,17 +233,17 @@ TEST_F(CameraHalTest, DeinitP)
}
}
-TEST_F(CameraHalTest, GetDeviceListP)
+TEST_F(CameraHalTest, GetDeviceInfoListP)
{
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
}
-TEST_F(CameraHalTest, GetDeviceListN)
+TEST_F(CameraHalTest, GetDeviceInfoListN)
{
EXPECT_NE(h, nullptr);
- ret = camera_hal_interface_get_device_list(h, nullptr);
+ ret = camera_hal_interface_get_device_info_list(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_INVALID_PARAMETER);
}
@@ -252,8 +252,8 @@ TEST_F(CameraHalTest, OpenDeviceP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- if (device_list.count > 0) {
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ if (device_info_list.count > 0) {
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
if (ret == CAMERA_ERROR_NONE) {
@@ -267,8 +267,8 @@ TEST_F(CameraHalTest, OpenDeviceN)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- if (device_list.count > 0) {
- ret = camera_hal_interface_open_device(NULL, device_list.device_info[device_list.count - 1].index + 1);
+ if (device_info_list.count > 0) {
+ ret = camera_hal_interface_open_device(NULL, device_info_list.device_info[device_info_list.count - 1].index + 1);
EXPECT_NE(ret, CAMERA_ERROR_NONE);
if (ret == CAMERA_ERROR_NONE) {
@@ -282,8 +282,8 @@ TEST_F(CameraHalTest, CloseDeviceP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- if (device_list.count > 0) {
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ if (device_info_list.count > 0) {
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
if (ret == CAMERA_ERROR_NONE) {
@@ -298,7 +298,7 @@ TEST_F(CameraHalTest, SetPreviewStreamFormatP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -306,13 +306,13 @@ TEST_F(CameraHalTest, SetPreviewStreamFormatP)
camera_hal_interface_close_device(h);
}
-#if 0
+
TEST_F(CameraHalTest, SetPreviewStreamFormatN)
{
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, nullptr);
@@ -328,7 +328,7 @@ TEST_F(CameraHalTest, GetPreviewStreamFormatP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -350,7 +350,7 @@ TEST_F(CameraHalTest, GetPreviewStreamFormatN)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_get_preview_stream_format(h, nullptr);
@@ -364,7 +364,7 @@ TEST_F(CameraHalTest, StartPreviewP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -389,7 +389,7 @@ TEST_F(CameraHalTest, StartPreviewN)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -406,7 +406,7 @@ TEST_F(CameraHalTest, StopPreviewP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -426,7 +426,7 @@ TEST_F(CameraHalTest, StartCaptureP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -438,14 +438,18 @@ TEST_F(CameraHalTest, StartCaptureP)
capture_check = 0;
ret = camera_hal_interface_start_capture(h, _CaptureCb, NULL);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- /* wait for capture frame */
- sleep(1);
+ if (ret != CAMERA_ERROR_DEVICE_NOT_SUPPORTED) {
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+
+ /* wait for capture frame */
+ sleep(1);
- EXPECT_TRUE(capture_check);
+ EXPECT_TRUE(capture_check);
+
+ camera_hal_interface_stop_capture(h);
+ }
- camera_hal_interface_stop_capture(h);
camera_hal_interface_stop_preview(h);
camera_hal_interface_close_device(h);
}
@@ -455,7 +459,7 @@ TEST_F(CameraHalTest, StartCaptureN)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -476,7 +480,7 @@ TEST_F(CameraHalTest, StartRecordP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -486,19 +490,23 @@ TEST_F(CameraHalTest, StartRecordP)
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_video_stream_format(h, &video_format);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- video_check = 0;
+ if (ret != CAMERA_ERROR_DEVICE_NOT_SUPPORTED) {
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+
+ video_check = 0;
- ret = camera_hal_interface_start_record(h, _VideoCb, (void *)h);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+ ret = camera_hal_interface_start_record(h, _VideoCb, (void *)h);
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- /* wait for video frame */
- sleep(1);
+ /* wait for video frame */
+ sleep(1);
- EXPECT_TRUE(video_check);
+ EXPECT_TRUE(video_check);
+
+ camera_hal_interface_stop_record(h);
+ }
- camera_hal_interface_stop_record(h);
camera_hal_interface_stop_preview(h);
camera_hal_interface_close_device(h);
}
@@ -508,7 +516,7 @@ TEST_F(CameraHalTest, StartRecordN)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_preview_stream_format(h, &preview_format);
@@ -518,10 +526,13 @@ TEST_F(CameraHalTest, StartRecordN)
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_video_stream_format(h, &video_format);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_start_record(h, nullptr, (void *)h);
- EXPECT_EQ(ret, CAMERA_ERROR_INVALID_PARAMETER);
+ if (ret != CAMERA_ERROR_DEVICE_NOT_SUPPORTED) {
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+
+ ret = camera_hal_interface_start_record(h, nullptr, (void *)h);
+ EXPECT_EQ(ret, CAMERA_ERROR_INVALID_PARAMETER);
+ }
camera_hal_interface_stop_preview(h);
camera_hal_interface_close_device(h);
@@ -532,11 +543,13 @@ TEST_F(CameraHalTest, SetVideoStreamFormatP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_video_stream_format(h, &video_format);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+ if (ret != CAMERA_ERROR_DEVICE_NOT_SUPPORTED) {
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+ }
camera_hal_interface_close_device(h);
}
@@ -546,7 +559,7 @@ TEST_F(CameraHalTest, SetVideoStreamFormatN)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_video_stream_format(h, nullptr);
@@ -564,17 +577,20 @@ TEST_F(CameraHalTest, GetVideoStreamFormatP)
memset(&get_format, 0x0, sizeof(camera_format_t));
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_set_video_stream_format(h, &video_format);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_get_video_stream_format(h, &get_format);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+ if (ret != CAMERA_ERROR_DEVICE_NOT_SUPPORTED) {
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = memcmp(&video_format, &get_format, sizeof(camera_format_t));
- EXPECT_EQ(ret, 0);
+ ret = camera_hal_interface_get_video_stream_format(h, &get_format);
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+
+ ret = memcmp(&video_format, &get_format, sizeof(camera_format_t));
+ EXPECT_EQ(ret, 0);
+ }
camera_hal_interface_close_device(h);
}
@@ -584,11 +600,11 @@ TEST_F(CameraHalTest, GetVideoStreamFormatN)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_get_video_stream_format(h, nullptr);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+ EXPECT_EQ(ret, CAMERA_ERROR_INVALID_PARAMETER);
camera_hal_interface_close_device(h);
}
@@ -600,7 +616,7 @@ TEST_F(CameraHalTest, AddMessageCallbackP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_add_message_callback(h, _MessageCb, nullptr, &cb_id);
@@ -620,7 +636,7 @@ TEST_F(CameraHalTest, AddMessageCallbackN1)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_add_message_callback(h, nullptr, nullptr, &cb_id);
@@ -634,7 +650,7 @@ TEST_F(CameraHalTest, AddMessageCallbackN2)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_add_message_callback(h, _MessageCb, nullptr, nullptr);
@@ -650,7 +666,7 @@ TEST_F(CameraHalTest, RemoveMessageCallbackP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_add_message_callback(h, _MessageCb, nullptr, &cb_id);
@@ -672,7 +688,7 @@ TEST_F(CameraHalTest, StartAutoFocusP)
EXPECT_NE(h, nullptr);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- ret = camera_hal_interface_open_device(h, device_list.device_info[0].index);
+ ret = camera_hal_interface_open_device(h, device_info_list.device_info[0].index);
EXPECT_EQ(ret, CAMERA_ERROR_NONE);
ret = camera_hal_interface_add_message_callback(h, _MessageCb, nullptr, &cb_id);
@@ -687,11 +703,14 @@ TEST_F(CameraHalTest, StartAutoFocusP)
g_mutex_lock(&msg_cb_lock);
ret = camera_hal_interface_start_auto_focus(h);
- EXPECT_EQ(ret, CAMERA_ERROR_NONE);
- /* wait a message and check result */
- end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND * 5;
- EXPECT_EQ(g_cond_wait_until(&msg_cb_cond, &msg_cb_lock, end_time), true);
+ if (ret != CAMERA_ERROR_DEVICE_NOT_SUPPORTED) {
+ EXPECT_EQ(ret, CAMERA_ERROR_NONE);
+
+ /* wait a message and check result */
+ end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND * 5;
+ EXPECT_EQ(g_cond_wait_until(&msg_cb_cond, &msg_cb_lock, end_time), true);
+ }
g_mutex_unlock(&msg_cb_lock);
@@ -699,7 +718,6 @@ TEST_F(CameraHalTest, StartAutoFocusP)
camera_hal_interface_remove_message_callback(h, cb_id);
camera_hal_interface_close_device(h);
}
-#endif
int main(int argc, char **argv)
{