Lines Matching full:devices
2 # libv4l1 userspace v4l1 api emulation for v4l2 devices
35 capture only devices, or non v4l2 devices.
75 static struct v4l1_dev_info devices[V4L1_MAX_DEVICES] = { variable
176 v4l2_pixfmt = devices[index].v4l2_pixfmt; in v4l1_set_format()
177 v4l1_pal = devices[index].v4l1_pal; in v4l1_set_format()
181 if (width == devices[index].width && height == devices[index].height && in v4l1_set_format()
182 v4l2_pixfmt == devices[index].v4l2_pixfmt) { in v4l1_set_format()
183 devices[index].v4l1_pal = v4l1_pal; in v4l1_set_format()
188 result = v4l2_ioctl(devices[index].fd, VIDIOC_G_FMT, &fmt2); in v4l1_set_format()
200 result = v4l2_ioctl(devices[index].fd, VIDIOC_TRY_FMT, &fmt2); in v4l1_set_format()
218 if (fmt2.fmt.pix.width == devices[index].width && in v4l1_set_format()
219 fmt2.fmt.pix.height == devices[index].height && in v4l1_set_format()
220 fmt2.fmt.pix.pixelformat == devices[index].v4l2_pixfmt) { in v4l1_set_format()
221 devices[index].v4l1_pal = v4l1_pal; in v4l1_set_format()
225 result = v4l2_ioctl(devices[index].fd, VIDIOC_S_FMT, &fmt2); in v4l1_set_format()
234 devices[index].width = fmt2.fmt.pix.width; in v4l1_set_format()
235 devices[index].height = fmt2.fmt.pix.height; in v4l1_set_format()
236 devices[index].v4l2_pixfmt = v4l2_pixfmt; in v4l1_set_format()
237 devices[index].v4l1_pal = v4l1_pal; in v4l1_set_format()
238 devices[index].depth = ((fmt2.fmt.pix.bytesperline << 3) + in v4l1_set_format()
249 devices[index].min_width = -1; in v4l1_find_min_and_max_size()
250 devices[index].min_height = -1; in v4l1_find_min_and_max_size()
251 devices[index].max_width = 0; in v4l1_find_min_and_max_size()
252 devices[index].max_height = 0; in v4l1_find_min_and_max_size()
257 if (v4l2_ioctl(devices[index].fd, VIDIOC_ENUM_FMT, &fmtdesc2)) in v4l1_find_min_and_max_size()
264 if (v4l2_ioctl(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { in v4l1_find_min_and_max_size()
265 if (fmt2->fmt.pix.width < devices[index].min_width) in v4l1_find_min_and_max_size()
266 devices[index].min_width = fmt2->fmt.pix.width; in v4l1_find_min_and_max_size()
267 if (fmt2->fmt.pix.height < devices[index].min_height) in v4l1_find_min_and_max_size()
268 devices[index].min_height = fmt2->fmt.pix.height; in v4l1_find_min_and_max_size()
275 if (v4l2_ioctl(devices[index].fd, VIDIOC_TRY_FMT, fmt2) == 0) { in v4l1_find_min_and_max_size()
276 if (fmt2->fmt.pix.width > devices[index].max_width) in v4l1_find_min_and_max_size()
277 devices[index].max_width = fmt2->fmt.pix.width; in v4l1_find_min_and_max_size()
278 if (fmt2->fmt.pix.height > devices[index].max_height) in v4l1_find_min_and_max_size()
279 devices[index].max_height = fmt2->fmt.pix.height; in v4l1_find_min_and_max_size()
362 it in our devices array */ in v4l1_open()
365 if (devices[index].fd == -1) { in v4l1_open()
366 devices[index].fd = fd; in v4l1_open()
372 V4L1_LOG_ERR("attempting to open more than %d video devices\n", in v4l1_open()
382 devices[index].flags = 0; in v4l1_open()
383 devices[index].open_count = 1; in v4l1_open()
384 devices[index].v4l1_frame_buf_map_count = 0; in v4l1_open()
385 devices[index].v4l1_frame_pointer = MAP_FAILED; in v4l1_open()
386 devices[index].width = fmt2.fmt.pix.width; in v4l1_open()
387 devices[index].height = fmt2.fmt.pix.height; in v4l1_open()
388 devices[index].v4l2_pixfmt = fmt2.fmt.pix.pixelformat; in v4l1_open()
389 devices[index].v4l1_pal = pixelformat_to_palette(fmt2.fmt.pix.pixelformat); in v4l1_open()
390 devices[index].depth = ((fmt2.fmt.pix.bytesperline << 3) + in v4l1_open()
398 devices[index].flags |= V4L1_SUPPORTS_ENUMINPUT; in v4l1_open()
402 devices[index].flags |= V4L1_SUPPORTS_ENUMSTD; in v4l1_open()
419 if (devices[index].fd == fd) in v4l1_get_index()
438 pthread_mutex_lock(&devices[index].stream_lock); in v4l1_close()
439 devices[index].open_count--; in v4l1_close()
440 result = devices[index].open_count != 0; in v4l1_close()
441 pthread_mutex_unlock(&devices[index].stream_lock); in v4l1_close()
447 if (devices[index].v4l1_frame_pointer != MAP_FAILED) { in v4l1_close()
448 if (devices[index].v4l1_frame_buf_map_count) in v4l1_close()
450 devices[index].v4l1_frame_buf_map_count); in v4l1_close()
452 SYS_MUNMAP(devices[index].v4l1_frame_pointer, in v4l1_close()
454 devices[index].v4l1_frame_pointer = MAP_FAILED; in v4l1_close()
460 devices[index].fd = -1; in v4l1_close()
476 devices[index].open_count++; in v4l1_dup()
510 pthread_mutex_lock(&devices[index].stream_lock); in v4l1_ioctl()
550 cap->minwidth = devices[index].min_width; in v4l1_ioctl()
551 cap->minheight = devices[index].min_height; in v4l1_ioctl()
552 cap->maxwidth = devices[index].max_width; in v4l1_ioctl()
553 cap->maxheight = devices[index].max_height; in v4l1_ioctl()
560 devices[index].flags |= V4L1_PIX_FMT_TOUCHED; in v4l1_ioctl()
568 result = v4l1_set_format(index, devices[index].width, in v4l1_ioctl()
569 devices[index].height, pic->palette, 0); in v4l1_ioctl()
582 if (!(devices[index].flags & V4L1_PIX_FMT_TOUCHED) && in v4l1_ioctl()
583 !pixelformat_to_palette(devices[index].v4l2_pixfmt)) in v4l1_ioctl()
584 v4l1_set_format(index, devices[index].width, in v4l1_ioctl()
585 devices[index].height, in v4l1_ioctl()
587 (devices[index].flags & in v4l1_ioctl()
590 devices[index].flags |= V4L1_PIX_FMT_TOUCHED; in v4l1_ioctl()
593 pic->depth = devices[index].depth; in v4l1_ioctl()
594 pic->palette = devices[index].v4l1_pal; in v4l1_ioctl()
595 i = v4l2_get_control(devices[index].fd, V4L2_CID_HUE); in v4l1_ioctl()
598 i = v4l2_get_control(devices[index].fd, V4L2_CID_SATURATION); in v4l1_ioctl()
601 i = v4l2_get_control(devices[index].fd, V4L2_CID_CONTRAST); in v4l1_ioctl()
604 i = v4l2_get_control(devices[index].fd, V4L2_CID_WHITENESS); in v4l1_ioctl()
607 i = v4l2_get_control(devices[index].fd, V4L2_CID_BRIGHTNESS); in v4l1_ioctl()
619 devices[index].flags |= V4L1_PIX_SIZE_TOUCHED; in v4l1_ioctl()
629 win->width = devices[index].width; in v4l1_ioctl()
630 win->height = devices[index].height; in v4l1_ioctl()
645 if (devices[index].flags & V4L1_SUPPORTS_ENUMINPUT) { in v4l1_ioctl()
674 if (devices[index].flags & V4L1_SUPPORTS_ENUMSTD) { in v4l1_ioctl()
696 if (devices[index].flags & V4L1_SUPPORTS_ENUMINPUT) { in v4l1_ioctl()
712 if (devices[index].flags & V4L1_SUPPORTS_ENUMSTD) { in v4l1_ioctl()
750 if (devices[index].v4l1_frame_pointer == MAP_FAILED) { in v4l1_ioctl()
751 devices[index].v4l1_frame_pointer = (void *)SYS_MMAP(NULL, in v4l1_ioctl()
755 if (devices[index].v4l1_frame_pointer == MAP_FAILED) { in v4l1_ioctl()
763 devices[index].v4l1_frame_pointer); in v4l1_ioctl()
772 devices[index].flags |= V4L1_PIX_FMT_TOUCHED | in v4l1_ioctl()
783 if (devices[index].v4l1_frame_pointer == MAP_FAILED || in v4l1_ioctl()
790 result = v4l2_read(devices[index].fd, in v4l1_ioctl()
791 devices[index].v4l1_frame_pointer + in v4l1_ioctl()
811 if (devices[index].v4l2_pixfmt != fmt2->fmt.pix.pixelformat) { in v4l1_ioctl()
812 devices[index].v4l2_pixfmt = fmt2->fmt.pix.pixelformat; in v4l1_ioctl()
813 devices[index].v4l1_pal = in v4l1_ioctl()
816 devices[index].width = fmt2->fmt.pix.width; in v4l1_ioctl()
817 devices[index].height = fmt2->fmt.pix.height; in v4l1_ioctl()
1184 pthread_mutex_unlock(&devices[index].stream_lock); in v4l1_ioctl()
1202 pthread_mutex_lock(&devices[index].stream_lock); in v4l1_read()
1204 pthread_mutex_unlock(&devices[index].stream_lock); in v4l1_read()
1225 pthread_mutex_lock(&devices[index].stream_lock); in v4l1_mmap()
1230 if (devices[index].v4l1_frame_pointer == MAP_FAILED) { in v4l1_mmap()
1235 devices[index].v4l1_frame_buf_map_count++; in v4l1_mmap()
1238 devices[index].v4l1_frame_pointer); in v4l1_mmap()
1240 result = devices[index].v4l1_frame_pointer; in v4l1_mmap()
1243 pthread_mutex_unlock(&devices[index].stream_lock); in v4l1_mmap()
1257 if (devices[index].fd != -1 && in v4l1_munmap()
1258 start == devices[index].v4l1_frame_pointer) in v4l1_munmap()
1264 pthread_mutex_lock(&devices[index].stream_lock); in v4l1_munmap()
1267 if (start == devices[index].v4l1_frame_pointer) { in v4l1_munmap()
1268 if (devices[index].v4l1_frame_buf_map_count > 0) in v4l1_munmap()
1269 devices[index].v4l1_frame_buf_map_count--; in v4l1_munmap()
1274 pthread_mutex_unlock(&devices[index].stream_lock); in v4l1_munmap()