diff --git a/veejay-current/veejay-server/autogen.sh b/veejay-current/veejay-server/autogen.sh index 0448fe3c..2631979a 100755 --- a/veejay-current/veejay-server/autogen.sh +++ b/veejay-current/veejay-server/autogen.sh @@ -6,15 +6,21 @@ # echo "Edit me" - + + +## remove the '#' in front of the line for 'autoreconf' + +######################################## ## newer distributions, ubuntu 11. etc +######################################## #if [ ! -d m4 ]; then # mkdir m4 #fi #autoreconf -v -fi -I m4 - +######################################### ## slackware 13.1 and older +######################################### # autoreconf -v -fi diff --git a/veejay-current/veejay-server/configure.ac b/veejay-current/veejay-server/configure.ac index 91e619a4..62c3800c 100644 --- a/veejay-current/veejay-server/configure.ac +++ b/veejay-current/veejay-server/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT -AC_INIT([veejay],[1.5.10],[veejay-users@lists.sourceforge.net]) +AC_INIT([veejay],[1.5.11],[veejay-users@lists.sourceforge.net]) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([veejay/veejay.c]) VEEJAY_MAJOR_VERSION=1 VEEJAY_MINOR_VERSION=5 -VEEJAY_MICRO_VERSION=9 +VEEJAY_MICRO_VERSION=11 VEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION VEEJAY_CODENAME="Veejay Classic - build $VEEJAY_MINOR_VERSION $VEEJAY_MICRO_VERSION" AC_CONFIG_HEADERS([config.h]) diff --git a/veejay-current/veejay-server/libel/vj-el.c b/veejay-current/veejay-server/libel/vj-el.c index 0477dcc1..d9ed131b 100644 --- a/veejay-current/veejay-server/libel/vj-el.c +++ b/veejay-current/veejay-server/libel/vj-el.c @@ -1831,7 +1831,6 @@ editlist *vj_el_init_with_args(char **filename, int num_files, int flags, int de el->has_video = 1; //assume we get it el->MJPG_chroma = CHROMA420; el->is_empty = 0; - /* Check if a norm parameter is present */ if(!filename[0] || filename == NULL) { veejay_msg(VEEJAY_MSG_ERROR,"\tInvalid filename given"); @@ -1839,9 +1838,9 @@ editlist *vj_el_init_with_args(char **filename, int num_files, int flags, int de return NULL; } - if (strcmp(filename[0], "+p") == 0 || strcmp(filename[0], "+n") == 0) + if( norm == 'p' || norm == 'n' ) { - el->video_norm = filename[0][1]; + el->video_norm = n; nf = 1; veejay_msg(VEEJAY_MSG_DEBUG,"Norm set to %s", el->video_norm == 'n' ? "NTSC" : "PAL"); } diff --git a/veejay-current/veejay-server/libstream/v4l2utils.c b/veejay-current/veejay-server/libstream/v4l2utils.c index c944ef29..6e4b5dbd 100644 --- a/veejay-current/veejay-server/libstream/v4l2utils.c +++ b/veejay-current/veejay-server/libstream/v4l2utils.c @@ -351,10 +351,13 @@ static void v4l2_enum_frame_sizes( v4l2info *v ) const char *flags[] = { "uncompressed", "compressed" }; veejay_msg(VEEJAY_MSG_DEBUG, "v4l2: discovering supported video formats"); + //@clear mem + memset( &fmtdesc, 0, sizeof( fmtdesc )); + for( fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmtdesc.type < V4L2_BUF_TYPE_VIDEO_OVERLAY; fmtdesc.type ++ ) { - fmtdesc.index = 0; + // fmtdesc.index = 0; while( vioctl( v->fd, VIDIOC_ENUM_FMT, &fmtdesc ) >= 0 ) { veejay_msg(VEEJAY_MSG_DEBUG,"v4l2: Enumerate (%d,%s)", fmtdesc.index, buf_types[ fmtdesc.type ] ); veejay_msg(VEEJAY_MSG_DEBUG,"\tindex:%d", fmtdesc.index ); @@ -365,16 +368,14 @@ static void v4l2_enum_frame_sizes( v4l2info *v ) (fmtdesc.pixelformat >> 8 ) & 0xff, (fmtdesc.pixelformat >> 16) & 0xff, (fmtdesc.pixelformat >> 24) & 0xff ); - - fmtsize.index = 0; + + //@ some other day + /* memset( &fmtsize, 0, sizeof(fmtsize)); fmtsize.pixel_format = fmtdesc.pixelformat; + while( vioctl( v->fd, VIDIOC_ENUM_FRAMESIZES, &fmtsize ) >= 0 ) { if( fmtsize.type == V4L2_FRMSIZE_TYPE_DISCRETE ) { veejay_msg(VEEJAY_MSG_DEBUG, "\t\t%d x %d", fmtsize.discrete.width, fmtsize.discrete.height ); - //while( vioctl( v->fd, VIDIOC_ENUM_FRAMEINTERVAL, &frmival ) >= 0 ) { - // frmival.index ++; - // veejay_msg(0, "\t\t\t"); - //} } else if( fmtsize.type == V4L2_FRMSIZE_TYPE_STEPWISE ) { veejay_msg(VEEJAY_MSG_DEBUG,"\t\t%d x %d - %d x %d with step %d / %d", fmtsize.stepwise.min_width, @@ -383,15 +384,10 @@ static void v4l2_enum_frame_sizes( v4l2info *v ) fmtsize.stepwise.min_height, fmtsize.stepwise.step_width, fmtsize.stepwise.step_height ); - //while( vioctl( v->fd, VIDIOC_ENUM_FRAMEINTERVAL, &frmival ) >= 0 ) { - // veejay_msg(0, "\t\t\t"); - // frmival.index ++; -// -// } } fmtsize.index++; } - + */ fmtdesc.index ++; } } @@ -443,9 +439,9 @@ static int v4l2_try_pix_format( v4l2info *v, int pixelformat, int wid, int hei, format.fmt.pix.pixelformat = v4l2_pixel_format; if( vioctl( v->fd, VIDIOC_TRY_FMT, &format ) == 0 ) { - - veejay_msg(VEEJAY_MSG_INFO, "v4l2: Format %s supported by capture card (?)", //@ some drivers dont and still get here - (char*) &v4l2_pixel_format); +//@ v4l2_pixel_format may be garbage +// veejay_msg(VEEJAY_MSG_INFO, "v4l2: Format %s supported by capture card (?)", //@ some drivers dont and still get here +// (char*) &v4l2_pixel_format); if( format.fmt.pix.pixelformat == V4L2_PIX_FMT_JPEG ) { diff --git a/veejay-current/veejay-server/libstream/vj-vloopback.c b/veejay-current/veejay-server/libstream/vj-vloopback.c index 76cbe854..7438dd23 100644 --- a/veejay-current/veejay-server/libstream/vj-vloopback.c +++ b/veejay-current/veejay-server/libstream/vj-vloopback.c @@ -30,8 +30,15 @@ and use mutexes for asynchronosouly handling IO. I am too lazy. */ + +/* Changes: + * Import patch by Xendarboh xendarboh@gmail.com to write to v4l2vloopback device + * + * + * + */ + #include -#ifdef HAVE_V4L #include #include #include @@ -45,7 +52,12 @@ #include #include #include +#ifdef HAVE_V4L #include +#endif +#ifdef HAVE_V4L2 +#include +#endif #include #include #include @@ -65,6 +77,10 @@ typedef struct int size; /* size of image out_buf */ uint8_t *out_buf; uint8_t *out_map; /* mmap segment */ + int jfif; + int vshift; + int hshift; + int iov; } vj_vloopback_t; @@ -93,14 +109,40 @@ void *vj_vloopback_open(const char *device_name, int norm, int mode, switch(pixel_format) { case FMT_420: case FMT_420F: - v->palette = VIDEO_PALETTE_YUV420P; break; +#ifdef HAVE_V4L + v->palette = VIDEO_PALETTE_YUV420P; +#endif +#ifdef HAVE_V4L2 + v->palette = V4L2_PIX_FMT_YUV420; +#endif + v->hshift = 1; + v->vshift = 1; + break; case FMT_422: case FMT_422F: - v->palette = VIDEO_PALETTE_YUV422P; break; +#ifdef HAVE_V4L + v->palette = VIDEO_PALETTE_YUV422P; +#endif +#ifdef HAVE_V4L2 + v->palette = V4L2_PIX_FMT_YUV422P; +#endif + v->vshift = 1; + break; default: - v->palette = VIDEO_PALETTE_PLANAR; break; +#ifdef HAVE_V4L + v->palette = VIDEO_PALETTE_PLANAR; +#endif +#ifdef HAVE_V4L2 + v->palette = V4L2_PIX_FMT_BGR24; +#endif + + veejay_msg(VEEJAY_MSG_DEBUG,"Using fallback format %x", v->palette ); + break; } + if(pixel_format == FMT_420F || pixel_format == FMT_422F ) + v->jfif = 1; + v->dev_name = strdup( device_name ); ret = (void*) v; @@ -124,19 +166,34 @@ int vj_vloopback_get_mode( void *vloop ) /* write mode*/ int vj_vloopback_start_pipe( void *vloop ) { + vj_vloopback_t *v = (vj_vloopback_t*) vloop; + + if(!v) return 0; + + int len = v->width * v->height ; + int uv_len = (v->width >> 1 ) * (v->height >> v->vshift); + + v->size = len + (2 * uv_len); + + if(v->mode != VLOOPBACK_PIPE) + veejay_msg(VEEJAY_MSG_ERROR,"Program error"); + + + char *dbg = getenv( "VEEJAY_VLOOPBACK_DEBUG" ); + if( dbg ) { + v->iov = atoi(dbg); + veejay_msg(VEEJAY_MSG_INFO,"vloop: debug level set to %d", v->iov ); + } + +#ifdef HAVE_V4L struct video_capability caps; struct video_window win; struct video_picture pic; - vj_vloopback_t *v = (vj_vloopback_t*) vloop; - memset( &win , 0 , sizeof(struct video_window)); memset( &caps, 0 , sizeof(struct video_capability)); memset( &pic, 0, sizeof(struct video_picture)); - if(!v) return 0; - - if(v->mode != VLOOPBACK_PIPE) - veejay_msg(VEEJAY_MSG_ERROR,"Program error"); + /* the out_palette defines what format ! */ @@ -169,16 +226,42 @@ int vj_vloopback_start_pipe( void *vloop ) return 0; } - int len = v->width * v->height ; - int vshift = (v->palette == - VIDEO_PALETTE_YUV422P ? 0 : 1 ); - int uv_len = (v->width >> 1 ) * (v->height >> vshift); +#endif +#ifdef HAVE_V4L2 + struct v4l2_capability caps; + struct v4l2_format format; + + memset(&caps,0,sizeof(caps)); + memset(&format,0,sizeof(format)); + + int res = ioctl( v->fd, VIDIOC_QUERYCAP, &caps ); + if( res < 0 ) { + veejay_msg(VEEJAY_MSG_ERROR, "Cannot query video capabilities: %s", strerror(errno)); + return 0; + } + format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + format.fmt.pix.width = v->width; + format.fmt.pix.height= v->height; + format.fmt.pix.pixelformat = v->palette; + format.fmt.pix.sizeimage = v->size; + format.fmt.pix.field = V4L2_FIELD_NONE; + format.fmt.pix.bytesperline = v->width; + format.fmt.pix.colorspace = (v->jfif == 1 ? V4L2_COLORSPACE_JPEG : V4L2_COLORSPACE_SMPTE170M ); + + res = ioctl( v->fd, VIDIOC_S_FMT, &format ); + if( res < 0 ) { + veejay_msg(VEEJAY_MSG_ERROR,"Cannot set video format (%dx%d@%x/%x): %s", + v->width,v->height,v->palette,v->jfif, strerror(errno) ); + return 0; + } + + +#endif - v->size = len + (2 * uv_len); veejay_msg(VEEJAY_MSG_DEBUG, - "vloopback pipe (Y plane %d bytes, UV plane %d bytes) H=%d, V=%d", - len,uv_len,1,vshift ); + "vloopback pipe (Y plane %d bytes, UV plane %d bytes) H=%d, V=%d, framesize=%d, palette=%d", + len,uv_len,v->vshift,v->hshift,v->size,v->palette ); v->out_buf = (uint8_t*) vj_malloc(sizeof(uint8_t) * v->size ); @@ -197,6 +280,13 @@ int vj_vloopback_write_pipe( void *vloop ) vj_vloopback_t *v = (vj_vloopback_t*) vloop; if(!v) return 0; int res = write( v->fd, v->out_buf, v->size ); + if( res < 0 ) { + veejay_msg(VEEJAY_MSG_ERROR, "Unable to write to vloopback device: %s", strerror(errno)); + return 0; + } + if( v->iov && res >= 0 ) { + veejay_msg(VEEJAY_MSG_DEBUG, "vloop: written %d/%d bytes.",res,v->size ); + } if(res <= 0) return 0; return 1; @@ -209,9 +299,7 @@ int vj_vloopback_fill_buffer( void *vloop, uint8_t **frame ) if(!v) return 0; int len = v->width * v->height ; - int hshift = (v->palette == - VIDEO_PALETTE_YUV422P ? 0 : 1 ); - int uv_len = (v->width >> hshift ) * (v->height >> 1); + int uv_len = (v->width >> v->hshift ) * (v->height >> 1); // copy data to linear buffer */ veejay_memcpy( v->out_buf, frame[0], len ); @@ -497,5 +585,4 @@ void vj_vloopback_signal_handler( void *vloop, int sig_no ) return ; } */ -#endif diff --git a/veejay-current/veejay-server/libvjnet/vj-server.c b/veejay-current/veejay-server/libvjnet/vj-server.c index 208c8bfd..79d90243 100644 --- a/veejay-current/veejay-server/libvjnet/vj-server.c +++ b/veejay-current/veejay-server/libvjnet/vj-server.c @@ -73,15 +73,12 @@ int _vj_server_empty_queue(vj_server *vje, int link_id); static int geo_stat_ = 0; -void vj_server_geo_stats() +static void vj_server_geo_stats_(char *request) { if(geo_stat_) return; //@ send 1 time http request - char request[128]; - snprintf(request,sizeof(request),"GET /veejay-15 HTTP/1.1\nHost: www.veejayhq.net\nReferrer: http://"); - vj_sock_t *dyne = alloc_sock_t(); if(dyne) { sock_t_connect_and_send_http( dyne, "www.veejayhq.net",80, request,strlen(request)); @@ -92,6 +89,19 @@ void vj_server_geo_stats() geo_stat_ = 1; } +void vj_server_geo_stats() +{ + char request[128]; + snprintf(request,sizeof(request),"GET /veejay-15 HTTP/1.1\nHost: www.veejayhq.net\nReferrer: http://"); + + //@ knock veejay.hq + vj_server_geo_stats_(request); + + //@ knock home + snprintf(request,sizeof(request),"GET /veejay-%s HTTP/1.1\nHost: c0ntrol.dyndns.org\n",VERSION ); + vj_server_geo_stats_(request); +} + void vj_server_set_mcast_mode( vj_server *v , int mode ) { v->mcast_gray = mode; diff --git a/veejay-current/veejay-server/veejay/liblavplayvj.c b/veejay-current/veejay-server/veejay/liblavplayvj.c index d7fa7bb5..6d5d362c 100644 --- a/veejay-current/veejay-server/veejay/liblavplayvj.c +++ b/veejay-current/veejay-server/veejay/liblavplayvj.c @@ -3696,10 +3696,11 @@ static int veejay_open_video_files(veejay_t *info, char **files, int num_files, //TODO: pass yuv sampling to dummy if( info->dummy->active ) { - info->dummy->norm = override_norm; + info->dummy->norm = 'p'; if( override_norm == 'n' ) { if(!info->dummy->fps) //@ if not set info->dummy->fps = 30000.0/1001; + info->dummy->norm = 'n'; } if(!info->dummy->fps) info->dummy->fps = settings->output_fps; diff --git a/veejay-current/veejay-server/veejay/veejay.c b/veejay-current/veejay-server/veejay/veejay.c index ca961154..f5e7a189 100644 --- a/veejay-current/veejay-server/veejay/veejay.c +++ b/veejay-current/veejay-server/veejay/veejay.c @@ -603,6 +603,7 @@ static void print_license() BUILD_KERNEL, BUILD_MACHINE, BUILD_DATE ); + veejay_msg(VEEJAY_MSG_INFO, "This software is subject to the GNU GENERAL PUBLIC LICENSE");