summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorkonablend <[email protected]>2009-03-01 17:03:11 +0000
committerkonablend <[email protected]>2009-03-01 17:03:11 +0000
commit4dbce6b69967c1e14092637aa95b6c31855a81fc (patch)
tree516c17095967698eeb419c70ce72dbd2c11bf754 /contrib
parentc47939541ccec1e5e57753b16b28baed2613f586 (diff)
BuildSystem: conversion from jam-based to make-based system.
KNOWN ISSUES: 1. OSX + Xcode builds do not support parallel builds; attempting to use them may cause unbounded number of jobs. However, disabling via configure --disable-xcode avoids the issue. 2. OSX ppc binary produces binary which has audio-scan problems. 3. OSX ppc64 binary has not been runtime tested. ADDED: 00-BuildUserGuide.txt contrib/*/module.* doc/ make/ libhb/module.* test/module.* macos/module.* gtk/module.* DROPPED: BUILD BuildContribDarwin.sh DownloadMacOsXContribBinaries.sh Jamfile Jamrules MacOsXContribBinariesVersion.txt Makefile Makefile.config jam libhb/Jamefile libhb/Makefile test/BUILDSHARED test/Makefile contrib/Jamfile contrib/Makefile contrib/patch-ffmpeg.patch contrib/patch-x264-idr.patch contrib/patch-x264-linux.patch RENAMED: contrib/*.patch -> contrib/MODULE/[AP]??-*.patch macosx/HandBrake.plist -> macosx/Info.plist MODIFIED: libhb/decavcodec.c Patched to use cleaner include "libavcodec/audioconvert". Second part to support this cleanup is ffmpeg A02-audioconvert.patch . MODIFIED: libhb/hb.c MODIFIED: libhb/hb.h MODIFIED: libhb/muxmkv.c MODIFIED: libhb/muxmp4.c MODIFIED: libhb/update.c Patched to use "project.h" for project metadata. Renamed HB_BUILD -> HB_PROJECT_BUILD. Renamed HB_VERSION -> HB_PROJECT_VERSION. MODIFIED: test/test.c: Patched HandBrakeCLI to support I/O on Mac OS X ZFS filesystems. Reference r1803 as similar patch for HandBrake.app . Unpatched behavior is crash/buserror when using ZFS. MODIFIED: macosx/Growl.framework/ Upgraded 0.7.6 (i386,ppc) -> 1.1.2 (i386,x86_64,ppc,ppc64). New architectures facilitate x86_64 and ppc64 builds. MODIFIED: macosx/HandBrake.xcodeproj/ Bumped compatibilty mode from 2.4 -> 3.1 . Dumped old configurations Deployment, Developer. Added configurations standard, sebug as replacements. Added standard.i386, standard.x86_64, standard.ppc, standard.ppc64 . for explicit architecture build. All configurations settings cleaned up and normalized. Build output directories adjusted to support new build system. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2180 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'contrib')
-rw-r--r--contrib/Jamfile494
-rw-r--r--contrib/Makefile49
-rw-r--r--contrib/a52dec/A00-dpl2.patch (renamed from contrib/patch-a52dec.patch)0
-rw-r--r--contrib/a52dec/module.defs6
-rw-r--r--contrib/a52dec/module.rules2
-rw-r--r--contrib/bzip2/module.defs24
-rw-r--r--contrib/bzip2/module.rules2
-rw-r--r--contrib/faac/P00-cygwin.patch (renamed from contrib/patch-faac-cygwin.patch)0
-rw-r--r--contrib/faac/module.defs8
-rw-r--r--contrib/faac/module.rules2
-rw-r--r--contrib/faad2/A00-libtool22.patch (renamed from contrib/patch-faad2-libtool22.patch)0
-rw-r--r--contrib/faad2/module.defs7
-rw-r--r--contrib/faad2/module.rules2
-rw-r--r--contrib/ffmpeg/A00-latm.patch (renamed from contrib/patch-ffmpeg-latm.patch)431
-rw-r--r--contrib/ffmpeg/A01-mpegleak.patch (renamed from contrib/patch-ffmpeg-mpegleak.patch)18
-rw-r--r--contrib/ffmpeg/A02-audioconvert.patch12
-rw-r--r--contrib/ffmpeg/P00-cygwin.patch (renamed from contrib/patch-ffmpeg-cygwin.patch)0
-rw-r--r--contrib/ffmpeg/P01-sunos.patch (renamed from contrib/patch-ffmpeg-solaris.patch)0
-rw-r--r--contrib/ffmpeg/P02-darwin-h264dsp-crash.patch (renamed from contrib/patch-ffmpeg-h264dsp-crash.diff)0
-rw-r--r--contrib/ffmpeg/module.defs32
-rw-r--r--contrib/ffmpeg/module.rules2
-rw-r--r--contrib/lame/P00-darwin-xmmintrin.patch28
-rw-r--r--contrib/lame/module.defs5
-rw-r--r--contrib/lame/module.rules2
-rw-r--r--contrib/libdca/A00-general.patch (renamed from contrib/patch-libdca.patch)0
-rw-r--r--contrib/libdca/module.defs5
-rw-r--r--contrib/libdca/module.rules2
-rw-r--r--contrib/libdvdread/P00-darwin-css-vlc-dylib.patch (renamed from contrib/patch-libdvdread-css-vlc-dylib.patch)5
-rw-r--r--contrib/libdvdread/P01-cygwin.patch (renamed from contrib/patch-libdvdread-cygwin.patch)0
-rw-r--r--contrib/libdvdread/module.defs5
-rw-r--r--contrib/libdvdread/module.rules2
-rw-r--r--contrib/libmkv/module.defs5
-rw-r--r--contrib/libmkv/module.rules2
-rw-r--r--contrib/libmp4v2/module.defs5
-rw-r--r--contrib/libmp4v2/module.rules2
-rw-r--r--contrib/libogg/module.defs7
-rw-r--r--contrib/libogg/module.rules2
-rw-r--r--contrib/libsamplerate/module.defs5
-rw-r--r--contrib/libsamplerate/module.rules2
-rw-r--r--contrib/libtheora/module.defs13
-rw-r--r--contrib/libtheora/module.rules2
-rw-r--r--contrib/libvorbis/module.defs7
-rw-r--r--contrib/libvorbis/module.rules2
-rw-r--r--contrib/mpeg2dec/module.defs7
-rw-r--r--contrib/mpeg2dec/module.rules2
-rw-r--r--contrib/patch-ffmpeg.patch18
-rw-r--r--contrib/patch-libmpeg2.patch33
-rw-r--r--contrib/patch-x264-idr.patch17
-rw-r--r--contrib/patch-x264-linux.patch194
-rw-r--r--contrib/patch_mpeg4ip_cygwin.patch262
-rw-r--r--contrib/version_a52dec.txt1
-rw-r--r--contrib/version_bzip2.txt1
-rw-r--r--contrib/version_faac.txt1
-rw-r--r--contrib/version_faad2.txt1
-rw-r--r--contrib/version_ffmpeg.txt1
-rw-r--r--contrib/version_lame.txt1
-rw-r--r--contrib/version_libdca.txt1
-rw-r--r--contrib/version_libdvdcss.txt1
-rw-r--r--contrib/version_libdvdread.txt1
-rw-r--r--contrib/version_libmkv.txt1
-rw-r--r--contrib/version_libmp4v2.txt1
-rw-r--r--contrib/version_libogg.txt1
-rw-r--r--contrib/version_libsamplerate.txt1
-rw-r--r--contrib/version_libtheora.txt2
-rw-r--r--contrib/version_libvorbis.txt1
-rw-r--r--contrib/version_mpeg2dec.txt1
-rw-r--r--contrib/version_mpeg4ip.txt1
-rw-r--r--contrib/version_qt.txt1
-rw-r--r--contrib/version_x264.txt1
-rw-r--r--contrib/version_xvidcore.txt1
-rw-r--r--contrib/version_zlib.txt1
-rw-r--r--contrib/x264/P00-cygwin.patch (renamed from contrib/patch-x264-cygwin.patch)0
-rw-r--r--contrib/x264/P01-sunos.patch (renamed from contrib/patch-x264-solaris.patch)0
-rw-r--r--contrib/x264/module.defs11
-rw-r--r--contrib/x264/module.rules2
-rw-r--r--contrib/xvidcore/A00-nasm.patch (renamed from contrib/patch-xvidcore-nasm-2.00-configure.patch)0
-rw-r--r--contrib/xvidcore/A01-fdct.patch (renamed from contrib/patch-xvidcore-fdct.patch)0
-rw-r--r--contrib/xvidcore/P00-darwin.patch (renamed from contrib/patch-xvidcore-macosx.patch)0
-rw-r--r--contrib/xvidcore/P01-cygwin.patch (renamed from contrib/patch-xvidcore-cygwin.patch)0
-rw-r--r--contrib/xvidcore/module.defs20
-rw-r--r--contrib/xvidcore/module.rules2
-rw-r--r--contrib/zlib/module.defs6
-rw-r--r--contrib/zlib/module.rules2
83 files changed, 477 insertions, 1320 deletions
diff --git a/contrib/Jamfile b/contrib/Jamfile
deleted file mode 100644
index d0450cdfc..000000000
--- a/contrib/Jamfile
+++ /dev/null
@@ -1,494 +0,0 @@
-SubDir TOP contrib ;
-
-# Use curl on Mac OS X since it's always installed, and assume wget
-# is installed for all other systems
-if $(OS) = MACOSX
-{
- WGET = curl -q -L -o ;
-}
-else
-{
- WGET = wget -O ;
-}
-
-if $(OS) = UNKNOWN
-{
- OS = CYGWIN ;
-}
-
-if $(OS) = SOLARIS
-{
- PATCH = gpatch ;
- STRIP = echo ;
-}
-else
-{
- PATCH = patch ;
- STRIP = strip -S ;
-}
-
-# Wget rule: downloads $(<) from the link in $(>)
-rule Wget
-{
- Depends $(<) : $(>) ;
-}
-actions Wget
-{
- $(RM) $(<) &&
- $(WGET) $(<) `cat $(>)` &&
- ( touch $(<) || true )
-}
-
-# liba52
-rule LibA52
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibA52
-{
-
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf a52dec && (gzip -dc a52dec.tar.gz | tar xf -) &&
- cd a52dec && $(PATCH) -p1 < ../patch-a52dec.patch &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/liba52.a
-}
-Wget $(SUBDIR)/a52dec.tar.gz : $(SUBDIR)/version_a52dec.txt ;
-LibA52 $(SUBDIR)/lib/liba52.a : $(SUBDIR)/a52dec.tar.gz ;
-
-# FAAD2
-rule LibFaad2
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-
-actions LibFaad2
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf faad2 && (gzip -dc faad2.tar.gz | tar xf -) &&
- cd faad2 && $(PATCH) -p1 < ../patch-faad2-libtool22.patch &&
- ./bootstrap && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared && $(MAKE) && $(MAKE) install
-}
-Wget $(SUBDIR)/faad2.tar.gz : $(SUBDIR)/version_faad2.txt ;
-LibFaad2 $(SUBDIR)/lib/libfaad.a : $(SUBDIR)/faad2.tar.gz ;
-
-# libavcodec
-rule LibAvCodec
-{
- FFMPEG_PATCH = "$(PATCH) -p0 < ../patch-ffmpeg.patch" ;
- FFMPEG_PATCH += " && $(PATCH) -p0 < ../patch-ffmpeg-latm.patch " ;
- FFMPEG_PATCH += " && $(PATCH) -p0 < ../patch-ffmpeg-mpegleak.patch " ;
- if $(OS) = CYGWIN
- {
- FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-cygwin.patch " ;
- }
- else if $(OS) = SOLARIS
- {
- FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-solaris.patch " ;
- }
- else if $(OS) = MACOSX
- {
- FFMPEG_PATCH += " && $(PATCH) -p1 < ../patch-ffmpeg-h264dsp-crash.diff " ;
- }
-
- if $(OS) = SOLARIS
- {
- #
- # Not all of ffmpeg works on Solaris - disable the bits that
- # don't. When we get new versions of FFMPEG we can try enabling
- # then again.
- #
- FFMPEG_EXTRA_OPTIONS = "--disable-vis --disable-demuxer=mpc8 --disable-vhook --disable-network" ;
- }
-
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibAvCodec
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf ffmpeg && (gzip -dc ffmpeg.tar.gz | tar xf -) &&
- cd ffmpeg && $(FFMPEG_PATCH) &&
- ./configure --prefix=$CONTRIB --enable-gpl --enable-pthreads --enable-swscale \
- --disable-shared --enable-static --disable-encoders \
- --enable-encoder=mpeg4 --enable-encoder=ac3 --enable-encoder=snow \
- --enable-libfaad --disable-ffmpeg --disable-ffserver \
- --disable-muxers --enable-muxer=ipod --disable-bsfs --disable-vhook \
- --extra-cflags="-I$CONTRIB/include" \
- --extra-ldflags="-L$CONTRIB/lib" $(FFMPEG_EXTRA_OPTIONS) &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libavcodec.a
-}
-Wget $(SUBDIR)/ffmpeg.tar.gz : $(SUBDIR)/version_ffmpeg.txt ;
-LibAvCodec $(SUBDIR)/lib/libavcodec.a : $(SUBDIR)/ffmpeg.tar.gz ;
-
-rule LibAvUtil
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibAvUtil
-{
- $(STRIP) $(<)
-}
-LibAvUtil $(SUBDIR)/lib/libavutil.a : $(SUBDIR)/lib/libavcodec.a ;
-LibAvUtil $(SUBDIR)/lib/libavformat.a : $(SUBDIR)/lib/libavcodec.a ;
-LibAvUtil $(SUBDIR)/lib/libswscale.a : $(SUBDIR)/lib/libavcodec.a ;
-
-# HandBrake does not include a DVD decrypting library,
-# so if a user requests it, let them download and compile it from a 3rd party
-if $(CSS) = 1
-{
- # libdvdcss
- # We need libdvdcss.so for libdvdread's configure to work...
- rule LibDvdCss
- {
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
- }
- actions LibDvdCss
- {
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libdvdcss-1.2.9 && (gzip -dc libdvdcss.tar.gz | tar xf - ) &&
- cd libdvdcss-1.2.9 &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libdvdcss.a
- }
- Wget $(SUBDIR)/libdvdcss.tar.gz : $(SUBDIR)/version_libdvdcss.txt ;
- LibDvdCss $(SUBDIR)/lib/libdvdcss.a : $(SUBDIR)/libdvdcss.tar.gz ;
-}
-
-# libdca
-rule LibDCA
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibDCA
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libdca && (gzip -dc libdca.tar.gz | tar xf - ) &&
- cd libdca && $(PATCH) -p1 < ../patch-libdca.patch &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libdca.a
-}
-Wget $(SUBDIR)/libdca.tar.gz : $(SUBDIR)/version_libdca.txt ;
-LibDCA $(SUBDIR)/lib/libdca.a : $(SUBDIR)/libdca.tar.gz ;
-
-# libdvdread
-rule LibDvdRead
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-
- if $(OS) = MACOSX
- {
- DVDREAD_PATCH = "$(PATCH) -p0 < ../patch-libdvdread-css-vlc-dylib.patch &&" ;
- }
-
- if $(OS) = CYGWIN
- {
- DVDREAD_PATCH = "$(PATCH) -p1 < ../patch-libdvdread-cygwin.patch &&" ;
- }
-
-}
-if $(CSS) = 1 # Include CSS support in libdvdread if requested
-{
- actions LibDvdRead
- {
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) &&
- cd libdvdread &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --with-libdvdcss=$CONTRIB &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libdvdread.a
- }
-}
-else {
- # Cygwin/Windows doesn't use CSS as of now, so don't include it on the
- # configure line.
- # MacOSX uses a dylib for CSS, so it doesn't need including there either.
- actions LibDvdRead
- {
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libdvdread && (gzip -dc libdvdread.tar.gz | tar xf - ) &&
- cd libdvdread && $(DVDREAD_PATCH)
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libdvdread.a
- }
-}
-Wget $(SUBDIR)/libdvdread.tar.gz : $(SUBDIR)/version_libdvdread.txt ;
-LibDvdRead $(SUBDIR)/lib/libdvdread.a : $(SUBDIR)/libdvdread.tar.gz ;
-
-# libfaac
-rule LibFaac
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
- if $(OS) = CYGWIN
- {
- CYGWIN_PATCH = "$(PATCH) -p1 < ../patch-faac-cygwin.patch &&" ;
- }
-}
-actions LibFaac
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf faac && (gzip -dc faac.tar.gz | tar xf - ) && cd faac && $(CYGWIN_PATCH) ./bootstrap &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --enable-static --without-mp4v2 &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libfaac.a
-}
-Wget $(SUBDIR)/faac.tar.gz : $(SUBDIR)/version_faac.txt ;
-LibFaac $(SUBDIR)/lib/libfaac.a : $(SUBDIR)/faac.tar.gz ;
-
-# libmp3lame
-rule LibMp3Lame
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibMp3Lame
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf lame && (gzip -dc lame.tar.gz | tar xf - ) && cd lame &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libmp3lame.a
-}
-Wget $(SUBDIR)/lame.tar.gz : $(SUBDIR)/version_lame.txt ;
-LibMp3Lame $(SUBDIR)/lib/libmp3lame.a : $(SUBDIR)/lame.tar.gz ;
-
-# libmp4v2
-rule LibMp4v2
-{
- LIBMP4V2_PATCH = "" ;
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibMp4v2
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libmp4v2 && (gzip -dc libmp4v2.tar.gz | tar xf - ) &&
- cd libmp4v2 && $(LIBMP4V2_PATCH) rm -rf build && mkdir build && cd build &&
- ../configure --disable-shared --disable-debug --prefix=$CONTRIB && $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libmp4v2.a
-}
-Wget $(SUBDIR)/libmp4v2.tar.gz : $(SUBDIR)/version_libmp4v2.txt ;
-LibMp4v2 $(SUBDIR)/lib/libmp4v2.a : $(SUBDIR)/libmp4v2.tar.gz ;
-
-rule LibMkv
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibMkv
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libmkv && (gzip -dc libmkv.tar.gz | tar xf - ) &&
- cd libmkv &&
- ./configure --disable-shared --enable-static --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libmkv.a
-}
-Wget $(SUBDIR)/libmkv.tar.gz : $(SUBDIR)/version_libmkv.txt ;
-LibMkv $(SUBDIR)/lib/libmkv.a : $(SUBDIR)/libmkv.tar.gz ;
-
-# libmpeg2
-rule LibMpeg2
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibMpeg2
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf mpeg2dec && (gzip -dc mpeg2dec.tar.gz | tar xf - ) &&
- cd mpeg2dec &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared --disable-sdl --without-x &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libmpeg2.a
-}
-Wget $(SUBDIR)/mpeg2dec.tar.gz : $(SUBDIR)/version_mpeg2dec.txt ;
-LibMpeg2 $(SUBDIR)/lib/libmpeg2.a : $(SUBDIR)/mpeg2dec.tar.gz ;
-
-# libogg
-rule LibOgg
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibOgg
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libogg && (gzip -dc libogg.tar.gz | tar xf - ) &&
- cd libogg &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libogg.a
-}
-Wget $(SUBDIR)/libogg.tar.gz : $(SUBDIR)/version_libogg.txt ;
-LibOgg $(SUBDIR)/lib/libogg.a : $(SUBDIR)/libogg.tar.gz ;
-
-# libsamplerate
-rule LibSampleRate
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibSampleRate
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libsamplerate && (gzip -dc libsamplerate.tar.gz | tar xf - ) &&
- cd libsamplerate &&
- ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libsamplerate.a
-}
-Wget $(SUBDIR)/libsamplerate.tar.gz : $(SUBDIR)/version_libsamplerate.txt ;
-LibSampleRate $(SUBDIR)/lib/libsamplerate.a : $(SUBDIR)/libsamplerate.tar.gz ;
-
-# libvorbis
-rule LibVorbis
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibVorbis
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf libvorbis && (gzip -dc libvorbis.tar.gz | tar xf - ) &&
- cd libvorbis &&
- ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libvorbis.a
-}
-Wget $(SUBDIR)/libvorbis.tar.gz : $(SUBDIR)/version_libvorbis.txt ;
-LibVorbis $(SUBDIR)/lib/libvorbis.a : $(SUBDIR)/libvorbis.tar.gz ;
-
-rule LibVorbisEnc
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibVorbisEnc
-{
- $(STRIP) $(<)
-}
-LibVorbisEnc $(SUBDIR)/lib/libvorbisenc.a : $(SUBDIR)/lib/libvorbis.a ;
-
-# libtheora
-rule LibTheora
-{
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibTheora
-{
- cd `dirname $(>)` && CONTRIB=`pwd` && rm -rf libtheora &&
- (gzip -dc libtheora.tar.gz | tar xf - ) && cd libtheora &&
- HAVE_PKG_CONFIG="no" && export HAVE_PKG_CONFIG &&
- ./configure --prefix=$CONTRIB --with-ogg=$CONTRIB --with-vorbis=$CONTRIB --cache-file=$CONTRIB/config.cache --disable-shared \
- --disable-oggtest --disable-vorbistest --disable-sdltest --disable-examples &&
- $(MAKE) && $(MAKE) install &&
- $(STRIP) $CONTRIB/lib/libtheora.a
-}
-Wget $(SUBDIR)/libtheora.tar.gz : $(SUBDIR)/version_libtheora.txt ;
-LibTheora $(SUBDIR)/lib/libtheora.a : $(SUBDIR)/libtheora.tar.gz ;
-
-# libx264
-rule LibX264
-{
- LIBX264_PATCH = "" ;
- if $(OS) = CYGWIN
- {
- LIBX264_PATCH += "$(PATCH) -p1 < ../patch-x264-cygwin.patch && " ;
- }
- else if $(OS) = SOLARIS
- {
- LIBX264_PATCH += " $(PATCH) -p1 < ../patch-x264-solaris.patch && " ;
- }
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibX264
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf x264 && (gzip -dc x264.tar.gz | tar xf - ) &&
- cd x264 && $(LIBX264_PATCH)
- bash ./configure --prefix=$CONTRIB --enable-pthread &&
- $(MAKE) libx264.a && cp libx264.a $CONTRIB/lib/ && cp x264.h $CONTRIB/include/ && $(STRIP) $CONTRIB/lib/libx264.a
-}
-Wget $(SUBDIR)/x264.tar.gz : $(SUBDIR)/version_x264.txt ;
-LibX264 $(SUBDIR)/lib/libx264.a : $(SUBDIR)/x264.tar.gz ;
-
-# libxvidcore
-rule LibXvidCore
-{
- LIBXVIDCORE_PATCH = "" ;
- if $(OS) = MACOSX
- {
- LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-macosx.patch && " ;
- }
- else if $(OS) = CYGWIN
- {
- LIBXVIDCORE_PATCH = "$(PATCH) -p1 < ../patch-xvidcore-cygwin.patch && " ;
- }
- LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-nasm-2.00-configure.patch && " ;
- LIBXVIDCORE_PATCH += "$(PATCH) -p1 < ../patch-xvidcore-fdct.patch && " ;
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
-}
-actions LibXvidCore
-{
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf xvidcore && (gzip -dc xvidcore.tar.gz | tar xf - ) &&
- cd xvidcore && $(LIBXVIDCORE_PATCH)
- cd build/generic/ && ./configure --prefix=$CONTRIB --cache-file=$CONTRIB/config.cache && $(MAKE) libxvidcore.a &&
- cp ./=build/libxvidcore.a $CONTRIB/lib/ &&
- cp ../../src/xvid.h $CONTRIB/include/ &&
- $(STRIP) $CONTRIB/lib/libxvidcore.a
-}
-Wget $(SUBDIR)/xvidcore.tar.gz : $(SUBDIR)/version_xvidcore.txt ;
-LibXvidCore $(SUBDIR)/lib/libxvidcore.a : $(SUBDIR)/xvidcore.tar.gz ;
-
-# zlib
-if $(OS) = CYGWIN
-{
- rule Zlib
- {
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
- }
- actions Zlib
- {
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf zlib && (gzip -dc zlib.tar.gz | tar xf - ) &&
- cd zlib && ./configure --prefix=$CONTRIB &&
- $(MAKE) && $(MAKE) install && touch $CONTRIB/.contrib &&
- $(STRIP) $CONTRIB/lib/libz.a
- }
- Wget $(SUBDIR)/zlib.tar.gz : $(SUBDIR)/version_zlib.txt ;
- Zlib $(SUBDIR)/lib/libz.a : $(SUBDIR)/zlib.tar.gz ;
-}
-
-# bzip2
-if $(OS) = CYGWIN
-{
- rule BZip2
- {
- Depends $(<) : $(>) ;
- Depends lib : $(<) ;
- }
- actions BZip2
- {
- cd `dirname $(>)` && CONTRIB=`pwd` &&
- rm -rf bzip2 && (gzip -dc bzip2.tar.gz | tar xf - ) &&
- cd bzip2 && $(MAKE) && $(MAKE) install && cp libbz2.a $CONTRIB/lib/ &&
- $(STRIP) $CONTRIB/lib/libbz2.a
- }
- Wget $(SUBDIR)/bzip2.tar.gz : $(SUBDIR)/version_bzip2.txt ;
- BZip2 $(SUBDIR)/lib/libbz2.a : $(SUBDIR)/bzip2.tar.gz ;
-}
diff --git a/contrib/Makefile b/contrib/Makefile
deleted file mode 100644
index 1855ed06c..000000000
--- a/contrib/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-# Contrib Makefile
-
-SYSTEM = $(shell uname -s)
-
-# Special case for Mac OS X: everything is handled from the Xcode project
-ifeq ($(SYSTEM),Darwin)
-
-all: .contrib
-
-.contrib:
- ( cd .. ; ./configure ; cd contrib ; cp -f ../config.jam . ; ../jam )
-
-clean:
- ( echo "Do a make mrproper to remove the contrib libraries )
-
-mrproper:
- (rm -rf lib ; rm -rf include )
-
-endif
-
-ifeq ($(SYSTEM),Linux)
-
-all: .contrib
-
-.contrib:
- ( cd .. ; ./configure ; cd contrib ; cp -f ../config.jam . ; jam )
-
-clean:
- ( echo "Do a make mrproper to remove the contrib libraries )
-
-mrproper:
- (rm -rf lib ; rm -rf include )
-
-endif
-
-ifeq ($(findstring CYGWIN_NT,$(SYSTEM)),CYGWIN_NT)
-
-all: .contrib
-
-.contrib:
- ( cd .. ; ./configure ; cd contrib ; cp -f ../config.jam . ; jam.exe )
-
-clean:
- ( echo "Do a make mrproper to remove the contrib libraries )
-
-mrproper: clean
- (rm -rf lib ; rm -rf include ; rm -f .contrib)
-
-endif
diff --git a/contrib/patch-a52dec.patch b/contrib/a52dec/A00-dpl2.patch
index cf1c8a64a..cf1c8a64a 100644
--- a/contrib/patch-a52dec.patch
+++ b/contrib/a52dec/A00-dpl2.patch
diff --git a/contrib/a52dec/module.defs b/contrib/a52dec/module.defs
new file mode 100644
index 000000000..470ddfa12
--- /dev/null
+++ b/contrib/a52dec/module.defs
@@ -0,0 +1,6 @@
+$(eval $(call import.MODULE.defs,A52DEC,a52dec))
+$(eval $(call import.CONTRIB.defs,A52DEC))
+
+A52DEC.FETCH.url = http://download.m0k.org/handbrake/contrib/a52dec-0.7.4.tar.gz
+A52DEC.EXTRACT.tarbase = a52dec
+A52DEC.INSTALL.strip = liba52.a
diff --git a/contrib/a52dec/module.rules b/contrib/a52dec/module.rules
new file mode 100644
index 000000000..cecab72f7
--- /dev/null
+++ b/contrib/a52dec/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,A52DEC))
+$(eval $(call import.CONTRIB.rules,A52DEC))
diff --git a/contrib/bzip2/module.defs b/contrib/bzip2/module.defs
new file mode 100644
index 000000000..dcc878ad4
--- /dev/null
+++ b/contrib/bzip2/module.defs
@@ -0,0 +1,24 @@
+$(eval $(call import.MODULE.defs,BZIP2,bzip2))
+$(eval $(call import.CONTRIB.defs,BZIP2))
+
+BZIP2.FETCH.url = http://download.m0k.org/handbrake/contrib/bzip2-1.0.5.tar.gz
+BZIP2.EXTRACT.tarbase = bzip2
+BZIP2.CONFIGURE =
+
+BZIP2.BUILD.extra = \
+ CC=$(BZIP2.GCC.gcc) \
+ CFLAGS="$(call fn.ARGS,BZIP2.GCC,*archs)" \
+ PREFIX=$(call fn.ABSOLUTE,$(CONTRIB.build/))
+
+BZIP2.BUILD.ntargets = libbz2.a
+
+define BZIP2.INSTALL
+ mkdir -p $(CONTRIB.build/)lib/ $(CONTRIB.build/)include/
+ cp $(BZIP2.EXTRACT.target/)libbz2.a $(CONTRIB.build/)lib/
+ cp $(BZIP2.EXTRACT.target/)bzlib.h $(CONTRIB.build/)include/
+endef
+
+define BZIP2.UNINSTALL
+ rm $(CONTRIB.build/)lib/libbz2.a
+ rm $(CONTRIB.build/)include/bzlib.h
+endef
diff --git a/contrib/bzip2/module.rules b/contrib/bzip2/module.rules
new file mode 100644
index 000000000..456bb1215
--- /dev/null
+++ b/contrib/bzip2/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,BZIP2))
+$(eval $(call import.CONTRIB.rules,BZIP2))
diff --git a/contrib/patch-faac-cygwin.patch b/contrib/faac/P00-cygwin.patch
index d54b08d02..d54b08d02 100644
--- a/contrib/patch-faac-cygwin.patch
+++ b/contrib/faac/P00-cygwin.patch
diff --git a/contrib/faac/module.defs b/contrib/faac/module.defs
new file mode 100644
index 000000000..2b032fee9
--- /dev/null
+++ b/contrib/faac/module.defs
@@ -0,0 +1,8 @@
+$(eval $(call import.MODULE.defs,FAAC,faac))
+$(eval $(call import.CONTRIB.defs,FAAC))
+
+FAAC.FETCH.url = http://download.m0k.org/handbrake/contrib/faac-1.26.tar.gz
+FAAC.EXTRACT.tarbase = faac
+
+FAAC.CONFIGURE.bootstrap = ./bootstrap;
+FAAC.CONFIGURE.extra = --without-mp4v2
diff --git a/contrib/faac/module.rules b/contrib/faac/module.rules
new file mode 100644
index 000000000..5c311304a
--- /dev/null
+++ b/contrib/faac/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,FAAC))
+$(eval $(call import.CONTRIB.rules,FAAC))
diff --git a/contrib/patch-faad2-libtool22.patch b/contrib/faad2/A00-libtool22.patch
index 4eab08487..4eab08487 100644
--- a/contrib/patch-faad2-libtool22.patch
+++ b/contrib/faad2/A00-libtool22.patch
diff --git a/contrib/faad2/module.defs b/contrib/faad2/module.defs
new file mode 100644
index 000000000..04b9e0b82
--- /dev/null
+++ b/contrib/faad2/module.defs
@@ -0,0 +1,7 @@
+$(eval $(call import.MODULE.defs,FAAD2,faad2))
+$(eval $(call import.CONTRIB.defs,FAAD2))
+
+FAAD2.FETCH.url = http://download.m0k.org/handbrake/contrib/faad2-2.6.1.tar.gz
+FAAD2.EXTRACT.tarbase = faad2
+
+FAAD2.CONFIGURE.bootstrap = ./bootstrap;
diff --git a/contrib/faad2/module.rules b/contrib/faad2/module.rules
new file mode 100644
index 000000000..2b9bdd015
--- /dev/null
+++ b/contrib/faad2/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,FAAD2))
+$(eval $(call import.CONTRIB.rules,FAAD2))
diff --git a/contrib/patch-ffmpeg-latm.patch b/contrib/ffmpeg/A00-latm.patch
index 84cd6a85f..a286f4c19 100644
--- a/contrib/patch-ffmpeg-latm.patch
+++ b/contrib/ffmpeg/A00-latm.patch
@@ -1,8 +1,7 @@
-Index: libavcodec/Makefile
-===================================================================
---- libavcodec/Makefile (revision 14016)
-+++ libavcodec/Makefile (working copy)
-@@ -322,7 +322,7 @@
+diff -Naur ffmpeg.orig/libavcodec/Makefile ffmpeg/libavcodec/Makefile
+--- ffmpeg.orig/libavcodec/Makefile 2008-12-01 01:40:36.000000000 -0500
++++ ffmpeg/libavcodec/Makefile 2009-02-21 08:25:13.000000000 -0500
+@@ -338,7 +338,7 @@
OBJS-$(CONFIG_LIBDIRAC_DECODER) += libdiracdec.o
OBJS-$(CONFIG_LIBDIRAC_ENCODER) += libdiracenc.o libdirac_libschro.o
OBJS-$(CONFIG_LIBFAAC) += libfaac.o
@@ -20,10 +19,171 @@ Index: libavcodec/Makefile
OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o aac_ac3_parser.o
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o
-Index: libavcodec/latmaac.c
-===================================================================
---- libavcodec/latmaac.c (revision 0)
-+++ libavcodec/latmaac.c (revision 0)
+diff -Naur ffmpeg.orig/libavcodec/allcodecs.c ffmpeg/libavcodec/allcodecs.c
+--- ffmpeg.orig/libavcodec/allcodecs.c 2008-12-01 01:40:36.000000000 -0500
++++ ffmpeg/libavcodec/allcodecs.c 2009-02-21 08:25:13.000000000 -0500
+@@ -291,6 +291,7 @@
+ REGISTER_ENCDEC (LIBDIRAC, libdirac);
+ REGISTER_ENCODER (LIBFAAC, libfaac);
+ REGISTER_DECODER (LIBFAAD, libfaad);
++ REGISTER_DECODER (LIBFAAD, libfaad2);
+ REGISTER_ENCDEC (LIBGSM, libgsm);
+ REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
+ REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
+@@ -303,6 +304,7 @@
+
+ /* parsers */
+ REGISTER_PARSER (AAC, aac);
++ REGISTER_PARSER (AAC, aac_latm);
+ REGISTER_PARSER (AC3, ac3);
+ REGISTER_PARSER (CAVSVIDEO, cavsvideo);
+ REGISTER_PARSER (DCA, dca);
+diff -Naur ffmpeg.orig/libavcodec/avcodec.h ffmpeg/libavcodec/avcodec.h
+--- ffmpeg.orig/libavcodec/avcodec.h 2008-12-01 01:40:36.000000000 -0500
++++ ffmpeg/libavcodec/avcodec.h 2009-02-21 08:25:13.000000000 -0500
+@@ -264,6 +264,7 @@
+ CODEC_ID_MP2= 0x15000,
+ CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
+ CODEC_ID_AAC,
++ CODEC_ID_AAC_LATM,
+ CODEC_ID_AC3,
+ CODEC_ID_DTS,
+ CODEC_ID_VORBIS,
+diff -Naur ffmpeg.orig/libavcodec/latm_parser.c ffmpeg/libavcodec/latm_parser.c
+--- ffmpeg.orig/libavcodec/latm_parser.c 1969-12-31 19:00:00.000000000 -0500
++++ ffmpeg/libavcodec/latm_parser.c 2009-02-21 08:25:13.000000000 -0500
+@@ -0,0 +1,128 @@
++/*
++ * LATM parser
++ * Copyright (c) 2008 Paul Kendall <[email protected]>
++ *
++ * This file is part of FFmpeg.
++ *
++ * FFmpeg 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.
++ *
++ * FFmpeg 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 FFmpeg; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ */
++
++/**
++ * @file latm_parser.c
++ * LATM parser
++ */
++
++#include "parser.h"
++
++#define LATM_HEADER 0x56e000 // 0x2b7 (11 bits)
++#define LATM_MASK 0xFFE000 // top 11 bits
++#define LATM_SIZE_MASK 0x001FFF // bottom 13 bits
++
++typedef struct LATMParseContext{
++ ParseContext pc;
++ int count;
++} LATMParseContext;
++
++/**
++ * finds the end of the current frame in the bitstream.
++ * @return the position of the first byte of the next frame, or -1
++ */
++static int latm_find_frame_end(AVCodecParserContext *s1, const uint8_t *buf,
++ int buf_size) {
++ LATMParseContext *s = s1->priv_data;
++ ParseContext *pc = &s->pc;
++ int pic_found, i;
++ uint32_t state;
++
++ pic_found = pc->frame_start_found;
++ state = pc->state;
++
++ i = 0;
++ if(!pic_found){
++ for(i=0; i<buf_size; i++){
++ state = (state<<8) | buf[i];
++ if((state & LATM_MASK) == LATM_HEADER){
++ i++;
++ s->count = - i;
++ pic_found=1;
++ break;
++ }
++ }
++ }
++
++ if(pic_found){
++ /* EOF considered as end of frame */
++ if (buf_size == 0)
++ return 0;
++ if((state & LATM_SIZE_MASK) - s->count <= buf_size) {
++ pc->frame_start_found = 0;
++ pc->state = -1;
++ return (state & LATM_SIZE_MASK) - s->count;
++ }
++ }
++
++ s->count += buf_size;
++ pc->frame_start_found = pic_found;
++ pc->state = state;
++ return END_NOT_FOUND;
++}
++
++static int latm_parse(AVCodecParserContext *s1,
++ AVCodecContext *avctx,
++ const uint8_t **poutbuf, int *poutbuf_size,
++ const uint8_t *buf, int buf_size)
++{
++ LATMParseContext *s = s1->priv_data;
++ ParseContext *pc = &s->pc;
++ int next;
++
++ if(s1->flags & PARSER_FLAG_COMPLETE_FRAMES){
++ next = buf_size;
++ }else{
++ next = latm_find_frame_end(s1, buf, buf_size);
++
++ if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
++ *poutbuf = NULL;
++ *poutbuf_size = 0;
++ return buf_size;
++ }
++ }
++ *poutbuf = buf;
++ *poutbuf_size = buf_size;
++ return next;
++}
++
++static int latm_split(AVCodecContext *avctx,
++ const uint8_t *buf, int buf_size)
++{
++ int i;
++ uint32_t state= -1;
++
++ for(i=0; i<buf_size; i++){
++ state= (state<<8) | buf[i];
++ if((state & LATM_MASK) == LATM_HEADER)
++ return i-2;
++ }
++ return 0;
++}
++
++AVCodecParser aac_latm_parser = {
++ { CODEC_ID_AAC_LATM },
++ sizeof(LATMParseContext),
++ NULL,
++ latm_parse,
++ ff_parse_close,
++ latm_split,
++};
+diff -Naur ffmpeg.orig/libavcodec/latmaac.c ffmpeg/libavcodec/latmaac.c
+--- ffmpeg.orig/libavcodec/latmaac.c 1969-12-31 19:00:00.000000000 -0500
++++ ffmpeg/libavcodec/latmaac.c 2009-02-21 08:25:13.000000000 -0500
@@ -0,0 +1,624 @@
+/*
+ * copyright (c) 2008 Paul Kendall <[email protected]>
@@ -649,182 +809,51 @@ Index: libavcodec/latmaac.c
+ .long_name = "AAC over LATM",
+};
+
-Index: libavcodec/latm_parser.c
-===================================================================
---- libavcodec/latm_parser.c (revision 0)
-+++ libavcodec/latm_parser.c (revision 0)
-@@ -0,0 +1,128 @@
-+/*
-+ * LATM parser
-+ * Copyright (c) 2008 Paul Kendall <[email protected]>
-+ *
-+ * This file is part of FFmpeg.
-+ *
-+ * FFmpeg 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.
-+ *
-+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ */
-+
-+/**
-+ * @file latm_parser.c
-+ * LATM parser
-+ */
-+
-+#include "parser.h"
-+
-+#define LATM_HEADER 0x56e000 // 0x2b7 (11 bits)
-+#define LATM_MASK 0xFFE000 // top 11 bits
-+#define LATM_SIZE_MASK 0x001FFF // bottom 13 bits
-+
-+typedef struct LATMParseContext{
-+ ParseContext pc;
-+ int count;
-+} LATMParseContext;
-+
-+/**
-+ * finds the end of the current frame in the bitstream.
-+ * @return the position of the first byte of the next frame, or -1
-+ */
-+static int latm_find_frame_end(AVCodecParserContext *s1, const uint8_t *buf,
-+ int buf_size) {
-+ LATMParseContext *s = s1->priv_data;
-+ ParseContext *pc = &s->pc;
-+ int pic_found, i;
-+ uint32_t state;
-+
-+ pic_found = pc->frame_start_found;
-+ state = pc->state;
-+
-+ i = 0;
-+ if(!pic_found){
-+ for(i=0; i<buf_size; i++){
-+ state = (state<<8) | buf[i];
-+ if((state & LATM_MASK) == LATM_HEADER){
-+ i++;
-+ s->count = - i;
-+ pic_found=1;
-+ break;
-+ }
-+ }
-+ }
-+
-+ if(pic_found){
-+ /* EOF considered as end of frame */
-+ if (buf_size == 0)
-+ return 0;
-+ if((state & LATM_SIZE_MASK) - s->count <= buf_size) {
-+ pc->frame_start_found = 0;
-+ pc->state = -1;
-+ return (state & LATM_SIZE_MASK) - s->count;
-+ }
-+ }
-+
-+ s->count += buf_size;
-+ pc->frame_start_found = pic_found;
-+ pc->state = state;
-+ return END_NOT_FOUND;
-+}
-+
-+static int latm_parse(AVCodecParserContext *s1,
-+ AVCodecContext *avctx,
-+ const uint8_t **poutbuf, int *poutbuf_size,
-+ const uint8_t *buf, int buf_size)
-+{
-+ LATMParseContext *s = s1->priv_data;
-+ ParseContext *pc = &s->pc;
-+ int next;
-+
-+ if(s1->flags & PARSER_FLAG_COMPLETE_FRAMES){
-+ next = buf_size;
-+ }else{
-+ next = latm_find_frame_end(s1, buf, buf_size);
-+
-+ if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-+ *poutbuf = NULL;
-+ *poutbuf_size = 0;
-+ return buf_size;
-+ }
-+ }
-+ *poutbuf = buf;
-+ *poutbuf_size = buf_size;
-+ return next;
-+}
-+
-+static int latm_split(AVCodecContext *avctx,
-+ const uint8_t *buf, int buf_size)
-+{
-+ int i;
-+ uint32_t state= -1;
-+
-+ for(i=0; i<buf_size; i++){
-+ state= (state<<8) | buf[i];
-+ if((state & LATM_MASK) == LATM_HEADER)
-+ return i-2;
-+ }
-+ return 0;
-+}
-+
-+AVCodecParser aac_latm_parser = {
-+ { CODEC_ID_AAC_LATM },
-+ sizeof(LATMParseContext),
-+ NULL,
-+ latm_parse,
-+ ff_parse_close,
-+ latm_split,
-+};
-Index: libavcodec/allcodecs.c
-===================================================================
---- libavcodec/allcodecs.c (revision 14016)
-+++ libavcodec/allcodecs.c (working copy)
-@@ -280,6 +280,7 @@
- REGISTER_ENCDEC (LIBDIRAC, libdirac);
- REGISTER_ENCODER (LIBFAAC, libfaac);
- REGISTER_DECODER (LIBFAAD, libfaad);
-+ REGISTER_DECODER (LIBFAAD, libfaad2);
- REGISTER_ENCDEC (LIBGSM, libgsm);
- REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
- REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
-@@ -294,6 +295,7 @@
+diff -Naur ffmpeg.orig/libavformat/mpeg.c ffmpeg/libavformat/mpeg.c
+--- ffmpeg.orig/libavformat/mpeg.c 2008-10-02 12:03:00.000000000 -0400
++++ ffmpeg/libavformat/mpeg.c 2009-02-21 08:25:13.000000000 -0500
+@@ -281,7 +281,7 @@
+ /* find matching stream */
+ if (!((startcode >= 0x1c0 && startcode <= 0x1df) ||
+ (startcode >= 0x1e0 && startcode <= 0x1ef) ||
+- (startcode == 0x1bd) || (startcode == 0x1fd)))
++ (startcode == 0x1bd) || (startcode == 0x1fa) || (startcode == 0x1fd)))
+ goto redo;
+ if (ppos) {
+ *ppos = url_ftell(s->pb) - 4;
+@@ -441,6 +441,9 @@
+ } else if(es_type == STREAM_TYPE_AUDIO_AAC){
+ codec_id = CODEC_ID_AAC;
+ type = CODEC_TYPE_AUDIO;
++ } else if(es_type == STREAM_TYPE_AUDIO_AAC_LATM){
++ codec_id = CODEC_ID_AAC_LATM;
++ type = CODEC_TYPE_AUDIO;
+ } else if(es_type == STREAM_TYPE_VIDEO_MPEG4){
+ codec_id = CODEC_ID_MPEG4;
+ type = CODEC_TYPE_VIDEO;
+diff -Naur ffmpeg.orig/libavformat/mpeg.h ffmpeg/libavformat/mpeg.h
+--- ffmpeg.orig/libavformat/mpeg.h 2008-08-31 03:39:47.000000000 -0400
++++ ffmpeg/libavformat/mpeg.h 2009-02-21 08:25:13.000000000 -0500
+@@ -53,6 +53,7 @@
+ #define STREAM_TYPE_PRIVATE_DATA 0x06
+ #define STREAM_TYPE_AUDIO_AAC 0x0f
+ #define STREAM_TYPE_VIDEO_MPEG4 0x10
++#define STREAM_TYPE_AUDIO_AAC_LATM 0x11
+ #define STREAM_TYPE_VIDEO_H264 0x1b
- /* parsers */
- REGISTER_PARSER (AAC, aac);
-+ REGISTER_PARSER (AAC, aac_latm);
- REGISTER_PARSER (AC3, ac3);
- REGISTER_PARSER (CAVSVIDEO, cavsvideo);
- REGISTER_PARSER (DCA, dca);
-Index: libavcodec/avcodec.h
-===================================================================
---- libavcodec/avcodec.h (revision 14016)
-+++ libavcodec/avcodec.h (working copy)
-@@ -259,4 +259,5 @@
- CODEC_ID_AAC,
-+ CODEC_ID_AAC_LATM,
- CODEC_ID_AC3,
- CODEC_ID_DTS,
- CODEC_ID_VORBIS,
-Index: libavformat/mpegts.c
-===================================================================
---- libavformat/mpegts.c (revision 14016)
-+++ libavformat/mpegts.c (working copy)
-@@ -611,6 +611,7 @@
- case STREAM_TYPE_VIDEO_H264:
+ #define STREAM_TYPE_AUDIO_AC3 0x81
+diff -Naur ffmpeg.orig/libavformat/mpegts.c ffmpeg/libavformat/mpegts.c
+--- ffmpeg.orig/libavformat/mpegts.c 2008-10-02 12:28:58.000000000 -0400
++++ ffmpeg/libavformat/mpegts.c 2009-02-21 08:25:13.000000000 -0500
+@@ -625,6 +625,7 @@
case STREAM_TYPE_VIDEO_VC1:
+ case STREAM_TYPE_VIDEO_DIRAC:
case STREAM_TYPE_AUDIO_AAC:
+ case STREAM_TYPE_AUDIO_AAC_LATM:
case STREAM_TYPE_AUDIO_AC3:
case STREAM_TYPE_AUDIO_DTS:
case STREAM_TYPE_AUDIO_HDMV_DTS:
-@@ -832,7 +833,7 @@
+@@ -847,7 +848,7 @@
code = pes->header[3] | 0x100;
if (!((code >= 0x1c0 && code <= 0x1df) ||
(code >= 0x1e0 && code <= 0x1ef) ||
@@ -833,7 +862,7 @@ Index: libavformat/mpegts.c
goto skip;
if (!pes->st) {
/* allocate stream */
-@@ -948,6 +949,10 @@
+@@ -968,6 +969,10 @@
codec_type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_AAC;
break;
@@ -844,10 +873,9 @@ Index: libavformat/mpegts.c
case STREAM_TYPE_AUDIO_AC3:
codec_type = CODEC_TYPE_AUDIO;
codec_id = CODEC_ID_AC3;
-Index: libavformat/mpegts.h
-===================================================================
---- libavformat/mpegts.h (revision 14016)
-+++ libavformat/mpegts.h (working copy)
+diff -Naur ffmpeg.orig/libavformat/mpegts.h ffmpeg/libavformat/mpegts.h
+--- ffmpeg.orig/libavformat/mpegts.h 2008-08-31 03:39:47.000000000 -0400
++++ ffmpeg/libavformat/mpegts.h 2009-02-21 08:25:13.000000000 -0500
@@ -50,6 +50,7 @@
#define STREAM_TYPE_PRIVATE_DATA 0x06
#define STREAM_TYPE_AUDIO_AAC 0x0f
@@ -855,39 +883,4 @@ Index: libavformat/mpegts.h
+#define STREAM_TYPE_AUDIO_AAC_LATM 0x11
#define STREAM_TYPE_VIDEO_H264 0x1b
#define STREAM_TYPE_VIDEO_VC1 0xea
-
-Index: libavformat/mpeg.c
-===================================================================
---- libavformat/mpeg.c (revision 14016)
-+++ libavformat/mpeg.c (working copy)
-@@ -281,7 +281,7 @@
- /* find matching stream */
- if (!((startcode >= 0x1c0 && startcode <= 0x1df) ||
- (startcode >= 0x1e0 && startcode <= 0x1ef) ||
-- (startcode == 0x1bd) || (startcode == 0x1fd)))
-+ (startcode == 0x1bd) || (startcode == 0x1fa) || (startcode == 0x1fd)))
- goto redo;
- if (ppos) {
- *ppos = url_ftell(s->pb) - 4;
-@@ -439,6 +439,9 @@
- } else if(es_type == STREAM_TYPE_AUDIO_AAC){
- codec_id = CODEC_ID_AAC;
- type = CODEC_TYPE_AUDIO;
-+ } else if(es_type == STREAM_TYPE_AUDIO_AAC_LATM){
-+ codec_id = CODEC_ID_AAC_LATM;
-+ type = CODEC_TYPE_AUDIO;
- } else if(es_type == STREAM_TYPE_VIDEO_MPEG4){
- codec_id = CODEC_ID_MPEG4;
- type = CODEC_TYPE_VIDEO;
-Index: libavformat/mpeg.h
-===================================================================
---- libavformat/mpeg.h (revision 14016)
-+++ libavformat/mpeg.h (working copy)
-@@ -53,6 +53,7 @@
- #define STREAM_TYPE_PRIVATE_DATA 0x06
- #define STREAM_TYPE_AUDIO_AAC 0x0f
- #define STREAM_TYPE_VIDEO_MPEG4 0x10
-+#define STREAM_TYPE_AUDIO_AAC_LATM 0x11
- #define STREAM_TYPE_VIDEO_H264 0x1b
-
- #define STREAM_TYPE_AUDIO_AC3 0x81
+ #define STREAM_TYPE_VIDEO_DIRAC 0xd1
diff --git a/contrib/patch-ffmpeg-mpegleak.patch b/contrib/ffmpeg/A01-mpegleak.patch
index 74907258b..36179ba57 100644
--- a/contrib/patch-ffmpeg-mpegleak.patch
+++ b/contrib/ffmpeg/A01-mpegleak.patch
@@ -1,8 +1,7 @@
-Index: libavcodec/h264.c
-===================================================================
---- libavcodec/h264.c (revision 14820)
-+++ libavcodec/h264.c (working copy)
-@@ -3355,7 +3355,7 @@
+diff -Naur ffmpeg.orig/libavcodec/h264.c ffmpeg/libavcodec/h264.c
+--- ffmpeg.orig/libavcodec/h264.c 2008-12-01 11:24:19.000000000 -0500
++++ ffmpeg/libavcodec/h264.c 2009-02-21 08:23:58.000000000 -0500
+@@ -3298,7 +3298,7 @@
* stream. Need to discard one frame. Prevents overrun of the
* short_ref and long_ref buffers.
*/
@@ -11,7 +10,7 @@ Index: libavcodec/h264.c
"number of reference frames exceeds max (probably "
"corrupt input), discarding one\n");
-@@ -7557,7 +7557,7 @@
+@@ -7556,7 +7556,7 @@
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
@@ -20,10 +19,9 @@ Index: libavcodec/h264.c
return -1;
}
-Index: libavcodec/mpegvideo.c
-===================================================================
---- libavcodec/mpegvideo.c (revision 14820)
-+++ libavcodec/mpegvideo.c (working copy)
+diff -Naur ffmpeg.orig/libavcodec/mpegvideo.c ffmpeg/libavcodec/mpegvideo.c
+--- ffmpeg.orig/libavcodec/mpegvideo.c 2008-10-01 20:27:09.000000000 -0400
++++ ffmpeg/libavcodec/mpegvideo.c 2009-02-21 08:23:58.000000000 -0500
@@ -779,19 +779,18 @@
}
diff --git a/contrib/ffmpeg/A02-audioconvert.patch b/contrib/ffmpeg/A02-audioconvert.patch
new file mode 100644
index 000000000..5062e3439
--- /dev/null
+++ b/contrib/ffmpeg/A02-audioconvert.patch
@@ -0,0 +1,12 @@
+diff -Naur ffmpeg.orig/libavcodec/Makefile ffmpeg/libavcodec/Makefile
+--- ffmpeg.orig/libavcodec/Makefile 2008-12-01 01:40:36.000000000 -0500
++++ ffmpeg/libavcodec/Makefile 2009-02-23 07:03:23.000000000 -0500
+@@ -3,7 +3,7 @@
+ NAME = avcodec
+ FFLIBS = avutil
+
+-HEADERS = avcodec.h opt.h
++HEADERS = avcodec.h opt.h audioconvert.h
+
+ OBJS = allcodecs.o \
+ audioconvert.o \
diff --git a/contrib/patch-ffmpeg-cygwin.patch b/contrib/ffmpeg/P00-cygwin.patch
index b6ca99f26..b6ca99f26 100644
--- a/contrib/patch-ffmpeg-cygwin.patch
+++ b/contrib/ffmpeg/P00-cygwin.patch
diff --git a/contrib/patch-ffmpeg-solaris.patch b/contrib/ffmpeg/P01-sunos.patch
index f5cd7d726..f5cd7d726 100644
--- a/contrib/patch-ffmpeg-solaris.patch
+++ b/contrib/ffmpeg/P01-sunos.patch
diff --git a/contrib/patch-ffmpeg-h264dsp-crash.diff b/contrib/ffmpeg/P02-darwin-h264dsp-crash.patch
index 53b5cf09d..53b5cf09d 100644
--- a/contrib/patch-ffmpeg-h264dsp-crash.diff
+++ b/contrib/ffmpeg/P02-darwin-h264dsp-crash.patch
diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs
new file mode 100644
index 000000000..b41291018
--- /dev/null
+++ b/contrib/ffmpeg/module.defs
@@ -0,0 +1,32 @@
+$(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,FAAD2))
+$(eval $(call import.CONTRIB.defs,FFMPEG))
+
+FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-r15974.tar.gz
+FFMPEG.EXTRACT.tarbase = ffmpeg
+
+FFMPEG.CONFIGURE.deps =
+FFMPEG.CONFIGURE.env =
+FFMPEG.CONFIGURE.host =
+
+FFMPEG.CONFIGURE.extra = \
+ --disable-bsfs \
+ --disable-encoders \
+ --disable-ffmpeg \
+ --disable-ffserver \
+ --disable-muxers \
+ --disable-vhook \
+ --enable-encoder=ac3 \
+ --enable-encoder=mpeg4 \
+ --enable-encoder=snow \
+ --enable-gpl \
+ --enable-libfaad \
+ --enable-muxer=ipod \
+ --enable-pthreads \
+ --enable-swscale \
+ --cc="$(GCC.gcc)" \
+ --extra-cflags="$(call fn.ARGS,FFMPEG.GCC,*archs) -I$(call fn.ABSOLUTE,$(CONTRIB.build/)include)" \
+ --extra-ldflags="$(call fn.ARGS,FFMPEG.GCC,*archs) -L$(call fn.ABSOLUTE,$(CONTRIB.build/)lib)"
+
+ifeq ($(BUILD.cross),1)
+ FFMPEG.CONFIGURE.extra += --enable-cross-compile --arch=$(FFMPEG.GCC.archs)
+endif
diff --git a/contrib/ffmpeg/module.rules b/contrib/ffmpeg/module.rules
new file mode 100644
index 000000000..7f475b3ec
--- /dev/null
+++ b/contrib/ffmpeg/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,FFMPEG))
+$(eval $(call import.CONTRIB.rules,FFMPEG))
diff --git a/contrib/lame/P00-darwin-xmmintrin.patch b/contrib/lame/P00-darwin-xmmintrin.patch
new file mode 100644
index 000000000..de19e55ba
--- /dev/null
+++ b/contrib/lame/P00-darwin-xmmintrin.patch
@@ -0,0 +1,28 @@
+diff -Naur lame.orig/configure lame/configure
+--- lame.orig/configure 2008-06-29 17:40:05.000000000 -0400
++++ lame/configure 2008-10-14 05:01:29.000000000 -0400
+@@ -21031,7 +21031,14 @@
+
+
+
+-
++case $host_cpu in
++powerpc*)
++ check_xmmintrin=
++ ;;
++*)
++ check_xmmintrin="xmmintrin.h"
++ ;;
++esac
+
+ for ac_header in \
+ errno.h \
+@@ -21042,7 +21049,7 @@
+ sys/soundcard.h \
+ sys/time.h \
+ unistd.h \
+- xmmintrin.h \
++ $check_xmmintrin \
+ linux/soundcard.h
+ do
+ as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/contrib/lame/module.defs b/contrib/lame/module.defs
new file mode 100644
index 000000000..dd89cd683
--- /dev/null
+++ b/contrib/lame/module.defs
@@ -0,0 +1,5 @@
+$(eval $(call import.MODULE.defs,LAME,lame))
+$(eval $(call import.CONTRIB.defs,LAME))
+
+LAME.FETCH.url = http://download.m0k.org/handbrake/contrib/lame-3.98.tar.gz
+LAME.EXTRACT.tarbase = lame
diff --git a/contrib/lame/module.rules b/contrib/lame/module.rules
new file mode 100644
index 000000000..058bc7b56
--- /dev/null
+++ b/contrib/lame/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LAME))
+$(eval $(call import.CONTRIB.rules,LAME))
diff --git a/contrib/patch-libdca.patch b/contrib/libdca/A00-general.patch
index cab8db266..cab8db266 100644
--- a/contrib/patch-libdca.patch
+++ b/contrib/libdca/A00-general.patch
diff --git a/contrib/libdca/module.defs b/contrib/libdca/module.defs
new file mode 100644
index 000000000..b69d1fb3a
--- /dev/null
+++ b/contrib/libdca/module.defs
@@ -0,0 +1,5 @@
+$(eval $(call import.MODULE.defs,LIBDCA,libdca))
+$(eval $(call import.CONTRIB.defs,LIBDCA))
+
+LIBDCA.FETCH.url = http://download.m0k.org/handbrake/contrib/libdca-r81-strapped.tar.gz
+LIBDCA.EXTRACT.tarbase = libdca
diff --git a/contrib/libdca/module.rules b/contrib/libdca/module.rules
new file mode 100644
index 000000000..0f33e2185
--- /dev/null
+++ b/contrib/libdca/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBDCA))
+$(eval $(call import.CONTRIB.rules,LIBDCA))
diff --git a/contrib/patch-libdvdread-css-vlc-dylib.patch b/contrib/libdvdread/P00-darwin-css-vlc-dylib.patch
index 70c5bab9c..cb0181517 100644
--- a/contrib/patch-libdvdread-css-vlc-dylib.patch
+++ b/contrib/libdvdread/P00-darwin-css-vlc-dylib.patch
@@ -1,5 +1,6 @@
---- dvdread/dvd_input.c 2005-09-19 09:43:08.000000000 -0400
-+++ dvdread/patched-dvd_input.c 2008-03-19 12:47:16.000000000 -0400
+diff -Naur libdvdread.orig/dvdread/dvd_input.c libdvdread/dvdread/dvd_input.c
+--- libdvdread.orig/dvdread/dvd_input.c 2005-09-19 09:43:08.000000000 -0400
++++ libdvdread/dvdread/dvd_input.c 2009-02-21 10:22:42.000000000 -0500
@@ -332,7 +332,7 @@
#else
diff --git a/contrib/patch-libdvdread-cygwin.patch b/contrib/libdvdread/P01-cygwin.patch
index fbb1f12d3..fbb1f12d3 100644
--- a/contrib/patch-libdvdread-cygwin.patch
+++ b/contrib/libdvdread/P01-cygwin.patch
diff --git a/contrib/libdvdread/module.defs b/contrib/libdvdread/module.defs
new file mode 100644
index 000000000..99b70923a
--- /dev/null
+++ b/contrib/libdvdread/module.defs
@@ -0,0 +1,5 @@
+$(eval $(call import.MODULE.defs,LIBDVDREAD,libdvdread))
+$(eval $(call import.CONTRIB.defs,LIBDVDREAD))
+
+LIBDVDREAD.FETCH.url = http://download.m0k.org/handbrake/contrib/libdvdread-0.9.7.tar.gz
+LIBDVDREAD.EXTRACT.tarbase = libdvdread
diff --git a/contrib/libdvdread/module.rules b/contrib/libdvdread/module.rules
new file mode 100644
index 000000000..6a9b42b0d
--- /dev/null
+++ b/contrib/libdvdread/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBDVDREAD))
+$(eval $(call import.CONTRIB.rules,LIBDVDREAD))
diff --git a/contrib/libmkv/module.defs b/contrib/libmkv/module.defs
new file mode 100644
index 000000000..102aea033
--- /dev/null
+++ b/contrib/libmkv/module.defs
@@ -0,0 +1,5 @@
+$(eval $(call import.MODULE.defs,LIBMKV,libmkv))
+$(eval $(call import.CONTRIB.defs,LIBMKV))
+
+LIBMKV.FETCH.url = http://download.m0k.org/handbrake/contrib/libmkv-0.6.3.1.tar.gz
+LIBMKV.EXTRACT.tarbase = libmkv
diff --git a/contrib/libmkv/module.rules b/contrib/libmkv/module.rules
new file mode 100644
index 000000000..7f443fe04
--- /dev/null
+++ b/contrib/libmkv/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBMKV))
+$(eval $(call import.CONTRIB.rules,LIBMKV))
diff --git a/contrib/libmp4v2/module.defs b/contrib/libmp4v2/module.defs
new file mode 100644
index 000000000..5a8063f3f
--- /dev/null
+++ b/contrib/libmp4v2/module.defs
@@ -0,0 +1,5 @@
+$(eval $(call import.MODULE.defs,LIBMP4V2,libmp4v2))
+$(eval $(call import.CONTRIB.defs,LIBMP4V2))
+
+LIBMP4V2.FETCH.url = http://download.m0k.org/handbrake/contrib/libmp4v2-2.0-r224-repack.tar.gz
+LIBMP4V2.EXTRACT.tarbase = libmp4v2
diff --git a/contrib/libmp4v2/module.rules b/contrib/libmp4v2/module.rules
new file mode 100644
index 000000000..8169e6032
--- /dev/null
+++ b/contrib/libmp4v2/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBMP4V2))
+$(eval $(call import.CONTRIB.rules,LIBMP4V2))
diff --git a/contrib/libogg/module.defs b/contrib/libogg/module.defs
new file mode 100644
index 000000000..0edc4106a
--- /dev/null
+++ b/contrib/libogg/module.defs
@@ -0,0 +1,7 @@
+$(eval $(call import.MODULE.defs,LIBOGG,libogg))
+$(eval $(call import.CONTRIB.defs,LIBOGG))
+
+LIBOGG.FETCH.url = http://download.m0k.org/handbrake/contrib/libogg-1.1.3.tar.gz
+LIBOGG.EXTRACT.tarbase = libogg
+
+LIBOGG.CONFIGURE.extra = --disable-sdl
diff --git a/contrib/libogg/module.rules b/contrib/libogg/module.rules
new file mode 100644
index 000000000..956fe0788
--- /dev/null
+++ b/contrib/libogg/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBOGG))
+$(eval $(call import.CONTRIB.rules,LIBOGG))
diff --git a/contrib/libsamplerate/module.defs b/contrib/libsamplerate/module.defs
new file mode 100644
index 000000000..c0717df37
--- /dev/null
+++ b/contrib/libsamplerate/module.defs
@@ -0,0 +1,5 @@
+$(eval $(call import.MODULE.defs,LIBSAMPLERATE,libsamplerate))
+$(eval $(call import.CONTRIB.defs,LIBSAMPLERATE))
+
+LIBSAMPLERATE.FETCH.url = http://download.m0k.org/handbrake/contrib/libsamplerate-0.1.4.tar.gz
+LIBSAMPLERATE.EXTRACT.tarbase = libsamplerate
diff --git a/contrib/libsamplerate/module.rules b/contrib/libsamplerate/module.rules
new file mode 100644
index 000000000..ef633856c
--- /dev/null
+++ b/contrib/libsamplerate/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBSAMPLERATE))
+$(eval $(call import.CONTRIB.rules,LIBSAMPLERATE))
diff --git a/contrib/libtheora/module.defs b/contrib/libtheora/module.defs
new file mode 100644
index 000000000..be40ab579
--- /dev/null
+++ b/contrib/libtheora/module.defs
@@ -0,0 +1,13 @@
+$(eval $(call import.MODULE.defs,LIBTHEORA,libtheora,LIBOGG LIBVORBIS))
+$(eval $(call import.CONTRIB.defs,LIBTHEORA))
+
+LIBTHEORA.FETCH.url = http://download.m0k.org/handbrake/contrib/libtheora-1.0.tar.gz
+LIBTHEORA.EXTRACT.tarbase = libtheora
+
+LIBTHEORA.CONFIGURE.extra = \
+ --disable-examples \
+ --disable-oggtest \
+ --disable-sdltest \
+ --disable-vorbistest \
+ --with-ogg=$(call fn.ABSOLUTE,$(CONTRIB.build/)) \
+ --with-vorbis=$(call fn.ABSOLUTE,$(CONTRIB.build/))
diff --git a/contrib/libtheora/module.rules b/contrib/libtheora/module.rules
new file mode 100644
index 000000000..c30224bb2
--- /dev/null
+++ b/contrib/libtheora/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBTHEORA))
+$(eval $(call import.CONTRIB.rules,LIBTHEORA))
diff --git a/contrib/libvorbis/module.defs b/contrib/libvorbis/module.defs
new file mode 100644
index 000000000..9946bb53c
--- /dev/null
+++ b/contrib/libvorbis/module.defs
@@ -0,0 +1,7 @@
+$(eval $(call import.MODULE.defs,LIBVORBIS,libvorbis,LIBOGG))
+$(eval $(call import.CONTRIB.defs,LIBVORBIS))
+
+LIBVORBIS.FETCH.url = http://download.m0k.org/handbrake/contrib/libvorbis-aotuv_b5.tar.gz
+LIBVORBIS.EXTRACT.tarbase = libvorbis
+
+LIBVORBIS.CONFIGURE.extra = --with-ogg=$(call fn.ABSOLUTE,$(CONTRIB.build/))
diff --git a/contrib/libvorbis/module.rules b/contrib/libvorbis/module.rules
new file mode 100644
index 000000000..418dfe0ef
--- /dev/null
+++ b/contrib/libvorbis/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,LIBVORBIS))
+$(eval $(call import.CONTRIB.rules,LIBVORBIS))
diff --git a/contrib/mpeg2dec/module.defs b/contrib/mpeg2dec/module.defs
new file mode 100644
index 000000000..5d608cc0b
--- /dev/null
+++ b/contrib/mpeg2dec/module.defs
@@ -0,0 +1,7 @@
+$(eval $(call import.MODULE.defs,MPEG2DEC,mpeg2dec))
+$(eval $(call import.CONTRIB.defs,MPEG2DEC))
+
+MPEG2DEC.FETCH.url = http://download.m0k.org/handbrake/contrib/mpeg2dec-0.5.1.tar.gz
+MPEG2DEC.EXTRACT.tarbase = mpeg2dec
+
+MPEG2DEC.CONFIGURE.extra = --disable-sdl --without-x
diff --git a/contrib/mpeg2dec/module.rules b/contrib/mpeg2dec/module.rules
new file mode 100644
index 000000000..78ce10aca
--- /dev/null
+++ b/contrib/mpeg2dec/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,MPEG2DEC))
+$(eval $(call import.CONTRIB.rules,MPEG2DEC))
diff --git a/contrib/patch-ffmpeg.patch b/contrib/patch-ffmpeg.patch
deleted file mode 100644
index e52731f1d..000000000
--- a/contrib/patch-ffmpeg.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: libavformat/tcp.c
-===================================================================
---- libavformat/tcp.c (revision 9814)
-+++ libavformat/tcp.c (working copy)
-@@ -88,11 +88,13 @@
- break;
- }
-
-+#ifndef __BEOS__
- /* test error */
- optlen = sizeof(ret);
- getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
- if (ret != 0)
- goto fail;
-+#endif
- }
- s->fd = fd;
- return 0;
diff --git a/contrib/patch-libmpeg2.patch b/contrib/patch-libmpeg2.patch
deleted file mode 100644
index d5ab5bf65..000000000
--- a/contrib/patch-libmpeg2.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-diff -ur orig/header.c mpeg2dec/libmpeg2/header.c
---- orig/header.c 2003-12-22 12:24:02.000000000 +0100
-+++ mpeg2dec/libmpeg2/header.c 2004-08-02 18:07:50.000000000 +0200
-@@ -100,6 +100,9 @@
- mpeg2dec->decoder.convert = NULL;
- mpeg2dec->decoder.convert_id = NULL;
- mpeg2dec->picture = mpeg2dec->pictures;
-+ memset(&mpeg2dec->fbuf_alloc[0].fbuf, 0, sizeof(mpeg2_fbuf_t));
-+ memset(&mpeg2dec->fbuf_alloc[1].fbuf, 0, sizeof(mpeg2_fbuf_t));
-+ memset(&mpeg2dec->fbuf_alloc[2].fbuf, 0, sizeof(mpeg2_fbuf_t));
- mpeg2dec->fbuf[0] = &mpeg2dec->fbuf_alloc[0].fbuf;
- mpeg2dec->fbuf[1] = &mpeg2dec->fbuf_alloc[1].fbuf;
- mpeg2dec->fbuf[2] = &mpeg2dec->fbuf_alloc[2].fbuf;
-@@ -551,6 +554,7 @@
- if (!(mpeg2dec->sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)) {
- picture->nb_fields = (buffer[3] & 2) ? 3 : 2;
- flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0;
-+ flags |= (buffer[3] & 2) ? PIC_FLAG_REPEAT_FIRST_FIELD : 0;
- } else
- picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2;
- break;
-diff -ur orig/mpeg2.h mpeg2dec/include/mpeg2.h
---- orig/mpeg2.h 2003-12-22 13:13:35.000000000 +0100
-+++ mpeg2dec/include/mpeg2.h 2004-02-18 13:50:13.000000000 +0100
-@@ -82,6 +82,7 @@
- #define PIC_FLAG_COMPOSITE_DISPLAY 32
- #define PIC_FLAG_SKIP 64
- #define PIC_FLAG_TAGS 128
-+#define PIC_FLAG_REPEAT_FIRST_FIELD 256
- #define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
-
- typedef struct mpeg2_picture_s {
-
diff --git a/contrib/patch-x264-idr.patch b/contrib/patch-x264-idr.patch
deleted file mode 100644
index df4294f12..000000000
--- a/contrib/patch-x264-idr.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Index: encoder/slicetype.c
-===================================================================
---- encoder/slicetype.c (revision 665)
-+++ encoder/slicetype.c (working copy)
-@@ -379,7 +379,12 @@
- return;
- frames[0] = h->frames.last_nonb;
- for( j = 0; h->frames.next[j]; j++ )
-+ {
-+ // if the app wants an IDR, give it to them
-+ if ( h->frames.next[j]->i_type == X264_TYPE_IDR )
-+ return;
- frames[j+1] = h->frames.next[j];
-+ }
- keyint_limit = h->param.i_keyint_max - frames[0]->i_frame + h->frames.i_last_idr - 1;
- num_frames = X264_MIN( j, keyint_limit );
- if( num_frames == 0 )
diff --git a/contrib/patch-x264-linux.patch b/contrib/patch-x264-linux.patch
deleted file mode 100644
index 3f1752d4c..000000000
--- a/contrib/patch-x264-linux.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-Index: /common/ppc/quant.c
-===================================================================
---- /common/ppc/quant.c (revision 601)
-+++ /common/ppc/quant.c (revision 621)
-@@ -18,8 +18,4 @@
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
--
--#ifdef HAVE_ALTIVEC_H
--#include <altivec.h>
--#endif
-
- #include "common/common.h"
-@@ -54,29 +50,29 @@
- temp2v = vec_xor(temp2v, mskB); \
- temp1v = vec_adds(temp1v, vec_and(mskA, one)); \
--vec_st(temp1v, (dct0), dct); \
-+vec_st(temp1v, (dct0), (int16_t*)dct); \
- temp2v = vec_adds(temp2v, vec_and(mskB, one)); \
--vec_st(temp2v, (dct1), dct);
-+vec_st(temp2v, (dct1), (int16_t*)dct);
-
- void x264_quant_4x4_altivec( int16_t dct[4][4], int quant_mf[4][4], int const i_qbits, int const f ) {
- vector bool short mskA;
-- vec_s32_t i_qbitsv;
-+ vec_u32_t i_qbitsv;
- vec_u16_t coefvA;
- vec_u32_t multEvenvA, multOddvA;
-- vec_u32_t mfvA;
-+ vec_u16_t mfvA;
- vec_s16_t zerov, one;
-- vec_s32_t fV;
-+ vec_u32_t fV;
-
- vector bool short mskB;
- vec_u16_t coefvB;
- vec_u32_t multEvenvB, multOddvB;
-- vec_u32_t mfvB;
-+ vec_u16_t mfvB;
-
- vec_s16_t temp1v, temp2v;
-
-- vect_sint_u qbits_u;
-+ vect_int_u qbits_u;
- qbits_u.s[0]=i_qbits;
- i_qbitsv = vec_splat(qbits_u.v, 0);
-
-- vect_sint_u f_u;
-+ vect_int_u f_u;
- f_u.s[0]=f;
-
-@@ -114,16 +110,16 @@
- temp2v = vec_xor(temp2v, mskB); \
- temp1v = vec_add(temp1v, vec_and(mskA, one)); \
--vec_st(temp1v, (dct0), dct); \
-+vec_st(temp1v, (dct0), (int16_t*)dct); \
- temp2v = vec_add(temp2v, vec_and(mskB, one)); \
--vec_st(temp2v, (dct1), dct);
-+vec_st(temp2v, (dct1), (int16_t*)dct);
-
-
- void x264_quant_4x4_dc_altivec( int16_t dct[4][4], int i_quant_mf, int const i_qbits, int const f ) {
- vector bool short mskA;
-- vec_s32_t i_qbitsv;
-+ vec_u32_t i_qbitsv;
- vec_u16_t coefvA;
- vec_u32_t multEvenvA, multOddvA;
- vec_s16_t zerov, one;
-- vec_s32_t fV;
-+ vec_u32_t fV;
-
- vector bool short mskB;
-@@ -133,15 +129,14 @@
- vec_s16_t temp1v, temp2v;
-
-- vec_u32_t mfv;
-- vect_int_u mf_u;
-+ vec_u16_t mfv;
-+ vect_ushort_u mf_u;
- mf_u.s[0]=i_quant_mf;
- mfv = vec_splat( mf_u.v, 0 );
-- mfv = vec_packs( mfv, mfv);
-
-- vect_sint_u qbits_u;
-+ vect_int_u qbits_u;
- qbits_u.s[0]=i_qbits;
- i_qbitsv = vec_splat(qbits_u.v, 0);
-
-- vect_sint_u f_u;
-+ vect_int_u f_u;
- f_u.s[0]=f;
- fV = vec_splat(f_u.v, 0);
-@@ -156,13 +151,15 @@
- void x264_quant_8x8_altivec( int16_t dct[8][8], int quant_mf[8][8], int const i_qbits, int const f ) {
- vector bool short mskA;
-- vec_s32_t i_qbitsv;
-+ vec_u32_t i_qbitsv;
- vec_u16_t coefvA;
-- vec_s32_t multEvenvA, multOddvA, mfvA;
-+ vec_u32_t multEvenvA, multOddvA;
-+ vec_u16_t mfvA;
- vec_s16_t zerov, one;
-- vec_s32_t fV;
-+ vec_u32_t fV;
-
- vector bool short mskB;
- vec_u16_t coefvB;
-- vec_u32_t multEvenvB, multOddvB, mfvB;
-+ vec_u32_t multEvenvB, multOddvB;
-+ vec_u16_t mfvB;
-
- vec_s16_t temp1v, temp2v;
-@@ -172,5 +169,5 @@
- i_qbitsv = vec_splat(qbits_u.v, 0);
-
-- vect_sint_u f_u;
-+ vect_int_u f_u;
- f_u.s[0]=f;
- fV = vec_splat(f_u.v, 0);
-Index: /common/ppc/dct.c
-===================================================================
---- /common/ppc/dct.c (revision 604)
-+++ /common/ppc/dct.c (revision 621)
-@@ -61,6 +61,6 @@
- VEC_DCT( dct0v, dct1v, dct2v, dct3v, tmp0v, tmp1v, tmp2v, tmp3v );
-
-- vec_st(vec_perm(tmp0v, tmp1v, permHighv), 0, dct);
-- vec_st(vec_perm(tmp2v, tmp3v, permHighv), 16, dct);
-+ vec_st(vec_perm(tmp0v, tmp1v, permHighv), 0, (int16_t*)dct);
-+ vec_st(vec_perm(tmp2v, tmp3v, permHighv), 16, (int16_t*)dct);
- }
-
-@@ -95,12 +95,12 @@
- VEC_DCT( dct4v, dct5v, dct6v, dct7v, tmp4v, tmp5v, tmp6v, tmp7v );
-
-- vec_st(vec_perm(tmp0v, tmp1v, permHighv), 0, dct);
-- vec_st(vec_perm(tmp2v, tmp3v, permHighv), 16, dct);
-- vec_st(vec_perm(tmp4v, tmp5v, permHighv), 32, dct);
-- vec_st(vec_perm(tmp6v, tmp7v, permHighv), 48, dct);
-- vec_st(vec_perm(tmp0v, tmp1v, permLowv), 64, dct);
-- vec_st(vec_perm(tmp2v, tmp3v, permLowv), 80, dct);
-- vec_st(vec_perm(tmp4v, tmp5v, permLowv), 96, dct);
-- vec_st(vec_perm(tmp6v, tmp7v, permLowv), 112, dct);
-+ vec_st(vec_perm(tmp0v, tmp1v, permHighv), 0, (int16_t*)dct);
-+ vec_st(vec_perm(tmp2v, tmp3v, permHighv), 16, (int16_t*)dct);
-+ vec_st(vec_perm(tmp4v, tmp5v, permHighv), 32, (int16_t*)dct);
-+ vec_st(vec_perm(tmp6v, tmp7v, permHighv), 48, (int16_t*)dct);
-+ vec_st(vec_perm(tmp0v, tmp1v, permLowv), 64, (int16_t*)dct);
-+ vec_st(vec_perm(tmp2v, tmp3v, permLowv), 80, (int16_t*)dct);
-+ vec_st(vec_perm(tmp4v, tmp5v, permLowv), 96, (int16_t*)dct);
-+ vec_st(vec_perm(tmp6v, tmp7v, permLowv), 112, (int16_t*)dct);
- }
-
-@@ -312,6 +312,6 @@
- void x264_add8x8_idct8_altivec( uint8_t *dst, int16_t dct[8][8] )
- {
-- vec_s16_t onev = vec_splat_s16(1);
-- vec_s16_t twov = vec_splat_s16(2);
-+ vec_u16_t onev = vec_splat_s16(1);
-+ vec_u16_t twov = vec_splat_s16(2);
-
- dct[0][0] += 32; // rounding for the >>6 at the end
-@@ -342,5 +342,5 @@
- vec_u8_t perm_ldv = vec_lvsl(0, dst);
- vec_u8_t perm_stv = vec_lvsr(8, dst);
-- vec_s16_t sixv = vec_splat_s16(6);
-+ vec_u16_t sixv = vec_splat_s16(6);
- const vec_u8_t sel = (vec_u8_t) CV(0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1);
- LOAD_ZERO;
-Index: /common/ppc/quant.h
-===================================================================
---- /common/ppc/quant.h (revision 601)
-+++ /common/ppc/quant.h (revision 621)
-@@ -19,4 +19,8 @@
- *****************************************************************************/
-
-+#ifdef SYS_LINUX
-+#include <altivec.h>
-+#endif
-+
- #ifndef _PPC_QUANT_H
- #define _PPC_QUANT_H 1
-@@ -28,8 +32,7 @@
-
- typedef union {
-- signed int s[4];
-- vector signed int v;
--} vect_sint_u;
--
-+ unsigned short s[8];
-+ vector unsigned short v;
-+} vect_ushort_u;
-
- void x264_quant_4x4_altivec( int16_t dct[4][4], int quant_mf[4][4], int const i_qbits, int const f );
diff --git a/contrib/patch_mpeg4ip_cygwin.patch b/contrib/patch_mpeg4ip_cygwin.patch
deleted file mode 100644
index 0bc19cda6..000000000
--- a/contrib/patch_mpeg4ip_cygwin.patch
+++ /dev/null
@@ -1,262 +0,0 @@
-diff -Naur mpeg4ip/lib/mp4v2/mp4.cpp /Users/pri/t/mpeg4ip/lib/mp4v2/mp4.cpp
---- mpeg4ip/lib/mp4v2/mp4.cpp 2005-03-30 20:41:58.000000000 +0200
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4.cpp 2007-02-09 22:39:28.000000000 +0100
-@@ -1678,9 +1678,9 @@
- extern "C" bool MP4GetTrackH264SeqPictHeaders (MP4FileHandle hFile,
- MP4TrackId trackId,
- uint8_t ***pSeqHeader,
-- uint32_t **pSeqHeaderSize,
-+ u_int32_t **pSeqHeaderSize,
- uint8_t ***pPictHeader,
-- uint32_t **pPictHeaderSize)
-+ u_int32_t **pPictHeaderSize)
- {
- if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
- try {
-diff -Naur mpeg4ip/lib/mp4v2/mp4.h /Users/pri/t/mpeg4ip/lib/mp4v2/mp4.h
---- mpeg4ip/lib/mp4v2/mp4.h 2005-03-30 20:41:58.000000000 +0200
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4.h 2007-02-09 22:39:42.000000000 +0100
-@@ -631,9 +631,9 @@
-
- bool MP4GetTrackVideoMetadata(MP4FileHandle hFile,
- MP4TrackId trackId,
-- uint8_t **ppConfig,
-- uint32_t *pConfigSize);
--
-+ u_int8_t **ppConfig,
-+ u_int32_t *pConfigSize);
-+
- bool MP4GetTrackESConfiguration(
- MP4FileHandle hFile,
- MP4TrackId trackId,
-@@ -654,9 +654,9 @@
- bool MP4GetTrackH264SeqPictHeaders(MP4FileHandle hFile,
- MP4TrackId trackId,
- uint8_t ***pSeqHeaders,
-- uint32_t **pSeqHeaderSize,
-+ u_int32_t **pSeqHeaderSize,
- uint8_t ***pPictHeader,
-- uint32_t **pPictHeaderSize);
-+ u_int32_t **pPictHeaderSize);
- bool MP4GetTrackH264LengthSize(MP4FileHandle hFile,
- MP4TrackId trackId,
- uint32_t *pLength);
-diff -Naur mpeg4ip/lib/mp4v2/mp4container.cpp /Users/pri/t/mpeg4ip/lib/mp4v2/mp4container.cpp
---- mpeg4ip/lib/mp4v2/mp4container.cpp 2001-11-19 18:06:58.000000000 +0100
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4container.cpp 2007-02-09 22:10:23.000000000 +0100
-@@ -207,7 +207,7 @@
- u_int32_t numProperties = m_pProperties.Size();
-
- if (numProperties == 0) {
-- WARNING(numProperties == 0);
-+ //WARNING(numProperties == 0);
- return;
- }
-
-diff -Naur mpeg4ip/lib/mp4v2/mp4container.h /Users/pri/t/mpeg4ip/lib/mp4v2/mp4container.h
---- mpeg4ip/lib/mp4v2/mp4container.h 2001-11-19 18:06:58.000000000 +0100
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4container.h 2007-02-09 22:06:42.000000000 +0100
-@@ -1,24 +1,3 @@
--/*
-- * The contents of this file are subject to the Mozilla Public
-- * License Version 1.1 (the "License"); you may not use this file
-- * except in compliance with the License. You may obtain a copy of
-- * the License at http://www.mozilla.org/MPL/
-- *
-- * Software distributed under the License is distributed on an "AS
-- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-- * implied. See the License for the specific language governing
-- * rights and limitations under the License.
-- *
-- * The Original Code is MPEG4IP.
-- *
-- * The Initial Developer of the Original Code is Cisco Systems Inc.
-- * Portions created by Cisco Systems Inc. are
-- * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
-- *
-- * Contributor(s):
-- * Dave Mackie [email protected]
-- */
--
- #ifndef __MP4_CONTAINER_INCLUDED__
- #define __MP4_CONTAINER_INCLUDED__
-
-diff -Naur mpeg4ip/lib/mp4v2/mp4descriptor.cpp /Users/pri/t/mpeg4ip/lib/mp4v2/mp4descriptor.cpp
---- mpeg4ip/lib/mp4v2/mp4descriptor.cpp 2004-02-12 03:06:02.000000000 +0100
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4descriptor.cpp 2007-02-09 22:24:17.000000000 +0100
-@@ -149,7 +149,7 @@
- u_int32_t numProperties = m_pProperties.Size();
-
- if (numProperties == 0) {
-- WARNING(numProperties == 0);
-+ //WARNING(numProperties == 0);
- return;
- }
-
-@@ -194,7 +194,7 @@
- u_int32_t numProperties = m_pProperties.Size();
-
- if (numProperties == 0) {
-- WARNING(numProperties == 0);
-+ //WARNING(numProperties == 0);
- return;
- }
- for (u_int32_t i = 0; i < numProperties; i++) {
-diff -Naur mpeg4ip/lib/mp4v2/mp4file.cpp /Users/pri/t/mpeg4ip/lib/mp4v2/mp4file.cpp
---- mpeg4ip/lib/mp4v2/mp4file.cpp 2005-03-30 20:41:58.000000000 +0200
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4file.cpp 2007-02-09 22:44:08.000000000 +0100
-@@ -1431,7 +1431,7 @@
- return trackId;
- }
-
--MP4TrackId MP4File::AddCntlTrackDefault (uint32_t timeScale,
-+MP4TrackId MP4File::AddCntlTrackDefault (u_int32_t timeScale,
- MP4Duration sampleDuration,
- const char *type)
- {
-@@ -1682,7 +1682,7 @@
- (MP4Property **)&pLength) == false) ||
- (avcCAtom->FindProperty("avcC.sequenceEntries.sequenceParameterSetNALUnit",
- (MP4Property **)&pUnit) == false)) {
-- VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC properties"));
-+ //VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC properties"));
- return false;
- }
- uint32_t count = pCount->GetValue();
-@@ -1692,7 +1692,7 @@
- for (uint32_t index = 0; index < count; index++) {
- if (pLength->GetValue(index) == sequenceLen) {
- uint8_t *seq;
-- uint32_t seqlen;
-+ u_int32_t seqlen;
- pUnit->GetValue(&seq, &seqlen, index);
- if (memcmp(seq, pSequence, sequenceLen) == 0) {
- free(seq);
-@@ -1724,8 +1724,8 @@
- (MP4Property **)&pLength) == false) ||
- (avcCAtom->FindProperty("avcC.pictureEntries.pictureParameterSetNALUnit",
- (MP4Property **)&pUnit) == false)) {
-- VERBOSE_ERROR(m_verbosity,
-- WARNING("Could not find avcC picture table properties"));
-+ //VERBOSE_ERROR(m_verbosity,
-+ //WARNING("Could not find avcC picture table properties"));
- return false;
- }
- uint32_t count = pCount->GetValue();
-@@ -1735,7 +1735,7 @@
- for (uint32_t index = 0; index < count; index++) {
- if (pLength->GetValue(index) == pictLen) {
- uint8_t *seq;
-- uint32_t seqlen;
-+ u_int32_t seqlen;
- pUnit->GetValue(&seq, &seqlen, index);
- if (memcmp(seq, pPict, pictLen) == 0) {
- VERBOSE_WRITE(m_verbosity,
-@@ -2472,9 +2472,9 @@
-
- bool MP4File::GetTrackH264SeqPictHeaders (MP4TrackId trackId,
- uint8_t ***pppSeqHeader,
-- uint32_t **ppSeqHeaderSize,
-+ u_int32_t **ppSeqHeaderSize,
- uint8_t ***pppPictHeader,
-- uint32_t **ppPictHeaderSize)
-+ u_int32_t **ppPictHeaderSize)
- {
- uint32_t count;
-
-@@ -2490,15 +2490,15 @@
- (MP4Property **)&pSeqLen) == false) ||
- (avcCAtom->FindProperty("avcC.sequenceEntries.sequenceParameterSetNALUnit",
- (MP4Property **)&pSeqVal) == false)) {
-- VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC properties"));
-+ //VERBOSE_ERROR(m_verbosity, WARNING("Could not find avcC properties"));
- return false;
- }
- uint8_t **ppSeqHeader =
- (uint8_t **)malloc((pSeqCount->GetValue() + 1) * sizeof(uint8_t *));
- *pppSeqHeader = ppSeqHeader;
-
-- uint32_t *pSeqHeaderSize =
-- (uint32_t *)malloc((pSeqCount->GetValue() + 1) * sizeof(uint32_t *));
-+ u_int32_t *pSeqHeaderSize =
-+ (u_int32_t *)malloc((pSeqCount->GetValue() + 1) * sizeof(u_int32_t *));
-
- *ppSeqHeaderSize = pSeqHeaderSize;
- for (count = 0; count < pSeqCount->GetValue(); count++) {
-@@ -2513,15 +2513,15 @@
- (MP4Property **)&pPictLen) == false) ||
- (avcCAtom->FindProperty("avcC.pictureEntries.pictureParameterSetNALUnit",
- (MP4Property **)&pPictVal) == false)) {
-- VERBOSE_ERROR(m_verbosity,
-- WARNING("Could not find avcC picture table properties"));
-+ //VERBOSE_ERROR(m_verbosity,
-+ //WARNING("Could not find avcC picture table properties"));
- return false;
- }
- uint8_t
- **ppPictHeader =
- (uint8_t **)malloc((pPictCount->GetValue() + 1) * sizeof(uint8_t *));
-- uint32_t *pPictHeaderSize =
-- (uint32_t *)malloc((pPictCount->GetValue() + 1)* sizeof(uint32_t *));
-+ u_int32_t *pPictHeaderSize =
-+ (u_int32_t *)malloc((pPictCount->GetValue() + 1)* sizeof(u_int32_t *));
- *pppPictHeader = ppPictHeader;
- *ppPictHeaderSize = pPictHeaderSize;
-
-diff -Naur mpeg4ip/lib/mp4v2/mp4file.h /Users/pri/t/mpeg4ip/lib/mp4v2/mp4file.h
---- mpeg4ip/lib/mp4v2/mp4file.h 2005-03-30 20:41:58.000000000 +0200
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4file.h 2007-02-09 22:35:21.000000000 +0100
-@@ -329,9 +329,9 @@
- uint8_t *pLevel);
- bool GetTrackH264SeqPictHeaders(MP4TrackId trackId,
- uint8_t ***pSeqHeader,
-- uint32_t **pSeqHeaderSize,
-+ u_int32_t **pSeqHeaderSize,
- uint8_t ***pPictHeader,
-- uint32_t **pPictHeaderSize);
-+ u_int32_t **pPictHeaderSize);
- void GetTrackH264LengthSize(MP4TrackId,
- uint32_t *pLength);
- const char* GetHintTrackSdp(MP4TrackId hintTrackId);
-diff -Naur mpeg4ip/lib/mp4v2/mp4file_io.cpp /Users/pri/t/mpeg4ip/lib/mp4v2/mp4file_io.cpp
---- mpeg4ip/lib/mp4v2/mp4file_io.cpp 2004-07-15 20:09:48.000000000 +0200
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4file_io.cpp 2007-02-09 22:44:47.000000000 +0100
-@@ -86,7 +86,7 @@
- }
-
- ASSERT(pBytes);
-- WARNING(m_numReadBits > 0);
-+ //WARNING(m_numReadBits > 0);
-
- if (pFile == NULL) {
- pFile = m_pFile;
-diff -Naur mpeg4ip/lib/mp4v2/mp4property.cpp /Users/pri/t/mpeg4ip/lib/mp4v2/mp4property.cpp
---- mpeg4ip/lib/mp4v2/mp4property.cpp 2004-08-23 20:28:21.000000000 +0200
-+++ /Users/pri/t/mpeg4ip/lib/mp4v2/mp4property.cpp 2007-02-09 22:47:04.000000000 +0100
-@@ -636,7 +636,7 @@
- u_int32_t numProperties = m_pProperties.Size();
-
- if (numProperties == 0) {
-- WARNING(numProperties == 0);
-+ //WARNING(numProperties == 0);
- return;
- }
-
-@@ -670,7 +670,7 @@
- u_int32_t numProperties = m_pProperties.Size();
-
- if (numProperties == 0) {
-- WARNING(numProperties == 0);
-+ //WARNING(numProperties == 0);
- return;
- }
-
-@@ -709,7 +709,7 @@
- u_int32_t numProperties = m_pProperties.Size();
-
- if (numProperties == 0) {
-- WARNING(numProperties == 0);
-+ //WARNING(numProperties == 0);
- return;
- }
-
diff --git a/contrib/version_a52dec.txt b/contrib/version_a52dec.txt
deleted file mode 100644
index 86617fd36..000000000
--- a/contrib/version_a52dec.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/a52dec-0.7.4.tar.gz
diff --git a/contrib/version_bzip2.txt b/contrib/version_bzip2.txt
deleted file mode 100644
index 7a90c8411..000000000
--- a/contrib/version_bzip2.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/bzip2-1.0.5.tar.gz
diff --git a/contrib/version_faac.txt b/contrib/version_faac.txt
deleted file mode 100644
index b53bcc4dd..000000000
--- a/contrib/version_faac.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/faac-1.26.tar.gz
diff --git a/contrib/version_faad2.txt b/contrib/version_faad2.txt
deleted file mode 100644
index ad74c36cd..000000000
--- a/contrib/version_faad2.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/faad2-2.6.1.tar.gz
diff --git a/contrib/version_ffmpeg.txt b/contrib/version_ffmpeg.txt
deleted file mode 100644
index 8ca79d702..000000000
--- a/contrib/version_ffmpeg.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/ffmpeg-r15974.tar.gz
diff --git a/contrib/version_lame.txt b/contrib/version_lame.txt
deleted file mode 100644
index 6790bfb7d..000000000
--- a/contrib/version_lame.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/lame-3.98.tar.gz
diff --git a/contrib/version_libdca.txt b/contrib/version_libdca.txt
deleted file mode 100644
index dfa4de6a0..000000000
--- a/contrib/version_libdca.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libdca-r81-strapped.tar.gz
diff --git a/contrib/version_libdvdcss.txt b/contrib/version_libdvdcss.txt
deleted file mode 100644
index 4821730fd..000000000
--- a/contrib/version_libdvdcss.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.videolan.org/pub/libdvdcss/1.2.9/libdvdcss-1.2.9.tar.gz \ No newline at end of file
diff --git a/contrib/version_libdvdread.txt b/contrib/version_libdvdread.txt
deleted file mode 100644
index ef686d667..000000000
--- a/contrib/version_libdvdread.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libdvdread-0.9.7.tar.gz
diff --git a/contrib/version_libmkv.txt b/contrib/version_libmkv.txt
deleted file mode 100644
index b5f851c78..000000000
--- a/contrib/version_libmkv.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libmkv-0.6.3.1.tar.gz
diff --git a/contrib/version_libmp4v2.txt b/contrib/version_libmp4v2.txt
deleted file mode 100644
index 33509b29b..000000000
--- a/contrib/version_libmp4v2.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libmp4v2-2.0-r224.tar.gz
diff --git a/contrib/version_libogg.txt b/contrib/version_libogg.txt
deleted file mode 100644
index 25bcb92ce..000000000
--- a/contrib/version_libogg.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libogg-1.1.3.tar.gz
diff --git a/contrib/version_libsamplerate.txt b/contrib/version_libsamplerate.txt
deleted file mode 100644
index 038fcbb1f..000000000
--- a/contrib/version_libsamplerate.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libsamplerate-0.1.4.tar.gz
diff --git a/contrib/version_libtheora.txt b/contrib/version_libtheora.txt
deleted file mode 100644
index 8595fe999..000000000
--- a/contrib/version_libtheora.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libtheora-1.0.tar.gz
-
diff --git a/contrib/version_libvorbis.txt b/contrib/version_libvorbis.txt
deleted file mode 100644
index ad9df271e..000000000
--- a/contrib/version_libvorbis.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libvorbis-aotuv_b5.tar.gz
diff --git a/contrib/version_mpeg2dec.txt b/contrib/version_mpeg2dec.txt
deleted file mode 100644
index 248ce7bfa..000000000
--- a/contrib/version_mpeg2dec.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/mpeg2dec-0.5.1.tar.gz
diff --git a/contrib/version_mpeg4ip.txt b/contrib/version_mpeg4ip.txt
deleted file mode 100644
index f60e5972a..000000000
--- a/contrib/version_mpeg4ip.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/mpeg4ip-1.3.tar.gz
diff --git a/contrib/version_qt.txt b/contrib/version_qt.txt
deleted file mode 100644
index 5f679e32c..000000000
--- a/contrib/version_qt.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/libquicktime-0.9.10.tar.gz
diff --git a/contrib/version_x264.txt b/contrib/version_x264.txt
deleted file mode 100644
index beb28f14b..000000000
--- a/contrib/version_x264.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/x264-r1109-75b495f.tar.gz \ No newline at end of file
diff --git a/contrib/version_xvidcore.txt b/contrib/version_xvidcore.txt
deleted file mode 100644
index 5d8c19719..000000000
--- a/contrib/version_xvidcore.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/xvidcore-1.1.3.tar.gz
diff --git a/contrib/version_zlib.txt b/contrib/version_zlib.txt
deleted file mode 100644
index bbb84c298..000000000
--- a/contrib/version_zlib.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://download.m0k.org/handbrake/contrib/zlib-1.2.3.tar.gz
diff --git a/contrib/patch-x264-cygwin.patch b/contrib/x264/P00-cygwin.patch
index f2e375d69..f2e375d69 100644
--- a/contrib/patch-x264-cygwin.patch
+++ b/contrib/x264/P00-cygwin.patch
diff --git a/contrib/patch-x264-solaris.patch b/contrib/x264/P01-sunos.patch
index 24d629ff9..24d629ff9 100644
--- a/contrib/patch-x264-solaris.patch
+++ b/contrib/x264/P01-sunos.patch
diff --git a/contrib/x264/module.defs b/contrib/x264/module.defs
new file mode 100644
index 000000000..6476d19fb
--- /dev/null
+++ b/contrib/x264/module.defs
@@ -0,0 +1,11 @@
+$(eval $(call import.MODULE.defs,X264,x264))
+$(eval $(call import.CONTRIB.defs,X264))
+
+X264.FETCH.url = http://download.m0k.org/handbrake/contrib/x264-r1109-75b495f.tar.gz
+X264.EXTRACT.tarbase = x264
+
+X264.CONFIGURE.deps =
+X264.CONFIGURE.shared =
+X264.CONFIGURE.static =
+
+X264.CONFIGURE.extra = --enable-pthread
diff --git a/contrib/x264/module.rules b/contrib/x264/module.rules
new file mode 100644
index 000000000..182ede881
--- /dev/null
+++ b/contrib/x264/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,X264))
+$(eval $(call import.CONTRIB.rules,X264))
diff --git a/contrib/patch-xvidcore-nasm-2.00-configure.patch b/contrib/xvidcore/A00-nasm.patch
index 44242ace4..44242ace4 100644
--- a/contrib/patch-xvidcore-nasm-2.00-configure.patch
+++ b/contrib/xvidcore/A00-nasm.patch
diff --git a/contrib/patch-xvidcore-fdct.patch b/contrib/xvidcore/A01-fdct.patch
index 1fc90b689..1fc90b689 100644
--- a/contrib/patch-xvidcore-fdct.patch
+++ b/contrib/xvidcore/A01-fdct.patch
diff --git a/contrib/patch-xvidcore-macosx.patch b/contrib/xvidcore/P00-darwin.patch
index 51cb94c6d..51cb94c6d 100644
--- a/contrib/patch-xvidcore-macosx.patch
+++ b/contrib/xvidcore/P00-darwin.patch
diff --git a/contrib/patch-xvidcore-cygwin.patch b/contrib/xvidcore/P01-cygwin.patch
index 7b60510d0..7b60510d0 100644
--- a/contrib/patch-xvidcore-cygwin.patch
+++ b/contrib/xvidcore/P01-cygwin.patch
diff --git a/contrib/xvidcore/module.defs b/contrib/xvidcore/module.defs
new file mode 100644
index 000000000..0ec291a24
--- /dev/null
+++ b/contrib/xvidcore/module.defs
@@ -0,0 +1,20 @@
+$(eval $(call import.MODULE.defs,XVIDCORE,xvidcore))
+$(eval $(call import.CONTRIB.defs,XVIDCORE))
+
+XVIDCORE.FETCH.url = http://download.m0k.org/handbrake/contrib/xvidcore-1.1.3.tar.gz
+XVIDCORE.EXTRACT.tarbase = xvidcore
+
+XVIDCORE.CONFIGURE.dir = $(XVIDCORE.EXTRACT.target/)build/generic/
+
+XVIDCORE.BUILD.dir = $(XVIDCORE.EXTRACT.target/)build/generic/
+XVIDCORE.BUILD.ntargets = libxvidcore.a
+
+define XVIDCORE.INSTALL
+ cp $(XVIDCORE.EXTRACT.target/)build/generic/=build/libxvidcore.a $(CONTRIB.build/)lib/
+ cp $(XVIDCORE.EXTRACT.target/)src/xvid.h $(CONTRIB.build/)include/
+endef
+
+define XVIDCORE.UNINSTALL
+ rm $(CONTRIB.build/)lib/libxvidcore.a
+ rm $(CONTRIB.build/)include/xvid.h
+endef
diff --git a/contrib/xvidcore/module.rules b/contrib/xvidcore/module.rules
new file mode 100644
index 000000000..76600608e
--- /dev/null
+++ b/contrib/xvidcore/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,XVIDCORE))
+$(eval $(call import.CONTRIB.rules,XVIDCORE))
diff --git a/contrib/zlib/module.defs b/contrib/zlib/module.defs
new file mode 100644
index 000000000..66db2f491
--- /dev/null
+++ b/contrib/zlib/module.defs
@@ -0,0 +1,6 @@
+$(eval $(call import.MODULE.defs,ZLIB,zlib))
+$(eval $(call import.CONTRIB.defs,ZLIB))
+
+ZLIB.FETCH.url = http://download.m0k.org/handbrake/contrib/zlib-1.2.3.tar.gz
+ZLIB.EXTRACT.tarbase = zlib
+ZLIB.CONFIGURE.args = !sete @dir !env !exe @prefix !extra
diff --git a/contrib/zlib/module.rules b/contrib/zlib/module.rules
new file mode 100644
index 000000000..5767ee682
--- /dev/null
+++ b/contrib/zlib/module.rules
@@ -0,0 +1,2 @@
+$(eval $(call import.MODULE.rules,ZLIB))
+$(eval $(call import.CONTRIB.rules,ZLIB))