Package-Name: avifile
Rebuild-For: XFree86 Xorg SDL a52dec freetype libmad libvorbis
Compile-Requires: autoconf automake libtool
Homepage: http://avifile.sourceforge.net/
Source: sourceforge:///avifile/avifile(-\d+(.\d+)+)?-(\d+(.\d+)+).tar.bz2 $3
Zap-Before-Install: 1
Repack:
	tar xjvfp "$(SOURCE)"
	test -d avifile-"$(VERSION)" || mv avifile* avifile-"$(VERSION)"
Compile:
	cp -pf COPYING Change* README "$(PREFIX)/"
	touch NEWS AUTHORS
	autoreconf -fi
	# FIXME: optimization causes some constants to disappear (compiler bug, or...?)
	$(MAKE) -f ../Makefile configure CUSTOM_OPT="-O0"
	$(MAKE)
	$(MAKE) install
Install:
	$(MAKE) instbin BIN=avifile-config
	$(MAKE) instman SECTION=1 MAN=avifile-config
	$(MAKE) addldso
	$(MAKE) instpc PC=avifile
	$(MAKE) instaclocal M4=avifile
Patch: <<EOT
######## the rest is patches from gentoo
--- ffmpeg/libavcodec/common.h.old	2005-02-15 21:33:33 +0900
+++ ffmpeg/libavcodec/common.h	2005-10-14 17:46:17 +0900
@@ -54,14 +54,6 @@
 #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr }
 #define AVOPTION_END() AVOPTION_SUB(NULL)
 
-struct AVOption;
-#ifdef HAVE_MMX
-extern const struct AVOption avoptions_common[3 + 5];
-#else
-extern const struct AVOption avoptions_common[3];
-#endif
-extern const struct AVOption avoptions_workaround_bug[11];
-
 #endif /* HAVE_AV_CONFIG_H */
 
 /* Suppress restrict if it was not defined in config.h.  */
--- ffmpeg/libavcodec/h263dec.c.old	2005-02-15 21:33:34 +0900
+++ ffmpeg/libavcodec/h263dec.c	2005-10-14 17:46:32 +0900
@@ -27,6 +27,13 @@
 #include "dsputil.h"
 #include "mpegvideo.h"
 
+#ifdef HAVE_MMX
+extern const struct AVOption avoptions_common[3 + 5];
+#else
+extern const struct AVOption avoptions_common[3];
+#endif
+extern const struct AVOption avoptions_workaround_bug[11];
+
 //#define DEBUG
 //#define PRINT_FRAME_TIME
 
--- ffmpeg/libavcodec/mpegvideo.c.old	2005-02-24 20:31:10 +0900
+++ ffmpeg/libavcodec/mpegvideo.c	2005-10-14 17:46:42 +0900
@@ -31,6 +31,13 @@
 #include "faandct.h"
 #include <limits.h>
 
+#ifdef HAVE_MMX
+extern const struct AVOption avoptions_common[3 + 5];
+#else
+extern const struct AVOption avoptions_common[3];
+#endif
+extern const struct AVOption avoptions_workaround_bug[11];
+
 #ifdef USE_FASTMEMCPY
 #include "fastmemcpy.h"
 #endif
--- lib/aviread/ReadFile.cpp.old	2004-03-11 02:00:09 +0900
+++ lib/aviread/ReadFile.cpp	2005-10-14 18:17:52 +0900
@@ -125,7 +125,7 @@
 };
 
 
-avm::IReadFile* avm::CreateReadFile(const char* name, unsigned int flags)
+avm::IReadFile* CreateReadFile(const char* name, unsigned int flags)
 {
     ReadFile* r = new ReadFile(name, flags);
     return r;
--- ffmpeg/libavcodec/libpostproc/postprocess_template.c.old	2004-10-15 23:55:27 +0900
+++ ffmpeg/libavcodec/libpostproc/postprocess_template.c	2005-10-16 14:41:20 +0900
@@ -24,18 +24,22 @@
 
 #ifdef ARCH_X86_64
 #  define REGa  rax
+#  define REGb  rbx
 #  define REGc  rcx
 #  define REGd  rdx
 #  define REG_a  "rax"
+#  define REG_b  "rbx"
 #  define REG_c  "rcx"
 #  define REG_d  "rdx"
 #  define REG_SP "rsp"
 #  define ALIGN_MASK "$0xFFFFFFFFFFFFFFF8"
 #else
 #  define REGa  eax
+#  define REGb  ebx
 #  define REGc  ecx
 #  define REGd  edx
 #  define REG_a  "eax"
+#  define REG_b  "ebx"
 #  define REG_c  "ecx"
 #  define REG_d  "edx"
 #  define REG_SP "esp"
@@ -3196,10 +3200,11 @@
 	{
 #ifdef HAVE_MMX
 					asm volatile(
+						"push %%"REG_b"\n\t"
 						"movq (%%"REG_a"), %%mm2	\n\t" // packedYOffset
 						"movq 8(%%"REG_a"), %%mm3	\n\t" // packedYScale
 						"lea (%2,%4), %%"REG_a"	\n\t"
-						"lea (%3,%5), %%"REG_d"	\n\t"
+						"lea (%3,%5), %%"REG_b"	\n\t"
 						"pxor %%mm4, %%mm4	\n\t"
 #ifdef HAVE_MMX2
 #define REAL_SCALED_CPY(src1, src2, dst1, dst2)					\
@@ -3256,12 +3261,12 @@
    REAL_SCALED_CPY(src1, src2, dst1, dst2)
 
 SCALED_CPY((%2)       , (%2, %4)      , (%3)       , (%3, %5))
-SCALED_CPY((%2, %4, 2), (%%REGa, %4, 2), (%3, %5, 2), (%%REGd, %5, 2))
-SCALED_CPY((%2, %4, 4), (%%REGa, %4, 4), (%3, %5, 4), (%%REGd, %5, 4))
+SCALED_CPY((%2, %4, 2), (%%REGa, %4, 2), (%3, %5, 2), (%%REGb, %5, 2))
+SCALED_CPY((%2, %4, 4), (%%REGa, %4, 4), (%3, %5, 4), (%%REGb, %5, 4))
 						"lea (%%"REG_a",%4,4), %%"REG_a"	\n\t"
-						"lea (%%"REG_d",%5,4), %%"REG_d"	\n\t"
-SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGd, %5), (%%REGd, %5, 2))
-
+						"lea (%%"REG_b",%5,4), %%"REG_b"	\n\t"
+SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGb, %5), (%%REGb, %5, 2))
+						"pop %%"REG_b"\n\t"
 
 						: "=&a" (packedOffsetAndScale)
 						: "0" (packedOffsetAndScale),
@@ -3269,7 +3274,6 @@
 						"r"(dst),
 						"r" ((long)srcStride),
 						"r" ((long)dstStride)
-						: "%"REG_d
 					);
 #else
 				for(i=0; i<8; i++)
@@ -3281,8 +3285,9 @@
 	{
 #ifdef HAVE_MMX
 					asm volatile(
+						"push %%"REG_b"\n\t"
 						"lea (%0,%2), %%"REG_a"	\n\t"
-						"lea (%1,%3), %%"REG_d"	\n\t"
+						"lea (%1,%3), %%"REG_b"	\n\t"
 
 #define REAL_SIMPLE_CPY(src1, src2, dst1, dst2)				\
 						"movq " #src1 ", %%mm0	\n\t"\
@@ -3294,17 +3299,18 @@
    REAL_SIMPLE_CPY(src1, src2, dst1, dst2)
 
 SIMPLE_CPY((%0)       , (%0, %2)      , (%1)       , (%1, %3))
-SIMPLE_CPY((%0, %2, 2), (%%REGa, %2, 2), (%1, %3, 2), (%%REGd, %3, 2))
-SIMPLE_CPY((%0, %2, 4), (%%REGa, %2, 4), (%1, %3, 4), (%%REGd, %3, 4))
+SIMPLE_CPY((%0, %2, 2), (%%REGa, %2, 2), (%1, %3, 2), (%%REGb, %3, 2))
+SIMPLE_CPY((%0, %2, 4), (%%REGa, %2, 4), (%1, %3, 4), (%%REGb, %3, 4))
 						"lea (%%"REG_a",%2,4), %%"REG_a"	\n\t"
-						"lea (%%"REG_d",%3,4), %%"REG_d"	\n\t"
-SIMPLE_CPY((%%REGa, %2), (%%REGa, %2, 2), (%%REGd, %3), (%%REGd, %3, 2))
+						"lea (%%"REG_b",%3,4), %%"REG_b"	\n\t"
+SIMPLE_CPY((%%REGa, %2), (%%REGa, %2, 2), (%%REGb, %3), (%%REGb, %3, 2))
+						"pop %%"REG_b"\n\t"
 
 						: : "r" (src),
 						"r" (dst),
 						"r" ((long)srcStride),
 						"r" ((long)dstStride)
-						: "%"REG_a, "%"REG_d
+						: "%"REG_a
 					);
 #else
 				for(i=0; i<8; i++)
--- lib/common/mmx.cpp.old	2005-02-15 21:33:39 +0900
+++ lib/common/mmx.cpp	2005-10-16 14:55:35 +0900
@@ -106,11 +106,12 @@
     {
 	for(int i=0; i<dst_h; i++)
 	{
-	    int j = dst_w;
+	    //int j = dst_w;
 	    //printf("%d  %p  %p  j:%d\n", y_accum, dest, src2, j);
 	    // for(int j=0; j<dst_w; j++)
 	    asm volatile
 		("pushl %%ebx		\n\t"
+		 "pushl %7		\n\t"
 		 "1:			\n\t"
 		 //   *(dest+j)=*src;
 		 "movw   (%%eax),%%bx	\n\t"
@@ -118,7 +119,7 @@
 		 //   dest++;
 		 "addl   $2, %%ecx	\n\t"
 		 //   src+=x_maj;
-		 "addl   %9, %%eax	\n\t"
+		 "addl   %8, %%eax	\n\t"
 		 //   x_accum-=x_min;
 		 "subl   %6, %%edx	\n\t"
 		 //   if(x_accum<=0) {
@@ -128,11 +129,12 @@
 		 //         src++;
 		 "addl   $2, %%eax	\n\t"
 		 "x2:			\n\t"
-		 "decl   %8		\n\t"
+		 "decl   (%%esp)	\n\t"
 		 "jnz    1b		\n\t"
 		 "popl   %%ebx		\n\t"
+		 "popl   %%ebx		\n\t"
 		 : "=a"(src), "=c"(dest), "=d"(x_accum)           // output
-		 : "a"(src),"c"(dest), "d"(x_accum), "r"(x_min), "r"(dst_w), "r"(j), "g"(x_maj)
+		 : "a"(src),"c"(dest), "d"(x_accum), "r"(x_min), "r"(dst_w), "g"(x_maj)
 		 :"memory"
 		);
 
--- lib/aviplay/AudioQueue.cpp.old	2004-03-29 17:18:00 +0900
+++ lib/aviplay/AudioQueue.cpp	2005-10-16 15:01:12 +0900
@@ -41,6 +41,7 @@
 
 AudioQueue::AudioQueue(WAVEFORMATEX& Iwf, WAVEFORMATEX& Owf) : m_Bufs(64)
 {
+    MAX_BUFFER_TIME = 1.0;
     m_dRemains = 0.0;
     m_pResampler = 0;
     m_pCleaner = 0;
--- lib/aviplay/AudioQueue.h.old	2004-08-26 01:29:06 +0900
+++ lib/aviplay/AudioQueue.h	2005-10-16 15:00:40 +0900
@@ -19,7 +19,7 @@
 class AudioQueue
 {
 public:
-    static const double MAX_BUFFER_TIME = 1.0;
+    double MAX_BUFFER_TIME;
     AudioQueue(WAVEFORMATEX& Iwf, WAVEFORMATEX& Owf);
     ~AudioQueue();
 
--- lib/aviplay/aviplay.cpp.old	2004-11-04 21:52:41 +0900
+++ lib/aviplay/aviplay.cpp	2005-10-16 15:01:40 +0900
@@ -51,6 +51,7 @@
 		     const char* vcodec, const char* acodec)
     :m_Drop("Drop", 50), m_Quality("Quality", 25)
 {
+    m_fDropLimit = -0.015;
     m_pVideostream = 0;
     m_pAudiostream = 0;
     m_bInitialized = false;
--- lib/aviplay/aviplay_impl.h.old	2003-12-18 05:37:54 +0900
+++ lib/aviplay/aviplay_impl.h	2005-10-16 15:01:54 +0900
@@ -136,7 +136,7 @@
     void createAudioRenderer();
     int restartVideoStreaming(const char* codec = 0);
 
-    static const float m_fDropLimit = -0.015;
+    float m_fDropLimit;
 
     mutable int AviPlayer::propertyRead[LAST_PROPERTY]; // have we read at least once from Registry::
 
EOT

/pkg/avifile/
/usr/bin/avifile-config
/usr/lib/pkgconfig/avifile.pc
/usr/man/man1/avifile-config.1.gz
/usr/share/aclocal/avifile.m4
