diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-09-27 00:38:43 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-09-27 00:38:43 +0000 |
commit | edcafde9c5fccaaa35dc470eb75f382258641748 (patch) | |
tree | 38954149f4b407355e8b0c1c990b44e5d771daa1 /media-video/mpeg-tools | |
parent | +media-libs/urt:gs (diff) | |
download | historical-edcafde9c5fccaaa35dc470eb75f382258641748.tar.gz historical-edcafde9c5fccaaa35dc470eb75f382258641748.tar.bz2 historical-edcafde9c5fccaaa35dc470eb75f382258641748.zip |
Clean up source code, fix insecure tempfile usage #107344, and let netpbm install the converting programs eyuvtoppm/ppmtoeyuv since it has newer versions #78777.
Package-Manager: portage-2.0.52-r1 http://www.bash.org/?136501
Diffstat (limited to 'media-video/mpeg-tools')
10 files changed, 764 insertions, 36 deletions
diff --git a/media-video/mpeg-tools/ChangeLog b/media-video/mpeg-tools/ChangeLog index d161375f5106..9b8d064ba806 100644 --- a/media-video/mpeg-tools/ChangeLog +++ b/media-video/mpeg-tools/ChangeLog @@ -1,6 +1,19 @@ # ChangeLog for media-video/mpeg-tools -# Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/mpeg-tools/ChangeLog,v 1.10 2004/08/12 20:50:20 chriswhite Exp $ +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/media-video/mpeg-tools/ChangeLog,v 1.11 2005/09/27 00:38:43 vapier Exp $ + +*mpeg-tools-1.5b-r2 (27 Sep 2005) + + 27 Sep 2005; Mike Frysinger <vapier@gentoo.org> + files/mpeg-tools-1.5b-64bit_fixes.patch, + +files/mpeg-tools-1.5b-build.patch, + +files/mpeg-tools-1.5b-system-jpeg.patch, + +files/mpeg-tools-1.5b-tempfile-convert.patch, + +files/mpeg-tools-1.5b-tempfile-mpeg-encode.patch, + +files/mpeg-tools-1.5b-tempfile-tests.patch, +mpeg-tools-1.5b-r2.ebuild: + Clean up source code, fix insecure tempfile usage #107344, and let netpbm + install the converting programs eyuvtoppm/ppmtoeyuv since it has newer + versions #78777. 13 Aug 2004; Chris White <chriswhite@gentoo.org> +metadata.xml: Adding missing metadata.xml. diff --git a/media-video/mpeg-tools/Manifest b/media-video/mpeg-tools/Manifest index 26c2f96fac68..7a24fb83b5d3 100644 --- a/media-video/mpeg-tools/Manifest +++ b/media-video/mpeg-tools/Manifest @@ -1,11 +1,28 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + MD5 8d067537a06634e898b40532dd5d3233 mpeg-tools-1.5b.ebuild 1127 -MD5 0ca9d85354046cd139e1fab894900df0 mpeg-tools-1.5b-r1.ebuild 1354 -MD5 cb27980f2a27ddca280f5e6e0c56b26f ChangeLog 1420 MD5 9ef4af14dad87b03fde8e43f19e08d26 metadata.xml 225 +MD5 0ca9d85354046cd139e1fab894900df0 mpeg-tools-1.5b-r1.ebuild 1354 +MD5 5bb118a1633c2fb2320362e95a1eea26 mpeg-tools-1.5b-r2.ebuild 1620 +MD5 7c4496c93fe88c7115aa26fe3d316900 ChangeLog 1972 +MD5 0971aef5099bdb3d5c9a962c308a1d43 files/mpeg-tools-1.5b-system-jpeg.patch 893 +MD5 411d4b0fde7b753d3ff9008eb9eaefcc files/mpeg-tools-1.5b-64bit_fixes.patch 6986 +MD5 20a27f243e783c15b17079c112876d10 files/mpeg-tools-1.5b-tempfile-convert.patch 4097 +MD5 44b911d91abb56f60d64cc8b07074b11 files/mpeg-tools-1.5b-build.patch 1414 +MD5 bf748902484902bcc7eb4e616a8d04dd files/digest-mpeg-tools-1.5b-r2 73 MD5 bf748902484902bcc7eb4e616a8d04dd files/digest-mpeg-tools-1.5b-r1 73 +MD5 ac3d41c507a2fc1b1cfcf8ca91e1e983 files/mpeg-tools-1.5b-tempfile-mpeg-encode.patch 2538 +MD5 b6d276af6f148879e1569d6ea5d2077a files/mpeg-tools-1.5b-tempfile-tests.patch 5269 MD5 bf748902484902bcc7eb4e616a8d04dd files/digest-mpeg-tools-1.5b 73 -MD5 c2a255a517528ad380ddb47264c34c58 files/mpeg-tools-1.5b-64bit_fixes.patch 5849 -MD5 b45f0ebe9bad10888b67ac1d1475c0d4 files/1.5b/mpeg-tools-1.5b-fix-exit-call.patch 464 +MD5 ee6ac6a97ef340aecff643f24bc2f02c files/1.5b/mpeg-tools-1.5b-gentoo.patch 560 MD5 1c465916c02ad5e984eefda8b236fbc9 files/1.5b/libpnmrw.c 37348 +MD5 b45f0ebe9bad10888b67ac1d1475c0d4 files/1.5b/mpeg-tools-1.5b-fix-exit-call.patch 464 MD5 1f0b9c5d21516dc0b597bdd8563a7e39 files/1.5b/libpnmrw.h 6791 -MD5 ee6ac6a97ef340aecff643f24bc2f02c files/1.5b/mpeg-tools-1.5b-gentoo.patch 560 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.2 (GNU/Linux) + +iD8DBQFDOJTJgIKl8Uu19MoRAhDUAJ9gsQREkmJjxvwJcDmtAYyFupS8mQCdFpZ6 +JuurYPYoLi4GUEKbIl1OsmM= +=Q8PH +-----END PGP SIGNATURE----- diff --git a/media-video/mpeg-tools/files/digest-mpeg-tools-1.5b-r2 b/media-video/mpeg-tools/files/digest-mpeg-tools-1.5b-r2 new file mode 100644 index 000000000000..63605b69a15d --- /dev/null +++ b/media-video/mpeg-tools/files/digest-mpeg-tools-1.5b-r2 @@ -0,0 +1 @@ +MD5 ff125fb82118efc7c852f0d26d5552c6 mpeg_encode-1.5b-src.tar.gz 2028724 diff --git a/media-video/mpeg-tools/files/mpeg-tools-1.5b-64bit_fixes.patch b/media-video/mpeg-tools/files/mpeg-tools-1.5b-64bit_fixes.patch index 1f693e311a90..fa2e70304dbe 100644 --- a/media-video/mpeg-tools/files/mpeg-tools-1.5b-64bit_fixes.patch +++ b/media-video/mpeg-tools/files/mpeg-tools-1.5b-64bit_fixes.patch @@ -1,6 +1,5 @@ -diff -urN work.orig/convert/eyuvtojpeg.c work/convert/eyuvtojpeg.c ---- work.orig/convert/eyuvtojpeg.c 1995-04-14 23:16:52.000000000 +0200 -+++ work/convert/eyuvtojpeg.c 2004-01-21 21:19:20.463187922 +0100 +--- work/convert/eyuvtojpeg.c ++++ work/convert/eyuvtojpeg.c @@ -22,6 +22,7 @@ /*==============* * HEADER FILES * @@ -26,9 +25,8 @@ diff -urN work.orig/convert/eyuvtojpeg.c work/convert/eyuvtojpeg.c } -diff -urN work.orig/convert/eyuvtoppm.c work/convert/eyuvtoppm.c ---- work.orig/convert/eyuvtoppm.c 1995-04-14 23:16:52.000000000 +0200 -+++ work/convert/eyuvtoppm.c 2004-01-21 21:19:20.463187922 +0100 +--- work/convert/eyuvtoppm.c ++++ work/convert/eyuvtoppm.c @@ -22,6 +22,7 @@ /*==============* * HEADER FILES * @@ -55,9 +53,8 @@ diff -urN work.orig/convert/eyuvtoppm.c work/convert/eyuvtoppm.c } void Usage(void) -diff -urN work.orig/convert/mtv/archdep.h work/convert/mtv/archdep.h ---- work.orig/convert/mtv/archdep.h 1995-01-24 23:42:33.000000000 +0100 -+++ work/convert/mtv/archdep.h 2004-01-21 21:19:20.464187759 +0100 +--- work/convert/mtv/archdep.h ++++ work/convert/mtv/archdep.h @@ -45,16 +45,46 @@ ((char *)(to))[5] = ((char *)(from))[2]; \ ((char *)(to))[6] = ((char *)(from))[1]; \ @@ -107,9 +104,8 @@ diff -urN work.orig/convert/mtv/archdep.h work/convert/mtv/archdep.h /* Define types of specific length */ typedef char i_8; typedef short i_16; -diff -urN work.orig/convert/mtv/movieToVid.c work/convert/mtv/movieToVid.c ---- work.orig/convert/mtv/movieToVid.c 1995-01-24 23:42:33.000000000 +0100 -+++ work/convert/mtv/movieToVid.c 2004-01-21 21:19:20.465187595 +0100 +--- work/convert/mtv/movieToVid.c ++++ work/convert/mtv/movieToVid.c @@ -295,7 +295,7 @@ exit (0); } @@ -125,14 +121,17 @@ diff -urN work.orig/convert/mtv/movieToVid.c work/convert/mtv/movieToVid.c fprintf (stderr, "done\n"); + return 0; } -diff -urN work.orig/convert/ppmtoeyuv.c work/convert/ppmtoeyuv.c ---- work.orig/convert/ppmtoeyuv.c 1995-01-20 04:25:37.000000000 +0100 -+++ work/convert/ppmtoeyuv.c 2004-01-21 21:19:20.462188086 +0100 -@@ -39,6 +39,7 @@ +--- work/convert/ppmtoeyuv.c ++++ work/convert/ppmtoeyuv.c +@@ -39,6 +39,11 @@ * HEADER FILES * *==============*/ +#include <malloc.h> ++#include <unistd.h> ++#include <string.h> ++#include <stdlib.h> ++#include <ctype.h> #include <stdio.h> #include "ansi.h" @@ -153,9 +152,8 @@ diff -urN work.orig/convert/ppmtoeyuv.c work/convert/ppmtoeyuv.c } -diff -urN work.orig/mpeg_encode/bitio.c work/mpeg_encode/bitio.c ---- work.orig/mpeg_encode/bitio.c 1995-06-21 20:36:12.000000000 +0200 -+++ work/mpeg_encode/bitio.c 2004-01-21 21:19:20.458188741 +0100 +--- work/mpeg_encode/bitio.c ++++ work/mpeg_encode/bitio.c @@ -79,6 +79,8 @@ * HEADER FILES * *==============*/ @@ -165,9 +163,8 @@ diff -urN work.orig/mpeg_encode/bitio.c work/mpeg_encode/bitio.c #include <assert.h> #include "all.h" #include "byteorder.h" -diff -urN work.orig/mpeg_encode/jpeg.c work/mpeg_encode/jpeg.c ---- work.orig/mpeg_encode/jpeg.c 1995-08-05 01:35:07.000000000 +0200 -+++ work/mpeg_encode/jpeg.c 2004-01-21 21:19:20.461188250 +0100 +--- work/mpeg_encode/jpeg.c ++++ work/mpeg_encode/jpeg.c @@ -65,6 +65,8 @@ *==============*/ @@ -177,20 +174,54 @@ diff -urN work.orig/mpeg_encode/jpeg.c work/mpeg_encode/jpeg.c #include "all.h" #include "mtypes.h" #include "frames.h" -diff -urN work.orig/mpeg_encode/libpnmrw.c work/mpeg_encode/libpnmrw.c ---- work.orig/mpeg_encode/libpnmrw.c 2004-01-21 19:41:38.000000000 +0100 -+++ work/mpeg_encode/libpnmrw.c 2004-01-21 21:19:20.460188414 +0100 -@@ -27,6 +27,7 @@ +--- work/mpeg_encode/headers/libpnmrw.h ++++ work/mpeg_encode/headers/libpnmrw.h +@@ -20,9 +20,6 @@ + ** that point here, feel free to tweak or remove these declarations. + */ + #include <malloc.h> +-#if !defined(sco) && !defined(sgi) && !defined(IRIX) +-extern char* malloc(); +-#endif + /* End of configurable definitions. */ + + +--- work/mpeg_encode/libpnmrw.c ++++ work/mpeg_encode/libpnmrw.c +@@ -27,6 +27,9 @@ /* #define MSDOS */ #endif +#include <stdlib.h> ++#include <unistd.h> ++#include <errno.h> #include <stdio.h> #include "libpnmrw.h" -diff -urN work.orig/mpeg_encode/opts.c work/mpeg_encode/opts.c ---- work.orig/mpeg_encode/opts.c 1995-08-15 20:34:09.000000000 +0200 -+++ work/mpeg_encode/opts.c 2004-01-21 21:19:20.459188578 +0100 +@@ -128,11 +128,9 @@ + pm_perror( reason ) + char* reason; + { +- extern char* sys_errlist[]; +- extern int errno; + char* e; + +- e = sys_errlist[errno]; ++ e = strerror(errno); + + if ( reason != 0 && reason[0] != '\0' ) + (void) fprintf( stderr, "%s: %s - %s\n", progname, reason, e ); +@@ -361,7 +361,7 @@ + int cols, format; + { + register int col, bitshift, b; +- register int item; ++ register int item = 0; + register bit* bP; + + switch ( format ) +--- work/mpeg_encode/opts.c ++++ work/mpeg_encode/opts.c @@ -35,6 +35,7 @@ * HEADER FILES * *==============*/ @@ -199,3 +230,57 @@ diff -urN work.orig/mpeg_encode/opts.c work/mpeg_encode/opts.c #include <stdio.h> #include <string.h> #include "opts.h" +--- work/mpeg_encode/iframe.c ++++ work/mpeg_encode/iframe.c +@@ -235,6 +235,8 @@ + int SetFCodeHelper _ANSI_ARGS_((int sr)); + void CalcDistortion _ANSI_ARGS_((MpegFrame *current, int y, int x)); + ++void Mpost_UnQuantZigBlockLaplace _ANSI_ARGS_((FlatBlock in, Block out, int qscale, boolean iblock)); ++ + int + SetFCodeHelper(SR) + int SR; +--- work/convert/jmovie2jpeg.c ++++ work/convert/jmovie2jpeg.c +@@ -33,6 +33,9 @@ + ************************************************************************/ + + #include <stdio.h> ++#include <string.h> ++#include <stdlib.h> ++#include <unistd.h> + + #define HEADER_SIZE 607 /*JFIF header size used on output images*/ + +@@ -54,7 +54,6 @@ + FILE *inFile; /* Jmovie file pointer */ + FILE *outFile; /* JPEG file pointer for output file */ + FILE *audiooutfile; /* SPARC .AU audio output file pointer*/ +- extern char *malloc(); + int fd, i; /* input file descriptor and a counting variable*/ + int start, end; /* first and last frames to be extracted */ + char ofname[256]; /* output filename string */ +@@ -283,12 +283,12 @@ + if (fread (&(image_offset),sizeof(int),1,inFile) != 1) + { + perror("Error in reading image offset"); +- exit(); ++ exit(1); + } + if (fread (&(audio_tracks),sizeof(int),1,inFile) != 1) + { + perror("Error in reading audio tracks"); +- exit(); ++ exit(1); + } + if (audio_tracks != 1) + { +@@ -373,6 +373,7 @@ + fclose(inFile); + fclose(audiooutfile); + ++ return 0; + } + + diff --git a/media-video/mpeg-tools/files/mpeg-tools-1.5b-build.patch b/media-video/mpeg-tools/files/mpeg-tools-1.5b-build.patch new file mode 100644 index 000000000000..70a96c439e9c --- /dev/null +++ b/media-video/mpeg-tools/files/mpeg-tools-1.5b-build.patch @@ -0,0 +1,56 @@ +--- convert/Makefile ++++ convert/Makefile +@@ -24,7 +24,7 @@ + #CC = cc + + # compiler flags +-CFLAGS = -O -g -Wall -W -Wreturn-type -Wunused -Wmissing-prototypes $(PROFLAG) ++CFLAGS += -Wall -W -Wreturn-type -Wunused -Wmissing-prototypes $(PROFLAG) + + # if you have an ANSI C Compiler, use the following line, otherwise + # uncomment the longer .c.o rule, also +@@ -52,15 +52,6 @@ + + all: $(TARGETS) + +-ppmtoeyuv: ppmtoeyuv.c +- $(CC) -o ppmtoeyuv ppmtoeyuv.c +- +-jmovie2jpeg: jmovie2jpeg.c +- $(CC) -o jmovie2jpeg jmovie2jpeg.c +- +-mpeg_demux: mpeg_demux.c +- $(CC) -O -o mpeg_demux mpeg_demux.c +- + vidtoppm: vidtoppm.c + $(CC) -lXvid -lX11 $(INCLUDE) -o vidtoppm vidtoppm.c + +--- convert/mtv/Makefile ++++ convert/mtv/Makefile +@@ -4,7 +4,7 @@ + + PURIFY = $(PURIFYHOME)/purify + +-CFLAGS= -g -I. ++CFLAGS+= -I. + + #CFLAGS= -O -DLITTLE_ENDIEN + LFLAGS= +@@ -15,7 +15,7 @@ + default: movieToVid + + movieToVid: movieToVid.o +- cc ${CFLAGS} -o movieToVid movieToVid.o ++ $(CC) $(CFLAGS) -o movieToVid movieToVid.o + + clean: + rm -f core lintout makeout tags Makefile.bak *.o \ +--- mpeg_encode/Makefile.orig 2005-09-26 16:01:51.000000000 -0400 ++++ mpeg_encode/Makefile 2005-09-26 16:02:11.000000000 -0400 +@@ -97,5 +97,5 @@ + + # gcc +-CFLAGS = $(INCLUDEDIR) $(DEBUGFLAG) -Wall -Wmissing-prototypes $(PROFLAG) $(PROTOFLAG) ++CFLAGS += $(INCLUDEDIR) -Wall -Wmissing-prototypes $(PROFLAG) $(PROTOFLAG) + + # gcc-strict diff --git a/media-video/mpeg-tools/files/mpeg-tools-1.5b-system-jpeg.patch b/media-video/mpeg-tools/files/mpeg-tools-1.5b-system-jpeg.patch new file mode 100644 index 000000000000..7be3905577c3 --- /dev/null +++ b/media-video/mpeg-tools/files/mpeg-tools-1.5b-system-jpeg.patch @@ -0,0 +1,38 @@ +Use the system jpeg rather than the bundled one + +--- mpeg_encode/Makefile ++++ mpeg_encode/Makefile +@@ -36,9 +36,9 @@ + ############## + # JPEG STUFF # + ############## +-JPEG_LIB = jpeg/libjpeg.a +-JPEG_DIR = -Ijpeg +-JPEG_LIB_DIR = -Ljpeg ++JPEG_LIB = -ljpeg ++JPEG_DIR = ++JPEG_LIB_DIR = + MP_JPEG_OBJS = jpeg.o + MP_JPEG_SRCS = jpeg.c + +@@ -57,7 +57,7 @@ + ################# + # INCLUDE FILES # + ################# +-INCLUDEDIR = -Iheaders -I/usr/include $(JPEG_DIR) ++INCLUDEDIR = -Iheaders + + ############################################################################ + # LIBRARIES # specify library directories; need jpg lib and maybe pbm # +--- mpeg_encode/jpeg.c ++++ mpeg_encode/jpeg.c +@@ -79,7 +79,8 @@ + + /* make it happier.... */ + #undef DCTSIZE2 +-#include "jpeg/jpeglib.h" ++#include "jpeglib.h" ++#include "jpegint.h" + + + #define HEADER_SIZE 607 /*JFIF header size used on output images*/ diff --git a/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-convert.patch b/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-convert.patch new file mode 100644 index 000000000000..2bab1511bf59 --- /dev/null +++ b/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-convert.patch @@ -0,0 +1,169 @@ +--- convert/eyuvtojpeg.c ++++ convert/eyuvtojpeg.c +@@ -25,6 +25,7 @@ + #include <string.h> + #include <stdio.h> + #include <stdlib.h> ++#include <unistd.h> + #include <malloc.h> + + typedef unsigned char uint8; +@@ -47,8 +48,9 @@ + int main(int argc, char **argv) + { + FILE *fpointer; +- char command[256]; +- char src[256], dest[256]; ++ char command[4096]; ++ char src[4096], dest[4096], tempfile[4096]; ++ int ret; + + if ((strcmp(argv[1],"-?") == 0) || + (strcmp(argv[1],"-h") == 0) || +@@ -99,14 +101,16 @@ + YUVtoPPM(); + + fprintf(stdout, "Writing PPM\n"); +- fpointer = fopen("/tmp/foobar", "w"); ++ sprintf(tempfile, "%s.tmp", dest); ++ fpointer = fopen(tempfile, "w"); + WritePPM(fpointer); + fclose(fpointer); + + fprintf(stdout, "Converting to JPEG %s\n", dest); +- sprintf(command, "cjpeg /tmp/foobar > %s", dest); +- system(command); +- return 0; ++ sprintf(command, "cjpeg %s > %s", tempfile, dest); ++ ret = system(command); ++ unlink(tempfile); ++ return ret; + } + + +--- convert/vidtoeyuv.c ++++ convert/vidtoeyuv.c +@@ -125,9 +125,9 @@ + XImage *ximage; + char *tdata; + char *obase; +- char ofname[256]; ++ char ofname[4096], tempfile[4096]; + int height, width; +- char command[256]; ++ char command[4096]; + int nth; + + if ((argc != 7) && (argc != 8))usage (argv[0]); +@@ -223,9 +223,11 @@ + + + sprintf(ofname, "%s%d.yuv", obase, i); +- outFile = fopen("/tmp/foobar", "w"); ++ sprintf(tempfile, "%s%d.yuv.tmp", obase, i); ++ outFile = fopen(tempfile, "w"); + if (!outFile) { + perror("Couldn't open output file."); ++ exit(1); + } + + for (r=0; r<height; r++) { +@@ -241,9 +243,10 @@ + + free(tdata); + +- sprintf(command, "rawtoppm %d %d < /tmp/foobar | ppmtoyuv > %s", +- width, height, ofname); ++ sprintf(command, "rawtoppm %d %d < %s | ppmtoyuv > %s", ++ width, height, tempfile, ofname); + system(command); ++ unlink(tempfile); + + for (j=0; j<nth-1; j++) { + if (read (fd, &image, sizeof(image)) != sizeof(image)) { +--- convert/vidtojpeg.c ++++ convert/vidtojpeg.c +@@ -123,9 +123,9 @@ + XImage *ximage; + char *tdata; + char *obase; +- char ofname[256]; ++ char ofname[4096], tempfile[4096]; + int height, width; +- char command[256]; ++ char command[4096]; + + + if ((argc != 7) && (argc != 8))usage (argv[0]); +@@ -221,9 +221,11 @@ + + + sprintf(ofname, "%s.%d.jpeg", obase, i); +- outFile = fopen("/tmp/foobar", "w"); ++ sprintf(tempfile, "%s.%d.jpeg.tmp", obase, i); ++ outFile = fopen(tempfile, "w"); + if (!outFile) { + perror("Couldn't open output file."); ++ exit(1); + } + + for (r=0; r<height; r++) { +@@ -239,9 +241,10 @@ + + free(tdata); + +- sprintf(command, "rawtoppm %d %d < /tmp/foobar | cjpeg > %s", +- width, height, ofname); ++ sprintf(command, "rawtoppm %d %d < %s | cjpeg > %s", ++ width, height, tempfile, ofname); + system(command); ++ unlink(tempfile); + } + } + +--- convert/vidtoppm.c ++++ convert/vidtoppm.c +@@ -220,9 +220,11 @@ + + + sprintf(ofname, "%s%d.ppm", obase, i); +- outFile = fopen("/tmp/foobar", "w"); ++ sprintf(tempfile, "%s%d.ppm.tmp", obase, i); ++ outFile = fopen(tempfile, "w"); + if (!outFile) { + perror("Couldn't open output file."); ++ exit(1); + } + + for (r=0; r<height; r++) { +@@ -238,8 +240,9 @@ + + free(tdata); + +- sprintf(command, "rawtoppm %d %d < /tmp/foobar > %s", +- width, height, ofname); ++ sprintf(command, "rawtoppm %d %d < %s > %s", ++ width, height, tempfile, ofname); + system(command); ++ unlink(tempfile); + } + } +--- convert/eyuvtoppm.c ++++ convert/eyuvtoppm.c +@@ -100,13 +100,9 @@ + fpointer = fopen(dest, "w"); + if (fpointer == NULL) { + fprintf(stderr, "Problems opening %s!\n", dest); +- fprintf(stderr, "Trying /tmp/foobar instead\n"); +- strcpy(dest, "/tmp/foobar"); +- fpointer = fopen(dest, "w"); +- if (fpointer == NULL) { +- fprintf(stderr, "Nope, exiting.\n"); +- exit(1); +- }} ++ perror(""); ++ exit(1); ++ } + + WritePPM(fpointer); + fclose(fpointer); diff --git a/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-mpeg-encode.patch b/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-mpeg-encode.patch new file mode 100644 index 000000000000..1b33bc5dd1c8 --- /dev/null +++ b/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-mpeg-encode.patch @@ -0,0 +1,87 @@ +--- mpeg_encode/parallel.c ++++ mpeg_encode/parallel.c +@@ -586,6 +586,8 @@ + * SIDE EFFECTS: none + * + *===========================================================================*/ ++/* internal hook into the ReadFrame function */ ++void _ReadFrame(MpegFrame *frame, char *fileName, FILE *fileHook, char *conversion, boolean addPath); + void + GetRemoteFrame(frame, frameNumber) + MpegFrame *frame; +@@ -615,8 +617,13 @@ + + if ( frameNumber != -1 ) { + if ( separateConversion ) { +- sprintf(fileName, "/tmp/foobar%d", machineNumber); +- filePtr = fopen(fileName, "wb"); ++ int fd; ++ snprintf(fileName, sizeof(fileName), "/tmp/mpeg_encode_foobar%dXXXXXX", machineNumber); ++ fd = mkstemp(fileName); ++ if (fd == -1 || (filePtr = fdopen(fd, "wb")) == NULL) { ++ perror("ERROR: mpeg_encode->GetRemoteFrame"); ++ exit(1); ++ } + + /* read in stuff, SafeWrite to file, perform local conversion */ + do { +@@ -628,10 +635,12 @@ + fwrite(smallBuffer, 1, numBytes, filePtr); + } while ( numBytes == 1000 ); + fflush(filePtr); +- fclose(filePtr); ++ rewind(filePtr); + + /* now do slave conversion */ +- ReadFrame(frame, fileName, slaveConversion, FALSE); ++ _ReadFrame(frame, NULL, filePtr, slaveConversion, FALSE); ++ /* _ReadFrame() will close the file pointer for us */ ++ /* fclose(filePtr); */ + } else { + Frame_AllocYCC(frame); + +--- mpeg_encode/readframe.c ++++ mpeg_encode/readframe.c +@@ -227,14 +227,22 @@ + * SIDE EFFECTS: none + * + *===========================================================================*/ ++void _ReadFrame(MpegFrame *frame, char *fileName, FILE *fileHook, char *conversion, boolean addPath); ++ ++void ReadFrame(MpegFrame *frame, char *fileName, char *conversion, boolean addPath) ++{ ++ _ReadFrame(frame, fileName, NULL, conversion, addPath); ++} ++ + void +-ReadFrame(frame, fileName, conversion, addPath) ++_ReadFrame(frame, fileName, fileHook, conversion, addPath) + MpegFrame *frame; + char *fileName; ++ FILE *fileHook; + char *conversion; + boolean addPath; + { +- FILE *ifp; ++ FILE *ifp = fileHook; + char command[1024]; + char fullFileName[1024]; + MpegFrame tempFrame; +@@ -274,6 +282,9 @@ + } + #endif + ++ if (fileHook) ++ goto file_is_already_opened; ++ + if ( fileType == ANY_FILE_TYPE ) { + char *convertPtr, *commandPtr, *charPtr; + +@@ -325,6 +336,7 @@ + exit(1); + } + ++file_is_already_opened: + switch(baseFormat) { + case YUV_FILE_TYPE: + diff --git a/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-tests.patch b/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-tests.patch new file mode 100644 index 000000000000..d766786b6eed --- /dev/null +++ b/media-video/mpeg-tools/files/mpeg-tools-1.5b-tempfile-tests.patch @@ -0,0 +1,203 @@ +When running tests, don't use /tmp for obvious reasons + +Also rewrite the diffscript in sh since csh isnt always available + +--- mepg_encode/Makefile ++++ mepg_encode/Makefile +@@ -187,16 +187,16 @@ + ######### + + test: +- rm -f /tmp/ts.stat +- ./mpeg_encode -stat /tmp/ts.stat ./tst/ts.param +- csh ./tst/diffscript /tmp/ts.stat ./tst/ts.stat /tmp/ts.mpg ./tst/ts.mpg ++ rm -f ./tst/ts.stat.new ++ ./mpeg_encode -stat ./tst/ts.stat.new ./tst/ts.param ++ sh ./tst/diffscript.sh ./tst/ts.stat.new ./tst/ts.stat ./tst/ts.mpg.new ./tst/ts.mpg + + testd: +- rm -f /tmp/tsd.stat +- ./mpeg_encode -stat /tmp/tsd.stat ./tst/tsd.param +- csh ./tst/diffscript /tmp/tsd.stat ./tst/tsd.stat /tmp/tsd.mpg ./tst/tsd.mpg ++ rm -f ./tst/tsd.stat.new ++ ./mpeg_encode -stat ./tst/tsd.stat.new ./tst/tsd.param ++ sh ./tst/diffscript.sh ./tst/tsd.stat.new ./tst/tsd.stat ./tst/tsd.mpg.new ./tst/tsd.mpg + +-test_all: test testd ++test_all check: test testd + + ############ + # BINARIES # +--- mepg_encode/tst/diffscript.sh ++++ mepg_encode/tst/diffscript.sh +@@ -0,0 +1,16 @@ ++diff $1 $2 > ./tst/foobar ++egrep Blocks ./tst/foobar > ./tst/blockbar ++ ++if test ! -s ./tst/blockbar ; then ++ diff $3 $4 > ./tst/foobar.mpg ++ if test -s ./tst/foobar.mpg ; then ++ echo "FAILURE! (different output -- probably endian bug). Please send bug report." ++ exit 1 ++ else ++ echo "SUCCESS." ++ exit 0 ++ fi ++else ++ echo "FAILURE! (different exection). Please send bug report." ++ exit 1 ++fi +--- mpeg_encode/tst/test_all ++++ mpeg_encode/tst/test_all +@@ -1,19 +1,19 @@ + #!/bin/csh -f + cd .. +-echo "First we encode three mpegs... (note requires 5MB on /tmp)" +-rm -f /tmp/ts{,2,d}.{mpg,stat} +-./mpeg_encode -stat /tmp/ts.stat ./tst/ts.param +-./mpeg_encode -stat /tmp/ts2.stat ./tst/ts2.param +-./mpeg_encode -stat /tmp/tsd.stat ./tst/tsd.param ++echo "First we encode three mpegs... (note requires 5MB in ./tst)" ++rm -f ./tst/ts{,2,d}.{mpg,stat}.new ++./mpeg_encode -stat ./tst/ts.stat.new ./tst/ts.param ++./mpeg_encode -stat ./tst/ts2.stat.new ./tst/ts2.param ++./mpeg_encode -stat ./tst/tsd.stat.new ./tst/tsd.param + + cd tst + + echo "Test one - tst/ts.param" +-csh diffscript /tmp/ts.stat ts.stat /tmp/ts.mpg ts.mpg ++sh diffscript.sh ./tst/ts.stat ts.stat ./tst/ts.mpg ts.mpg + + echo "Test two - tst/ts2.param (different pattern)" +-csh diffscript /tmp/ts2.stat ts2.stat /tmp/ts2.mpg ts2.mpg ++sh diffscript.sh ./tst/ts2.stat ts2.stat ./tst/ts2.mpg ts2.mpg + + echo "Test three - tst/tsd.param (uses decoded frames)" +-csh diffscript /tmp/tsd.stat tsd.stat /tmp/tsd.mpg tsd.mpg ++sh diffscript.sh ./tst/tsd.stat tsd.stat ./tst/tsd.mpg tsd.mpg + +--- mpeg_encode/tst/diffscript ++++ mpeg_encode/tst/diffscript +@@ -3,23 +3,23 @@ + # + # NOTE: if this script doesn't work, then basically all you need to know + # is that the stat files should be the same except for the times. +-# So the /tmp/blockbar below should be empty if the test succeeded, and non- ++# So the ./blockbar below should be empty if the test succeeded, and non- + # empty if it failed. Then the .mpg files are compared. + # + +-rm -f /tmp/foobar +-rm -f /tmp/blockbar ++rm -f ./foobar ++rm -f ./blockbar + +-diff $1 $2 > /tmp/foobar ++diff $1 $2 > ./foobar + +-# /tmp/foobar must exist, since starting times will be different ++# ./foobar must exist, since starting times will be different + +-egrep Blocks /tmp/foobar > /tmp/blockbar ++egrep Blocks ./foobar > ./blockbar + +-# /tmp/blockbar may or may not exist +-if ( -z /tmp/blockbar ) then +- diff $3 $4 > /tmp/foobar.mpg +- if ( -z /tmp/foobar.mpg ) then ++# ./blockbar may or may not exist ++if ( -z ./blockbar ) then ++ diff $3 $4 > ./foobar.mpg ++ if ( -z ./foobar.mpg ) then + echo "SUCCESS." + else + echo "FAILURE! (different output -- probably endian bug). Please send bug report." +--- mpeg_encode/tst/ts.param ++++ mpeg_encode/tst/ts.param +@@ -1,7 +1,7 @@ + # test suite parameter file + + PATTERN IBBPBBPBBP +-OUTPUT /tmp/ts.mpg ++OUTPUT ./tst/ts.mpg.new + + YUV_SIZE 352x240 + +--- mpeg_encode/tst/tsd.param ++++ mpeg_encode/tst/tsd.param +@@ -1,7 +1,7 @@ + # test suite parameter file + + PATTERN IBBBPBBBBP +-OUTPUT /tmp/tsd.mpg ++OUTPUT ./tst/tsd.mpg.new + + YUV_SIZE 352x240 + +--- mpeg_encode/tst/gop.param ++++ mpeg_encode/tst/gop.param +@@ -1,7 +1,7 @@ + # test suite parameter file + + PATTERN IBPBIBPBPB +-OUTPUT /tmp/ts.mpg ++OUTPUT ./tst/ts.mpg.new + + YUV_SIZE 352x240 + +--- mpeg_encode/tst/short.param ++++ mpeg_encode/tst/short.param +@@ -1,7 +1,7 @@ + # test suite parameter file + + PATTERN IBBBPBBB +-OUTPUT /tmp/ts.mpg ++OUTPUT ./tst/ts.mpg.new + + YUV_SIZE 352x240 + +--- mpeg_encode/tst/ts2.param ++++ mpeg_encode/tst/ts2.param +@@ -2,7 +2,7 @@ + + PATTERN IBBPBBPBB + +-OUTPUT /tmp/ts2.mpg ++OUTPUT ./tst/ts2.mpg.new + + YUV_SIZE 352x240 + +--- mpeg_encode/tst/ts3.param ++++ mpeg_encode/tst/ts3.param +@@ -1,7 +1,7 @@ + # test suite parameter file + + PATTERN IBPB +-OUTPUT /tmp/ts.mpg ++OUTPUT ./tst/ts.mpg.new + + YUV_SIZE 352x240 + +--- mpeg_encode/tst/ts4.param ++++ mpeg_encode/tst/ts4.param +@@ -1,7 +1,7 @@ + # test suite parameter file + + PATTERN IBBBPBBBBP +-OUTPUT /tmp/ts.mpg ++OUTPUT ./tst/ts.mpg.new + + YUV_SIZE 352x240 + +--- mpeg_encode/tst/tstl.param ++++ mpeg_encode/tst/tstl.param +@@ -1,7 +1,7 @@ + # test suite parameter file + + PATTERN IBBBPBBBBP +-OUTPUT /tmp/ts.mpg ++OUTPUT ./tst/ts.mpg.new + + YUV_SIZE 352x240 + diff --git a/media-video/mpeg-tools/mpeg-tools-1.5b-r2.ebuild b/media-video/mpeg-tools/mpeg-tools-1.5b-r2.ebuild new file mode 100644 index 000000000000..a8290ab55c06 --- /dev/null +++ b/media-video/mpeg-tools/mpeg-tools-1.5b-r2.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-video/mpeg-tools/mpeg-tools-1.5b-r2.ebuild,v 1.1 2005/09/27 00:38:43 vapier Exp $ + +inherit eutils + +MY_PN=mpeg_encode +DESCRIPTION="Tools for MPEG video" +HOMEPAGE="http://bmrc.berkeley.edu/research/mpeg/mpeg_encode.html" +SRC_URI="ftp://mm-ftp.cs.berkeley.edu/pub/multimedia/mpeg/encode/${MY_PN}-${PV}-src.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="-*" +IUSE="" + +DEPEND="virtual/x11" + +S=${WORKDIR}/${MY_PN} + +src_unpack () { + unpack ${A} + cd "${WORKDIR}" + epatch "${FILESDIR}"/${P}-build.patch + epatch "${FILESDIR}"/${P}-64bit_fixes.patch + epatch "${FILESDIR}"/${P}-tempfile-convert.patch + cd "${S}" + rm -r jpeg + epatch "${FILESDIR}"/${P}-system-jpeg.patch + epatch "${FILESDIR}"/${P}-tempfile-mpeg-encode.patch + epatch "${FILESDIR}"/${P}-tempfile-tests.patch +} + +src_compile() { + emake || die "make" + emake -C convert || die "make convert" + emake -C convert/mtv || die "make mtv" +} + +src_install () { + dobin mpeg_encode || die "dobin mpeg_encode" + doman docs/*.1 + dodoc BUGS CHANGES README TODO VERSION + dodoc docs/EXTENSIONS docs/INPUT.FORMAT docs/*.param docs/param-summary + docinto examples + dodoc examples/* + + cd ../convert + dobin eyuvtojpeg jmovie2jpeg mpeg_demux mtv/movieToVid || die "dobin convert utils" + newdoc README README.convert + newdoc mtv/README README.mtv +} + +pkg_postinst() { + if [[ -z $(best_version media-libs/netpbm) ]] ; then + einfo "If you are looking for eyuvtoppm or ppmtoeyuv, please" + einfo "emerge the netpbm package. It has updated versions." + fi +} |