050-fix-yuv-capture.patch (2944B)
1 Binary files a/ipkg-ar71xx/mjpg-streamer/usr/lib/input_uvc.so and b/ipkg-ar71xx/mjpg-streamer/usr/lib/input_uvc.so differ 2 diff -ur a/plugins/input_uvc/input_uvc.c b/plugins/input_uvc/input_uvc.c 3 --- a/plugins/input_uvc/input_uvc.c 2015-03-02 09:14:05.000000000 +0200 4 +++ b/plugins/input_uvc/input_uvc.c 2015-03-02 09:18:22.000000000 +0200 5 @@ -311,6 +311,10 @@ 6 } 7 memset(cams[id].videoIn, 0, sizeof(struct vdIn)); 8 9 + /* Non-MJPEG formats seem to fail with unlimited FPS */ 10 + if (format != V4L2_PIX_FMT_MJPEG && fps == -1) 11 + fps = 15; 12 + 13 /* display the parsed values */ 14 IPRINT("Using V4L2 device.: %s\n", dev); 15 IPRINT("Desired Resolution: %i x %i\n", width, height); 16 diff -ur a/plugins/input_uvc/jpeg_utils.c b/plugins/input_uvc/jpeg_utils.c 17 --- a/plugins/input_uvc/jpeg_utils.c 2015-03-02 09:17:02.000000000 +0300 18 +++ b/plugins/input_uvc/jpeg_utils.c 2015-03-02 09:25:18.000000000 +0200 19 @@ -198,7 +198,7 @@ 20 } 21 22 row_pointer = (JSAMPROW*)line_buffer; 23 - jpeg_write_scanlines(&cinfo, row_pointer, 1); 24 + jpeg_write_scanlines(&cinfo, &row_pointer, 1); 25 } 26 } else if (vd->formatIn == V4L2_PIX_FMT_RGB565) { 27 while(cinfo.next_scanline < vd->height) { 28 @@ -220,7 +220,7 @@ 29 } 30 31 row_pointer = (JSAMPROW*)line_buffer; 32 - jpeg_write_scanlines(&cinfo, row_pointer, 1); 33 + jpeg_write_scanlines(&cinfo, &row_pointer, 1); 34 } 35 } else if (vd->formatIn == V4L2_PIX_FMT_RGB24) { 36 jpeg_write_scanlines(&cinfo, (JSAMPROW*)vd->framebuffer, vd->height); 37 diff -ur a/plugins/input_uvc/v4l2uvc.c b/plugins/input_uvc/v4l2uvc.c 38 --- a/plugins/input_uvc/v4l2uvc.c 2015-03-02 09:14:05.000000000 +0200 39 +++ b/plugins/input_uvc/v4l2uvc.c 2015-03-02 09:22:09.000000000 +0200 40 @@ -338,11 +338,15 @@ 41 vd->frame_period_time = 1000/vd->fps; // calcualate frame period time in ms 42 IPRINT("Frame period time ......: %ld ms\n", vd->frame_period_time); 43 44 - // set FPS to maximum in order to minimize the lagging 45 memset(setfps, 0, sizeof(struct v4l2_streamparm)); 46 setfps->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 47 setfps->parm.capture.timeperframe.numerator = 1; 48 - setfps->parm.capture.timeperframe.denominator = 255; 49 + if (vd->formatIn == V4L2_PIX_FMT_MJPEG) 50 + // set FPS to maximum in order to minimize the lagging 51 + setfps->parm.capture.timeperframe.denominator = 255; 52 + else 53 + setfps->parm.capture.timeperframe.denominator = vd->fps; 54 + 55 ret = xioctl(vd->fd, VIDIOC_S_PARM, setfps); 56 if (ret) { 57 perror("Unable to set the FPS\n"); 58