From 9bc3d4c9a76886f62899365aca3a65d123395994 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 25 Jul 2011 13:27:58 +0200 Subject: oamp3isp: Move video device open to omap3_isp_pipeline_build() Open video devices right away when they're added to the pipeline. This will help pools implementation. Signed-off-by: Laurent Pinchart --- isp/omap3isp.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'isp/omap3isp.c') diff --git a/isp/omap3isp.c b/isp/omap3isp.c index 7bd58c8..be5ea3d 100644 --- a/isp/omap3isp.c +++ b/isp/omap3isp.c @@ -108,6 +108,7 @@ static void omap3_isp_pipeline_destroy(struct omap3_isp_pipeline *pipe) switch (entity->type) { case OMAP3_ISP_ENTITY_VIDEO: video = to_omap3_isp_video(entity); + v4l2_close(video->video); free(video); break; @@ -148,6 +149,15 @@ static int omap3_isp_pipeline_build(struct omap3_isp_device *isp, } memset(video, 0, sizeof *video); + + video->video = v4l2_open(entity->devname); + if (video->video == NULL) { + printf("error: unable to open video device %s\n", + entity->devname); + ret = -ENXIO; + goto done; + } + sink = &video->entity; } else { sink = malloc(sizeof *entity); @@ -511,14 +521,6 @@ int omap3_isp_viewfinder_setup(struct omap3_isp_device *isp, if (ret < 0) return ret; - /* Open the V4L2 device. */ - isp->viewfinder.output->video = v4l2_open(isp->viewfinder.output->entity.entity->devname); - if (isp->viewfinder.output->video == NULL) { - printf("error: unable to open video capture device %s\n", - isp->viewfinder.output->entity.entity->devname); - return -ENXIO; - } - /* Set the capture format on the output video node. */ memset(&format, 0, sizeof format); format.pixelformat = mbus_to_pix(ofmt->code); @@ -728,14 +730,6 @@ int omap3_isp_snapshot_setup(struct omap3_isp_device *isp, isp->snapshot.output->format = *ofmt; - /* Open the V4L2 device. */ - isp->snapshot.output->video = v4l2_open(isp->snapshot.output->entity.entity->devname); - if (isp->snapshot.output->video == NULL) { - printf("error: unable to open snapshot capture device %s\n", - isp->snapshot.output->entity.entity->devname); - return -ENODEV; - } - /* Set the capture format on the output video node. */ memset(&format, 0, sizeof format); format.pixelformat = mbus_to_pix(ofmt->code); -- cgit v1.2.3