From ba1ec7726af6de481977176c6caf7ac77aa2d6cd Mon Sep 17 00:00:00 2001 From: niels Date: Mon, 28 Mar 2011 21:41:45 +0200 Subject: [PATCH] fix compilation of v4l2. re-run autogen.sh --- veejay-current/veejay-server/configure.ac | 4 +- .../veejay-server/libstream/v4l2utils.c | 2 +- .../veejay-server/libstream/v4lutils.c | 9 +- .../veejay-server/libstream/v4lutils.h | 4 - .../veejay-server/libstream/v4lvideo.c | 3 +- .../veejay-server/libstream/vj-tag.c | 103 +++++++++++------- .../veejay-server/libstream/vj-vloopback.c | 2 +- veejay-current/veejay-server/veejay/veejay.c | 2 +- .../veejay-server/veejay/vj-event.c | 10 +- veejay-current/veejay-server/veejay/vj-lib.h | 1 - 10 files changed, 82 insertions(+), 58 deletions(-) diff --git a/veejay-current/veejay-server/configure.ac b/veejay-current/veejay-server/configure.ac index a7686531..45781f21 100644 --- a/veejay-current/veejay-server/configure.ac +++ b/veejay-current/veejay-server/configure.ac @@ -619,7 +619,7 @@ if test x$with_v4l2 != xno ; then AC_CHECK_HEADER(linux/videodev2.h, [have_v4l2=true if test x$with_v4l2 != xno; then - AC_DEFINE(USE_V4L2, 1, + AC_DEFINE(HAVE_V4L2, 1, [Building for Linux - using the video4linux2 API]) fi ], @@ -923,7 +923,7 @@ AM_CONDITIONAL(HAVE_SAMPLERATE,test x$have_samplerate = xtrue) AM_CONDITIONAL(HAVE_DIRECTFB, test x$have_directfb = xtrue) AM_CONDITIONAL(HAVE_FREETYPE, test x$have_freetype = xtrue) AM_CONDITIONAL(HAVE_V4L, test x$have_v4l = xtrue) -AM_CONDITIONAL(USE_V4L2, test x$have_V4l2 = xtrue) +AM_CONDITIONAL(HAVE_V4L2, test x$have_V4l2 = xtrue) AM_CONDITIONAL(SUPPORT_READ_DV2, test x$have_libdv = xtrue) AM_CONDITIONAL(HAVE_DL_DLOPEN, test x$have_dl_dlopen = xtrue) AM_CONDITIONAL(HAVE_JPEG,test x$have_jpeg = xtrue) diff --git a/veejay-current/veejay-server/libstream/v4l2utils.c b/veejay-current/veejay-server/libstream/v4l2utils.c index 5a58ebaa..c6ffba78 100644 --- a/veejay-current/veejay-server/libstream/v4l2utils.c +++ b/veejay-current/veejay-server/libstream/v4l2utils.c @@ -39,7 +39,7 @@ */ #include -#ifdef USE_V4L2 +#ifdef HAVE_V4L2 #include #ifdef STRICT_CHECKING #include diff --git a/veejay-current/veejay-server/libstream/v4lutils.c b/veejay-current/veejay-server/libstream/v4lutils.c index 6882557c..9c60063f 100644 --- a/veejay-current/veejay-server/libstream/v4lutils.c +++ b/veejay-current/veejay-server/libstream/v4lutils.c @@ -22,18 +22,20 @@ */ #include +#ifdef HAVE_V4L #include #ifdef STRICT_CHECKING #include #endif -#include -#include -#include #include #include #include #include #include +#include +#include +#include +# #include #include #define DEFAULT_DEVICE "/dev/video" @@ -588,3 +590,4 @@ void v4ldebug(int flag) veejay_msg(0, "debug: %d",flag); v4l_debug = flag; } +#endif diff --git a/veejay-current/veejay-server/libstream/v4lutils.h b/veejay-current/veejay-server/libstream/v4lutils.h index a9518c07..004d0b77 100644 --- a/veejay-current/veejay-server/libstream/v4lutils.h +++ b/veejay-current/veejay-server/libstream/v4lutils.h @@ -23,11 +23,7 @@ #ifndef __V4LUTILS_H__ #define __V4LUTILS_H__ - -#include #include -#include - /* * Error message displaying level */ diff --git a/veejay-current/veejay-server/libstream/v4lvideo.c b/veejay-current/veejay-server/libstream/v4lvideo.c index 67662aaa..d5cc743f 100644 --- a/veejay-current/veejay-server/libstream/v4lvideo.c +++ b/veejay-current/veejay-server/libstream/v4lvideo.c @@ -21,6 +21,7 @@ #include +#ifdef HAVE_V4L #include #include #include @@ -1194,4 +1195,4 @@ int v4lvideo_get_composite_status( void *vv) v4lvideo_template_t *v = (v4lvideo_template_t*) vv; return v->composite; } - +#endif diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index b2eebc70..15b22a47 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #ifdef STRICT_CHECKING @@ -47,9 +46,11 @@ #include #include #include -#ifndef USE_V4L2 +#ifdef HAVE_V4L +#include #include -#else +#endif +#ifdef HAVE_V4L2 #include #endif #ifdef HAVE_UNICAP @@ -220,11 +221,12 @@ int vj_tag_num_devices() { #ifdef HAVE_UNICAP return vj_unicap_num_capture_devices( unicap_data_ ); -#ifndef USE_V4L2 - return v4lvideo_templ_num_devices(); -#else - return v4l2_num_devices(); #endif +#ifdef HAVE_V4L + return v4lvideo_templ_num_devices(); +#endif +#ifdef HAVE_V4L2 + return v4l2_num_devices(); #endif } @@ -237,12 +239,12 @@ char *vj_tag_scan_devices( void ) #ifdef HAVE_UNICAP char **device_list = vj_unicap_get_devices(unicap_data_, &num); #else -#ifndef USE_V4L2 +#ifdef HAVE_V4L char **device_list = v4lvideo_templ_get_devices(&num); -#else +#endif +#ifdef HAVE_V4L2 char **device_list = v4l2_get_device_list(); #endif - #endif if(!device_list) return strdup(default_str); @@ -316,7 +318,7 @@ int vj_tag_init(int width, int height, int pix_fmt, int video_driver) for(i=0; i < SAMPLE_MAX_SAMPLES; i++) { avail_tag[i] = 0; } -#ifndef USE_V4L2 +#ifdef HAVE_V4L v4lvideo_templ_init(); #endif return 0; @@ -396,7 +398,7 @@ int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height, int { return 0; } -#ifdef USE_V4L2 +#ifdef HAVE_V4L2 snprintf(refname,sizeof(refname), "/dev/v4l/video%d",device_num ); #else snprintf(refname,sizeof(refname), "/dev/video%d",device_num ); // freq->device_num @@ -415,7 +417,7 @@ int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height, int veejay_msg(VEEJAY_MSG_INFO, "Open capture device with %s", ( driver == 1 ? "v4l[x]" : "Unicap" ) ); if( tag->capture_type == 1 ) { -#ifndef USE_V4L2 +#ifdef HAVE_V4L vj_tag_input->unicap[stream_nr] = v4lvideo_init( refname, channel, v4lvideo_templ_get_norm( selected_video_norm ), freq, @@ -428,7 +430,8 @@ int _vj_tag_new_unicap( vj_tag * tag, int stream_nr, int width, int height, int sprintf(refname, "%d",channel ); tag->extra = strdup(refname); veejay_msg(VEEJAY_MSG_DEBUG, "Using V4lutils from EffecTV"); -#else +#endif +#ifdef HAVE_V4L2 vj_tag_input->unicap[stream_nr] = v4l2open( refname, channel, palette,width,height, _tag_info->edit_list->video_fps,_tag_info->edit_list->video_norm ); if( !vj_tag_input->unicap[stream_nr] ) { @@ -838,9 +841,10 @@ int vj_tag_composite(int t1) return vj_unicap_composite_status( vj_tag_input->unicap[ tag->index ] ); #endif if(tag->capture_type==1) -#ifndef USE_V4L2 +#ifdef HAVE_V4L return v4lvideo_get_composite_status( vj_tag_input->unicap[tag->index]); -#else +#endif +#ifdef HAVE_V4L2 return v4l2_get_composite_status( vj_tag_input->unicap[tag->index] ); #endif return 0; @@ -954,9 +958,10 @@ int vj_tag_new(int type, char *filename, int stream_nr, editlist * el, if(type == VJ_TAG_TYPE_MCAST || type == VJ_TAG_TYPE_NET) tag->priv = net_threader(); -#ifndef USE_V4L2 +#ifdef HAVE_V4L palette = v4lvideo_templ_get_palette( pix_fmt ); -#else +#endif +#ifdef HAVE_V4L2 palette = get_ffmpeg_pixfmt( pix_fmt ); #endif switch (type) { @@ -1153,7 +1158,7 @@ int vj_tag_del(int id) #endif if(tag->capture_type==1) -#ifdef USE_V4L2 +#ifdef HAVE_V4L2 v4l2_close( vj_tag_input->unicap[tag->index]); #else v4lvideo_destroy( vj_tag_input->unicap[tag->index] ); @@ -1739,7 +1744,7 @@ int vj_tag_set_brightness(int t1, int value) else { if(tag->capture_type==1) -#ifdef USE_V4L2 +#ifdef HAVE_V4L2 v4l2_set_brightness( vj_tag_input->unicap[tag->index],value); #else v4lvideo_set_brightness( vj_tag_input->unicap[tag->index], value ); @@ -1763,9 +1768,10 @@ int vj_tag_set_white(int t1, int value) else { if(tag->capture_type==1) -#ifndef USE_V4L2 +#ifdef HAVE_V4L v4lvideo_set_white( vj_tag_input->unicap[tag->index],value ); -#else +#endif +#ifdef HAVE_V4L2 v4l2_set_temperature( vj_tag_input->unicap[tag->index],value); #endif #ifdef HAVE_UNICAP @@ -1785,19 +1791,18 @@ int vj_tag_set_hue(int t1, int value) veejay_msg(VEEJAY_MSG_ERROR,"Hue valid range is 0 - 65535"); return -1; } - else - { - if(tag->capture_type==1) -#ifndef USE_V4L2 - v4lvideo_set_hue( vj_tag_input->unicap[tag->index], value ); -#else - v4l2_set_hue( vj_tag_input->unicap[tag->index],value ); -#endif #ifdef HAVE_UNICAP - else - vj_unicap_select_value( vj_tag_input->unicap[tag->index],UNICAP_HUE, (double)value ); + if(tag->capture_type==0) { + vj_unicap_select_value( vj_tag_input->unicap[tag->index],UNICAP_HUE,(double)value); + } +#endif + if( tag->capture_type==1) +#ifdef HAVE_V4L + { v4lvideo_set_hue( vj_tag_input->unicap[tag->index], value ); } +#endif +#ifdef HAVE_V4l2 + { v4l2_set_hue( vj_tag_input->unicap[tag->index],value ); } #endif - } return 1; } int vj_tag_set_contrast(int t1,int value) @@ -1812,9 +1817,10 @@ int vj_tag_set_contrast(int t1,int value) else { if(tag->capture_type==1) -#ifndef USE_V4L2 +#ifdef HAVE_V4L v4lvideo_set_contrast( vj_tag_input->unicap[tag->index], value ); -#else +#endif +#ifdef HAVE_V4L2 v4l2_set_contrast( vj_tag_input->unicap[tag->index], value ); #endif #ifdef HAVE_UNICAP @@ -1837,9 +1843,10 @@ int vj_tag_set_color(int t1, int value) else { if(tag->capture_type==1) -#ifndef USE_V4L2 +#ifdef HAVE_V4L v4lvideo_set_colour( vj_tag_input->unicap[tag->index], value ); -#else +#endif +#ifdef HAVE_V4L2 v4l2_set_contrast( vj_tag_input->unicap[tag->index],value); #endif #ifdef HAVE_UNICAP @@ -1862,11 +1869,22 @@ int vj_tag_get_v4l_properties(int t1, } if(tag->capture_type == 1 ) { +#ifdef HAVE_V4L *brightness = v4lvideo_get_brightness( vj_tag_input->unicap[tag->index] ); *contrast = v4lvideo_get_contrast( vj_tag_input->unicap[tag->index] ); *hue = v4lvideo_get_hue( vj_tag_input->unicap[tag->index] ); *color = v4lvideo_get_colour( vj_tag_input->unicap[tag->index] ); *white = v4lvideo_get_white( vj_tag_input->unicap[tag->index] ); +#endif +#ifdef HAVE_V4L2 + *brightness = v4l2_get_brightness( vj_tag_input->unicap[tag->index] ); + *contrast = v4l2_get_contrast( vj_tag_input->unicap[tag->index] ); + *hue = v4l2_get_hue( vj_tag_input->unicap[tag->index] ); + *color = v4l2_get_saturation( vj_tag_input->unicap[tag->index] ); + *white = v4l2_get_temperature( vj_tag_input->unicap[tag->index] ); + +#endif + return 0; } #ifdef HAVE_UNICAP @@ -2312,7 +2330,7 @@ int vj_tag_disable(int t1) { } if(tag->source_type == VJ_TAG_TYPE_V4L ) { -#ifndef USE_V4L2 +#ifdef HAVE_V4L if( tag->capture_type == 1 ) { if(v4lvideo_is_active(vj_tag_input->unicap[tag->index] ) ) v4lvideo_set_paused( vj_tag_input->unicap[tag->index] , 1 ); @@ -2350,7 +2368,7 @@ int vj_tag_enable(int t1) { if( tag->source_type == VJ_TAG_TYPE_V4L ) { if(tag->capture_type == 1 ) { -#ifndef USE_V4L2 +#ifdef HAVE_V4L if(!v4lvideo_is_active( vj_tag_input->unicap[tag->index] ) ) { if(v4lvideo_grabstart( vj_tag_input->unicap[tag->index] ) == 0 ) { @@ -2433,7 +2451,7 @@ int vj_tag_set_active(int t1, int active) case VJ_TAG_TYPE_V4L: if(tag->capture_type == 1 ) { -#ifndef USE_V4L2 +#ifdef HAVE_V4L if(active) { if( !v4lvideo_is_active( vj_tag_input->unicap[tag->index] ) ) { if(v4lvideo_grabstart( vj_tag_input->unicap[tag->index] ) < 0 ) { @@ -3365,9 +3383,10 @@ int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer) { case VJ_TAG_TYPE_V4L: if( tag->capture_type == 1 ) { -#ifndef USE_V4L2 +#ifdef HAVE_V4L int res = v4lvideo_copy_framebuffer_to(vj_tag_input->unicap[tag->index],buffer[0],buffer[1],buffer[2]); -#else +#endif +#ifdef HAVE_V4L2 int 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]) ); #endif if( res <= 0 ) { diff --git a/veejay-current/veejay-server/libstream/vj-vloopback.c b/veejay-current/veejay-server/libstream/vj-vloopback.c index e9af8a8a..a3214365 100644 --- a/veejay-current/veejay-server/libstream/vj-vloopback.c +++ b/veejay-current/veejay-server/libstream/vj-vloopback.c @@ -31,7 +31,7 @@ */ #include -#if defined (HAVE_V4L) || defined (USE_V4L2) +#ifdef HAVE_V4L #include #include #include diff --git a/veejay-current/veejay-server/veejay/veejay.c b/veejay-current/veejay-server/veejay/veejay.c index 6a2ca2c5..ca961154 100644 --- a/veejay-current/veejay-server/veejay/veejay.c +++ b/veejay-current/veejay-server/veejay/veejay.c @@ -135,7 +135,7 @@ static void CompiledWith() #ifdef HAVE_V4L veejay_msg(VEEJAY_MSG_INFO,"\tUsing Video4Linux"); #endif -#ifdef USE_V4L2 +#ifdef HAVE_V4L2 veejay_msg(VEEJAY_MSG_INFO, "\tUsing Video4Linux II"); #endif /* diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index fb31c01b..da5f9af9 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -9406,9 +9406,9 @@ void vj_event_quick_bundle( void *ptr, const char format[], va_list ap) vj_event_commit_bundle( (veejay_t*) ptr,0,0); } - void vj_event_vloopback_start(void *ptr, const char format[], va_list ap) { +#ifdef HAVE_V4L int args[2]; char *s = NULL; char device_name[100]; @@ -9462,14 +9462,20 @@ void vj_event_vloopback_start(void *ptr, const char format[], va_list ap) if( v->vloopback == NULL ) veejay_msg(VEEJAY_MSG_ERROR, "Failed to setup vloopback pusher"); +#else + veejay_msg(VEEJAY_MSG_ERROR, "not implemented yet!"); +#endif } void vj_event_vloopback_stop( void *ptr, const char format[], va_list ap ) { +#ifdef HAVE_V4L veejay_t *v = (veejay_t*) ptr; vj_vloopback_close( v->vloopback ); +#else + veejay_msg(VEEJAY_MSG_ERROR, "not implemented yet!"); +#endif } - /* * Function that returns the options for a special sample (markers, looptype, speed ...) or * for a special stream ... diff --git a/veejay-current/veejay-server/veejay/vj-lib.h b/veejay-current/veejay-server/veejay/vj-lib.h index 1f118a20..17ee82a1 100644 --- a/veejay-current/veejay-server/veejay/vj-lib.h +++ b/veejay-current/veejay-server/veejay/vj-lib.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include