050-fix-yuv-capture.patch 2.9 KB

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