qcap: Add optional dependency on libv4l.
This commit is contained in:
parent
3d7aabd887
commit
bf6f0750cd
|
@ -803,6 +803,7 @@ with_oss
|
||||||
with_png
|
with_png
|
||||||
with_pthread
|
with_pthread
|
||||||
with_sane
|
with_sane
|
||||||
|
with_v4l
|
||||||
with_xcomposite
|
with_xcomposite
|
||||||
with_xcursor
|
with_xcursor
|
||||||
with_xinerama
|
with_xinerama
|
||||||
|
@ -1488,6 +1489,7 @@ Optional Packages:
|
||||||
--without-png do not use PNG
|
--without-png do not use PNG
|
||||||
--without-pthread do not use the pthread library
|
--without-pthread do not use the pthread library
|
||||||
--without-sane do not use SANE (scanner support)
|
--without-sane do not use SANE (scanner support)
|
||||||
|
--without-v4l do not use v4l1 (v4l support)
|
||||||
--without-xcomposite do not use the Xcomposite extension
|
--without-xcomposite do not use the Xcomposite extension
|
||||||
--without-xcursor do not use the Xcursor extension
|
--without-xcursor do not use the Xcursor extension
|
||||||
--without-xinerama do not use Xinerama (multi-monitor support)
|
--without-xinerama do not use Xinerama (multi-monitor support)
|
||||||
|
@ -2665,6 +2667,12 @@ if test "${with_sane+set}" = set; then :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check whether --with-v4l was given.
|
||||||
|
if test "${with_v4l+set}" = set; then :
|
||||||
|
withval=$with_v4l;
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --with-xcomposite was given.
|
# Check whether --with-xcomposite was given.
|
||||||
if test "${with_xcomposite+set}" = set; then :
|
if test "${with_xcomposite+set}" = set; then :
|
||||||
withval=$with_xcomposite; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi
|
withval=$with_xcomposite; if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi
|
||||||
|
@ -9615,6 +9623,68 @@ This is an error since --with-sane was requested." "$LINENO" 5 ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "x$with_v4l" != "xno"
|
||||||
|
then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lv4l1" >&5
|
||||||
|
$as_echo_n "checking for -lv4l1... " >&6; }
|
||||||
|
if test "${ac_cv_lib_soname_v4l1+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_soname_save_LIBS=$LIBS
|
||||||
|
LIBS="-lv4l1 $LIBS"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
Use char because int might match the return type of a GCC
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
char v4l1_open ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return v4l1_open ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
case "$LIBEXT" in
|
||||||
|
dll) ;;
|
||||||
|
dylib) ac_cv_lib_soname_v4l1=`otool -L conftest$ac_exeext | grep "libv4l1\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libv4l1\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
|
||||||
|
*) ac_cv_lib_soname_v4l1=`$ac_cv_path_LDD conftest$ac_exeext | grep "libv4l1\\.$LIBEXT" | sed -e "s/^.*\(libv4l1\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_soname_save_LIBS
|
||||||
|
fi
|
||||||
|
if test "x$ac_cv_lib_soname_v4l1" = "x"; then :
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
|
||||||
|
$as_echo "not found" >&6; }
|
||||||
|
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_v4l1" >&5
|
||||||
|
$as_echo "$ac_cv_lib_soname_v4l1" >&6; }
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define SONAME_LIBV4L1 "$ac_cv_lib_soname_v4l1"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test "x$ac_cv_lib_soname_v4l1" = "x"; then :
|
||||||
|
case "x$with_v4l" in
|
||||||
|
x) wine_notices="$wine_notices|libv4l ${notice_platform}development files not found." ;;
|
||||||
|
xno) ;;
|
||||||
|
*) as_fn_error "libv4l ${notice_platform}development files not found.
|
||||||
|
This is an error since --with-v4l was requested." "$LINENO" 5 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$with_gphoto" != "xno"
|
if test "x$with_gphoto" != "xno"
|
||||||
then
|
then
|
||||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||||
|
|
|
@ -65,6 +65,7 @@ AC_ARG_WITH(png, AS_HELP_STRING([--without-png],[do not use PNG]),
|
||||||
AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthread library]),
|
AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthread library]),
|
||||||
[if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
|
[if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
|
||||||
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
|
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
|
||||||
|
AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
|
||||||
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
|
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
|
||||||
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
|
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
|
||||||
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
|
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
|
||||||
|
@ -1138,6 +1139,14 @@ fi
|
||||||
WINE_NOTICE_WITH(sane,[test "x$ac_cv_lib_soname_sane" = "x"],
|
WINE_NOTICE_WITH(sane,[test "x$ac_cv_lib_soname_sane" = "x"],
|
||||||
[libsane ${notice_platform}development files not found, scanners won't be supported.])
|
[libsane ${notice_platform}development files not found, scanners won't be supported.])
|
||||||
|
|
||||||
|
dnl **** Check for libv4l1 ****
|
||||||
|
if test "x$with_v4l" != "xno"
|
||||||
|
then
|
||||||
|
WINE_CHECK_SONAME(v4l1,v4l1_open,,,)
|
||||||
|
fi
|
||||||
|
WINE_NOTICE_WITH(v4l,[test "x$ac_cv_lib_soname_v4l1" = "x"],
|
||||||
|
[libv4l ${notice_platform}development files not found.])
|
||||||
|
|
||||||
dnl **** Check for libgphoto2 ****
|
dnl **** Check for libgphoto2 ****
|
||||||
if test "x$with_gphoto" != "xno"
|
if test "x$with_gphoto" != "xno"
|
||||||
then
|
then
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "wine/port.h"
|
#include "wine/port.h"
|
||||||
|
#include "wine/library.h"
|
||||||
|
|
||||||
#define NONAMELESSSTRUCT
|
#define NONAMELESSSTRUCT
|
||||||
#define NONAMELESSUNION
|
#define NONAMELESSUNION
|
||||||
|
@ -73,6 +74,32 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap_v4l);
|
||||||
|
|
||||||
#ifdef HAVE_LINUX_VIDEODEV_H
|
#ifdef HAVE_LINUX_VIDEODEV_H
|
||||||
|
|
||||||
|
static typeof(open) *video_open = open;
|
||||||
|
static typeof(close) *video_close = close;
|
||||||
|
static typeof(ioctl) *video_ioctl = ioctl;
|
||||||
|
static typeof(read) *video_read = read;
|
||||||
|
static typeof(mmap) *video_mmap = mmap;
|
||||||
|
static typeof(munmap) *video_munmap = munmap;
|
||||||
|
|
||||||
|
static void video_init(void)
|
||||||
|
{
|
||||||
|
#ifdef SONAME_LIBV4L1
|
||||||
|
static void *video_lib;
|
||||||
|
|
||||||
|
if (video_lib)
|
||||||
|
return;
|
||||||
|
video_lib = wine_dlopen(SONAME_LIBV4L1, RTLD_NOW, NULL, 0);
|
||||||
|
if (!video_lib)
|
||||||
|
return;
|
||||||
|
video_open = wine_dlsym(video_lib, "v4l1_open", NULL, 0);
|
||||||
|
video_close = wine_dlsym(video_lib, "v4l1_close", NULL, 0);
|
||||||
|
video_ioctl = wine_dlsym(video_lib, "v4l1_ioctl", NULL, 0);
|
||||||
|
video_read = wine_dlsym(video_lib, "v4l1_read", NULL, 0);
|
||||||
|
video_mmap = wine_dlsym(video_lib, "v4l1_mmap", NULL, 0);
|
||||||
|
video_munmap = wine_dlsym(video_lib, "v4l1_munmap", NULL, 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
typedef void (* Renderer)(const Capture *, LPBYTE bufferin, const BYTE *stream);
|
typedef void (* Renderer)(const Capture *, LPBYTE bufferin, const BYTE *stream);
|
||||||
|
|
||||||
struct _Capture
|
struct _Capture
|
||||||
|
@ -146,7 +173,7 @@ static int xioctl(int fd, int request, void * arg)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
r = ioctl (fd, request, arg);
|
r = video_ioctl (fd, request, arg);
|
||||||
} while (-1 == r && EINTR == errno);
|
} while (-1 == r && EINTR == errno);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -168,8 +195,8 @@ static HRESULT V4l_Prepare(Capture *capBox)
|
||||||
TRACE("%p: Using %d/%d buffers\n", capBox,
|
TRACE("%p: Using %d/%d buffers\n", capBox,
|
||||||
capBox->buffers, capBox->gb_buffers.frames);
|
capBox->buffers, capBox->gb_buffers.frames);
|
||||||
|
|
||||||
capBox->pmap = mmap( 0, capBox->gb_buffers.size, PROT_READ|PROT_WRITE,
|
capBox->pmap = video_mmap( 0, capBox->gb_buffers.size, PROT_READ|PROT_WRITE,
|
||||||
MAP_SHARED, capBox->fd, 0 );
|
MAP_SHARED, capBox->fd, 0 );
|
||||||
if (capBox->pmap != MAP_FAILED)
|
if (capBox->pmap != MAP_FAILED)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -177,7 +204,7 @@ static HRESULT V4l_Prepare(Capture *capBox)
|
||||||
capBox->grab_buf = CoTaskMemAlloc(sizeof(struct video_mmap) * capBox->buffers);
|
capBox->grab_buf = CoTaskMemAlloc(sizeof(struct video_mmap) * capBox->buffers);
|
||||||
if (!capBox->grab_buf)
|
if (!capBox->grab_buf)
|
||||||
{
|
{
|
||||||
munmap(capBox->pmap, capBox->gb_buffers.size);
|
video_munmap(capBox->pmap, capBox->gb_buffers.size);
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +238,7 @@ static void V4l_Unprepare(Capture *capBox)
|
||||||
{
|
{
|
||||||
for (capBox->curframe = 0; capBox->curframe < capBox->buffers; capBox->curframe++)
|
for (capBox->curframe = 0; capBox->curframe < capBox->buffers; capBox->curframe++)
|
||||||
xioctl(capBox->fd, VIDIOCSYNC, &capBox->grab_buf[capBox->curframe]);
|
xioctl(capBox->fd, VIDIOCSYNC, &capBox->grab_buf[capBox->curframe]);
|
||||||
munmap(capBox->pmap, capBox->gb_buffers.size);
|
video_munmap(capBox->pmap, capBox->gb_buffers.size);
|
||||||
CoTaskMemFree(capBox->grab_buf);
|
CoTaskMemFree(capBox->grab_buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -223,7 +250,7 @@ HRESULT qcap_driver_destroy(Capture *capBox)
|
||||||
TRACE("%p\n", capBox);
|
TRACE("%p\n", capBox);
|
||||||
|
|
||||||
if( capBox->fd != -1 )
|
if( capBox->fd != -1 )
|
||||||
close(capBox->fd);
|
video_close(capBox->fd);
|
||||||
capBox->CritSect.DebugInfo->Spare[0] = 0;
|
capBox->CritSect.DebugInfo->Spare[0] = 0;
|
||||||
DeleteCriticalSection(&capBox->CritSect);
|
DeleteCriticalSection(&capBox->CritSect);
|
||||||
CoTaskMemFree(capBox);
|
CoTaskMemFree(capBox);
|
||||||
|
@ -546,7 +573,7 @@ static void V4l_GetFrame(Capture * capBox, unsigned char ** pInput)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
while ((retval = read(capBox->fd, capBox->grab_data, capBox->imagesize)) == -1)
|
while ((retval = video_read(capBox->fd, capBox->grab_data, capBox->imagesize)) == -1)
|
||||||
if (errno != EAGAIN) break;
|
if (errno != EAGAIN) break;
|
||||||
if (retval == -1)
|
if (retval == -1)
|
||||||
WARN("Error occurred while reading from device: %s\n", strerror(errno));
|
WARN("Error occurred while reading from device: %s\n", strerror(errno));
|
||||||
|
@ -782,6 +809,7 @@ Capture * qcap_driver_init( IPin *pOut, USHORT card )
|
||||||
struct video_window window;
|
struct video_window window;
|
||||||
|
|
||||||
YUV_Init();
|
YUV_Init();
|
||||||
|
video_init();
|
||||||
|
|
||||||
capBox = CoTaskMemAlloc(sizeof(Capture));
|
capBox = CoTaskMemAlloc(sizeof(Capture));
|
||||||
if (!capBox)
|
if (!capBox)
|
||||||
|
@ -794,7 +822,7 @@ Capture * qcap_driver_init( IPin *pOut, USHORT card )
|
||||||
|
|
||||||
sprintf(device, "/dev/video%i", card);
|
sprintf(device, "/dev/video%i", card);
|
||||||
TRACE("opening %s\n", device);
|
TRACE("opening %s\n", device);
|
||||||
capBox->fd = open(device, O_RDWR | O_NONBLOCK);
|
capBox->fd = video_open(device, O_RDWR | O_NONBLOCK);
|
||||||
if (capBox->fd == -1)
|
if (capBox->fd == -1)
|
||||||
{
|
{
|
||||||
WARN("open failed (%d)\n", errno);
|
WARN("open failed (%d)\n", errno);
|
||||||
|
|
|
@ -1194,6 +1194,9 @@
|
||||||
/* Define to the soname of the libssl library. */
|
/* Define to the soname of the libssl library. */
|
||||||
#undef SONAME_LIBSSL
|
#undef SONAME_LIBSSL
|
||||||
|
|
||||||
|
/* Define to the soname of the libv4l1 library. */
|
||||||
|
#undef SONAME_LIBV4L1
|
||||||
|
|
||||||
/* Define to the soname of the libX11 library. */
|
/* Define to the soname of the libX11 library. */
|
||||||
#undef SONAME_LIBX11
|
#undef SONAME_LIBX11
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue