} \
} while (0)
-#define VISION_SOURCE_NULL_ARG_CHECK(arg) \
- VISION_SOURCE_CHECK_CONDITION(arg != NULL, VISION_SOURCE_ERROR_INVALID_PARAMETER, \
+#define VISION_SOURCE_NULL_ARG_CHECK(arg) \
+ VISION_SOURCE_CHECK_CONDITION(arg != NULL, \
+ VISION_SOURCE_ERROR_INVALID_PARAMETER, \
"VISION_SOURCE_ERROR_INVALID_PARAMETER")
#define VISION_SOURCE_INITIAL_FD -1
#define DEVICE_NODE_PATH_PREFIX "/dev/video"
#define FOURCC_FORMAT "%c%c%c%c"
-#define FOURCC_CONVERT(fourcc) fourcc & 0xff, (fourcc >> 8) & 0xff, (fourcc >> 16) & 0xff, (fourcc >> 24) & 0xff
+#define FOURCC_CONVERT(fourcc) \
+ fourcc & 0xff, (fourcc >> 8) & 0xff, (fourcc >> 16) & 0xff, \
+ (fourcc >> 24) & 0xff
#ifdef USE_DL
#define vision_source_init vision_source_v4l2_init
using namespace std;
-struct fmt_info {
+struct fmt_info
+{
media_format_mimetype_e type;
uint32_t width;
uint32_t height;
bool operator==(const fmt_info &rhs)
{
- return (type == rhs.type) && (width == rhs.width) && (height == rhs.height) && (fps == rhs.fps);
+ return (type == rhs.type) && (width == rhs.width) &&
+ (height == rhs.height) && (fps == rhs.fps);
}
};
-struct pkt_dispose_cb_data {
+struct pkt_dispose_cb_data
+{
int fd;
int index;
};
-struct vision_source_v4l2_s {
+struct vision_source_v4l2_s
+{
/* device */
vision_source_device_info_s *dev_info {};
media_format_h **fmt {};
return VISION_SOURCE_ERROR_NOT_SUPPORTED_FORMAT;
}
- LOGD("fourcc " FOURCC_FORMAT " -> %d", FOURCC_CONVERT(fourcc), *pixel_format);
+ LOGD("fourcc " FOURCC_FORMAT " -> %d", FOURCC_CONVERT(fourcc),
+ *pixel_format);
return VISION_SOURCE_ERROR_NONE;
}
-static int __vision_source_get_fourcc_plane_num(media_format_mimetype_e pixel_format, uint32_t *fourcc)
+static int
+__vision_source_get_fourcc_plane_num(media_format_mimetype_e pixel_format,
+ uint32_t *fourcc)
{
switch (pixel_format) {
case MEDIA_FORMAT_RGB888:
return VISION_SOURCE_ERROR_INTERNAL;
}
- LOGD("format %d -> fourcc " FOURCC_FORMAT, pixel_format, FOURCC_CONVERT(*fourcc));
+ LOGD("format %d -> fourcc " FOURCC_FORMAT, pixel_format,
+ FOURCC_CONVERT(*fourcc));
return VISION_SOURCE_ERROR_NONE;
}
-static vector<uint32_t> __vision_source_get_fps_list(int device_fd, uint32_t pixel_format, int width, int height)
+static vector<uint32_t> __vision_source_get_fps_list(int device_fd,
+ uint32_t pixel_format,
+ int width, int height)
{
vector<uint32_t> fps_list;
struct v4l2_frmivalenum ival;
}
do {
- LOGI("\t\t\t\tFramerate[%u/%u]", ival.discrete.denominator, ival.discrete.numerator);
+ LOGI("\t\t\t\tFramerate[%u/%u]", ival.discrete.denominator,
+ ival.discrete.numerator);
fps_list.push_back(ival.discrete.denominator);
ival.index++;
} while (v4l2_ioctl(device_fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) >= 0);
return fps_list;
}
-static int __vision_source_v4l2_qbuf(int device_fd, int type, int memory, int index)
+static int __vision_source_v4l2_qbuf(int device_fd, int type, int memory,
+ int index)
{
struct v4l2_buffer v4l2_buf;
v4l2_buf.memory = memory;
if (v4l2_ioctl(device_fd, VIDIOC_QBUF, &v4l2_buf) < 0) {
- LOGE("qbuf failed. [i: %d, t: %d, m: %d] errno %d", index, type, memory, errno);
+ LOGE("qbuf failed. [i: %d, t: %d, m: %d] errno %d", index, type,
+ memory, errno);
return VISION_SOURCE_ERROR_INTERNAL;
}
return VISION_SOURCE_ERROR_NONE;
}
-static int __vision_source_get_valid_fmt(int device_fd, vector<fmt_info> &found_fmt)
+static int __vision_source_get_valid_fmt(int device_fd,
+ vector<fmt_info> &found_fmt)
{
int pixel_format = 0;
int pixel_index = 0;
break;
}
- LOGD("\tformat[%d] " FOURCC_FORMAT " (emulated:%d)", pixel_index, FOURCC_CONVERT(v4l2_format.pixelformat),
+ LOGD("\tformat[%d] " FOURCC_FORMAT " (emulated:%d)", pixel_index,
+ FOURCC_CONVERT(v4l2_format.pixelformat),
((v4l2_format.flags & V4L2_FMT_FLAG_EMULATED) ? 1 : 0));
- if (__vision_source_get_format(v4l2_format.pixelformat, &pixel_format) != VISION_SOURCE_ERROR_NONE) {
+ if (__vision_source_get_format(v4l2_format.pixelformat,
+ &pixel_format) !=
+ VISION_SOURCE_ERROR_NONE) {
pixel_index++;
continue;
}
v4l2_frame.index = resolution_index;
v4l2_frame.pixel_format = v4l2_format.pixelformat;
- if (v4l2_ioctl(device_fd, VIDIOC_ENUM_FRAMESIZES, &v4l2_frame) < 0) {
+ if (v4l2_ioctl(device_fd, VIDIOC_ENUM_FRAMESIZES, &v4l2_frame) <
+ 0) {
LOGW("\t\tframe : end of enumeration ");
break;
}
LOGD("\t\tsize[%d] %ux%u", resolution_index, width, height);
- auto fps_list = __vision_source_get_fps_list(device_fd, v4l2_frame.pixel_format, width, height);
+ auto fps_list = __vision_source_get_fps_list(
+ device_fd, v4l2_frame.pixel_format, width, height);
if (fps_list.empty()) {
return VISION_SOURCE_ERROR_NOT_SUPPORTED_FORMAT;
}
resolution_index++;
for (auto fps : fps_list) {
- fmt_info fmt { (media_format_mimetype_e) pixel_format, width, height, fps };
+ fmt_info fmt { (media_format_mimetype_e) pixel_format, width,
+ height, fps };
found_fmt.push_back(fmt);
}
}
else
dev_caps = v4l2_cap.capabilities;
- if (!(dev_caps & V4L2_CAP_VIDEO_CAPTURE) || (dev_caps & V4L2_CAP_VIDEO_OUTPUT)) {
+ if (!(dev_caps & V4L2_CAP_VIDEO_CAPTURE) ||
+ (dev_caps & V4L2_CAP_VIDEO_OUTPUT)) {
LOGW("[%s] is not a capture device 0x%x", path, dev_caps);
v4l2_close(device_fd);
return ret;
size_t dev_count = dev_name.size();
- vs_handle->dev_info = (vision_source_device_info_s *) calloc(dev_count, sizeof(vision_source_device_info_s));
+ vs_handle->dev_info = (vision_source_device_info_s *) calloc(
+ dev_count, sizeof(vision_source_device_info_s));
if (!vs_handle->dev_info) {
return VISION_SOURCE_ERROR_OUT_OF_MEMORY;
}
- vs_handle->fmt = (media_format_h **) calloc(dev_count, sizeof(media_format_h *));
+ vs_handle->fmt =
+ (media_format_h **) calloc(dev_count, sizeof(media_format_h *));
if (!vs_handle->fmt) {
return VISION_SOURCE_ERROR_OUT_OF_MEMORY;
}
for (size_t i = 0; i < dev_count; i++) {
vs_handle->dev_info[i].index = i;
- strncpy(vs_handle->dev_info[i].name, dev_name[i].c_str(), DEVICE_NAME_LENGTH_MAX);
- vs_handle->fmt[i] = (media_format_h *) calloc(dev_fmt_list[i].size(), sizeof(media_format_h));
+ strncpy(vs_handle->dev_info[i].name, dev_name[i].c_str(),
+ DEVICE_NAME_LENGTH_MAX);
+ vs_handle->dev_info[i].name[DEVICE_NAME_LENGTH_MAX - 1] = '\0';
+ vs_handle->fmt[i] = (media_format_h *) calloc(dev_fmt_list[i].size(),
+ sizeof(media_format_h));
if (!vs_handle->fmt[i]) {
return VISION_SOURCE_ERROR_OUT_OF_MEMORY;
}
static int __vision_source_v4l2_stream(int device_fd, int type, bool onoff)
{
- if (v4l2_ioctl(device_fd, onoff ? VIDIOC_STREAMON : VIDIOC_STREAMOFF, &type) < 0) {
+ if (v4l2_ioctl(device_fd, onoff ? VIDIOC_STREAMON : VIDIOC_STREAMOFF,
+ &type) < 0) {
LOGE("stream %d failed. [t:%d] errno %d", onoff, type, errno);
return VISION_SOURCE_ERROR_INTERNAL;
}
return VISION_SOURCE_ERROR_NONE;
}
-static int __vision_source_v4l2_reqbufs(int device_fd, int type, int memory, uint32_t count, uint32_t *result_count)
+static int __vision_source_v4l2_reqbufs(int device_fd, int type, int memory,
+ uint32_t count, uint32_t *result_count)
{
struct v4l2_requestbuffers v4l2_reqbuf;
LOGD("__vision_source_stop_stream");
/* stream off */
- int ret = __vision_source_v4l2_stream(handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, false);
+ int ret = __vision_source_v4l2_stream(handle->device_fd,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE, false);
/* munmap */
for (size_t i = 0; i < handle->mmap_addr.size(); i++) {
/* reqbufs 0 */
uint32_t buffer_count;
- ret = __vision_source_v4l2_reqbufs(handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, 0,
- &buffer_count);
+ ret = __vision_source_v4l2_reqbufs(handle->device_fd,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ V4L2_MEMORY_MMAP, 0, &buffer_count);
LOGD("reqbufs 0 : 0x%x", ret);
return VISION_SOURCE_ERROR_NONE;
}
-static int __vision_source_v4l2_dqbuf(int device_fd, int type, int memory, int *index, unsigned int *used_size)
+static int __vision_source_v4l2_dqbuf(int device_fd, int type, int memory,
+ int *index, unsigned int *used_size)
{
struct v4l2_buffer v4l2_buf;
memset(&v4l2_buf, 0x0, sizeof(struct v4l2_buffer));
handle->v4l2_buf.push_back(v4l2_buf);
- void *data =
- v4l2_mmap(0, v4l2_buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, handle->device_fd, v4l2_buf.m.offset);
+ void *data = v4l2_mmap(0, v4l2_buf.length, PROT_READ | PROT_WRITE,
+ MAP_SHARED, handle->device_fd,
+ v4l2_buf.m.offset);
if (data == MAP_FAILED) {
LOGE("[%d] mmap failed (errno %d)", i, errno);
handle->mmap_addr.push_back(data);
- if (__vision_source_v4l2_qbuf(handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, i) !=
- VISION_SOURCE_ERROR_NONE) {
+ if (__vision_source_v4l2_qbuf(
+ handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ V4L2_MEMORY_MMAP, i) != VISION_SOURCE_ERROR_NONE) {
LOGE("[%d] qbuf failed (errno %d)", i, errno);
return VISION_SOURCE_ERROR_INTERNAL;
}
}
/* stream on */
- return __vision_source_v4l2_stream(handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, true);
+ return __vision_source_v4l2_stream(handle->device_fd,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE, true);
}
static int __vision_source_start_stream(vision_source_v4l2_s *handle)
{
uint32_t buffer_count = 0;
/* request buffer */
- int ret = __vision_source_v4l2_reqbufs(handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, BUFFER_MAX,
+ int ret = __vision_source_v4l2_reqbufs(handle->device_fd,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ V4L2_MEMORY_MMAP, BUFFER_MAX,
&buffer_count);
if (ret != VISION_SOURCE_ERROR_NONE) {
return ret;
ret = __vision_source_mmap(handle);
if (ret != VISION_SOURCE_ERROR_NONE)
- __vision_source_v4l2_reqbufs(handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, 0,
- &buffer_count);
+ __vision_source_v4l2_reqbufs(handle->device_fd,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ V4L2_MEMORY_MMAP, 0, &buffer_count);
return ret;
}
int ret = __vision_source_list_devices(v4l2_handle);
if (ret != VISION_SOURCE_ERROR_NONE) {
- free(v4l2_handle);
+ delete v4l2_handle;
LOGE("get device info failed");
return ret;
}
return VISION_SOURCE_ERROR_NONE;
}
-int vision_source_list_devices(vision_source_h handle, const vision_source_device_info_s **dev_list, int *dev_count)
+int vision_source_list_devices(vision_source_h handle,
+ const vision_source_device_info_s **dev_list,
+ int *dev_count)
{
vision_source_v4l2_s *v4l2_handle = (vision_source_v4l2_s *) handle;
return VISION_SOURCE_ERROR_NONE;
}
-int vision_source_list_device_caps(vision_source_h handle, int dev_index, const media_format_h **fmt_list,
+int vision_source_list_device_caps(vision_source_h handle, int dev_index,
+ const media_format_h **fmt_list,
int *fmt_count)
{
vision_source_v4l2_s *v4l2_handle = (vision_source_v4l2_s *) handle;
{
vision_source_v4l2_s *v4l2_handle = (vision_source_v4l2_s *) handle;
- if (!v4l2_handle->fmt || v4l2_handle->status != VISION_SOURCE_STATUS_OPENDED) {
+ if (!v4l2_handle->fmt ||
+ v4l2_handle->status != VISION_SOURCE_STATUS_OPENDED) {
LOGE("Invalid state");
return VISION_SOURCE_ERROR_INVALID_OPERATION;
}
media_format_mimetype_e mimetype;
int width, height, fps;
- int ret = media_format_get_video_info(fmt, &mimetype, &width, &height, nullptr, nullptr);
+ int ret = media_format_get_video_info(fmt, &mimetype, &width, &height,
+ nullptr, nullptr);
if (ret != MEDIA_FORMAT_ERROR_NONE) {
LOGE("media_format_get_video_info failed");
return VISION_SOURCE_ERROR_INTERNAL;
LOGI("Try set format width: %d, height: %d, fps: %d", width, height, fps);
- fmt_info request { mimetype, (uint32_t) width, (uint32_t) height, (uint32_t) fps };
+ fmt_info request { mimetype, (uint32_t) width, (uint32_t) height,
+ (uint32_t) fps };
vector<fmt_info> &vec = v4l2_handle->fmt_list[v4l2_handle->device_index];
const auto pos = find(vec.begin(), vec.end(), request);
if (pos == vec.end()) {
return VISION_SOURCE_ERROR_NONE;
}
-static void __vision_source_pkt_dispose_cb(media_packet_h packet, void *user_data)
+static void __vision_source_pkt_dispose_cb(media_packet_h packet,
+ void *user_data)
{
pkt_dispose_cb_data *data = (pkt_dispose_cb_data *) user_data;
- int ret = __vision_source_v4l2_qbuf(data->fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, data->index);
+ int ret = __vision_source_v4l2_qbuf(data->fd, V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ V4L2_MEMORY_MMAP, data->index);
if (ret != VISION_SOURCE_ERROR_NONE)
LOGE("qbuf failed");
}
LOGD("stop buffer handler thread");
break;
}
- ret = __vision_source_v4l2_dqbuf(v4l2_handle->device_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, &index,
- &byte_size);
+ ret = __vision_source_v4l2_dqbuf(v4l2_handle->device_fd,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ V4L2_MEMORY_MMAP, &index, &byte_size);
if (ret != VISION_SOURCE_ERROR_NONE) {
LOGE("dqbuf failed");
break;
}
- media_format_h fmt = v4l2_handle->fmt[v4l2_handle->device_index][v4l2_handle->fmt_index];
+ media_format_h fmt = v4l2_handle->fmt[v4l2_handle->device_index]
+ [v4l2_handle->fmt_index];
media_packet_h pkt;
- ret = media_packet_new_from_external_memory(fmt, v4l2_handle->mmap_addr[index], byte_size,
- __vision_source_pkt_dispose_cb, &v4l2_handle->pkt_data[index],
- &pkt);
+ ret = media_packet_new_from_external_memory(
+ fmt, v4l2_handle->mmap_addr[index], byte_size,
+ __vision_source_pkt_dispose_cb, &v4l2_handle->pkt_data[index],
+ &pkt);
if (ret != MEDIA_PACKET_ERROR_NONE) {
LOGE("media_packet_new_from_external_memory failed");
continue;
}
v4l2_handle->buffer_thread_run = true;
- v4l2_handle->buffer_thread = thread(__fetch_buffer_and_callback, v4l2_handle);
+ v4l2_handle->buffer_thread =
+ thread(__fetch_buffer_and_callback, v4l2_handle);
v4l2_handle->status = VISION_SOURCE_STATUS_STARTED;
LOGD("start preview done");
}
/* TODO: run-time callback change*/
-int vision_source_set_stream_cb(vision_source_h handle, stream_cb callback, void *user_data)
+int vision_source_set_stream_cb(vision_source_h handle, stream_cb callback,
+ void *user_data)
{
vision_source_v4l2_s *v4l2_handle = (vision_source_v4l2_s *) handle;
{
const vision_source_device_info_s *dev_list;
int dev_cnt;
- ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt),
+ VISION_SOURCE_ERROR_NONE);
EXPECT_GT(dev_cnt, 0);
}
const media_format_h *fmt_list;
int fmt_count;
int dev_cnt;
- ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(dev_cnt, 0);
- ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list, &fmt_count), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list,
+ &fmt_count),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(fmt_count, 0);
}
TEST_F(VisionV4L2, OpenDev0)
{
- ASSERT_EQ(vision_source_open_device(ms_handle, 0), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_open_device(ms_handle, 0),
+ VISION_SOURCE_ERROR_NONE);
EXPECT_EQ(vision_source_close_device(ms_handle), VISION_SOURCE_ERROR_NONE);
}
const media_format_h *fmt_list;
int fmt_count;
int dev_cnt;
- ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(dev_cnt, 0);
- ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list, &fmt_count), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list,
+ &fmt_count),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(fmt_count, 2);
- EXPECT_EQ(vision_source_set_stream_format(ms_handle, fmt_list[2]), VISION_SOURCE_ERROR_INVALID_OPERATION);
+ EXPECT_EQ(vision_source_set_stream_format(ms_handle, fmt_list[2]),
+ VISION_SOURCE_ERROR_INVALID_OPERATION);
}
TEST_F(VisionV4L2, SetStream)
const media_format_h *fmt_list;
int fmt_count;
int dev_cnt;
- ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(dev_cnt, 0);
- ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list, &fmt_count), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list,
+ &fmt_count),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(fmt_count, 2);
- ASSERT_EQ(vision_source_open_device(ms_handle, 0), VISION_SOURCE_ERROR_NONE);
- EXPECT_EQ(vision_source_set_stream_format(ms_handle, fmt_list[2]), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_open_device(ms_handle, 0),
+ VISION_SOURCE_ERROR_NONE);
+ EXPECT_EQ(vision_source_set_stream_format(ms_handle, fmt_list[2]),
+ VISION_SOURCE_ERROR_NONE);
EXPECT_EQ(vision_source_close_device(ms_handle), VISION_SOURCE_ERROR_NONE);
}
int fmt_count;
int dev_cnt;
- ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_devices(ms_handle, &dev_list, &dev_cnt),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(dev_cnt, 0);
- ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list, &fmt_count), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_list_device_caps(ms_handle, 0, &fmt_list,
+ &fmt_count),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_GT(fmt_count, 2);
- ASSERT_EQ(vision_source_open_device(ms_handle, 0), VISION_SOURCE_ERROR_NONE);
- ASSERT_EQ(vision_source_set_stream_format(ms_handle, fmt_list[2]), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_open_device(ms_handle, 0),
+ VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_set_stream_format(ms_handle, fmt_list[2]),
+ VISION_SOURCE_ERROR_NONE);
}
void TearDown() override
{
- EXPECT_EQ(vision_source_close_device(ms_handle), VISION_SOURCE_ERROR_NONE);
+ EXPECT_EQ(vision_source_close_device(ms_handle),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_EQ(vision_source_exit(ms_handle), VISION_SOURCE_ERROR_NONE);
}
vision_source_h ms_handle;
TEST_F(VisionV4L2FixedFormat, OnlyStopStream)
{
- EXPECT_EQ(vision_source_stop_stream(ms_handle), VISION_SOURCE_ERROR_INVALID_OPERATION);
+ EXPECT_EQ(vision_source_stop_stream(ms_handle),
+ VISION_SOURCE_ERROR_INVALID_OPERATION);
}
TEST_F(VisionV4L2FixedFormat, StartStream)
double delta_ms = (double) (end - *start) / CLOCKS_PER_SEC * 1000;
- snprintf(filename, 127, "/opt/usr/home/owner/media/Images/out_%04u.data", (unsigned) delta_ms);
+ snprintf(filename, 127, "/opt/usr/home/owner/media/Images/out_%04u.data",
+ (unsigned) delta_ms);
file = fopen(filename, "w");
void *data;
TEST_F(VisionV4L2FixedFormat, StartWithCallback)
{
clock_t start = clock();
- ASSERT_EQ(vision_source_set_stream_cb(ms_handle, test_cb, &start), VISION_SOURCE_ERROR_NONE);
+ ASSERT_EQ(vision_source_set_stream_cb(ms_handle, test_cb, &start),
+ VISION_SOURCE_ERROR_NONE);
ASSERT_EQ(vision_source_start_stream(ms_handle), VISION_SOURCE_ERROR_NONE);
sleep(5);
EXPECT_EQ(vision_source_stop_stream(ms_handle), VISION_SOURCE_ERROR_NONE);