From b6f56999614369c54dd7ef8d576d781df7cbf496 Mon Sep 17 00:00:00 2001 From: niels Date: Tue, 21 Jun 2011 17:37:49 +0200 Subject: [PATCH] drop configure option without-v4l2 / without-v4l add option 'enable-v4l1' v4l2 driver is default check on failed open in v4l2_open --- veejay-current/veejay-server/configure.ac | 57 ++++++++++++------- .../veejay-server/libstream/v4l2utils.c | 9 ++- .../veejay-server/libstream/vj-tag.c | 3 +- .../veejay-server/libvjmem/vj-x86.c | 7 --- veejay-current/veejay-server/veejay/vj-misc.c | 6 +- veejay-current/veejay-server/veejay/vj-misc.h | 3 +- 6 files changed, 51 insertions(+), 34 deletions(-) diff --git a/veejay-current/veejay-server/configure.ac b/veejay-current/veejay-server/configure.ac index 5f381f39..dff2c9bb 100644 --- a/veejay-current/veejay-server/configure.ac +++ b/veejay-current/veejay-server/configure.ac @@ -35,6 +35,7 @@ dnl Options AC_CONFIG_MACRO_DIR([m4]) + dnl kill CFLAGS CFLAGS="" AC_ARG_ENABLE(strict, @@ -83,12 +84,12 @@ AC_ARG_WITH(jack, AC_ARG_WITH(samplerate, AC_HELP_STRING([--without-samplerate], [Do not use libsamplerate.]), [], [with_samplerate=yes]) -AC_ARG_WITH(v4l2, - AC_HELP_STRING([--without-v4l2], [Do not use video4linux2]), - [with_v4l2=no], [with_v4l2=yes]) -AC_ARG_WITH(v4l, - AC_HELP_STRING([--without-v4l], [Do not use video4linux1]), - [with_v4l=yes], [with_v4l=no]) + + +AC_ARG_ENABLE(v4l1, + AC_HELP_STRING([--enable-v4l1], + [Compile with video4linux instead of video4linux 2])) + AC_ARG_WITH(xml2, AC_HELP_STRING([--without-xml2], [Do not use the XML library for Gnome]), [], [with_xml2=yes]) @@ -230,6 +231,14 @@ else fi +if test "x$enable_v4l1" = "xyes" ; then + with_v4l2=no + with_v4l=yes +else + with_v4l2=yes + with_v4l=no +fi + dnl ******************************************************************** dnl Test for MMX support if an IA32 platform. If on a PPC then look for dnl Altivec support. For the IA32 platform see if gcc understands inline @@ -596,6 +605,26 @@ AC_MSG_CHECKING( for Xinerama support on XFree86 ) AC_MSG_RESULT($use_xinerama) +AC_MSG_RESULT( $with_v4l ) + +AC_MSG_RESULT( $with_v4l2 ) + +if test x$with_v4l2 != xno ; then + if test x$have_linux != xfalse ; then + + AC_CHECK_HEADER(linux/videodev2.h, + [have_v4l2=true + if test x$with_v4l2 != xno; then + AC_DEFINE(HAVE_V4L2, 1, + [Building for Linux - using the video4linux2 API]) + have_v4l=false + with_v4l=no + fi + ], + [AC_MSG_ERROR([videodev2.h not found - please install the linux kernel headers or try configure with --enable-v4l1])]) + fi +fi + if test x$with_v4l != xno ; then if test x$have_linux != xfalse ; then @@ -611,20 +640,6 @@ if test x$with_v4l != xno ; then fi -if test x$with_v4l2 != xno ; then - if test x$have_linux != xfalse ; then - - AC_CHECK_HEADER(linux/videodev2.h, - [have_v4l2=true - if test x$with_v4l2 != xno; then - AC_DEFINE(HAVE_V4L2, 1, - [Building for Linux - using the video4linux2 API]) - fi - ], - [AC_MSG_ERROR([videodev2.h not found - please install the linux kernel headers])]) - fi -fi - dnl ********************************************************************* dnl Check for the pthread lib @@ -1086,7 +1101,7 @@ AC_MSG_NOTICE([ - Jack Audio Connection Kit : ${have_jack}]) AC_MSG_NOTICE([ - Unicap Imaging : ${have_unicap} ]) AC_MSG_NOTICE([ - Liblo OSC client : ${have_liblo}]) AC_MSG_NOTICE([ - V4L2 (default) : ${have_v4l2}]) -AC_MSG_NOTICE([ - V4L1 (default) : ${have_v4l}]) +AC_MSG_NOTICE([ - V4L1 (obsolete) : ${have_v4l}]) #AC_MSG_NOTICE([ - libsamplerate : ${have_samplerate}]) cat NEWS diff --git a/veejay-current/veejay-server/libstream/v4l2utils.c b/veejay-current/veejay-server/libstream/v4l2utils.c index f15a9cdd..c643b524 100644 --- a/veejay-current/veejay-server/libstream/v4l2utils.c +++ b/veejay-current/veejay-server/libstream/v4l2utils.c @@ -657,9 +657,16 @@ void *v4l2open ( const char *file, const int input_channel, int host_fmt, int wi return NULL; } + veejay_msg(VEEJAY_MSG_INFO, "v4l2: Opening Video4Linux2 device: %s ...", file ); + int fd = open( file , O_RDWR ); int i; - veejay_msg(VEEJAY_MSG_INFO, "v4l2: Video4Linux2 device opened: %s", file ); + + if( fd <= 0 ) { + return NULL; + } else { + veejay_msg(VEEJAY_MSG_INFO, "v4l2: Video4Linux2 device opened: %s", file ); + } v4l2info *v = (v4l2info*) vj_calloc(sizeof(v4l2info)); diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index f073469f..ae95d917 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -3426,9 +3426,10 @@ int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer) if( tag->capture_type == 1 ) { #ifdef HAVE_V4L int res = v4lvideo_copy_framebuffer_to(vj_tag_input->unicap[tag->index],buffer[0],buffer[1],buffer[2]); +#else + int res = 0; #endif #ifdef HAVE_V4L2 - int res = 0; if( no_v4l2_threads_ ) { res = v4l2_pull_frame( vj_tag_input->unicap[tag->index],v4l2_get_dst(vj_tag_input->unicap[tag->index],buffer[0],buffer[1],buffer[2]) ); } else { diff --git a/veejay-current/veejay-server/libvjmem/vj-x86.c b/veejay-current/veejay-server/libvjmem/vj-x86.c index 69bad15e..08e4b369 100644 --- a/veejay-current/veejay-server/libvjmem/vj-x86.c +++ b/veejay-current/veejay-server/libvjmem/vj-x86.c @@ -125,13 +125,6 @@ void mymemset_generic(void *s, char c, size_t cc ) } #endif -unsigned int vj_get_timer() -{ - struct timeval tv; - gettimeofday(&tv, 0); - return ((tv.tv_sec & 1000000) + tv.tv_usec); -} - int cpu_cache_size() { return CACHE_LINE_SIZE; diff --git a/veejay-current/veejay-server/veejay/vj-misc.c b/veejay-current/veejay-server/veejay/vj-misc.c index 416fcd91..722cb328 100644 --- a/veejay-current/veejay-server/veejay/vj-misc.c +++ b/veejay-current/veejay-server/veejay/vj-misc.c @@ -45,7 +45,7 @@ #endif static unsigned int vj_relative_time = 0; static unsigned int vj_stamp_ = 0; -static unsigned int vj_get_timer() +long vj_get_timer() { struct timeval tv; gettimeofday(&tv, 0); @@ -63,9 +63,9 @@ void vj_stamp_clear() vj_stamp_ = 0; } -unsigned int vj_get_relative_time() +long vj_get_relative_time() { - unsigned int time, relative; + long time, relative; time = vj_get_timer(); relative = time - vj_relative_time; vj_relative_time = time; diff --git a/veejay-current/veejay-server/veejay/vj-misc.h b/veejay-current/veejay-server/veejay/vj-misc.h index 10d31c5e..57d4d1d4 100644 --- a/veejay-current/veejay-server/veejay/vj-misc.h +++ b/veejay-current/veejay-server/veejay/vj-misc.h @@ -40,8 +40,9 @@ int veejay_sprintf( char *s, size_t size, const char *format, ... ); #else #define veejay_snprintf snprintf #endif +long vj_get_timer(void); -unsigned int vj_get_relative_time(void); +long vj_get_relative_time(void); void vj_stamp_clear(); unsigned int vj_stamp();