Date: Fri, 9 Feb 2007 07:33:53 -0800 From: Luigi Rizzo <rizzo@icir.org> To: mi@aldan.algebra.com, multimedia@freebsd.org Subject: vic patches for video4linux support Message-ID: <20070209073353.A99372@xorpc.icir.org>
next in thread | raw e-mail | index | archive | help
--UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline attached are some small patches to let mbone/vic detect and make use of video4linux devices including the webcam drivers recently made available as multimedia/linux-gspca-kmod and multimedia/linux-ov511-kmod If there are no objections i will commit them, and also a BUILD_DEPENDS+= v4l_compat>=1.0.20060801:${PORTSDIR}/multimedia/v4l_compat line in the main Makefile to set a proper build environment. In detail, the patches do the following: + fix configure to look for videodev.h in the place where it is on FreeBSD, and disable v4l2 support for the time being as there is none as far as i know; + add -I/usr/local/include in the search path, for the above file; + patch the v4l detection module so that it doesn't exit if the driver does not support mmap, and instead fall back to read() cheers luigi --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-Makefile.in" --- Makefile.in.orig Wed Apr 30 13:50:17 2003 +++ Makefile.in Fri Feb 9 16:08:03 2007 @@ -58,7 +58,7 @@ INCLUDE_TK = @V_INCLUDE_TK@ INCLUDE_TCL = @V_INCLUDE_TCL@ INCLUDE_X11 = @V_INCLUDE_X11@ -INCLUDE_MISC = @V_INCLUDE@ -I. -Icodec/tmndec -Icodec/tmn-x -Icodec/h263 -Irtp -Irender -Inet -Ivideo -Icodec -I../common/src +INCLUDE_MISC = @V_INCLUDE@ -I. -Icodec/tmndec -Icodec/tmn-x -Icodec/h263 -Irtp -Irender -Inet -Ivideo -Icodec -I${LOCALBASE}/include/uclmmbase -I${LOCALBASE}/include STATIC = @V_STATIC@ MKDEP = ./mkdep @@ -89,12 +89,12 @@ OBJ_XIL = @V_OBJ_XIL@ OBJ_CRYPT = @V_OBJ_CRYPT@ LIB = $(LIB_GRABBER) @V_LIB_TK@ @V_LIB_TCL@ @V_LIB_X11@ @V_LIB@ \ - codec/tmndec/libh263.a codec/tmn-x/libh263coder.a ../common/src/libuclmmbase.a -lm + codec/tmndec/libh263.a codec/tmn-x/libh263coder.a -L${LOCALBASE}/lib -luclmmbase -lm INCLUDE = $(INCLUDE_MISC) $(INCLUDE_GRABBER) $(INCLUDE_TK) $(INCLUDE_TCL) \ $(INCLUDE_X11) $(MD_INC) -Icodec/jpeg -Icodec/p64 -I. DEFINE = @V_DEFINE@ -DED_YBITS=$(ED_YBITS) -DSIGRET=@V_SIGRET@ -DNLAYER=8 BFLAGS = $(DEFINE) $(INCLUDE) -CFLAGS = $(CCOPT) $(BFLAGS) +CFLAGS += $(BFLAGS) # # Remember to add a dependency if you add any tcl sources here. @@ -122,7 +122,7 @@ codec/h263/idctenc.o codec/h263/sac.o # .c objects -OBJ1 = net/inet.o net/inet6.o codec/cellb_tables.o tkStripchart.o md5c.o random.o \ +OBJ1 = net/inet.o net/inet6.o codec/cellb_tables.o tkStripchart.o \ $(H263_OBJS) # session-rtpv1.o session-nv.o session-ivs.o # Not supported anymore # .cpp objects @@ -329,15 +329,9 @@ $(CC) -o $@ $(CFLAGS) render/ppmtolut/ppmtolut.c -lm $(STATIC) install: force - cp vic @prefix@/bin/vic - chown bin @prefix@/bin/vic - chgrp bin @prefix@/bin/vic - chmod 555 @prefix@/bin/vic - cp vic.1 @prefix@/man/vic.1 - cp histtolut @prefix@/bin/histtolut - chown bin @prefix@/bin/histtolut - chgrp bin @prefix@/bin/histtolut - chmod 555 @prefix@/bin/histtolut + ${BSD_INSTALL_PROGRAM} vic @prefix@/bin/vic + ${BSD_INSTALL_MAN} vic.1 @prefix@/man/man1/vic.1 + ${BSD_INSTALL_PROGRAM} histtolut @prefix@/bin/histtolut clean: rm -f *.o codec/jpeg/*.o codec/p64/*.o codec/h263/*.o \ @@ -410,7 +404,7 @@ codec/tmn-x/libh263coder.a: - (cd codec/tmn-x; $(MAKE) CC=$(CC) CCOPT="$(CCOPT)" ) + (cd codec/tmn-x; $(MAKE) CC=$(CC) CCOPT="$(CFLAGS)" ) codec/tmndec/libh263.a: - (cd codec/tmndec; $(MAKE) CC=$(CC) CCOPT="$(CCOPT)" -f Makefile.lib) + (cd codec/tmndec; $(MAKE) CC=$(CC) CCOPT="$(CFLAGS)" -f Makefile.lib) --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-configure.in" --- configure.in.orig Thu Jul 10 16:55:43 2003 +++ configure.in Fri Feb 9 12:40:20 2007 @@ -69,19 +69,13 @@ if test -r /usr/include/machine/ioctl_meteor.h ; then V_OBJ_GRABBER="video/grabber-meteor.o $V_OBJ_GRABBER" fi -if test -r /usr/include/linux/videodev.h ; then - if grep V4L2 /usr/include/linux/videodev.h >/dev/null 2>&1 ; then +if test -r /usr/local/include/linux/videodev.h ; then + if grep V4L2 /usr/include/linux/videodev.h >/dev/null 2>&1 ; then V_OBJ_GRABBER="$V_OBJ_GRABBER video/grabber-v4l2.o" else V_OBJ_GRABBER="$V_OBJ_GRABBER video/grabber-video4linux.o" fi fi -#if test -r /usr/local/lib/libspigot.a -a ${PORTOBJFORMAT} != elf; then -if test -r /usr/local/lib/libspigot.a ; then - V_OBJ_GRABBER="video/grabber-spigot.o $V_OBJ_GRABBER" - V_LIB_GRABBER="$V_LIB_GRABBER -lspigot" - V_INCLUDE_GRABBER="$V_INCLUDE_GRABBER -I/usr/local/include" -fi if test "$qcamdir" != "" ; then V_OBJ_GRABBER="video/grabber-qcam.o $V_OBJ_GRABBER" V_INCLUDE_GRABBER="$V_INCLUDE_GRABBER -I$qcamdir" @@ -254,6 +248,7 @@ else V_DEFINE="$V_DEFINE -DFreeBSD" fi + V_DEFINE="$V_DEFINE -DSIGARGS=int" OPSYS=freebsd ;; *-*-hpux*) --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch-video-grabber-video4linux.cpp" diff -ubwr video/grabber-video4linux.cpp ../../test/vic-2.8ucl1.1.6/video/grabber-video4linux.cpp --- video/grabber-video4linux.cpp Fri Sep 12 19:36:19 2003 +++ ../../test/vic-2.8ucl1.1.6/video/grabber-video4linux.cpp Fri Feb 9 16:15:12 2007 @@ -36,7 +36,7 @@ extern "C" { -#include <asm/types.h> +//#include <asm/types.h> #include <linux/videodev.h> } @@ -312,9 +314,20 @@ } if( !( have_422P || have_422 || have_420P)) { - debug_msg("No suituable palette found\n"); + debug_msg("No suituable palette found, try normal\n"); + /* this needs to cleaned up heavily */ + have_420P = 1; /* assume no mmap and try 420 is default */ + struct video_picture vp; + if(ioctl(fd_,VIDIOCGPICT,&vp) == -1) { + debug_msg("Failed to get current picture info"); exit(1); } + vp.palette = VIDEO_PALETTE_YUV420P; + if(ioctl(fd_,VIDIOCSPICT,&vp) == -1) { + debug_msg("Failed to set current picture info"); + exit(1); + } + } /* Release device */ close(fd_); @@ -551,10 +564,15 @@ Grabber::stop(); } +/* + * quick hack - support only a single device of this kind, + * with a static max-sized buffer for reads. + */ +static char buf1[1024*768*3/2]; + int V4lGrabber::grab() { char *fr=NULL; - debug_msg((sync_count % 2) ? "o" : "e"); if (have_mmap) { @@ -566,6 +584,8 @@ else sync_count++; } else { + read(fd_, buf1, (size_t)height_*width_*3/2); + fr = buf1; /* FIXME: read() */ } --UlVJffcvxoiEqYs2--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070209073353.A99372>