From mreimer@bilbo.vpop.net  Fri Jul 25 08:27:15 2003
Return-Path: <mreimer@bilbo.vpop.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id CDEFB37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jul 2003 08:27:15 -0700 (PDT)
Received: from bilbo.vpop.net (bilbo.vpop.net [65.103.33.41])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D720343F93
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jul 2003 08:27:14 -0700 (PDT)
	(envelope-from mreimer@bilbo.vpop.net)
Received: from bilbo.vpop.net (localhost [127.0.0.1])
	by bilbo.vpop.net (8.12.9/8.12.8) with ESMTP id h6PFSrcw000688
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jul 2003 10:28:54 -0500 (CDT)
	(envelope-from mreimer@bilbo.vpop.net)
Received: (from mreimer@localhost)
	by bilbo.vpop.net (8.12.9/8.12.8/Submit) id h6LHs8do015064;
	Mon, 21 Jul 2003 12:54:08 -0500 (CDT)
Message-Id: <200307211754.h6LHs8do015064@bilbo.vpop.net>
Date: Mon, 21 Jul 2003 12:54:08 -0500 (CDT)
From: Matthew Reimer <mreimer@vpop.net>
Reply-To: Matthew Reimer <mreimer@vpop.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: PATCH: fix mjpegtools divx tools segfaults
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         54855
>Category:       ports
>Synopsis:       PATCH: fix multimedia/mjpegtools divx tools segfaults
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lioux
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 25 08:30:19 PDT 2003
>Closed-Date:    Sat Jun 26 04:33:08 GMT 2004
>Last-Modified:  Sat Jun 26 04:33:08 GMT 2004
>Originator:     Matthew Reimer
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
>Environment:
System: FreeBSD bilbo.vpop.net 4.8-STABLE FreeBSD 4.8-STABLE #6: Sat Jul 5 14:18:50 CDT 2003 root@bilbo.vpop.net:/usr/obj/usr/src/sys/BILBO i386


	-stable
	mjpegtools 1.6.1
	avifile-0.7.34.20030319,2

>Description:
	Running any of the divx tools (lav2divx, yuv2divx, divxdec)
	results in a segfault.
>How-To-Repeat:
	Run any of the divx tools (lav2divx, yuv2divx, divxdec).
	
>Fix:

	From http://sourceforge.net/mailarchive/message.php?msg_id=4333933:


--- lavtools/divxdec.cpp.orig	Mon Jul 21 12:37:07 2003
+++ lavtools/divxdec.cpp	Mon Jul 21 12:11:58 2003
@@ -106,7 +106,7 @@
 #include <sys/time.h>
 #include <unistd.h>		// Needed for the access call to check if file exists
 #include <getopt.h>		// getopt
-#include <stdint.h>		// standard integer types
+#include <sys/types.h>		// standard integer types
 #include <stdlib.h>		// standard library with integer division
 #include <stdio.h>
 #include <config.h>
@@ -211,7 +211,7 @@
 		fmt = RIFFINFO_IYUV;
 	}
 // only in avifile-0.6
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 	else if ( caps & IVideoDecoder::CAP_I420 )
 	{
 		fmt = RIFFINFO_I420;
@@ -595,7 +595,7 @@
 			// end of data, yes?
 			return 0;
 		}
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 		currentFrame.inputBuffer = imsrc->Data ();
 #else
 		currentFrame.inputBuffer = imsrc->data ();
@@ -634,7 +634,7 @@
 			break;
 		}
 		// done with image.  ( was delete imsrc; )
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 		imsrc->Release() ;
 #else
 		imsrc->release() ;
@@ -944,7 +944,7 @@
 		mjpeg_debug ( "VIDEO: Using decoder %s", sFourCC );
 		fourCCToString ( input.files[input.currentFile].outputCodec, sFourCC );
 		mjpeg_debug ( "VIDEO: Using interim YUV format %s", sFourCC );
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 		input.files[input.currentFile].frames = input.invstream->GetLength ();
 #else
 		input.files[input.currentFile].frames = input.invstream->GetEndPos ();
@@ -957,7 +957,7 @@
 		input.inastream->StartStreaming ();
 		if ( input.files[input.currentFile].frames == 0)
 		{
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 			input.files[input.currentFile].frames = input.inastream->GetLength ();
 #else
 			input.files[input.currentFile].frames = input.inastream->GetEndPos ();
@@ -973,14 +973,14 @@
 		// key frame.
 		if ( input.processVideo )
 		{
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 			framepos_t fp = input.invstream->SeekToKeyFrame ( firstFrame );
 #else
 			framepos_t fp = input.invstream->SeekToKeyframe ( firstFrame );
 #endif
 			if ( input.processAudio )
 			{
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 				double pos = input.invstream->GetTime ( max( 0, fp - 1 ) );
 				input.inastream->SeekTime ( pos );
 #else
@@ -1284,7 +1284,7 @@
 	exit (1);
 }
 
-FILE* real_stdout;
+FILE real_stdout;
 
 int
 main (int argc, char **argv)
@@ -1309,16 +1309,20 @@
 	std::cout.rdbuf ( std::cerr.rdbuf () );
 	//
 	// 4. keep old stdout FILE, and use stderr in its place (for printf ("...") ; )
-	real_stdout = stdout ;
-	stdout = stderr;
+	real_stdout = *stdout ;
+	*stdout = *stderr;
 
 	displayGreeting();
 
 	if ( GetAvifileVersion (  ) != AVIFILE_VERSION )
 	{
-		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %.2f but the library is %.2f"
-				, AVIFILE_VERSION
-				, GetAvifileVersion () );
+		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %d.%d.%d but the library is %d.%d.%d"
+				, AVIFILE_VERSION >> 16
+				, (AVIFILE_VERSION >> 8) & 0xff
+				, AVIFILE_VERSION & 0xff
+				, GetAvifileVersion () >> 16
+				, (GetAvifileVersion () >> 8) & 0xff
+				, GetAvifileVersion () & 0xff);
 	}
 
 	( void ) mjpeg_default_handler_verbosity ( 3 );
@@ -1583,7 +1587,7 @@
 				inastream = file->GetStream ( 0, AviStream::Audio );
 				mjpeg_debug ( "AUDIO stream queried" );
 			}
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 			input.files[i].frames = invstream->GetLength();
 #else
 			input.files[i].frames = invstream->GetEndPos ();
@@ -1733,7 +1737,7 @@
 		if ( 0 == strcmp ( "-", filenameYUV ) )
 		{
 			//output.fdYUV = FD_STDOUT;
-			output.fdYUV = fileno ( real_stdout );
+			output.fdYUV = fileno ( &real_stdout );
 		}
 		else
 		{
@@ -2042,7 +2046,7 @@
 	freeAll ();
 	// reassign cout, stdout to their original values.
 	std::cout.rdbuf ( real_cout );
-	stdout = real_stdout;
+	*stdout = real_stdout;
 
 	mjpeg_info ( " " );
 	mjpeg_info ( "Done. %i frames", output.processedFrames );


--- lavtools/lav2divx.cpp.orig	Mon Jul 21 12:33:21 2003
+++ lavtools/lav2divx.cpp	Mon Jul 21 12:11:43 2003
@@ -218,7 +218,7 @@
 	printf ( "  -s --forcedaudiorate\taudio sample rate of input file (Hz);\n\t\t\tuse only if avifile gets it wrong\n" );
 	printf ( "  -n --noise\t\tnoise filter (0..2, default 0)\n" );
 	printf ( "  -g --guess\t\tguess values for -c and -z options\n" );
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 	printf ( "  -L --listcodecs\tdisplay available avifile codecs (LONG)\n" );
 	printf ( "  -k --keyframes\tset keyframes attribute (default 15)\n" );
 	printf ( "  -C --crispness\tset crispness attribute (default 20)\n" );
@@ -256,7 +256,7 @@
 	mjpeg_info ( "-----------------------------" );
 }
 
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 static void
 listCodecs ( )
 {
@@ -289,9 +289,13 @@
 
 	if ( GetAvifileVersion (  ) != AVIFILE_VERSION )
 	{
-		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %s but the library is %s"
-			, AVIFILE_VERSION
-			, GetAvifileVersion (  ) );
+		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %d.%d.%d but the library is %d.%d.%d"
+			, AVIFILE_VERSION >> 16
+			, (AVIFILE_VERSION >> 8) & 0xff
+			, AVIFILE_VERSION & 0xff
+			, GetAvifileVersion (  ) >> 16
+			, (GetAvifileVersion (  ) >> 8) & 0xff
+			, GetAvifileVersion (  ) & 0xff);
 	}
 
 	( void ) mjpeg_default_handler_verbosity ( 1 );
@@ -315,7 +319,7 @@
 	int opt_h = 0;
 
 	int opt_mono = 0;
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 	int opt_keyframes = 15;
 	int opt_crispness = 20;
 #endif
@@ -379,7 +383,7 @@
 			{"video_stream", required_argument, NULL, 'V'},
 			{"number_cpus", required_argument, NULL, 'U'},
 			{"outputfile", required_argument, NULL, 'o'},
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 			{"keyframes", required_argument, NULL, 'k'},
 			{"crispness", required_argument, NULL, 'C'},
 			{"listcodecs", no_argument, NULL, 'L'},
@@ -391,7 +395,7 @@
 		};
 
 		copt =
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 			getopt_long ( argc, argv, "LE:fa:e:c:b:o:s:gmvk:C:", long_options, &option_index );
 #else
 			getopt_long ( argc, argv, "E:fa:e:c:b:o:s:gmv", long_options, &option_index );
@@ -449,7 +453,7 @@
 			outputfile = optarg;
 			break;
 
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 		case 'k':
 			opt_keyframes = atoi ( optarg );
 			break;
@@ -681,7 +685,7 @@
 
 	avifile = CreateIAviWriteFile ( outputfile );
 
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 	const CodecInfo *codecInfo = CodecInfo::match ( fccHandler );
 	if (codecInfo == NULL)
 	{

--- lavtools/libavifile.h.orig	Thu Apr 25 00:49:12 2002
+++ lavtools/libavifile.h	Mon Jul 21 12:13:05 2003
@@ -32,18 +32,18 @@
 #include <videoencoder.h>
 
 // Correct the version numbers
-#if AVIFILE_MAJOR_VERSION == 0
-#if AVIFILE_MINOR_VERSION == 6
-#undef AVIFILE_MINOR_VERSION
-#define AVIFILE_MINOR_VERSION 60
-#elif AVIFILE_MINOR_VERSION == 7
-#undef AVIFILE_MINOR_VERSION
-#define AVIFILE_MINOR_VERSION 70
-#endif /* AVIFILE_MINOR_VERSION == 6/7 */
-#endif /* AVIFILE_MAJOR_VERSION == 0 */
+//#if AVIFILE_MAJOR_VERSION == 0
+//#if AVIFILE_MINOR_VERSION == 6
+//#undef AVIFILE_MINOR_VERSION
+//#define AVIFILE_MINOR_VERSION 60
+//#elif AVIFILE_MINOR_VERSION == 7
+//#undef AVIFILE_MINOR_VERSION
+//#define AVIFILE_MINOR_VERSION 70
+//#endif /* AVIFILE_MINOR_VERSION == 6/7 */
+//#endif /* AVIFILE_MAJOR_VERSION == 0 */
 
 // Import version-dependent headers
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION < 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION < 6
 #include <aviutil.h>
 typedef unsigned int framepos_t;
 #else

--- lavtools/yuv2divx.cpp.orig	Mon Jul 21 12:33:21 2003
+++ lavtools/yuv2divx.cpp	Mon Jul 21 12:16:28 2003
@@ -267,7 +267,7 @@
 	printf ( "  -d --droplsb\t\tdrop x least significant bits (0..3, default 0)\n" );
 	printf ( "  -n --noise\t\tnoise filter (0..2, default 0)\n" );
 	printf ( "  -g --guess\t\tguess values for -c and -z options\n" );
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 	printf ( "  -k --keyframes\tset keyframes attribute (default 15)\n" );
 	printf ( "  -C --crispness\tset crispness attribute (default 20)\n" );
 	printf ( "  -L --listcodecs\tshow the list of avifile codecs (LONG!)\n" );
@@ -306,7 +306,7 @@
 	mjpeg_info ( "-----------------------------" );
 }
 
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 static void
 listCodecs ( )
 {
@@ -340,9 +340,13 @@
 
 	if ( GetAvifileVersion (  ) != AVIFILE_VERSION )
 	{
-		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %s but the library is %s"
-			, AVIFILE_VERSION
-			, GetAvifileVersion (  ) );
+		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %d.%d.%d but the library is %d.%d.%d"
+			, AVIFILE_VERSION >> 16
+			, (AVIFILE_VERSION >> 8) & 0xff
+			, AVIFILE_VERSION & 0xff
+			, GetAvifileVersion (  ) >> 16
+			, (GetAvifileVersion (  ) >> 8) & 0xff
+			, GetAvifileVersion (  ) & 0xff);
 	}
 
 	( void ) mjpeg_default_handler_verbosity ( 1 );
@@ -380,7 +384,7 @@
 
 	int audio_bytes;
 
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 	int opt_keyframes = 15;
 	int opt_crispness = 20;
 #endif
@@ -429,7 +433,7 @@
 			{"outputfile", required_argument, NULL, 'o'},
 			{"droplsb", required_argument, NULL, 'd'},
 			{"noise", required_argument, NULL, 'n'},
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 			{"keyframes", required_argument, NULL, 'k'},
 			{"crispness", required_argument, NULL, 'C'},
 			{"listcodecs", no_argument, NULL, 'L' },
@@ -441,7 +445,7 @@
 		};
 
 		copt =
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 			getopt_long ( argc, argv, "F:E:A:a:w:h:e:c:b:o:s:n:d:gvVLk:C:", long_options, &option_index );
 #else
 			getopt_long ( argc, argv, "F:E:A:a:w:h:e:c:b:o:s:n:d:gvV", long_options, &option_index );
@@ -503,7 +507,7 @@
 			audioexist = 1;
 			break;
 
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 		case 'k':
 			opt_keyframes = atoi ( optarg );
 			break;
@@ -769,7 +773,7 @@
 
 	avifile = CreateIAviWriteFile ( outputfile );
 
-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
+#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 	const CodecInfo *codecInfo = CodecInfo::match ( opt_codec );
 	if ( codecInfo == NULL )
 	{
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->lioux 
Responsible-Changed-By: arved 
Responsible-Changed-When: Mon Jul 28 01:09:17 PDT 2003 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54855 

From: Anish Mistry <mistry.7@osu.edu>
To: freebsd-gnats-submit@FreeBSD.org, mreimer@vpop.net
Cc:  
Subject: Re: ports/54855: PATCH: fix mjpegtools divx tools segfaults
Date: Thu, 13 Nov 2003 02:50:16 -0500

 --Boundary-00=_5ezs/icFgczWafD
 Content-Type: multipart/signed;
   charset="us-ascii";
   protocol="application/pgp-signature";
   micalg=pgp-sha1;
   boundary="Boundary-02=_Afzs/wdkbgprLWZ";
   name=" "
 Content-Transfer-Encoding: 7bit
 
 --Boundary-02=_Afzs/wdkbgprLWZ
 Content-Type: text/plain;
   charset="us-ascii"
 Content-Transfer-Encoding: quoted-printable
 Content-Description: signed data
 Content-Disposition: inline
 
 The patch works for me.  I've attached an updated diff against the current=
 =20
 port skeleton since this super patch takes care of the=20
 patch-lavtools::divxdec.cpp patch too.
 =2D-=20
 Anish Mistry
 
 --Boundary-02=_Afzs/wdkbgprLWZ
 Content-Type: application/pgp-signature
 Content-Description: signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.3 (FreeBSD)
 
 iD8DBQA/szfAxqA5ziudZT0RAsIDAJ4lSavMAQyfvZ5sbcCMggdKC2yMRwCeNi1a
 IiEd9p4uPjRr4Xq70Ymwu3c=
 =3SKG
 -----END PGP SIGNATURE-----
 
 --Boundary-02=_Afzs/wdkbgprLWZ--
 
 --Boundary-00=_5ezs/icFgczWafD
 Content-Type: text/x-diff;
   charset="us-ascii";
   name="mjpegtools.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="mjpegtools.patch"
 
 diff -ruN mjpegtools.orig/files/patch-aa mjpegtools/files/patch-aa
 --- mjpegtools.orig/files/patch-aa	Wed Dec 31 19:00:00 1969
 +++ mjpegtools/files/patch-aa	Thu Nov 13 02:31:00 2003
 @@ -0,0 +1,334 @@
 +--- lavtools/divxdec.cpp.orig	Mon Jul 21 12:37:07 2003
 ++++ lavtools/divxdec.cpp	Mon Jul 21 12:11:58 2003
 +@@ -106,7 +106,7 @@
 + #include <sys/time.h>
 + #include <unistd.h>		// Needed for the access call to check if file exists
 + #include <getopt.h>		// getopt
 +-#include <stdint.h>		// standard integer types
 ++#include <sys/types.h>		// standard integer types
 + #include <stdlib.h>		// standard library with integer division
 + #include <stdio.h>
 + #include <config.h>
 +@@ -211,7 +211,7 @@
 + 		fmt = RIFFINFO_IYUV;
 + 	}
 + // only in avifile-0.6
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 	else if ( caps & IVideoDecoder::CAP_I420 )
 + 	{
 + 		fmt = RIFFINFO_I420;
 +@@ -595,7 +595,7 @@
 + 			// end of data, yes?
 + 			return 0;
 + 		}
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 		currentFrame.inputBuffer = imsrc->Data ();
 + #else
 + 		currentFrame.inputBuffer = imsrc->data ();
 +@@ -634,7 +634,7 @@
 + 			break;
 + 		}
 + 		// done with image.  ( was delete imsrc; )
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 		imsrc->Release() ;
 + #else
 + 		imsrc->release() ;
 +@@ -944,7 +944,7 @@
 + 		mjpeg_debug ( "VIDEO: Using decoder %s", sFourCC );
 + 		fourCCToString ( input.files[input.currentFile].outputCodec, sFourCC );
 + 		mjpeg_debug ( "VIDEO: Using interim YUV format %s", sFourCC );
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 		input.files[input.currentFile].frames = input.invstream->GetLength ();
 + #else
 + 		input.files[input.currentFile].frames = input.invstream->GetEndPos ();
 +@@ -957,7 +957,7 @@
 + 		input.inastream->StartStreaming ();
 + 		if ( input.files[input.currentFile].frames == 0)
 + 		{
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 			input.files[input.currentFile].frames = input.inastream->GetLength ();
 + #else
 + 			input.files[input.currentFile].frames = input.inastream->GetEndPos ();
 +@@ -973,14 +973,14 @@
 + 		// key frame.
 + 		if ( input.processVideo )
 + 		{
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 			framepos_t fp = input.invstream->SeekToKeyFrame ( firstFrame );
 + #else
 + 			framepos_t fp = input.invstream->SeekToKeyframe ( firstFrame );
 + #endif
 + 			if ( input.processAudio )
 + 			{
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 				double pos = input.invstream->GetTime ( max( 0, fp - 1 ) );
 + 				input.inastream->SeekTime ( pos );
 + #else
 +@@ -1284,7 +1284,7 @@
 + 	exit (1);
 + }
 + 
 +-FILE* real_stdout;
 ++FILE real_stdout;
 + 
 + int
 + main (int argc, char **argv)
 +@@ -1309,16 +1309,20 @@
 + 	std::cout.rdbuf ( std::cerr.rdbuf () );
 + 	//
 + 	// 4. keep old stdout FILE, and use stderr in its place (for printf ("...") ; )
 +-	real_stdout = stdout ;
 +-	stdout = stderr;
 ++	real_stdout = *stdout ;
 ++	*stdout = *stderr;
 + 
 + 	displayGreeting();
 + 
 + 	if ( GetAvifileVersion (  ) != AVIFILE_VERSION )
 + 	{
 +-		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %.2f but the library is %.2f"
 +-				, AVIFILE_VERSION
 +-				, GetAvifileVersion () );
 ++		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %d.%d.%d but the library is %d.%d.%d"
 ++				, AVIFILE_VERSION >> 16
 ++				, (AVIFILE_VERSION >> 8) & 0xff
 ++				, AVIFILE_VERSION & 0xff
 ++				, GetAvifileVersion () >> 16
 ++				, (GetAvifileVersion () >> 8) & 0xff
 ++				, GetAvifileVersion () & 0xff);
 + 	}
 + 
 + 	( void ) mjpeg_default_handler_verbosity ( 3 );
 +@@ -1583,7 +1587,7 @@
 + 				inastream = file->GetStream ( 0, AviStream::Audio );
 + 				mjpeg_debug ( "AUDIO stream queried" );
 + 			}
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 			input.files[i].frames = invstream->GetLength();
 + #else
 + 			input.files[i].frames = invstream->GetEndPos ();
 +@@ -1733,7 +1737,7 @@
 + 		if ( 0 == strcmp ( "-", filenameYUV ) )
 + 		{
 + 			//output.fdYUV = FD_STDOUT;
 +-			output.fdYUV = fileno ( real_stdout );
 ++			output.fdYUV = fileno ( &real_stdout );
 + 		}
 + 		else
 + 		{
 +@@ -2042,7 +2046,7 @@
 + 	freeAll ();
 + 	// reassign cout, stdout to their original values.
 + 	std::cout.rdbuf ( real_cout );
 +-	stdout = real_stdout;
 ++	*stdout = real_stdout;
 + 
 + 	mjpeg_info ( " " );
 + 	mjpeg_info ( "Done. %i frames", output.processedFrames );
 +
 +
 +--- lavtools/lav2divx.cpp.orig	Mon Jul 21 12:33:21 2003
 ++++ lavtools/lav2divx.cpp	Mon Jul 21 12:11:43 2003
 +@@ -218,7 +218,7 @@
 + 	printf ( "  -s --forcedaudiorate\taudio sample rate of input file (Hz);\n\t\t\tuse only if avifile gets it wrong\n" );
 + 	printf ( "  -n --noise\t\tnoise filter (0..2, default 0)\n" );
 + 	printf ( "  -g --guess\t\tguess values for -c and -z options\n" );
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 	printf ( "  -L --listcodecs\tdisplay available avifile codecs (LONG)\n" );
 + 	printf ( "  -k --keyframes\tset keyframes attribute (default 15)\n" );
 + 	printf ( "  -C --crispness\tset crispness attribute (default 20)\n" );
 +@@ -256,7 +256,7 @@
 + 	mjpeg_info ( "-----------------------------" );
 + }
 + 
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + static void
 + listCodecs ( )
 + {
 +@@ -289,9 +289,13 @@
 + 
 + 	if ( GetAvifileVersion (  ) != AVIFILE_VERSION )
 + 	{
 +-		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %s but the library is %s"
 +-			, AVIFILE_VERSION
 +-			, GetAvifileVersion (  ) );
 ++		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %d.%d.%d but the library is %d.%d.%d"
 ++			, AVIFILE_VERSION >> 16
 ++			, (AVIFILE_VERSION >> 8) & 0xff
 ++			, AVIFILE_VERSION & 0xff
 ++			, GetAvifileVersion (  ) >> 16
 ++			, (GetAvifileVersion (  ) >> 8) & 0xff
 ++			, GetAvifileVersion (  ) & 0xff);
 + 	}
 + 
 + 	( void ) mjpeg_default_handler_verbosity ( 1 );
 +@@ -315,7 +319,7 @@
 + 	int opt_h = 0;
 + 
 + 	int opt_mono = 0;
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 	int opt_keyframes = 15;
 + 	int opt_crispness = 20;
 + #endif
 +@@ -379,7 +383,7 @@
 + 			{"video_stream", required_argument, NULL, 'V'},
 + 			{"number_cpus", required_argument, NULL, 'U'},
 + 			{"outputfile", required_argument, NULL, 'o'},
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 			{"keyframes", required_argument, NULL, 'k'},
 + 			{"crispness", required_argument, NULL, 'C'},
 + 			{"listcodecs", no_argument, NULL, 'L'},
 +@@ -391,7 +395,7 @@
 + 		};
 + 
 + 		copt =
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 			getopt_long ( argc, argv, "LE:fa:e:c:b:o:s:gmvk:C:", long_options, &option_index );
 + #else
 + 			getopt_long ( argc, argv, "E:fa:e:c:b:o:s:gmv", long_options, &option_index );
 +@@ -449,7 +453,7 @@
 + 			outputfile = optarg;
 + 			break;
 + 
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 		case 'k':
 + 			opt_keyframes = atoi ( optarg );
 + 			break;
 +@@ -681,7 +685,7 @@
 + 
 + 	avifile = CreateIAviWriteFile ( outputfile );
 + 
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 	const CodecInfo *codecInfo = CodecInfo::match ( fccHandler );
 + 	if (codecInfo == NULL)
 + 	{
 +
 +--- lavtools/libavifile.h.orig	Thu Apr 25 00:49:12 2002
 ++++ lavtools/libavifile.h	Mon Jul 21 12:13:05 2003
 +@@ -32,18 +32,18 @@
 + #include <videoencoder.h>
 + 
 + // Correct the version numbers
 +-#if AVIFILE_MAJOR_VERSION == 0
 +-#if AVIFILE_MINOR_VERSION == 6
 +-#undef AVIFILE_MINOR_VERSION
 +-#define AVIFILE_MINOR_VERSION 60
 +-#elif AVIFILE_MINOR_VERSION == 7
 +-#undef AVIFILE_MINOR_VERSION
 +-#define AVIFILE_MINOR_VERSION 70
 +-#endif /* AVIFILE_MINOR_VERSION == 6/7 */
 +-#endif /* AVIFILE_MAJOR_VERSION == 0 */
 ++//#if AVIFILE_MAJOR_VERSION == 0
 ++//#if AVIFILE_MINOR_VERSION == 6
 ++//#undef AVIFILE_MINOR_VERSION
 ++//#define AVIFILE_MINOR_VERSION 60
 ++//#elif AVIFILE_MINOR_VERSION == 7
 ++//#undef AVIFILE_MINOR_VERSION
 ++//#define AVIFILE_MINOR_VERSION 70
 ++//#endif /* AVIFILE_MINOR_VERSION == 6/7 */
 ++//#endif /* AVIFILE_MAJOR_VERSION == 0 */
 + 
 + // Import version-dependent headers
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION < 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION < 6
 + #include <aviutil.h>
 + typedef unsigned int framepos_t;
 + #else
 +
 +--- lavtools/yuv2divx.cpp.orig	Mon Jul 21 12:33:21 2003
 ++++ lavtools/yuv2divx.cpp	Mon Jul 21 12:16:28 2003
 +@@ -267,7 +267,7 @@
 + 	printf ( "  -d --droplsb\t\tdrop x least significant bits (0..3, default 0)\n" );
 + 	printf ( "  -n --noise\t\tnoise filter (0..2, default 0)\n" );
 + 	printf ( "  -g --guess\t\tguess values for -c and -z options\n" );
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 	printf ( "  -k --keyframes\tset keyframes attribute (default 15)\n" );
 + 	printf ( "  -C --crispness\tset crispness attribute (default 20)\n" );
 + 	printf ( "  -L --listcodecs\tshow the list of avifile codecs (LONG!)\n" );
 +@@ -306,7 +306,7 @@
 + 	mjpeg_info ( "-----------------------------" );
 + }
 + 
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + static void
 + listCodecs ( )
 + {
 +@@ -340,9 +340,13 @@
 + 
 + 	if ( GetAvifileVersion (  ) != AVIFILE_VERSION )
 + 	{
 +-		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %s but the library is %s"
 +-			, AVIFILE_VERSION
 +-			, GetAvifileVersion (  ) );
 ++		mjpeg_error_exit1 ( "This binary was compiled for Avifile version %d.%d.%d but the library is %d.%d.%d"
 ++			, AVIFILE_VERSION >> 16
 ++			, (AVIFILE_VERSION >> 8) & 0xff
 ++			, AVIFILE_VERSION & 0xff
 ++			, GetAvifileVersion (  ) >> 16
 ++			, (GetAvifileVersion (  ) >> 8) & 0xff
 ++			, GetAvifileVersion (  ) & 0xff);
 + 	}
 + 
 + 	( void ) mjpeg_default_handler_verbosity ( 1 );
 +@@ -380,7 +384,7 @@
 + 
 + 	int audio_bytes;
 + 
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 	int opt_keyframes = 15;
 + 	int opt_crispness = 20;
 + #endif
 +@@ -429,7 +433,7 @@
 + 			{"outputfile", required_argument, NULL, 'o'},
 + 			{"droplsb", required_argument, NULL, 'd'},
 + 			{"noise", required_argument, NULL, 'n'},
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 			{"keyframes", required_argument, NULL, 'k'},
 + 			{"crispness", required_argument, NULL, 'C'},
 + 			{"listcodecs", no_argument, NULL, 'L' },
 +@@ -441,7 +445,7 @@
 + 		};
 + 
 + 		copt =
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 			getopt_long ( argc, argv, "F:E:A:a:w:h:e:c:b:o:s:n:d:gvVLk:C:", long_options, &option_index );
 + #else
 + 			getopt_long ( argc, argv, "F:E:A:a:w:h:e:c:b:o:s:n:d:gvV", long_options, &option_index );
 +@@ -503,7 +507,7 @@
 + 			audioexist = 1;
 + 			break;
 + 
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 		case 'k':
 + 			opt_keyframes = atoi ( optarg );
 + 			break;
 +@@ -769,7 +773,7 @@
 + 
 + 	avifile = CreateIAviWriteFile ( outputfile );
 + 
 +-#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 60
 ++#if AVIFILE_MAJOR_VERSION == 0 && AVIFILE_MINOR_VERSION >= 6
 + 	const CodecInfo *codecInfo = CodecInfo::match ( opt_codec );
 + 	if ( codecInfo == NULL )
 + 	{
 diff -ruN mjpegtools.orig/files/patch-lavtools::divxdec.cpp mjpegtools/files/patch-lavtools::divxdec.cpp
 --- mjpegtools.orig/files/patch-lavtools::divxdec.cpp	Thu Nov 13 02:35:31 2003
 +++ mjpegtools/files/patch-lavtools::divxdec.cpp	Wed Dec 31 19:00:00 1969
 @@ -1,40 +0,0 @@
 ---- lavtools/divxdec.cpp.orig	Wed May 29 19:02:12 2002
 -+++ lavtools/divxdec.cpp	Wed May 29 20:08:34 2002
 -@@ -1284,7 +1284,7 @@
 - 	exit (1);
 - }
 - 
 --FILE* real_stdout;
 -+FILE real_stdout;
 - 
 - int
 - main (int argc, char **argv)
 -@@ -1309,8 +1309,8 @@
 - 	std::cout.rdbuf ( std::cerr.rdbuf () );
 - 	//
 - 	// 4. keep old stdout FILE, and use stderr in its place (for printf ("...") ; )
 --	real_stdout = stdout ;
 --	stdout = stderr;
 -+	real_stdout = *stdout ;
 -+	*stdout = *stderr;
 - 
 - 	displayGreeting();
 - 
 -@@ -1733,7 +1733,7 @@
 - 		if ( 0 == strcmp ( "-", filenameYUV ) )
 - 		{
 - 			//output.fdYUV = FD_STDOUT;
 --			output.fdYUV = fileno ( real_stdout );
 -+			output.fdYUV = fileno ( &real_stdout );
 - 		}
 - 		else
 - 		{
 -@@ -2042,7 +2042,7 @@
 - 	freeAll ();
 - 	// reassign cout, stdout to their original values.
 - 	std::cout.rdbuf ( real_cout );
 --	stdout = real_stdout;
 -+	*stdout = real_stdout;
 - 
 - 	mjpeg_info ( " " );
 - 	mjpeg_info ( "Done. %i frames", output.processedFrames );
 
 --Boundary-00=_5ezs/icFgczWafD--
 
State-Changed-From-To: open->closed 
State-Changed-By: lioux 
State-Changed-When: Sat Jun 26 04:32:05 GMT 2004 
State-Changed-Why:  
No longer applies. Recent update of mjpegtools port to version 1.6.2 
no longer contains divx tools 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54855 
>Unformatted:
