Browse Source

mjpg-streamer: fix YUV capture mode

Update to r182-experimental (071481e626) broke YUV
capture mode in input_uvc. This patch fixes it.

Tested on ar71xx with Logitech C170

Signed-off-by: Mantas Pucka <mantas@8devices.com>
Mantas Pucka 9 years ago
parent
commit
84f3028036
1 changed files with 58 additions and 0 deletions
  1. 58
    0
      multimedia/mjpg-streamer/patches/050-fix-yuv-capture.patch

+ 58
- 0
multimedia/mjpg-streamer/patches/050-fix-yuv-capture.patch View File

@@ -0,0 +1,58 @@
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
+