Submitted By:            Kevin Day <thekevinday AT gmail DOT com>
Date:                    2007-08-20
Initial Package Version: 1.0.3
Upstream Status:         Not submitted
Description:             v4l2 capture does not work. This makes it work.
To be more specific, there were some very dangerous things going on here.
just look at the immediate ioctl below where v4l2_video_fd is used as the
video file descripter and is then sent as a reference in the third parameter
of the same function.
Now, I added dummy varables or set existing dummy variables to VID_TYPE_CAPTURE.
When I originally discovered this, I was using 1 and was not sure why it was
working. After finding some well documented specifications for video4linux2,
I was able to confirm this as a safe fix and changed 1 to VID_TYPE_CAPTURE.

NOTE: This might work in its unpatched state if your file descriptor happens
to be 1.

--- transcode-1.0.3/import/v4l/import_v4l2.c.orig	2007-08-20 16:57:56 -0500
+++ transcode-1.0.3/import/v4l/import_v4l2.c	2007-08-20 17:04:50 -0500
@@ -1006,8 +1006,9 @@
 		return(1);
 
 	// start capture
+	int dummy=VID_TYPE_CAPTURE;
 
-	if(ioctl(v4l2_video_fd, VIDIOC_STREAMON, &v4l2_video_fd /* ugh, needs valid memory location */) < 0)
+	if(ioctl(v4l2_video_fd, VIDIOC_STREAMON, &dummy) < 0)
 	{
 		perror(module "VIDIOC_STREAMON");
 		return(1);
@@ -1019,7 +1020,7 @@
 int	v4l2_video_get_frame(size_t size, char * data)
 {
 	int buffers_filled = 0;
-	int dummy;
+	int dummy=VID_TYPE_CAPTURE;
 
 	if(v4l2_overrun_guard)
 	{
@@ -1108,14 +1109,14 @@
 
 int v4l2_video_grab_stop(void)
 {
-	int dummy, ix;
+	int dummy=VID_TYPE_CAPTURE , ix;
 
 	// mute
 
 	if(!v4l2_mute(1))
 		return(1);
 
-	if(ioctl(v4l2_video_fd, VIDIOC_STREAMOFF, &dummy /* ugh */) < 0)
+	if(ioctl(v4l2_video_fd, VIDIOC_STREAMOFF, &dummy) < 0)
 	{
 		perror(module "VIDIOC_STREAMOFF");
 		return(1);
