Пример #1
0
void v4l2_overlay_dump_state(int fd)
{
    struct v4l2_format format;
    struct v4l2_crop crop;
    int ret;

    LOGI("dumping driver state:");
    format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
    ret = ioctl(fd, VIDIOC_G_FMT, &format);
    if (ret < 0)
        return;
    LOGI("output pixfmt:\n");
    dump_pixfmt(&format.fmt.pix);

    format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
    ret = ioctl(fd, VIDIOC_G_FMT, &format);
    if (ret < 0)
        return;
    LOGI("v4l2_overlay window:\n");
    dump_window(&format.fmt.win);

    crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
    ret = ioctl(fd, VIDIOC_G_CROP, &crop);
    if (ret < 0)
        return;
    LOGI("output crop:\n");
    dump_crop(&crop);
}
Пример #2
0
int main(int argc, char **argv)
{
	int fd;

	parse_args(argc, argv);

	memset(&window, 0, sizeof(struct vme_mapping));

	if ((window_num < 0) || (window_num > 7)) {
		printf("Wrong window number %d_n", window_num);
		exit(1);
	}

	window.window_num = window_num;
	window.am = am;

	switch (dsize) {
	case 16:
		window.data_width = VME_D16;
		break;
	case 32:
		window.data_width = VME_D32;
		break;
	default:
		printf("Unsupported data width %d\n", dsize);
		exit(1);
	}

	window.vme_addru = 0;
	window.vme_addrl = vmeaddr;

	window.sizeu = 0;
	window.sizel = length;

        printf("Creating window %d\n\tVME addr: 0x%08x size: 0x%08x "
	       "AM: 0x%02x data width: %d\n\n",
	       window_num, vmeaddr, length, am, dsize);

	if ((fd = open(VME_MWINDOW_DEV, O_RDWR)) < 0) {
		printf("Failed to open %s: %s\n", VME_MWINDOW_DEV,
		       strerror(errno));
		exit(1);
	}

	if (ioctl(fd, VME_IOCTL_CREATE_WINDOW, &window) < 0) {
		printf("Failed to create window: %s\n", strerror(errno));
		close(fd);
		exit(1);
	}

	memset(&testw, 0, sizeof(struct vme_mapping));

	testw.window_num = window_num;

	if (ioctl(fd, VME_IOCTL_GET_WINDOW_ATTR, &testw) < 0) {
		printf("Failed to get window attributes: %s\n",
		       strerror(errno));
		close(fd);
		exit(1);
	}

	compare_windows(&window, &testw);

	dump_window(&window);

	close(fd);

	return 0;
}