Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Nov 2004 16:33:52 +0100 (CET)
From:      "Frank W. Josellis" <frank@dynamical-systems.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/73419: multimedia/nuppelvideo: Proposal for various improvements
Message-ID:  <200411021533.iA2FXq4O002991@achilles.tractrix.org>
Resent-Message-ID: <200411021540.iA2FeSWf024006@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         73419
>Category:       ports
>Synopsis:       multimedia/nuppelvideo: Proposal for various improvements
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 02 15:40:28 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Frank W. Josellis
>Release:        FreeBSD 4.10-STABLE i386
>Organization:
>Environment:
System: FreeBSD achilles.tractrix.org 4.10-STABLE FreeBSD 4.10-STABLE #0: Sun Oct 3 22:22:17 CEST 2004 root@:/usr/obj/usr/src/sys/ACHILLES i386

>Description:
	Having used nuppelvideo for several months, I think that a few
	corrections should be considered for this port. The patch below
	provides a number of modifications as follows:

	- There is no documentation installed with the port. I'd suggest that
  	at least the README should be supplied to have some usage instructions
  	close at hand.

	- The scripts nuv2mpg and nuv2vbr fail to run for various reasons and
	the patch fixes some errors. However, the scripts depend on exportvideo 	and a user still might wonder what it is and where it comes from. 
	(This may change since exportvideo has right now been submitted to 
	the ports collection, ports/73417)

	- The nuvedit script depends on Tcl/Tk but is not registered with a 
  	particular Tk version, as would be appropriate for FreeBSD.

	- The nuvrec program splits its output into pieces whose size does not
  	exceed 2GB. This feature made sense for older Linux where the software
  	was originally developed, but is certainly not desired for the FreeBSD
  	port. The patch abolishes this, though nuvrec's original behavior can
  	be restored by adding -DSPLIT=1 to the CFLAGS.

	- For nuvplay, the rtjpeg_plugin.c code makes use of the glibc function 
  	memmem(). Rather than commenting out all occurrences of memmem() calls
  	one should consider to implement this function ad hoc. (The memmem.c
	code provided by the patch is copied from glibc sources.)


>How-To-Repeat:
	Just use it.

>Fix:

--- nuppelvideo.patch begins here ---
diff -Nur nuppelvideo.bak/Makefile nuppelvideo/Makefile
--- nuppelvideo.bak/Makefile	Mon Sep 20 16:05:45 2004
+++ nuppelvideo/Makefile	Fri Oct 29 11:06:28 2004
@@ -15,10 +15,14 @@
 MAINTAINER=	steve@sohara.org
 COMMENT=	A very low CPU usage VCR/DVR application
 
+RUN_DEPENDS=	wish8.4:${PORTSDIR}/x11-toolkits/tk84
+
 USE_XLIB=	yes
 USE_GMAKE=	yes
 USE_REINPLACE=	yes
 
+PORTDOCS=	README
+
 # find dependencies
 CFLAGS+=	-I${LOCALBASE}/include -I${X11BASE}/include \
 		-L${LOCALBASE}/lib -L${X11BASE}/lib
@@ -69,5 +73,13 @@
 		-e 's|^CC.*$$|#|' \
 		-e 's|^(COPTSRT).*$$|\1=\$$(CFLAGS)|' \
 		${WRKSRC}/Makefile
+
+post-install:
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+.for i in ${PORTDOCS}
+	${INSTALL_MAN} ${WRKSRC}/${i} ${DOCSDIR}
+.endfor
+.endif
 
 .include <bsd.port.post.mk>
diff -Nur nuppelvideo.bak/files/patch-Makefile nuppelvideo/files/patch-Makefile
--- nuppelvideo.bak/files/patch-Makefile	Mon Sep 20 16:05:45 2004
+++ nuppelvideo/files/patch-Makefile	Thu Oct 28 02:49:57 2004
@@ -1,6 +1,20 @@
---- Makefile.orig	Sat Jul  7 09:08:52 2001
-+++ Makefile	Wed Mar  5 19:10:28 2003
-@@ -19,25 +19,25 @@
+--- Makefile.orig	Sat Jul  7 14:08:52 2001
++++ Makefile	Thu Oct 28 02:47:40 2004
+@@ -1,10 +1,10 @@
+-CC=gcc
++#
+ #CFLAGS= -g -Wall -O3  -mcpu=pentium -march=pentium -funroll-loops -fexpensive-optimizations -finline
+-CFLAGS= -Wall -O3 -DMMX -mcpu=pentium -march=pentium -funroll-loops -fexpensive-optimizations -finline-functions
++#
+ 
+ V4LDIR=/usr/src/linux/drivers/char/
+ COPTS=$(CFLAGS) -I$(V4LDIR)
+-COPTSRT= -O3 -Wall -DMMX -mcpu=pentium -funroll-loops -fexpensive-optimizations -finline-functions
++COPTSRT=$(CFLAGS)
+ 
+ all:   nuvplay nuvrec
+ 
+@@ -19,32 +19,35 @@
  
  
  soxfuncs.o: soxfuncs.c
@@ -25,6 +39,9 @@
  areaDeinterlace.o: areaDeinterlace.h areaDeinterlace.c
 -	$(CC) $(COPTS) -O3 -fexpensive-optimizations -funroll-loops -finline-functions -c areaDeinterlace.c
 +	$(CC) $(COPTS) -c areaDeinterlace.c
++
++memmem.o: memmem.c
++	$(CC) $(COPTS) -c memmem.c
  
  rtjpeg_plugin.o: rtjpeg_plugin.c rtjpeg_plugin.h
 -	$(CC) $(COPTS) -O3 -fexpensive-optimizations -funroll-loops -finline-functions -c rtjpeg_plugin.c
@@ -32,7 +49,16 @@
  
  nuvrec:	nuvrec.c RTjpegN.h RTjpegN.o minilzo.o
  	$(CC) $(COPTS) -o nuvrec minilzo.o RTjpegN.o nuvrec.c
-@@ -52,8 +52,8 @@
+ 
+-nuvplay:nuvplay.c RTjpegN.h areaDeinterlace.o RTjpegN.o XJ.o minilzo.o yuv2rgb_mmx.o rtjpeg_plugin.o resample.o soxfuncs.o
++nuvplay:nuvplay.c RTjpegN.h areaDeinterlace.o RTjpegN.o XJ.o minilzo.o yuv2rgb_mmx.o memmem.o rtjpeg_plugin.o resample.o soxfuncs.o
+ 	$(CC) $(COPTS) -L/usr/X11R6/lib -lm -lXext -o nuvplay RTjpegN.o yuv2rgb_mmx.o \
+-	minilzo.o areaDeinterlace.o XJ.o soxfuncs.o resample.o rtjpeg_plugin.o nuvplay.c
++	minilzo.o areaDeinterlace.o XJ.o soxfuncs.o resample.o memmem.o rtjpeg_plugin.o nuvplay.c
+ 
+ static: rec-s nuvplay
+ 
+@@ -52,8 +55,8 @@
  	$(CC) $(COPTS) -static -o nuvrec minilzo.o RTjpegN.o nuvrec.c
  
  install: nuvrec nuvplay
diff -Nur nuppelvideo.bak/files/patch-memmem.c nuppelvideo/files/patch-memmem.c
--- nuppelvideo.bak/files/patch-memmem.c	Thu Jan  1 01:00:00 1970
+++ nuppelvideo/files/patch-memmem.c	Thu Oct 28 02:34:16 2004
@@ -0,0 +1,62 @@
+--- memmem.c.orig	Thu Jan  1 00:00:00 1970
++++ memmem.c	Sun Oct 24 23:05:56 2004
+@@ -0,0 +1,59 @@
++/* Copyright (C) 1991,92,93,94,96,97,98,2000 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#include <stddef.h>
++#include <string.h>
++
++/* Prepare for the case that `__builtin_expect' is not available.  */
++#ifndef HAVE_BUILTIN_EXPECT
++# define __builtin_expect(expr, val) (expr)
++#endif
++
++#undef memmem
++
++/* Return the first occurrence of NEEDLE in HAYSTACK.  */
++void *
++memmem (haystack, haystack_len, needle, needle_len)
++     const void *haystack;
++     size_t haystack_len;
++     const void *needle;
++     size_t needle_len;
++{
++  const char *begin;
++  const char *const last_possible
++    = (const char *) haystack + haystack_len - needle_len;
++
++  if (needle_len == 0)
++    /* The first occurrence of the empty string is deemed to occur at
++       the beginning of the string.  */
++    return (void *) haystack;
++
++  /* Sanity check, otherwise the loop might search through the whole
++     memory.  */
++  if (__builtin_expect (haystack_len < needle_len, 0))
++    return NULL;
++
++  for (begin = (const char *) haystack; begin <= last_possible; ++begin)
++    if (begin[0] == ((const char *) needle)[0] &&
++	!memcmp ((const void *) &begin[1],
++		 (const void *) ((const char *) needle + 1),
++		 needle_len - 1))
++      return (void *) begin;
++
++  return NULL;
++}
diff -Nur nuppelvideo.bak/files/patch-nuv2mpg nuppelvideo/files/patch-nuv2mpg
--- nuppelvideo.bak/files/patch-nuv2mpg	Thu Jan  1 01:00:00 1970
+++ nuppelvideo/files/patch-nuv2mpg	Thu Oct 28 18:47:19 2004
@@ -0,0 +1,50 @@
+--- nuv2mpg.orig	Mon Jun 25 21:33:41 2001
++++ nuv2mpg	Thu Oct 28 16:30:47 2004
+@@ -1,13 +1,30 @@
+ #!/bin/sh
+ 
++if [ $# = 0 ]; then
++	echo "Usage: $0 <nuvfile>"
++	exit 1
++fi
++name=${1%.nuv}
++
++retval=0
++for PROG in toolame exportvideo mpeg2enc mplex ; do
++    which -s $PROG || retval=$?
++    if [ $retval -ne 0 ]; then
++	echo "Error: could't find '$PROG' on this system." >&2
++	exit 1
++    fi
++done
++
+ echo "you have choosen to make a VCD compliant MPEG stream"
+ echo "please notice that VBR MPEG streams can have the same"
+ echo "visual quality with lower/low bitrates too (like divx)"
+ echo ""
+ 
+-nuvplay -e $1.nuv | toolame -s 44100 -b 224 -p 2 -m s /dev/stdin $1.mp2
+-exportvideo $1.nuv "|mpeg2enc -b 1152 -G 15 -g 15 -N -o $1.m1v"
+-mplex -f 1 -s 2324 -p 1 -o $1.mpg $1.m1v $1.mp2
++nuvplay -e $name.nuv | toolame -s 44.1 -b 224 -p 2 -m s /dev/stdin $name.mp2
++exportvideo -Y 2 $name.nuv | mpeg2enc -f 1 -o $name.m1v
++mplex -f 1 -s 2324 -p 1 -o $name.mpg $name.m1v $name.mp2
++
++which -s vcdimager || exit 2 
+ 
+ echo ""
+ echo "Press enter for making a BIN and CUE file from your MPG file or"
+@@ -15,11 +32,11 @@
+ echo ""
+ read enter 
+ 
+-vcdimager -c $1.cue -b $1.bin $1.mpg
++vcdimager -c $name.cue -b $name.bin $name.mpg
+ 
+ echo "you can burn your bin/cue files with cdrdao, simple change the
+ echo "device parameter to your cdwriter id and type"
+ echo ""
+-echo "cdrdao write --eject --device=0,3,0 $1.cue"
++echo "cdrdao write --eject --device=0,3,0 $name.cue"
+ echo ""
+ echo "have fun"
diff -Nur nuppelvideo.bak/files/patch-nuv2vbr nuppelvideo/files/patch-nuv2vbr
--- nuppelvideo.bak/files/patch-nuv2vbr	Thu Jan  1 01:00:00 1970
+++ nuppelvideo/files/patch-nuv2vbr	Thu Oct 28 18:47:50 2004
@@ -0,0 +1,48 @@
+--- nuv2vbr.orig	Mon Jun 25 21:35:49 2001
++++ nuv2vbr	Thu Oct 28 18:43:41 2004
+@@ -1,23 +1,39 @@
+ #!/bin/sh
+ 
++if [ $# = 0 ]; then
++	echo "Usage: $0 <nuvfile>"
++	exit 1
++fi
++name=${1%.nuv}
++
++retval=0
++for PROG in toolame exportvideo mpeg2enc mplex ; do
++    which -s $PROG || retval=$?
++    if [ $retval -ne 0 ]; then
++	echo "Error: could't find '$PROG' on this system." >&2
++	exit 1
++    fi
++done
++
+ echo "you have choosen to make a VBR MPEG stream"
+ echo "please notice that VBR MPEG streams cannot be burned to"
+ echo "a VCD for use with a DVD player, if you want that use nuv2mpg"
+ echo ""
+ echo "this is only an example script you should edit it to your"
+-echo "quality needs. i'll make a better all purpose mpeg script
++echo "quality needs. i'll make a better all purpose mpeg script"
+ echo "in time. try to play around with -q and -b and read the"
+ echo "mpeg2enc man page!!!"
++echo
+ 
+-nuvplay -e $1.nuv | toolame -s 44100 -b 192 -p 2 -m s /dev/stdin $1.mp2
+-exportvideo $1.nuv "|mpeg2enc -b 1300 -q 7 -G 21 -g 21 -N -o $1.m1v"
+-mplex -V -s 2324 -p 1 -o $1.mpg $1.m1v $1.mp2
++nuvplay -e $name.nuv | toolame -s 44.1 -b 192 -p 2 -m s /dev/stdin $name.mp2
++exportvideo -Y 2 $name.nuv | mpeg2enc -b 1300 -q 7 -G 21 -g 21 -o $name.m1v
++mplex -V -r 2000 -s 2324 -p 1 -o $name.mpg $name.m1v $name.mp2
+ 
+-echo "you can burn your mpg files with cdrecord, simple change the
++echo "you can burn your mpg files with cdrecord, simple change the"
+ echo "device parameter to your cdwriter id and type"
+ echo ""
+ echo "mkdir disk1"
+-echo "mv $1.mpg disk1/"
++echo "mv $name.mpg disk1/"
+ echo "cd disk1/"
+ echo "md5sum * >disk.md5"
+ echo "cd .."
diff -Nur nuppelvideo.bak/files/patch-nuvedit nuppelvideo/files/patch-nuvedit
--- nuppelvideo.bak/files/patch-nuvedit	Thu Jan  1 01:00:00 1970
+++ nuppelvideo/files/patch-nuvedit	Thu Oct 28 14:09:04 2004
@@ -0,0 +1,10 @@
+--- nuvedit.orig	Wed Jul  4 13:17:18 2001
++++ nuvedit	Thu Oct 28 14:08:14 2004
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ # \
+-exec wish "$0" "$@"
++exec wish8.4 "$0" "$@"
+ 
+ 
+ set procfil  {}
diff -Nur nuppelvideo.bak/files/patch-nuvrec.c nuppelvideo/files/patch-nuvrec.c
--- nuppelvideo.bak/files/patch-nuvrec.c	Mon Sep 20 16:05:45 2004
+++ nuppelvideo/files/patch-nuvrec.c	Thu Oct 28 12:03:41 2004
@@ -1,5 +1,5 @@
---- nuvrec.c.orig	Wed Jul  4 23:59:58 2001
-+++ nuvrec.c	Sun Feb  1 17:31:10 2004
+--- nuvrec.c.orig	Wed Jul  4 23:59:36 2001
++++ nuvrec.c	Thu Oct 28 12:02:27 2004
 @@ -27,14 +27,28 @@
  #include <sys/stat.h>
  #include <sys/time.h>
@@ -31,12 +31,22 @@
  // #define TESTINPUT 1
  // #define TESTSPLIT 1
  #define KEYFRAMEDIST 30
-@@ -47,11 +61,28 @@
+@@ -42,16 +56,38 @@
+ #ifdef TESTSPLIT
+   #define MAXBYTES          20000000
+   #define MAXBYTESFORCE     21000000
++#define SPLIT 1
+ #else
+   #define MAXBYTES       2000000000
    #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)
++#ifndef SPLIT
++#define SPLIT 0
++#endif
++
 +#define PAL 1
 +#define NTSC 2
 +#define SECAM 3
@@ -62,7 +72,7 @@
  int fd;     // output file haendle
  int ostr=0;
  __s8 *strm;
-@@ -71,10 +102,10 @@
+@@ -71,10 +107,10 @@
  unsigned long long audiobytes;
  int effectivedsp;
  int ntsc=0; // default to PAL, this info is only for the video header
@@ -75,7 +85,7 @@
  
  //#define DP(DSTRING) fprintf(stderr, "%s\n", DSTRING);
  #define DP(DSTRING)
-@@ -173,9 +204,6 @@
+@@ -173,9 +209,6 @@
    kill(pid,  9);
    if (recordaudio) kill(pid2, 9);
  
@@ -85,7 +95,7 @@
    if (!quiet) fprintf(stderr, "\n"); // preserve status line
    exit(i);
  }
-@@ -201,24 +229,25 @@
+@@ -201,24 +234,25 @@
      unsigned char *startaudio;
  
      if (init_shm) {
@@ -116,7 +126,25 @@
  
      videobuffer    = (struct vidbuffertype *)sharedbuffer;
      startaudiodesc = (char *)(sharedbuffer + video_buffer_count*sizeof(vidbuffertyp));
-@@ -899,24 +928,6 @@
+@@ -792,7 +826,7 @@
+       // we have no frames in our cycle buffer
+ //fprintf(stderr,"*");
+ 
+-      if (byteswritten > MAXBYTES) {
++      if (SPLIT && byteswritten > MAXBYTES) {
+         actfile++;
+         if (0 != create_nuppelfile(fname, actfile, w, h)) {
+           fprintf(stderr, "cannot open %s-%d.nuv for writing\n", fname, actfile);
+@@ -804,7 +838,7 @@
+       continue;   // check for next frame
+     }
+ 
+-    if (byteswritten > MAXBYTESFORCE) {
++    if (SPLIT && byteswritten > MAXBYTESFORCE) {
+       actfile++;
+       if (0 != create_nuppelfile(fname, actfile, w, h)) {
+         fprintf(stderr, "cannot open %s-%d.nuv for writing\n", fname, actfile);
+@@ -899,24 +933,6 @@
  #ifdef TESTINPUT
    tf+=2; // when reading from files we won't lose frames ;)
  #else
@@ -141,7 +169,7 @@
   // here is the non preferable timecode - drop algorithm - fallback
   if (!usebttv) {
  
-@@ -1073,21 +1084,125 @@
+@@ -1073,21 +1089,125 @@
     exit(-1);
  }
  
@@ -275,7 +303,7 @@
    double  frequency=0.0;
    long v4lfrequency=0;
    int volume = -1;
-@@ -1277,109 +1392,28 @@
+@@ -1277,109 +1397,28 @@
    testinput();
  #else
  
diff -Nur nuppelvideo.bak/files/patch-rtjpeg_plugin.c nuppelvideo/files/patch-rtjpeg_plugin.c
--- nuppelvideo.bak/files/patch-rtjpeg_plugin.c	Mon Sep 20 16:05:45 2004
+++ nuppelvideo/files/patch-rtjpeg_plugin.c	Thu Jan  1 01:00:00 1970
@@ -1,21 +0,0 @@
-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 -Nur nuppelvideo.bak/files/patch-rtjpeg_plugin.h nuppelvideo/files/patch-rtjpeg_plugin.h
--- nuppelvideo.bak/files/patch-rtjpeg_plugin.h	Thu Jan  1 01:00:00 1970
+++ nuppelvideo/files/patch-rtjpeg_plugin.h	Thu Oct 28 02:32:00 2004
@@ -0,0 +1,9 @@
+--- rtjpeg_plugin.h.orig	Tue Jul  3 15:01:32 2001
++++ rtjpeg_plugin.h	Thu Oct 28 02:28:45 2004
+@@ -56,3 +56,6 @@
+ int            rtjpeg_end_of_video();
+ int            rtjpeg_check_sig(char *fname);
+ 
++/* Stolen from glibc */
++void *memmem(const void *haystack, size_t haystacklen,
++	     const void *needle, size_t needlelen);
--- nuppelvideo.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411021533.iA2FXq4O002991>