summaryrefslogtreecommitdiff
path: root/multimedia
diff options
context:
space:
mode:
authorMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2003-03-05 22:27:25 +0000
committerMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2003-03-05 22:27:25 +0000
commit331e4213c9682358944f11a33fb2ebd6b89f64bf (patch)
tree58a603a46f27c56b275c8f8375b6754ca5f2dbf8 /multimedia
parentUpdate phpBB to 2.0.4. (diff)
New port NuppelVideo version 0.52a: A very low CPU usage VCR/DVR
application Submitted by: Steve O'Hara-Smith <steve@sohara.org>
Notes
Notes: svn path=/head/; revision=76985
Diffstat (limited to 'multimedia')
-rw-r--r--multimedia/Makefile1
-rw-r--r--multimedia/nuppelvideo/Makefile67
-rw-r--r--multimedia/nuppelvideo/distinfo1
-rw-r--r--multimedia/nuppelvideo/files/patch-Makefile45
-rw-r--r--multimedia/nuppelvideo/files/patch-nuvplay.c12
-rw-r--r--multimedia/nuppelvideo/files/patch-nuvrec.c396
-rw-r--r--multimedia/nuppelvideo/files/patch-rtjpeg_plugin.c21
-rw-r--r--multimedia/nuppelvideo/pkg-descr6
-rw-r--r--multimedia/nuppelvideo/pkg-plist5
9 files changed, 554 insertions, 0 deletions
diff --git a/multimedia/Makefile b/multimedia/Makefile
index e674e60a729e..c6075b9bcbcf 100644
--- a/multimedia/Makefile
+++ b/multimedia/Makefile
@@ -37,6 +37,7 @@
SUBDIR += mplayer-skins
SUBDIR += mplayerxp
SUBDIR += nautilus-media
+ SUBDIR += nuppelvideo
SUBDIR += ogle
SUBDIR += ogle-gui
SUBDIR += ogmtools
diff --git a/multimedia/nuppelvideo/Makefile b/multimedia/nuppelvideo/Makefile
new file mode 100644
index 000000000000..6033bc72f42b
--- /dev/null
+++ b/multimedia/nuppelvideo/Makefile
@@ -0,0 +1,67 @@
+# New ports collection makefile for: NuppelViodeo
+# Date created: Mon 10 Feb 2003 22:21:51 CET
+# Whom: Steve O'Hara-Smith <steve@sohara.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= NuppelVideo
+PORTVERSION= 0.52.a
+CATEGORIES= multimedia audio
+MASTER_SITES= http://frost.htu.tuwien.ac.at/~roman/nuppelvideo/
+DISTNAME= ${PORTNAME}-${PORTVERSION:C/.(.)$/\1/}
+
+MAINTAINER= steve@sohara.org
+COMMENT= A very low CPU usage VCR/DVR application
+
+USE_GMAKE= yes
+USE_REINPLACE= yes
+
+# find dependencies
+CFLAGS+= -I${LOCALBASE}/include -I${X11BASE}/include \
+ -L${LOCALBASE}/lib -L${X11BASE}/lib
+
+.include <bsd.port.pre.mk>
+
+###
+## Auto detected features
+###
+.if ${ARCH} == "i386"
+. if (defined(MACHINE_CPU) && ${MACHINE_CPU:Mmmx:L} == "mmx")
+WITH_MMX=yes
+. endif
+.endif
+
+###
+## Port options
+###
+.ifdef(WITH_OPTIMIZED_CFLAGS)
+CFLAGS+= -O3 -ffast-math -fomit-frame-pointer -finline-functions \
+ -funroll-loops -fexpensive-optimizations
+.endif
+#
+.ifdef(WITH_MMX)
+CFLAGS+= -DMMX
+.endif
+
+pre-everything::
+.ifndef(WITH_OPTIMIZED_CFLAGS)
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'You can enable additional compilation optimizations'
+ @${ECHO_MSG} 'by defining WITH_OPTIMIZED_CFLAGS'
+.endif
+.if (${ARCH} == "i386" && !defined(WITH_MMX))
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'You can enable MMX compilation optimizations'
+ @${ECHO_MSG} 'by defining WITH_MMX'
+.endif
+
+post-patch:
+# C{C,FLAGS} safeness
+ @${REINPLACE_CMD} -E -e \
+ 's|^CFLAGS.*$$|#|' \
+ -e 's|^CC.*$$|#|' \
+ -e 's|^(COPTSRT).*$$|\1=\$$(CFLAGS)|' \
+ ${WRKSRC}/Makefile
+
+.include <bsd.port.post.mk>
diff --git a/multimedia/nuppelvideo/distinfo b/multimedia/nuppelvideo/distinfo
new file mode 100644
index 000000000000..0f6e598115a3
--- /dev/null
+++ b/multimedia/nuppelvideo/distinfo
@@ -0,0 +1 @@
+MD5 (NuppelVideo-0.52a.tar.gz) = 320fa43a19c71778ea0d403528125c1e
diff --git a/multimedia/nuppelvideo/files/patch-Makefile b/multimedia/nuppelvideo/files/patch-Makefile
new file mode 100644
index 000000000000..e3faa983695b
--- /dev/null
+++ b/multimedia/nuppelvideo/files/patch-Makefile
@@ -0,0 +1,45 @@
+--- Makefile.orig Sat Jul 7 09:08:52 2001
++++ Makefile Wed Mar 5 19:10:28 2003
+@@ -19,25 +19,25 @@
+
+
+ soxfuncs.o: soxfuncs.c
+- $(CC) $(COPTS) -O3 -funroll-loops -finline-functions -c soxfuncs.c
++ $(CC) $(COPTS) -c soxfuncs.c
+
+
+ resample.o: resample.c
+- $(CC) $(COPTS) -O3 -funroll-loops -finline-functions -c resample.c
++ $(CC) $(COPTS) -c resample.c
+
+
+ minilzo.o: minilzo.c minilzo.h
+- $(CC) $(COPTS) -O3 -fexpensive-optimizations -funroll-loops -finline-functions -c minilzo.c
++ $(CC) $(COPTS) -c minilzo.c
+
+
+ yuv2rgb_mmx.o: yuv2rgb_mmx.c yuv2rgb.h
+- $(CC) $(COPTS) -O3 -funroll-loops -finline-functions -c yuv2rgb_mmx.c
++ $(CC) $(COPTS) -c yuv2rgb_mmx.c
+
+ areaDeinterlace.o: areaDeinterlace.h areaDeinterlace.c
+- $(CC) $(COPTS) -O3 -fexpensive-optimizations -funroll-loops -finline-functions -c areaDeinterlace.c
++ $(CC) $(COPTS) -c areaDeinterlace.c
+
+ rtjpeg_plugin.o: rtjpeg_plugin.c rtjpeg_plugin.h
+- $(CC) $(COPTS) -O3 -fexpensive-optimizations -funroll-loops -finline-functions -c rtjpeg_plugin.c
++ $(CC) $(COPTS) -c rtjpeg_plugin.c
+
+ nuvrec: nuvrec.c RTjpegN.h RTjpegN.o minilzo.o
+ $(CC) $(COPTS) -o nuvrec minilzo.o RTjpegN.o nuvrec.c
+@@ -52,8 +52,8 @@
+ $(CC) $(COPTS) -static -o nuvrec minilzo.o RTjpegN.o nuvrec.c
+
+ install: nuvrec nuvplay
+- strip nuvrec nuvplay
+- install -m 755 nuvrec nuvplay nuvedit nuv2mpg nuv2vbr /usr/local/bin
++ @${BSD_INSTALL_PROGRAM} nuvrec nuvplay ${PREFIX}/bin
++ @${BSD_INSTALL_SCRIPT} nuvedit nuv2mpg nuv2vbr ${PREFIX}/bin
+
+ clean:
+ rm -f *.o nuvplay nuvrec
diff --git a/multimedia/nuppelvideo/files/patch-nuvplay.c b/multimedia/nuppelvideo/files/patch-nuvplay.c
new file mode 100644
index 000000000000..0adf99aaaf92
--- /dev/null
+++ b/multimedia/nuppelvideo/files/patch-nuvplay.c
@@ -0,0 +1,12 @@
+diff -ur ../NuppelVideo-0.52a/nuvplay.c ./nuvplay.c
+--- ../NuppelVideo-0.52a/nuvplay.c Wed Jul 4 17:28:41 2001
++++ ./nuvplay.c Mon Feb 10 18:38:06 2003
+@@ -272,7 +272,7 @@
+ if (rtjpeg_fileheader.audioblocks!=0 && playaudio!=0) {
+ if (writeaudiotofile) {
+ // write to file, file MUST NOT exist
+- audf = (writeaudiotofile==1) ? open(audiofilename, O_EXCL|O_CREAT|O_WRONLY|O_SYNC, 0600) : 1;
++ audf = (writeaudiotofile==1) ? open(audiofilename, O_EXCL|O_CREAT|O_WRONLY|O_FSYNC, 0600) : 1;
+ if (audf==-1) {
+ if (errno!=EEXIST)
+ fprintf(stderr, "cannot write to file '%s', no audio is played\n", audiofilename);
diff --git a/multimedia/nuppelvideo/files/patch-nuvrec.c b/multimedia/nuppelvideo/files/patch-nuvrec.c
new file mode 100644
index 000000000000..43890279cfe7
--- /dev/null
+++ b/multimedia/nuppelvideo/files/patch-nuvrec.c
@@ -0,0 +1,396 @@
+diff -ur ../NuppelVideo-0.52a/nuvrec.c ./nuvrec.c
+--- ../NuppelVideo-0.52a/nuvrec.c Wed Jul 4 23:59:58 2001
++++ ./nuvrec.c Mon Feb 10 21:43:02 2003
+@@ -27,14 +27,22 @@
+ #include <sys/stat.h>
+ #include <sys/time.h>
+ #include <sys/resource.h>
++#include <machine/ioctl_meteor.h>
++#include <machine/ioctl_bt848.h>
+ #include <sys/soundcard.h>
+-#include <linux/videodev.h>
+-#include <linux/wait.h>
++#include <sys/wait.h>
+ #include <errno.h>
+ #include "minilzo.h"
+ #include "RTjpegN.h"
+ #include "nuppelvideo.h"
+
++typedef unsigned char UINT8;
++typedef unsigned int UINT32;
++typedef unsigned long long UINT64;
++typedef signed char INT8;
++typedef signed int INT32;
++typedef signed long long INT64;
++
+ // #define TESTINPUT 1
+ // #define TESTSPLIT 1
+ #define KEYFRAMEDIST 30
+@@ -47,11 +55,28 @@
+ #define MAXBYTESFORCE 2100000000
+ #endif
+
+-// we need the BTTV_FIELDNR, so we really know how many frames we lose
+-#define BTTV_FIELDNR _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int)
++#define PAL 1
++#define NTSC 2
++#define SECAM 3
++#define PALN 4
++#define PALM 5
++#define PALBDGHI PAL
++#define NTSCJ 6
++#define NTSCM NTSC
++
++/* PAL is 768 x 576. NTSC is 640 x 480 */
++#define PAL_HEIGHT 576
++#define SECAM_HEIGHT 576
++#define NTSC_HEIGHT 480
++
++#include <sys/mman.h>
++#include <sys/time.h>
++#include <signal.h>
+
+ /* Globals */
+
++int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
++ METEOR_DEV3, METEOR_DEV_SVIDEO };
+ int fd; // output file haendle
+ int ostr=0;
+ __s8 *strm;
+@@ -71,10 +96,10 @@
+ unsigned long long audiobytes;
+ int effectivedsp;
+ int ntsc=0; // default to PAL, this info is only for the video header
++int secam=0;
+ int quiet;
+ int rawmode=0;
+-int usebttv=1;
+-struct video_audio origaudio;
++int usebttv=0;
+
+ //#define DP(DSTRING) fprintf(stderr, "%s\n", DSTRING);
+ #define DP(DSTRING)
+@@ -173,9 +198,6 @@
+ kill(pid, 9);
+ if (recordaudio) kill(pid2, 9);
+
+- // reset audio settings
+- if (ioctl(fd, VIDIOCSAUDIO, &origaudio)<0) perror("VIDIOCSAUDIO");
+-
+ if (!quiet) fprintf(stderr, "\n"); // preserve status line
+ exit(i);
+ }
+@@ -201,24 +223,25 @@
+ unsigned char *startaudio;
+
+ if (init_shm) {
+- shmid = shmget(IPC_PRIVATE, video_buffer_size*video_buffer_count +
++ shmid = shmget(0xdeadbeef, video_buffer_size*video_buffer_count +
+ audio_buffer_size*audio_buffer_count +
+ video_buffer_count*sizeof(vidbuffertyp) +
+ audio_buffer_count*sizeof(audbuffertyp),
+- IPC_EXCL | IPC_CREAT | 0600);
++ IPC_CREAT | SHM_R | SHM_W);
+ if (shmid == -1)
+ ERROR("shmget");
+ }
+- sharedbuffer = shmat(shmid, IPC_RMID, SHM_RND);
++ sharedbuffer = shmat(shmid, (char *) 0, 0);
+ if (sharedbuffer == (char*)-1)
+ {
++ fprintf (stderr, "shmid %d\n", shmid);
+ perror("shmat");
+ if(shmctl(shmid, IPC_RMID, NULL))
+ perror("shmctl");
+ exit(-1);
+ }
+- if(shmctl(shmid, IPC_RMID, NULL))
+- ERROR("shmctl");
++// if(shmctl(shmid, IPC_RMID, NULL))
++// ERROR("shmctl");
+
+ videobuffer = (struct vidbuffertype *)sharedbuffer;
+ startaudiodesc = (char *)(sharedbuffer + video_buffer_count*sizeof(vidbuffertyp));
+@@ -899,24 +922,6 @@
+ #ifdef TESTINPUT
+ tf+=2; // when reading from files we won't lose frames ;)
+ #else
+- if (usebttv) {
+- // i hate it when interfaces changes and a non existent ioctl doesn't make an error
+- // and doesn't return -1, returning 0 instead and making no error is really weird
+- if (ioctl(fd, BTTV_FIELDNR, &tf)) {
+- perror("BTTV_FIELDNR");
+- usebttv = 0;
+- fprintf(stderr, "\nbttv_fieldnr not supported by bttv-driver"
+- "\nuse insmod/modprobe bttv card=YOURCARD field_nr=1 to activate f.n."
+- "\nfalling back to timecode routine to determine lost frames\n");
+- }
+- if (tf==0) {
+- usebttv = 0;
+- fprintf(stderr, "\nbttv_fieldnr not supported by bttv-driver"
+- "\nuse insmod/modprobe bttv card=YOURCARD field_nr=1 to activate f.n."
+- "\nfalling back to timecode routine to determine lost frames\n");
+- }
+- }
+-
+ // here is the non preferable timecode - drop algorithm - fallback
+ if (!usebttv) {
+
+@@ -1073,21 +1078,125 @@
+ exit(-1);
+ }
+
++INT64 av_gettime(void)
++{
++ struct timeval tv;
++ gettimeofday(&tv,NULL);
++ return (INT64)tv.tv_sec * 1000000 + tv.tv_usec;
++}
++
++static int nsignals = 0;
++static void catchsignal(int signal)
++{
++ nsignals++;
++ return;
++}
++
++static int bktr_init(int video_fd, int width, int height, UINT8 **video_buf, int channel)
++{
++ int format = PAL;
++ struct meteor_geomet geo;
++ int c;
++ int h_max;
++ struct sigaction act,old;
++
++ if (channel < 0 || channel > 4)
++ channel = 1;
++ if (ntsc) {
++ format = NTSC;
++ } else if (secam) {
++ format = SECAM;
++ }
++
++ memset(&act,0,sizeof(act));
++ sigemptyset(&act.sa_mask);
++ act.sa_handler = catchsignal;
++ sigaction(SIGUSR1,&act,&old);
++
++ geo.rows = height;
++ geo.columns = width;
++ geo.frames = 1;
++ geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12;
++
++ switch (format) {
++ case PAL: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break;
++ case PALN: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALN; break;
++ case PALM: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALM; break;
++ case SECAM: h_max = SECAM_HEIGHT; c = BT848_IFORM_F_SECAM; break;
++ case NTSC: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCM; break;
++ case NTSCJ: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCJ; break;
++ default: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break;
++ }
++ if (height <= h_max/2) {
++ geo.oformat |= METEOR_GEO_EVEN_ONLY;
++ }
++
++ if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
++ perror ("METEORSETGEO");
++ return -EIO;
++ }
++
++ if (ioctl(video_fd, BT848SFMT, &c) < 0) {
++ perror ("BT848SFMT");
++ return -EIO;
++ }
++
++ c = bktr_dev[channel];
++ if (ioctl(video_fd, METEORSINPUT, &c) < 0) {
++ perror ("METEORSINPUT");
++ return -EIO;
++ }
++ *video_buf = (UINT8 *) mmap((caddr_t)0, width*height*3,
++ PROT_READ, MAP_SHARED, video_fd, (off_t) 0);
++ if (*video_buf == MAP_FAILED) {
++ perror ("mmap");
++ return -EIO;
++ }
++ c = METEOR_CAP_CONTINOUS;
++ ioctl(video_fd, METEORCAPTUR, &c);
++ c = SIGUSR1;
++ ioctl (video_fd, METEORSSIGNAL, &c);
++ return 0;
++}
++
++/* note: we support only one picture read at a time */
++static void bktr_getframe(int width, int height, UINT64 per_frame)
++{
++ int size, halfsize;
++ UINT64 curtime;
++ static UINT64 last_frame_time = 0;
++
++ size = width * height;
++ halfsize = size << 1;
++
++ curtime = av_gettime();
++ if (!last_frame_time
++ || ((last_frame_time + per_frame) > curtime)) {
++ if (!usleep (last_frame_time + per_frame + per_frame/8 - curtime)) {
++ if (!nsignals)
++ printf ("\nSLEPT NO signals - %d microseconds late\n",
++ av_gettime() - last_frame_time - per_frame);
++ }
++ }
++ nsignals = 0;
++
++ last_frame_time = curtime;
++}
++
++
+ // ----------------------------------------------------------
+ // -- MAIN --------------------------------------------------
+
+ int main(int argc, char** argv)
+ {
+- struct video_mmap mm;
+- struct video_mbuf vm;
+- struct video_channel vchan;
+- struct video_audio va;
+- struct video_tuner vt;
++ int tuner_fd;
++ int video_frame_rate = 25;
++ UINT64 per_frame = (UINT64) (((UINT64)1000000 * (UINT64)10000) / (UINT64)video_frame_rate);
++ UINT8 *video_buf = NULL;
+
+- char *videodevice = "/dev/video0";
++ char *videodevice = "/dev/bktr0";
+ char c;
+- int secam;
+- int channel=0;
++ int channel=1;
+ double frequency=0.0;
+ long v4lfrequency=0;
+ int volume = -1;
+@@ -1277,109 +1386,28 @@
+ testinput();
+ #else
+
+- fd = open(videodevice, O_RDWR|O_CREAT);
++ fd = open(videodevice, O_RDONLY);
+ if(fd<=0){
+ perror("open");
+ fatherhandler(-1);
+ }
+-
+- if(ioctl(fd, VIDIOCGMBUF, &vm)<0)
+- {
+- perror("VIDIOCMCAPTUREi0");
+- fatherhandler(-1);
++ tuner_fd = open ("/dev/tuner0", O_RDWR);
++ if (tuner_fd < 0) {
++ perror("Warning: Tuner not opened continuing");
+ }
+- if(vm.frames<2)
+- {
+- fprintf(stderr, "stoopid prog want min 2 cap buffs!\n");
+- fatherhandler(-1);
+- }
+-
+- // fprintf(stderr, "We have vm.frames=%d\n", vm.frames);
+-
+- buf = (unsigned char*)mmap(0, vm.size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+- if (buf<=0)
+- {
+- perror("mmap");
+- fatherhandler(-1);
+- }
+-
+-
+- vchan.channel = channel;
+- if(ioctl(fd, VIDIOCGCHAN, &vchan)<0) perror("VIDIOCGCHAN");
+-
+- // choose the right input
+- if(ioctl(fd, VIDIOCSCHAN, &vchan)<0) perror("VIDIOCSCHAN");
+-
+- // if channel has a audio then activate it
+- if ((vchan.flags & VIDEO_VC_AUDIO)==VIDEO_VC_AUDIO) {
+- // we assume only a channel with audio can have a tuner therefore
+- // we only tune here if we are supposed to
+- if (frequency != 0.0) {
+- v4lfrequency = ((unsigned long)frequency)*16;
+- v4lfrequency |= ((unsigned long)( (frequency-(v4lfrequency/16))*100 )*16)/100; // ??????
+- if (ioctl(fd, VIDIOCSFREQ, &v4lfrequency)<0) perror("VIDIOCSFREQ");
+- if (!quiet) fprintf(stderr, "tuner frequency set to '%5.4f' MHz.\n", frequency);
+- }
+- if (!quiet) fprintf(stderr, "%s\n", "unmuting tv-audio");
+- // audio hack, to enable audio from tvcard, in case we use a tuner
+- va.audio = 0; // use audio channel 0
+- if (ioctl(fd, VIDIOCGAUDIO, &va)<0) perror("VIDIOCGAUDIO");
+- origaudio = va;
+- if (!quiet) fprintf(stderr, "audio volume was '%d'\n", va.volume);
+- va.audio = 0;
+- va.flags &= ~VIDEO_AUDIO_MUTE; // now this really has to work
+-
+- if ((volume==-1 && va.volume<32768) || volume!=-1) {
+- if (volume==-1) {
+- va.volume = 32768; // no more silence 8-)
+- } else {
+- va.volume = volume;
+- }
+- if (!quiet) fprintf(stderr, "audio volume set to '%d'\n", va.volume);
+- }
+- if (ioctl(fd, VIDIOCSAUDIO, &va)<0) perror("VIDIOCSAUDIO");
+- } else {
+- if (!quiet) fprintf(stderr, "channel '%d' has no tuner (composite)\n", channel);
++
++ bktr_init (fd, w, h, &video_buf, channel);
++ if (frequency != 0.0) {
++ v4lfrequency = (unsigned long)(frequency*16);
++ if (ioctl(tuner_fd, TVTUNER_SETFREQ, &v4lfrequency)<0)
++ perror("TVTUNER_SETFREQ");
++ if (!quiet)
++ fprintf(stderr, "tuner frequency set to '%5.4f' MHz.\n", frequency);
+ }
+
+- // setting video mode
+- vt.tuner = 0;
+- if(ioctl(fd, VIDIOCGTUNER, &vt)<0) perror("VIDIOCGTUNER");
+- if (ntsc) { vt.flags |= VIDEO_TUNER_NTSC; vt.mode |= VIDEO_MODE_NTSC; }
+- else if (secam) { vt.flags |= VIDEO_TUNER_SECAM; vt.mode |= VIDEO_MODE_SECAM; }
+- else { vt.flags |= VIDEO_TUNER_PAL; vt.mode |= VIDEO_MODE_PAL; }
+- vt.tuner = 0;
+- if(ioctl(fd, VIDIOCSTUNER, &vt)<0) perror("VIDIOCSTUNER");
+-
+- // make sure we use the right input
+- if(ioctl(fd, VIDIOCSCHAN, &vchan)<0) perror("VIDIOCSCHAN");
+-
+- mm.height = h;
+- mm.width = w;
+- mm.format = VIDEO_PALETTE_YUV420P ; /* YCrCb422 */
+-
+- mm.frame = 0;
+- if(ioctl(fd, VIDIOCMCAPTURE, &mm)<0) perror("VIDIOCMCAPTUREi0");
+- mm.frame = 1;
+- if(ioctl(fd, VIDIOCMCAPTURE, &mm)<0) perror("VIDIOCMCAPTUREi1");
+-
+ while(1) {
+- frame=0;
+- mm.frame = 0;
+- if(ioctl(fd, VIDIOCSYNC, &frame)<0) perror("VIDIOCSYNC0");
+- else {
+- if(ioctl(fd, VIDIOCMCAPTURE, &mm)<0) perror("VIDIOCMCAPTURE0");
+- DP("Captured 0er");
+- bufferit(buf+vm.offsets[0]);
+- }
+- frame=1;
+- mm.frame = 1;
+- if(ioctl(fd, VIDIOCSYNC, &frame)<0) perror("VIDIOCSYNC1");
+- else {
+- if(ioctl(fd, VIDIOCMCAPTURE, &mm)<0) perror("VIDIOCMCAPTURE1");
+- DP("Captured 1er");
+- bufferit(buf+vm.offsets[1]);
+- }
++ bktr_getframe (w, h, per_frame);
++ bufferit(video_buf);
+ }
+ #endif
+
diff --git a/multimedia/nuppelvideo/files/patch-rtjpeg_plugin.c b/multimedia/nuppelvideo/files/patch-rtjpeg_plugin.c
new file mode 100644
index 000000000000..54575d9cca62
--- /dev/null
+++ b/multimedia/nuppelvideo/files/patch-rtjpeg_plugin.c
@@ -0,0 +1,21 @@
+diff -ur ../NuppelVideo-0.52a/rtjpeg_plugin.c ./rtjpeg_plugin.c
+--- ../NuppelVideo-0.52a/rtjpeg_plugin.c Tue Jul 3 15:34:02 2001
++++ ./rtjpeg_plugin.c Mon Feb 10 18:42:01 2003
+@@ -155,7 +155,7 @@
+ while (pos > startpos && !foundit) {
+ lseek(rtjpeg_file, pos, SEEK_SET);
+ read(rtjpeg_file, buffer, 32768);
+- needlepos = (char *)memmem(buffer, 32768, "RTjjjjjjjjjjjjjjjjjjjjjjjj", FRAMEHEADERSIZE);
++// needlepos = (char *)memmem(buffer, 32768, "RTjjjjjjjjjjjjjjjjjjjjjjjj", FRAMEHEADERSIZE);
+ if (needlepos != NULL) {
+ lseek(rtjpeg_file, pos+(needlepos - buffer) + FRAMEHEADERSIZE, SEEK_SET);
+ read(rtjpeg_file, &frameheader, FRAMEHEADERSIZE);
+@@ -273,7 +273,7 @@
+ lseek(rtjpeg_file, pos, SEEK_SET);
+ read(rtjpeg_file, buffer, 32768);
+ //fprintf(stderr, "check for needle\n");
+- needlepos = (char *)memmem(buffer, 32768, "RTjjjjjjjjjjjjjjjjjjjjjjjj", FRAMEHEADERSIZE);
++// needlepos = (char *)memmem(buffer, 32768, "RTjjjjjjjjjjjjjjjjjjjjjjjj", FRAMEHEADERSIZE);
+ if (needlepos != NULL) {
+ lseek(rtjpeg_file, pos+(needlepos - buffer) + FRAMEHEADERSIZE, SEEK_SET);
+ read(rtjpeg_file, &frameheader, FRAMEHEADERSIZE);
diff --git a/multimedia/nuppelvideo/pkg-descr b/multimedia/nuppelvideo/pkg-descr
new file mode 100644
index 000000000000..cd62bd4d4df4
--- /dev/null
+++ b/multimedia/nuppelvideo/pkg-descr
@@ -0,0 +1,6 @@
+NuppelVideo is a simple low consuming and fast capture program for
+bktr. It is based on the RTjpeg2.0 test3* programs from Justin
+Schoemann who wrote the both very fast and fine RTjpeg2.0 codec
+(improved by Joerg Walter and Wim Taymans).
+
+WWW: http://frost.htu.tuwien.ac.at/~roman/nuppelvideo/
diff --git a/multimedia/nuppelvideo/pkg-plist b/multimedia/nuppelvideo/pkg-plist
new file mode 100644
index 000000000000..7d4661cead28
--- /dev/null
+++ b/multimedia/nuppelvideo/pkg-plist
@@ -0,0 +1,5 @@
+bin/nuv2mpg
+bin/nuv2vbr
+bin/nuvedit
+bin/nuvplay
+bin/nuvrec