2
1

0010-Build-libv4lconvert-helper-support-only-when-fork-is.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. From 91e7e4f4765780786e1479d28a70982adea256fc Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Tue, 25 Jul 2017 21:04:35 +0200
  4. Subject: [PATCH] Build libv4lconvert helper support only when fork() is
  5. available
  6. Upstream: https://git.linuxtv.org/v4l-utils.git/commit/?id=ed6eeee5f7dbc5b1b5b9263ae9281665d3fbe105
  7. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  8. ---
  9. configure.ac | 3 +++
  10. lib/libv4lconvert/Makefile.am | 7 ++++++-
  11. lib/libv4lconvert/libv4lconvert.c | 6 ++++++
  12. 3 files changed, 15 insertions(+), 1 deletion(-)
  13. diff --git a/configure.ac b/configure.ac
  14. index ae8f2e2..72c9421 100644
  15. --- a/configure.ac
  16. +++ b/configure.ac
  17. @@ -299,6 +299,9 @@ argp_saved_libs=$LIBS
  18. AC_SUBST([ARGP_LIBS])
  19. LIBS=$argp_saved_libs
  20. +AC_CHECK_FUNCS([fork], AC_DEFINE([HAVE_LIBV4LCONVERT_HELPERS],[1],[whether to use libv4lconvert helpers]))
  21. +AM_CONDITIONAL([HAVE_LIBV4LCONVERT_HELPERS], [test x$ac_cv_func_fork = xyes])
  22. +
  23. AC_CHECK_HEADER([linux/i2c-dev.h], [linux_i2c_dev=yes], [linux_i2c_dev=no])
  24. AM_CONDITIONAL([HAVE_LINUX_I2C_DEV], [test x$linux_i2c_dev = xyes])
  25. diff --git a/lib/libv4lconvert/Makefile.am b/lib/libv4lconvert/Makefile.am
  26. index 4f332fa..f266f3e 100644
  27. --- a/lib/libv4lconvert/Makefile.am
  28. +++ b/lib/libv4lconvert/Makefile.am
  29. @@ -1,6 +1,8 @@
  30. if WITH_DYN_LIBV4L
  31. lib_LTLIBRARIES = libv4lconvert.la
  32. +if HAVE_LIBV4LCONVERT_HELPERS
  33. libv4lconvertpriv_PROGRAMS = ov511-decomp ov518-decomp
  34. +endif
  35. include_HEADERS = ../include/libv4lconvert.h
  36. pkgconfig_DATA = libv4lconvert.pc
  37. LIBV4LCONVERT_VERSION = -version-info 0
  38. @@ -16,11 +18,14 @@ libv4lconvert_la_SOURCES = \
  39. control/libv4lcontrol.c control/libv4lcontrol.h control/libv4lcontrol-priv.h \
  40. processing/libv4lprocessing.c processing/whitebalance.c processing/autogain.c \
  41. processing/gamma.c processing/libv4lprocessing.h processing/libv4lprocessing-priv.h \
  42. - helper.c helper-funcs.h libv4lconvert-priv.h libv4lsyscall-priv.h \
  43. + helper-funcs.h libv4lconvert-priv.h libv4lsyscall-priv.h \
  44. tinyjpeg.h tinyjpeg-internal.h
  45. if HAVE_JPEG
  46. libv4lconvert_la_SOURCES += jpeg_memsrcdest.c jpeg_memsrcdest.h
  47. endif
  48. +if HAVE_LIBV4LCONVERT_HELPERS
  49. +libv4lconvert_la_SOURCES += helper.c
  50. +endif
  51. libv4lconvert_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC)
  52. libv4lconvert_la_LDFLAGS = $(LIBV4LCONVERT_VERSION) -lrt -lm $(JPEG_LIBS) $(ENFORCE_LIBV4L_STATIC)
  53. diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
  54. index d60774e..1a5ccec 100644
  55. --- a/lib/libv4lconvert/libv4lconvert.c
  56. +++ b/lib/libv4lconvert/libv4lconvert.c
  57. @@ -122,8 +122,10 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = {
  58. { V4L2_PIX_FMT_JPEG, 0, 7, 7, 0 },
  59. { V4L2_PIX_FMT_PJPG, 0, 7, 7, 1 },
  60. { V4L2_PIX_FMT_JPGL, 0, 7, 7, 1 },
  61. +#ifdef HAVE_LIBV4LCONVERT_HELPERS
  62. { V4L2_PIX_FMT_OV511, 0, 7, 7, 1 },
  63. { V4L2_PIX_FMT_OV518, 0, 7, 7, 1 },
  64. +#endif
  65. /* uncompressed bayer */
  66. { V4L2_PIX_FMT_SBGGR8, 8, 8, 8, 0 },
  67. { V4L2_PIX_FMT_SGBRG8, 8, 8, 8, 0 },
  68. @@ -278,7 +280,9 @@ void v4lconvert_destroy(struct v4lconvert_data *data)
  69. if (data->cinfo_initialized)
  70. jpeg_destroy_decompress(&data->cinfo);
  71. #endif // HAVE_JPEG
  72. +#ifdef HAVE_LIBV4LCONVERT_HELPERS
  73. v4lconvert_helper_cleanup(data);
  74. +#endif
  75. free(data->convert1_buf);
  76. free(data->convert2_buf);
  77. free(data->rotate90_buf);
  78. @@ -833,6 +837,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
  79. return -1;
  80. }
  81. break;
  82. +#ifdef HAVE_LIBV4LCONVERT_HELPERS
  83. case V4L2_PIX_FMT_OV511:
  84. if (v4lconvert_helper_decompress(data, LIBV4LCONVERT_PRIV_DIR "/ov511-decomp",
  85. src, src_size, d, d_size, width, height, yvu)) {
  86. @@ -849,6 +854,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
  87. return -1;
  88. }
  89. break;
  90. +#endif
  91. }
  92. switch (dest_pix_fmt) {
  93. --
  94. 1.9.1