コード例 #1
0
static int
uvc_gadget_stream(struct uvc_gadget_device *dev, int enable)
{
	int ret;

	if (enable) {
		xprint(xLOGDBG, "Starting video stream\n");
		ret = v4l2_stream_on(dev->fd, dev->type);
	} else {
		xprint(xLOGDBG, "Stopping video stream\n");
		ret = v4l2_stream_off(dev->fd, dev->type);
	}

	return ret;
}
コード例 #2
0
ファイル: camera.cpp プロジェクト: slambchops/jpeg_cam
/*
 * Initializes camera for streaming
 */
int init_camera(void)
{
	/* Declare properties for camera */
	camera.memory_mode = V4L2_MEMORY_MMAP;
	camera.num_buffers = 3;
	strcpy(camera.dev_name,"/dev/video0");
	strcpy(camera.name,"Camera");
	camera.buffers = NULL;
	camera.fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
	camera.width = 640;
	camera.height = 480;

	/* Initialize the v4l2 capture devices */
	if (v4l2_init_device(&camera) < 0) goto Error;

	/* Enable streaming for the v4l2 capture devices */
	if (v4l2_stream_on(&camera) < 0) goto Error;

	return 0;

Error:
	close_camera();
	return -1;
}