aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia
diff options
context:
space:
mode:
authorahze <ahze@FreeBSD.org>2004-11-23 04:26:08 +0800
committerahze <ahze@FreeBSD.org>2004-11-23 04:26:08 +0800
commit610eb5992ac9250becc36960a6b3d386453fbbba (patch)
tree71c31af4d97875406c2542758dbf8c5b0c6a700e /multimedia
parentb8e9f474e8736eb8266023fa083682d0aa984682 (diff)
downloadfreebsd-ports-gnome-610eb5992ac9250becc36960a6b3d386453fbbba.tar.gz
freebsd-ports-gnome-610eb5992ac9250becc36960a6b3d386453fbbba.tar.zst
freebsd-ports-gnome-610eb5992ac9250becc36960a6b3d386453fbbba.zip
HandBrake is a GPL'd multi-platform, multithreaded DVD to MPEG-4 ripper and
converter. HandBrake was originally available on the BeOS, but now has been ported over to MacOS X, GNU/Linux and FreeBSD. Features: * Can encode directly from DVDs (even encrypted ones) or from VIDEO_TS folders * Supports AC3, LPCM and MPEG audio tracks * Outputs MP4, AVI or OGM files * Outputs AAC, MP3 or Vorbis audio * Supports 2-pass encoding * Supports encoding of two audio tracks * Includes a bitrate calculator * Supports picture deinterlacing, cropping and scaling Known limitations: * Does not handle DTS audio tracks * Does not handle single VOB files or any other file format WWW: http://handbrake.m0k.org/ PR: 74214 Submitted by: Andrew Thompson Approved by: adamw (mentor)
Diffstat (limited to 'multimedia')
-rw-r--r--multimedia/Makefile1
-rw-r--r--multimedia/handbrake-gtk2/Makefile111
-rw-r--r--multimedia/handbrake-gtk2/distinfo4
-rw-r--r--multimedia/handbrake-gtk2/files/ffmpeg-patch56
-rw-r--r--multimedia/handbrake-gtk2/files/patch-Jamfile23
-rw-r--r--multimedia/handbrake-gtk2/files/patch-Jamrules29
-rw-r--r--multimedia/handbrake-gtk2/files/patch-contrib_Jamfile18
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_FfmpegEnc.c11
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_Fifo.c29
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_HandBrake.c30
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_Jamfile32
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_MpgaDec.c11
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_Scale.c21
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_Thread.c66
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_Thread.h75
-rw-r--r--multimedia/handbrake-gtk2/files/patch-core_Utils.c12
-rw-r--r--multimedia/handbrake-gtk2/files/patch-gtk2_main.c10
-rw-r--r--multimedia/handbrake-gtk2/pkg-descr22
-rw-r--r--multimedia/handbrake/Makefile111
-rw-r--r--multimedia/handbrake/distinfo4
-rw-r--r--multimedia/handbrake/files/ffmpeg-patch56
-rw-r--r--multimedia/handbrake/files/patch-Jamfile23
-rw-r--r--multimedia/handbrake/files/patch-Jamrules29
-rw-r--r--multimedia/handbrake/files/patch-contrib_Jamfile18
-rw-r--r--multimedia/handbrake/files/patch-core_FfmpegEnc.c11
-rw-r--r--multimedia/handbrake/files/patch-core_Fifo.c29
-rw-r--r--multimedia/handbrake/files/patch-core_HandBrake.c30
-rw-r--r--multimedia/handbrake/files/patch-core_Jamfile32
-rw-r--r--multimedia/handbrake/files/patch-core_MpgaDec.c11
-rw-r--r--multimedia/handbrake/files/patch-core_Scale.c21
-rw-r--r--multimedia/handbrake/files/patch-core_Thread.c66
-rw-r--r--multimedia/handbrake/files/patch-core_Thread.h75
-rw-r--r--multimedia/handbrake/files/patch-core_Utils.c12
-rw-r--r--multimedia/handbrake/files/patch-gtk2_main.c10
-rw-r--r--multimedia/handbrake/pkg-descr22
35 files changed, 1121 insertions, 0 deletions
diff --git a/multimedia/Makefile b/multimedia/Makefile
index 61301680d308..01723f4bac36 100644
--- a/multimedia/Makefile
+++ b/multimedia/Makefile
@@ -42,6 +42,7 @@
SUBDIR += gxanim
SUBDIR += gxine
SUBDIR += gxmms
+ SUBDIR += handbrake
SUBDIR += hayes
SUBDIR += kaffeine
SUBDIR += kaffeine-mozilla
diff --git a/multimedia/handbrake-gtk2/Makefile b/multimedia/handbrake-gtk2/Makefile
new file mode 100644
index 000000000000..278747613a4d
--- /dev/null
+++ b/multimedia/handbrake-gtk2/Makefile
@@ -0,0 +1,111 @@
+# New ports collection makefile for: handbrake
+# Date created: 19 November 2004
+# Whom: Andrew Thompson <andy@fud.org.nz>
+#
+# $FreeBSD$
+#
+
+PORTNAME= handbrake
+PORTVERSION= 0.6.2
+CATEGORIES= multimedia
+MASTER_SITES= http://people.via.ecp.fr/~titer/handbrake/ \
+ http://download.videolan.org/pub/videolan/vlc/0.8.1/contrib/:ffmpeg
+DISTFILES= HandBrake-${PORTVERSION}-src${EXTRACT_SUFX} \
+ ${FFMPEG_DIST}:ffmpeg
+EXTRACT_ONLY= HandBrake-${PORTVERSION}-src${EXTRACT_SUFX}
+
+MAINTAINER= andy@fud.org.nz
+COMMENT= A DVD to MPEG-4 ripper and encoder
+
+BUILD_DEPENDS= jam:${PORTSDIR}/devel/jam \
+ nasm:${PORTSDIR}/devel/nasm
+LIB_DEPENDS= a52.0:${PORTSDIR}/audio/liba52 \
+ dvdcss.2:${PORTSDIR}/multimedia/libdvdcss \
+ dvdread.3:${PORTSDIR}/multimedia/libdvdread \
+ faac.0:${PORTSDIR}/audio/faac \
+ mp3lame.0:${PORTSDIR}/audio/lame \
+ mp4.0:${PORTSDIR}/multimedia/mpeg4ip \
+ mpeg2.0:${PORTSDIR}/multimedia/libmpeg2 \
+ ogg.5:${PORTSDIR}/audio/libogg \
+ samplerate.1:${PORTSDIR}/audio/libsamplerate \
+ vorbis.3:${PORTSDIR}/audio/libvorbis \
+ xvidcore.4:${PORTSDIR}/multimedia/xvid
+
+FFMPEG_SNAP= 20041113
+FFMPEG_DIST= ffmpeg-${FFMPEG_SNAP}.tar.bz2
+FFMPEG_SRC_DIR= ${WRKDIR}/ffmpeg-${FFMPEG_SNAP}
+PLIST_FILES= bin/handbrake
+WRKSRC= ${WRKDIR}/HandBrake-${PORTVERSION}
+
+USE_GNOME= gtk20
+USE_REINPLACE= yes
+USE_X_PREFIX= yes
+
+SYSCTL_CMD?= /sbin/sysctl
+
+FFMPEG_CONFIGURE_ARGS+= --enable-gpl --disable-ffserver \
+ --enable-memalign-hack \
+ --cc="${CC}" \
+ --make="${GMAKE}" \
+ --extra-ldflags="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
+ --extra-cflags="${CFLAGS} -I${LOCALBASE}/include -I${X11BASE}/include" \
+ --extra-libs"-lm" \
+ --disable-debug \
+ --enable-pp \
+ --enable-pthreads \
+ --enable-faac \
+ --enable-mp3lame \
+ --enable-faad \
+ --enable-a52 \
+ --enable-xvid
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+WITH_DVD_DEVICE?= acd0c
+.else
+WITH_DVD_DEVICE?= acd0
+.endif
+
+post-extract:
+ cd ${WRKDIR}; ${BZIP2_CMD} ${EXTRACT_BEFORE_ARGS} \
+ ${_DISTDIR}/${FFMPEG_DIST} ${EXTRACT_AFTER_ARGS}
+
+do-build:
+ @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} jam)
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/gtk2HB ${PREFIX}/bin/handbrake
+
+post-patch:
+ @${REINPLACE_CMD} -e 's:%%PREFIX%%:${LOCALBASE}:g' \
+ -e 's:%%LIBAVCODEC%%:${FFMPEG_SRC_DIR}/libavcodec:g' \
+ -e 's:%%PTHREAD_LIBS%%:${PTHREAD_LIBS}:g' \
+ -e 's:%%CC%%:${CC}:g' -e 's:%%CXX%%:${CXX}:g' \
+ -e 's:%%CFLAGS%%:${CFLAGS}:g' \
+ ${BUILD_WRKSRC}/Jamfile ${BUILD_WRKSRC}/core/Jamfile \
+ ${BUILD_WRKSRC}/Jamrules
+ @${REINPLACE_CMD} -e 's:%%DVD_DEVICE%%:${WITH_DVD_DEVICE}:g' \
+ ${BUILD_WRKSRC}/gtk2/main.c
+# sysctl
+ @${REINPLACE_CMD} -e 's|/usr/sbin/sysctl|${SYSCTL_CMD}|' \
+ ${BUILD_WRKSRC}/core/HandBrake.c
+# ffmpeg
+.if ${OSVERSION} < 502119
+ @${REINPLACE_CMD} -e 's|roundf|rintf|' \
+ ${FFMPEG_SRC_DIR}/libavcodec/xvidff.c
+.endif
+ @${REINPLACE_CMD} -e 's|-lpthread|${PTHREAD_LIBS}|' \
+ ${FFMPEG_SRC_DIR}/configure
+ cd ${FFMPEG_SRC_DIR} && \
+ ${PATCH} -p0 < ${PATCHDIR}/ffmpeg-patch
+
+pre-configure:
+ cd ${FFMPEG_SRC_DIR} \
+ && ${SETENV} ${SCRIPTS_ENV} ${CONFIGURE_ENV} \
+ ${SH} ./configure ${CONFIGURE_ARGS} ${FFMPEG_CONFIGURE_ARGS}
+ cd ${FFMPEG_SRC_DIR}/libavcodec \
+ && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} Makefile \
+ ${MAKE_ARGS} all
+
+.include <bsd.port.post.mk>
diff --git a/multimedia/handbrake-gtk2/distinfo b/multimedia/handbrake-gtk2/distinfo
new file mode 100644
index 000000000000..f2f25d8e9179
--- /dev/null
+++ b/multimedia/handbrake-gtk2/distinfo
@@ -0,0 +1,4 @@
+MD5 (HandBrake-0.6.2-src.tar.gz) = a787787622cfa5411c13b7a4bc057ea5
+SIZE (HandBrake-0.6.2-src.tar.gz) = 1992682
+MD5 (ffmpeg-20041113.tar.bz2) = 245bbbb766f43722826358a938afd9a9
+SIZE (ffmpeg-20041113.tar.bz2) = 1472726
diff --git a/multimedia/handbrake-gtk2/files/ffmpeg-patch b/multimedia/handbrake-gtk2/files/ffmpeg-patch
new file mode 100644
index 000000000000..2a4b7280ae5e
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/ffmpeg-patch
@@ -0,0 +1,56 @@
+--- libavcodec/liba52/resample_mmx.c 2004/05/01 14:38:45 1.1
++++ libavcodec/liba52/resample_mmx.c 2004/05/01 14:58:39
+@@ -7,10 +7,10 @@
+ and it would mean (C / MMX2 / MMX / 3DNOW) versions
+ */
+
+-static uint64_t __attribute__((aligned(8))) magicF2W= 0x43c0000043c00000LL;
+-static uint64_t __attribute__((aligned(8))) wm1010= 0xFFFF0000FFFF0000LL;
+-static uint64_t __attribute__((aligned(8))) wm0101= 0x0000FFFF0000FFFFLL;
+-static uint64_t __attribute__((aligned(8))) wm1100= 0xFFFFFFFF00000000LL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) magicF2W= 0x43c0000043c00000LL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) wm1010= 0xFFFF0000FFFF0000LL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) wm0101= 0x0000FFFF0000FFFFLL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) wm1100= 0xFFFFFFFF00000000LL;
+
+ static int a52_resample_MONO_to_5_MMX(float * _f, int16_t * s16){
+ int32_t * f = (int32_t *) _f;
+
+--- Makefile.orig Fri Oct 22 04:08:47 2004
++++ Makefile Fri Oct 22 04:12:43 2004
+@@ -81,28 +81,29 @@
+ all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
+
+ lib:
+- $(MAKE) -C libavcodec all
+- $(MAKE) -C libavformat all
++ $(MAKE) LDFLAGS="$(LDFLAGS)" -C libavcodec all
++ $(MAKE) LDFLAGS="$(LDFLAGS)" -C libavformat all
++
+
+ ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
+- $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
+
+ ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
+ cp -p $< $@
+ $(STRIP) $@
+
+ ffserver$(EXESUF): ffserver.o .libs
+- $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
+
+ ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
+- $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
+
+ ffplay$(EXESUF): ffplay_g$(EXESUF)
+ cp -p $< $@
+ $(STRIP) $@
+
+ output_example$(EXESUF): output_example.o .libs
+- $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
+
+ qt-faststart$(EXESUF): qt-faststart.c
+ $(CC) qt-faststart.c -o qt-faststart$(EXESUF)
diff --git a/multimedia/handbrake-gtk2/files/patch-Jamfile b/multimedia/handbrake-gtk2/files/patch-Jamfile
new file mode 100644
index 000000000000..af6a54cdbd2b
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-Jamfile
@@ -0,0 +1,23 @@
+--- Jamfile.orig Wed May 26 05:51:32 2004
++++ Jamfile Mon Nov 22 20:29:09 2004
+@@ -54,6 +54,20 @@
+ ObjectCcFlags $(GTK2_SRC) : `pkg-config gtk+-2.0 --cflags` ;
+ Main $(GTK2_BIN) : $(GTK2_SRC) ;
+ }
++if $(OS) = FREEBSD
++{
++ HB_LIBS = libhb.a libx264.a ;
++ SystemLibraries $(TEST_BIN) : %%LIBAVCODEC%%/libavcodec.a
++ -L%%PREFIX%%/lib %%PTHREAD_LIBS%% -la52
++ -ldvdcss -ldvdread -lfaac -lmp3lame -lmp4v2 -lmpeg2 -logg
++ -lsamplerate -lvorbis -lvorbisenc -lxvidcore ;
++ SystemLibraries $(GTK2_BIN) : %%LIBAVCODEC%%/libavcodec.a
++ -L%%PREFIX%%/lib %%PTHREAD_LIBS%% `pkg-config gtk+-2.0 --libs`
++ -la52 -ldvdcss -ldvdread -lfaac -lmp3lame -lmp4v2
++ -lmpeg2 -logg -lsamplerate -lvorbis -lvorbisenc -lxvidcore ;
++ ObjectCcFlags $(GTK2_SRC) : `pkg-config gtk+-2.0 --cflags` ;
++ Main $(GTK2_BIN) : $(GTK2_SRC) ;
++}
+ if $(OS) = CYGWIN
+ {
+ SystemLibraries $(TEST_BIN) : -lws2_32 ;
diff --git a/multimedia/handbrake-gtk2/files/patch-Jamrules b/multimedia/handbrake-gtk2/files/patch-Jamrules
new file mode 100644
index 000000000000..5483bf3d2e54
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-Jamrules
@@ -0,0 +1,29 @@
+--- Jamrules.orig Tue May 25 13:51:32 2004
++++ Jamrules Mon Nov 22 12:57:16 2004
+@@ -8,11 +8,11 @@
+ LANGUAGES = fr de it pl ru nl es pt ja ;
+
+ # Compilers & flags
+-CC = gcc ;
+-C++ = g++ ;
++CC = %%CC%% ;
++C++ = %%CXX%% ;
+ AS = nasm ;
+-LINK = g++ ;
+-OPTIM = -O3 -funroll-loops ;
++LINK = %%CXX%% ;
++OPTIM = %%CFLAGS%% ;
+ DEFINES = HB_$(OS) HB_VERSION=\\\"$(HB_VERSION)\\\" ;
+
+ if $(OS) = BEOS
+@@ -32,6 +32,10 @@
+ if $(OS) = LINUX
+ {
+ ASFLAGS = -f elf ;
++}
++if $(OS) = FREEBSD
++{
++ OPTIM = %%CFLAGS%% ;
+ }
+ if $(OS) = CYGWIN
+ {
diff --git a/multimedia/handbrake-gtk2/files/patch-contrib_Jamfile b/multimedia/handbrake-gtk2/files/patch-contrib_Jamfile
new file mode 100644
index 000000000000..ad9895f511a6
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-contrib_Jamfile
@@ -0,0 +1,18 @@
+--- contrib/Jamfile.orig Fri Nov 19 15:50:35 2004
++++ contrib/Jamfile Fri Nov 19 15:50:49 2004
+@@ -1,15 +1,3 @@
+ SubDir TOP contrib ;
+
+-SubInclude TOP contrib liba52 ;
+-SubInclude TOP contrib libavcodec ;
+-SubInclude TOP contrib libdvdcss ;
+-SubInclude TOP contrib libdvdread ;
+-SubInclude TOP contrib libfaac ;
+-SubInclude TOP contrib libmp3lame ;
+-SubInclude TOP contrib libmp4v2 ;
+-SubInclude TOP contrib libmpeg2 ;
+-SubInclude TOP contrib libogg ;
+-SubInclude TOP contrib libsamplerate ;
+-SubInclude TOP contrib libvorbis ;
+ SubInclude TOP contrib libx264 ;
+-SubInclude TOP contrib libxvidcore ;
diff --git a/multimedia/handbrake-gtk2/files/patch-core_FfmpegEnc.c b/multimedia/handbrake-gtk2/files/patch-core_FfmpegEnc.c
new file mode 100644
index 000000000000..09e2a7af55b0
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_FfmpegEnc.c
@@ -0,0 +1,11 @@
+--- core/FfmpegEnc.c.orig Mon Nov 22 21:55:47 2004
++++ core/FfmpegEnc.c Mon Nov 22 21:28:42 2004
+@@ -7,7 +7,7 @@
+ #include "HBInternal.h"
+
+ /* libavcodec */
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ struct HBWork
+ {
diff --git a/multimedia/handbrake-gtk2/files/patch-core_Fifo.c b/multimedia/handbrake-gtk2/files/patch-core_Fifo.c
new file mode 100644
index 000000000000..290a891e8070
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_Fifo.c
@@ -0,0 +1,29 @@
+--- core/Fifo.c.orig Wed May 26 05:51:32 2004
++++ core/Fifo.c Fri Nov 19 15:55:26 2004
+@@ -23,7 +23,7 @@
+
+ #if defined( HB_BEOS ) || defined( HB_LINUX )
+ b->data = memalign( 16, size );
+-#elif defined( HB_MACOSX )
++#elif defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ /* OS X's malloc returns 16-bytes aligned memory */
+ b->data = malloc( size );
+ #elif defined( HB_CYGWIN )
+@@ -47,7 +47,7 @@
+ {
+ /* We don't care about alignment here, realloc is only used in the
+ AVI muxer anyway */
+-#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX )
++#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ b->data = realloc( b->data, size );
+ #elif defined( HB_CYGWIN )
+ int alignment = b->data - b->dataOrig;
+@@ -66,7 +66,7 @@
+ {
+ HBBuffer * b = *_b;
+
+-#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX )
++#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ free( b->data );
+ #elif defined( HB_CYGWIN )
+ free( b->dataOrig );
diff --git a/multimedia/handbrake-gtk2/files/patch-core_HandBrake.c b/multimedia/handbrake-gtk2/files/patch-core_HandBrake.c
new file mode 100644
index 000000000000..367fb978f25d
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_HandBrake.c
@@ -0,0 +1,30 @@
+--- core/HandBrake.c.orig Wed May 26 05:51:32 2004
++++ core/HandBrake.c Mon Nov 22 21:57:36 2004
+@@ -7,7 +7,7 @@
+ #include "HBInternal.h"
+
+ /* libavcodec */
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ /* Local prototypes */
+ static void HandBrakeThread( void * );
+@@ -277,7 +277,8 @@
+ img_resample_full_init( t->outWidth, t->outHeight,
+ t->inWidth, t->inHeight,
+ t->topCrop, t->bottomCrop,
+- t->leftCrop, t->rightCrop );
++ t->leftCrop, t->rightCrop,
++ 0,0,0,0 );
+ if( t->deinterlace )
+ {
+ avpicture_deinterlace( &pic2, &pic1, PIX_FMT_YUV420P,
+@@ -709,7 +710,7 @@
+ get_system_info( &info );
+ CPUCount = info.cpu_count;
+
+-#elif defined( HB_MACOSX )
++#elif defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ FILE * info;
+ char buffer[256];
+
diff --git a/multimedia/handbrake-gtk2/files/patch-core_Jamfile b/multimedia/handbrake-gtk2/files/patch-core_Jamfile
new file mode 100644
index 000000000000..7559149b0a51
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_Jamfile
@@ -0,0 +1,32 @@
+--- core/Jamfile.orig Wed May 26 05:51:32 2004
++++ core/Jamfile Mon Nov 22 20:28:52 2004
+@@ -15,25 +15,12 @@
+ Library libhb : $(LIBHB_SRC) ;
+
+ # Sadly, we might want to debug our code
+-ObjectCcFlags $(LIBHB_SRC) : -g -Wall -W ;
++ObjectCcFlags $(LIBHB_SRC) : -g -Wall -W -I%%PREFIX%%/include ;
+
+ # Needed includes
+-ObjectHdrs Ac3Dec.c : $(TOP)/contrib/liba52 ;
+ ObjectHdrs FfmpegEnc.c
+- HandBrake.c
+- MpgaDec.c
+- Scale.c : $(TOP)/contrib/libavcodec ;
+-ObjectHdrs DVDRead.c
+- Scan.c : $(TOP)/contrib/libdvdread ;
+-ObjectHdrs FaacEnc.c : $(TOP)/contrib/libfaac ;
+-ObjectHdrs Mp3Enc.c : $(TOP)/contrib/libmp3lame ;
+-ObjectHdrs Mp4Mux.c : $(TOP)/contrib/libmp4v2 ;
+-ObjectHdrs Mpeg2Dec.c
+- Scan.c : $(TOP)/contrib/libmpeg2 ;
+-ObjectHdrs Resample.c : $(TOP)/contrib/libsamplerate ;
+-ObjectHdrs OgmMux.c
+- VorbisEnc.c : $(TOP)/contrib/libogg ;
+-ObjectHdrs VorbisEnc.c : $(TOP)/contrib/libvorbis ;
++ HandBrake.c
++ MpgaDec.c
++ Scale.c : %%LIBAVCODEC%% ;
+ ObjectHdrs X264Enc.c : $(TOP)/contrib/libx264 ;
+-ObjectHdrs XvidEnc.c : $(TOP)/contrib/libxvidcore ;
+
diff --git a/multimedia/handbrake-gtk2/files/patch-core_MpgaDec.c b/multimedia/handbrake-gtk2/files/patch-core_MpgaDec.c
new file mode 100644
index 000000000000..7c0501c01011
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_MpgaDec.c
@@ -0,0 +1,11 @@
+--- core/MpgaDec.c.orig Mon Nov 22 21:58:23 2004
++++ core/MpgaDec.c Mon Nov 22 21:28:54 2004
+@@ -6,7 +6,7 @@
+
+ #include "HBInternal.h"
+
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ struct HBWork
+ {
diff --git a/multimedia/handbrake-gtk2/files/patch-core_Scale.c b/multimedia/handbrake-gtk2/files/patch-core_Scale.c
new file mode 100644
index 000000000000..56de0cc6dda8
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_Scale.c
@@ -0,0 +1,21 @@
+--- core/Scale.c.orig Mon Nov 22 21:59:25 2004
++++ core/Scale.c Mon Nov 22 21:59:48 2004
+@@ -6,7 +6,7 @@
+
+ #include "HBInternal.h"
+
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ struct HBWork
+ {
+@@ -52,7 +52,8 @@
+ img_resample_full_init( title->outWidth, title->outHeight,
+ title->inWidth, title->inHeight,
+ title->topCrop, title->bottomCrop,
+- title->leftCrop, title->rightCrop );
++ title->leftCrop, title->rightCrop,
++ 0,0,0,0 );
+
+ return w;
+ }
diff --git a/multimedia/handbrake-gtk2/files/patch-core_Thread.c b/multimedia/handbrake-gtk2/files/patch-core_Thread.c
new file mode 100644
index 000000000000..b47124180e5d
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_Thread.c
@@ -0,0 +1,66 @@
+diff -urN core/Thread.c core/Thread.c
+--- core/Thread.c Wed May 26 05:51:32 2004
++++ core/Thread.c Fri Nov 19 08:08:07 2004
+@@ -24,7 +24,7 @@
+ /* OS-specific thread id */
+ #if defined( HB_BEOS )
+ int thread;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_t thread;
+ #elif defined( HB_CYGWIN )
+ HANDLE thread;
+@@ -74,7 +74,7 @@
+ t->thread = spawn_thread( (int32 (*)( void * )) ThreadFunc,
+ name, priority, t );
+ resume_thread( t->thread );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_create( &t->thread, NULL,
+ (void * (*)( void * )) ThreadFunc, t );
+ #elif defined( HB_CYGWIN )
+@@ -96,7 +96,7 @@
+ #if defined( HB_BEOS )
+ long exitValue;
+ wait_for_thread( t->thread, &exitValue );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_join( t->thread, NULL );
+ #elif defined( HB_CYGWIN )
+ WaitForSingleObject( t->thread, INFINITE );
+@@ -126,7 +126,7 @@
+
+ #if defined( HB_BEOS )
+ l->sem = create_sem( 1, "sem" );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_init( &l->mutex, NULL );
+ #elif defined( HB_CYGWIN )
+ l->mutex = CreateMutex( 0, FALSE, 0 );
+@@ -141,7 +141,7 @@
+
+ #if defined( HB_BEOS )
+ delete_sem( l->sem );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_destroy( &l->mutex );
+ #elif defined( HB_CYGWIN )
+ CloseHandle( l->mutex );
+@@ -161,7 +161,7 @@
+
+ #if defined( HB_BEOS )
+ c->thread = -1;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_init( &c->cond, NULL );
+ #elif defined( HB_CYGWIN )
+ c->event = CreateEvent( NULL, FALSE, FALSE, NULL );
+@@ -175,7 +175,7 @@
+ HBCond * c = *_c;
+
+ #if defined( HB_BEOS )
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_destroy( &c->cond );
+ #elif defined( HB_CYGWIN )
+ CloseHandle( c->event );
diff --git a/multimedia/handbrake-gtk2/files/patch-core_Thread.h b/multimedia/handbrake-gtk2/files/patch-core_Thread.h
new file mode 100644
index 000000000000..59171d047127
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_Thread.h
@@ -0,0 +1,75 @@
+diff -urN core/Thread.h core/Thread.h
+--- core/Thread.h Wed May 26 05:51:32 2004
++++ core/Thread.h Fri Nov 19 08:08:07 2004
+@@ -10,7 +10,7 @@
+ /* System headers */
+ #if defined( HB_BEOS )
+ # include <OS.h>
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ # include <pthread.h>
+ #elif defined( HB_CYGWIN )
+ # include <windows.h>
+@@ -25,7 +25,7 @@
+ #elif defined( HB_MACOSX )
+ # define HB_LOW_PRIORITY 0
+ # define HB_NORMAL_PRIORITY 31
+-#elif defined( HB_LINUX ) || defined( HB_CYGWIN )
++#elif defined( HB_LINUX ) || defined( HB_CYGWIN ) || defined( HB_FREEBSD )
+ /* Actually unused */
+ # define HB_LOW_PRIORITY 0
+ # define HB_NORMAL_PRIORITY 0
+@@ -57,7 +57,7 @@
+ {
+ #if defined( HB_BEOS )
+ sem_id sem;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_t mutex;
+ #elif defined( HB_CYGWIN )
+ HANDLE mutex;
+@@ -68,7 +68,7 @@
+ {
+ #if defined( HB_BEOS )
+ acquire_sem( l->sem );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_lock( &l->mutex );
+ #elif defined( HB_CYGWIN )
+ WaitForSingleObject( l->mutex, INFINITE );
+@@ -79,7 +79,7 @@
+ {
+ #if defined( HB_BEOS )
+ release_sem( l->sem );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_unlock( &l->mutex );
+ #elif defined( HB_CYGWIN )
+ ReleaseMutex( l->mutex );
+@@ -94,7 +94,7 @@
+ {
+ #if defined( HB_BEOS )
+ int thread;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_t cond;
+ #elif defined( HB_CYGWIN )
+ HANDLE event;
+@@ -110,7 +110,7 @@
+ suspend_thread( c->thread );
+ acquire_sem( lock->sem );
+ c->thread = -1;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_wait( &c->cond, &lock->mutex );
+ #elif defined( HB_CYGWIN )
+ SignalObjectAndWait( lock->mutex, c->event, INFINITE, FALSE );
+@@ -134,7 +134,7 @@
+ release_sem() and suspend_thread() lines, wait a bit */
+ snooze( 5000 );
+ }
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_signal( &c->cond );
+ #elif defined( HB_CYGWIN )
+ PulseEvent( c->event );
diff --git a/multimedia/handbrake-gtk2/files/patch-core_Utils.c b/multimedia/handbrake-gtk2/files/patch-core_Utils.c
new file mode 100644
index 000000000000..17600fd81cc9
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-core_Utils.c
@@ -0,0 +1,12 @@
+diff -urN core/Utils.c core/Utils.c
+--- core/Utils.c Wed May 26 05:51:32 2004
++++ core/Utils.c Fri Nov 19 08:08:07 2004
+@@ -38,7 +38,7 @@
+ {
+ #if defined( HB_BEOS )
+ snooze( time );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ usleep( time );
+ #elif defined( HB_CYGWIN )
+ Sleep( time / 1000 );
diff --git a/multimedia/handbrake-gtk2/files/patch-gtk2_main.c b/multimedia/handbrake-gtk2/files/patch-gtk2_main.c
new file mode 100644
index 000000000000..e093de43990f
--- /dev/null
+++ b/multimedia/handbrake-gtk2/files/patch-gtk2_main.c
@@ -0,0 +1,10 @@
+--- gtk2/main.c.orig Sat Nov 20 19:20:18 2004
++++ gtk2/main.c Sat Nov 20 19:21:02 2004
+@@ -85,6 +85,7 @@
+
+ /* build dvd list */
+ items = g_list_append (items, "" );
++ items = g_list_append (items, "/dev/%%DVD_DEVICE%%" );
+ items = g_list_append (items, "/dev/dvd" );
+ gtk_combo_set_popdown_strings( GTK_COMBO(lookup_widget( hb_win_main, "combo1") ), items );
+
diff --git a/multimedia/handbrake-gtk2/pkg-descr b/multimedia/handbrake-gtk2/pkg-descr
new file mode 100644
index 000000000000..10fc32f61e54
--- /dev/null
+++ b/multimedia/handbrake-gtk2/pkg-descr
@@ -0,0 +1,22 @@
+HandBrake is a GPL'd multi-platform, multithreaded DVD to MPEG-4
+ripper and
+converter. HandBrake was originally available on the BeOS, but now has
+been
+ported over to MacOS X, GNU/Linux and FreeBSD.
+
+Features:
+ * Can encode directly from DVDs (even encrypted ones) or from
+VIDEO_TS folders
+ * Supports AC3, LPCM and MPEG audio tracks
+ * Outputs MP4, AVI or OGM files
+ * Outputs AAC, MP3 or Vorbis audio
+ * Supports 2-pass encoding
+ * Supports encoding of two audio tracks
+ * Includes a bitrate calculator
+ * Supports picture deinterlacing, cropping and scaling
+
+Known limitations:
+ * Does not handle DTS audio tracks
+ * Does not handle single VOB files or any other file format
+
+WWW: http://handbrake.m0k.org/
diff --git a/multimedia/handbrake/Makefile b/multimedia/handbrake/Makefile
new file mode 100644
index 000000000000..278747613a4d
--- /dev/null
+++ b/multimedia/handbrake/Makefile
@@ -0,0 +1,111 @@
+# New ports collection makefile for: handbrake
+# Date created: 19 November 2004
+# Whom: Andrew Thompson <andy@fud.org.nz>
+#
+# $FreeBSD$
+#
+
+PORTNAME= handbrake
+PORTVERSION= 0.6.2
+CATEGORIES= multimedia
+MASTER_SITES= http://people.via.ecp.fr/~titer/handbrake/ \
+ http://download.videolan.org/pub/videolan/vlc/0.8.1/contrib/:ffmpeg
+DISTFILES= HandBrake-${PORTVERSION}-src${EXTRACT_SUFX} \
+ ${FFMPEG_DIST}:ffmpeg
+EXTRACT_ONLY= HandBrake-${PORTVERSION}-src${EXTRACT_SUFX}
+
+MAINTAINER= andy@fud.org.nz
+COMMENT= A DVD to MPEG-4 ripper and encoder
+
+BUILD_DEPENDS= jam:${PORTSDIR}/devel/jam \
+ nasm:${PORTSDIR}/devel/nasm
+LIB_DEPENDS= a52.0:${PORTSDIR}/audio/liba52 \
+ dvdcss.2:${PORTSDIR}/multimedia/libdvdcss \
+ dvdread.3:${PORTSDIR}/multimedia/libdvdread \
+ faac.0:${PORTSDIR}/audio/faac \
+ mp3lame.0:${PORTSDIR}/audio/lame \
+ mp4.0:${PORTSDIR}/multimedia/mpeg4ip \
+ mpeg2.0:${PORTSDIR}/multimedia/libmpeg2 \
+ ogg.5:${PORTSDIR}/audio/libogg \
+ samplerate.1:${PORTSDIR}/audio/libsamplerate \
+ vorbis.3:${PORTSDIR}/audio/libvorbis \
+ xvidcore.4:${PORTSDIR}/multimedia/xvid
+
+FFMPEG_SNAP= 20041113
+FFMPEG_DIST= ffmpeg-${FFMPEG_SNAP}.tar.bz2
+FFMPEG_SRC_DIR= ${WRKDIR}/ffmpeg-${FFMPEG_SNAP}
+PLIST_FILES= bin/handbrake
+WRKSRC= ${WRKDIR}/HandBrake-${PORTVERSION}
+
+USE_GNOME= gtk20
+USE_REINPLACE= yes
+USE_X_PREFIX= yes
+
+SYSCTL_CMD?= /sbin/sysctl
+
+FFMPEG_CONFIGURE_ARGS+= --enable-gpl --disable-ffserver \
+ --enable-memalign-hack \
+ --cc="${CC}" \
+ --make="${GMAKE}" \
+ --extra-ldflags="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
+ --extra-cflags="${CFLAGS} -I${LOCALBASE}/include -I${X11BASE}/include" \
+ --extra-libs"-lm" \
+ --disable-debug \
+ --enable-pp \
+ --enable-pthreads \
+ --enable-faac \
+ --enable-mp3lame \
+ --enable-faad \
+ --enable-a52 \
+ --enable-xvid
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+WITH_DVD_DEVICE?= acd0c
+.else
+WITH_DVD_DEVICE?= acd0
+.endif
+
+post-extract:
+ cd ${WRKDIR}; ${BZIP2_CMD} ${EXTRACT_BEFORE_ARGS} \
+ ${_DISTDIR}/${FFMPEG_DIST} ${EXTRACT_AFTER_ARGS}
+
+do-build:
+ @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} jam)
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/gtk2HB ${PREFIX}/bin/handbrake
+
+post-patch:
+ @${REINPLACE_CMD} -e 's:%%PREFIX%%:${LOCALBASE}:g' \
+ -e 's:%%LIBAVCODEC%%:${FFMPEG_SRC_DIR}/libavcodec:g' \
+ -e 's:%%PTHREAD_LIBS%%:${PTHREAD_LIBS}:g' \
+ -e 's:%%CC%%:${CC}:g' -e 's:%%CXX%%:${CXX}:g' \
+ -e 's:%%CFLAGS%%:${CFLAGS}:g' \
+ ${BUILD_WRKSRC}/Jamfile ${BUILD_WRKSRC}/core/Jamfile \
+ ${BUILD_WRKSRC}/Jamrules
+ @${REINPLACE_CMD} -e 's:%%DVD_DEVICE%%:${WITH_DVD_DEVICE}:g' \
+ ${BUILD_WRKSRC}/gtk2/main.c
+# sysctl
+ @${REINPLACE_CMD} -e 's|/usr/sbin/sysctl|${SYSCTL_CMD}|' \
+ ${BUILD_WRKSRC}/core/HandBrake.c
+# ffmpeg
+.if ${OSVERSION} < 502119
+ @${REINPLACE_CMD} -e 's|roundf|rintf|' \
+ ${FFMPEG_SRC_DIR}/libavcodec/xvidff.c
+.endif
+ @${REINPLACE_CMD} -e 's|-lpthread|${PTHREAD_LIBS}|' \
+ ${FFMPEG_SRC_DIR}/configure
+ cd ${FFMPEG_SRC_DIR} && \
+ ${PATCH} -p0 < ${PATCHDIR}/ffmpeg-patch
+
+pre-configure:
+ cd ${FFMPEG_SRC_DIR} \
+ && ${SETENV} ${SCRIPTS_ENV} ${CONFIGURE_ENV} \
+ ${SH} ./configure ${CONFIGURE_ARGS} ${FFMPEG_CONFIGURE_ARGS}
+ cd ${FFMPEG_SRC_DIR}/libavcodec \
+ && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} Makefile \
+ ${MAKE_ARGS} all
+
+.include <bsd.port.post.mk>
diff --git a/multimedia/handbrake/distinfo b/multimedia/handbrake/distinfo
new file mode 100644
index 000000000000..f2f25d8e9179
--- /dev/null
+++ b/multimedia/handbrake/distinfo
@@ -0,0 +1,4 @@
+MD5 (HandBrake-0.6.2-src.tar.gz) = a787787622cfa5411c13b7a4bc057ea5
+SIZE (HandBrake-0.6.2-src.tar.gz) = 1992682
+MD5 (ffmpeg-20041113.tar.bz2) = 245bbbb766f43722826358a938afd9a9
+SIZE (ffmpeg-20041113.tar.bz2) = 1472726
diff --git a/multimedia/handbrake/files/ffmpeg-patch b/multimedia/handbrake/files/ffmpeg-patch
new file mode 100644
index 000000000000..2a4b7280ae5e
--- /dev/null
+++ b/multimedia/handbrake/files/ffmpeg-patch
@@ -0,0 +1,56 @@
+--- libavcodec/liba52/resample_mmx.c 2004/05/01 14:38:45 1.1
++++ libavcodec/liba52/resample_mmx.c 2004/05/01 14:58:39
+@@ -7,10 +7,10 @@
+ and it would mean (C / MMX2 / MMX / 3DNOW) versions
+ */
+
+-static uint64_t __attribute__((aligned(8))) magicF2W= 0x43c0000043c00000LL;
+-static uint64_t __attribute__((aligned(8))) wm1010= 0xFFFF0000FFFF0000LL;
+-static uint64_t __attribute__((aligned(8))) wm0101= 0x0000FFFF0000FFFFLL;
+-static uint64_t __attribute__((aligned(8))) wm1100= 0xFFFFFFFF00000000LL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) magicF2W= 0x43c0000043c00000LL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) wm1010= 0xFFFF0000FFFF0000LL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) wm0101= 0x0000FFFF0000FFFFLL;
++static uint64_t __attribute__((used)) __attribute__((aligned(8))) wm1100= 0xFFFFFFFF00000000LL;
+
+ static int a52_resample_MONO_to_5_MMX(float * _f, int16_t * s16){
+ int32_t * f = (int32_t *) _f;
+
+--- Makefile.orig Fri Oct 22 04:08:47 2004
++++ Makefile Fri Oct 22 04:12:43 2004
+@@ -81,28 +81,29 @@
+ all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
+
+ lib:
+- $(MAKE) -C libavcodec all
+- $(MAKE) -C libavformat all
++ $(MAKE) LDFLAGS="$(LDFLAGS)" -C libavcodec all
++ $(MAKE) LDFLAGS="$(LDFLAGS)" -C libavformat all
++
+
+ ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
+- $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(EXTRALIBS)
+
+ ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
+ cp -p $< $@
+ $(STRIP) $@
+
+ ffserver$(EXESUF): ffserver.o .libs
+- $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(EXTRALIBS)
+
+ ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
+- $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
+
+ ffplay$(EXESUF): ffplay_g$(EXESUF)
+ cp -p $< $@
+ $(STRIP) $@
+
+ output_example$(EXESUF): output_example.o .libs
+- $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
++ $(CC) $(FFLIBS) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
+
+ qt-faststart$(EXESUF): qt-faststart.c
+ $(CC) qt-faststart.c -o qt-faststart$(EXESUF)
diff --git a/multimedia/handbrake/files/patch-Jamfile b/multimedia/handbrake/files/patch-Jamfile
new file mode 100644
index 000000000000..af6a54cdbd2b
--- /dev/null
+++ b/multimedia/handbrake/files/patch-Jamfile
@@ -0,0 +1,23 @@
+--- Jamfile.orig Wed May 26 05:51:32 2004
++++ Jamfile Mon Nov 22 20:29:09 2004
+@@ -54,6 +54,20 @@
+ ObjectCcFlags $(GTK2_SRC) : `pkg-config gtk+-2.0 --cflags` ;
+ Main $(GTK2_BIN) : $(GTK2_SRC) ;
+ }
++if $(OS) = FREEBSD
++{
++ HB_LIBS = libhb.a libx264.a ;
++ SystemLibraries $(TEST_BIN) : %%LIBAVCODEC%%/libavcodec.a
++ -L%%PREFIX%%/lib %%PTHREAD_LIBS%% -la52
++ -ldvdcss -ldvdread -lfaac -lmp3lame -lmp4v2 -lmpeg2 -logg
++ -lsamplerate -lvorbis -lvorbisenc -lxvidcore ;
++ SystemLibraries $(GTK2_BIN) : %%LIBAVCODEC%%/libavcodec.a
++ -L%%PREFIX%%/lib %%PTHREAD_LIBS%% `pkg-config gtk+-2.0 --libs`
++ -la52 -ldvdcss -ldvdread -lfaac -lmp3lame -lmp4v2
++ -lmpeg2 -logg -lsamplerate -lvorbis -lvorbisenc -lxvidcore ;
++ ObjectCcFlags $(GTK2_SRC) : `pkg-config gtk+-2.0 --cflags` ;
++ Main $(GTK2_BIN) : $(GTK2_SRC) ;
++}
+ if $(OS) = CYGWIN
+ {
+ SystemLibraries $(TEST_BIN) : -lws2_32 ;
diff --git a/multimedia/handbrake/files/patch-Jamrules b/multimedia/handbrake/files/patch-Jamrules
new file mode 100644
index 000000000000..5483bf3d2e54
--- /dev/null
+++ b/multimedia/handbrake/files/patch-Jamrules
@@ -0,0 +1,29 @@
+--- Jamrules.orig Tue May 25 13:51:32 2004
++++ Jamrules Mon Nov 22 12:57:16 2004
+@@ -8,11 +8,11 @@
+ LANGUAGES = fr de it pl ru nl es pt ja ;
+
+ # Compilers & flags
+-CC = gcc ;
+-C++ = g++ ;
++CC = %%CC%% ;
++C++ = %%CXX%% ;
+ AS = nasm ;
+-LINK = g++ ;
+-OPTIM = -O3 -funroll-loops ;
++LINK = %%CXX%% ;
++OPTIM = %%CFLAGS%% ;
+ DEFINES = HB_$(OS) HB_VERSION=\\\"$(HB_VERSION)\\\" ;
+
+ if $(OS) = BEOS
+@@ -32,6 +32,10 @@
+ if $(OS) = LINUX
+ {
+ ASFLAGS = -f elf ;
++}
++if $(OS) = FREEBSD
++{
++ OPTIM = %%CFLAGS%% ;
+ }
+ if $(OS) = CYGWIN
+ {
diff --git a/multimedia/handbrake/files/patch-contrib_Jamfile b/multimedia/handbrake/files/patch-contrib_Jamfile
new file mode 100644
index 000000000000..ad9895f511a6
--- /dev/null
+++ b/multimedia/handbrake/files/patch-contrib_Jamfile
@@ -0,0 +1,18 @@
+--- contrib/Jamfile.orig Fri Nov 19 15:50:35 2004
++++ contrib/Jamfile Fri Nov 19 15:50:49 2004
+@@ -1,15 +1,3 @@
+ SubDir TOP contrib ;
+
+-SubInclude TOP contrib liba52 ;
+-SubInclude TOP contrib libavcodec ;
+-SubInclude TOP contrib libdvdcss ;
+-SubInclude TOP contrib libdvdread ;
+-SubInclude TOP contrib libfaac ;
+-SubInclude TOP contrib libmp3lame ;
+-SubInclude TOP contrib libmp4v2 ;
+-SubInclude TOP contrib libmpeg2 ;
+-SubInclude TOP contrib libogg ;
+-SubInclude TOP contrib libsamplerate ;
+-SubInclude TOP contrib libvorbis ;
+ SubInclude TOP contrib libx264 ;
+-SubInclude TOP contrib libxvidcore ;
diff --git a/multimedia/handbrake/files/patch-core_FfmpegEnc.c b/multimedia/handbrake/files/patch-core_FfmpegEnc.c
new file mode 100644
index 000000000000..09e2a7af55b0
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_FfmpegEnc.c
@@ -0,0 +1,11 @@
+--- core/FfmpegEnc.c.orig Mon Nov 22 21:55:47 2004
++++ core/FfmpegEnc.c Mon Nov 22 21:28:42 2004
+@@ -7,7 +7,7 @@
+ #include "HBInternal.h"
+
+ /* libavcodec */
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ struct HBWork
+ {
diff --git a/multimedia/handbrake/files/patch-core_Fifo.c b/multimedia/handbrake/files/patch-core_Fifo.c
new file mode 100644
index 000000000000..290a891e8070
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_Fifo.c
@@ -0,0 +1,29 @@
+--- core/Fifo.c.orig Wed May 26 05:51:32 2004
++++ core/Fifo.c Fri Nov 19 15:55:26 2004
+@@ -23,7 +23,7 @@
+
+ #if defined( HB_BEOS ) || defined( HB_LINUX )
+ b->data = memalign( 16, size );
+-#elif defined( HB_MACOSX )
++#elif defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ /* OS X's malloc returns 16-bytes aligned memory */
+ b->data = malloc( size );
+ #elif defined( HB_CYGWIN )
+@@ -47,7 +47,7 @@
+ {
+ /* We don't care about alignment here, realloc is only used in the
+ AVI muxer anyway */
+-#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX )
++#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ b->data = realloc( b->data, size );
+ #elif defined( HB_CYGWIN )
+ int alignment = b->data - b->dataOrig;
+@@ -66,7 +66,7 @@
+ {
+ HBBuffer * b = *_b;
+
+-#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX )
++#if defined( HB_BEOS ) || defined( HB_LINUX ) || defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ free( b->data );
+ #elif defined( HB_CYGWIN )
+ free( b->dataOrig );
diff --git a/multimedia/handbrake/files/patch-core_HandBrake.c b/multimedia/handbrake/files/patch-core_HandBrake.c
new file mode 100644
index 000000000000..367fb978f25d
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_HandBrake.c
@@ -0,0 +1,30 @@
+--- core/HandBrake.c.orig Wed May 26 05:51:32 2004
++++ core/HandBrake.c Mon Nov 22 21:57:36 2004
+@@ -7,7 +7,7 @@
+ #include "HBInternal.h"
+
+ /* libavcodec */
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ /* Local prototypes */
+ static void HandBrakeThread( void * );
+@@ -277,7 +277,8 @@
+ img_resample_full_init( t->outWidth, t->outHeight,
+ t->inWidth, t->inHeight,
+ t->topCrop, t->bottomCrop,
+- t->leftCrop, t->rightCrop );
++ t->leftCrop, t->rightCrop,
++ 0,0,0,0 );
+ if( t->deinterlace )
+ {
+ avpicture_deinterlace( &pic2, &pic1, PIX_FMT_YUV420P,
+@@ -709,7 +710,7 @@
+ get_system_info( &info );
+ CPUCount = info.cpu_count;
+
+-#elif defined( HB_MACOSX )
++#elif defined( HB_MACOSX ) || defined( HB_FREEBSD )
+ FILE * info;
+ char buffer[256];
+
diff --git a/multimedia/handbrake/files/patch-core_Jamfile b/multimedia/handbrake/files/patch-core_Jamfile
new file mode 100644
index 000000000000..7559149b0a51
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_Jamfile
@@ -0,0 +1,32 @@
+--- core/Jamfile.orig Wed May 26 05:51:32 2004
++++ core/Jamfile Mon Nov 22 20:28:52 2004
+@@ -15,25 +15,12 @@
+ Library libhb : $(LIBHB_SRC) ;
+
+ # Sadly, we might want to debug our code
+-ObjectCcFlags $(LIBHB_SRC) : -g -Wall -W ;
++ObjectCcFlags $(LIBHB_SRC) : -g -Wall -W -I%%PREFIX%%/include ;
+
+ # Needed includes
+-ObjectHdrs Ac3Dec.c : $(TOP)/contrib/liba52 ;
+ ObjectHdrs FfmpegEnc.c
+- HandBrake.c
+- MpgaDec.c
+- Scale.c : $(TOP)/contrib/libavcodec ;
+-ObjectHdrs DVDRead.c
+- Scan.c : $(TOP)/contrib/libdvdread ;
+-ObjectHdrs FaacEnc.c : $(TOP)/contrib/libfaac ;
+-ObjectHdrs Mp3Enc.c : $(TOP)/contrib/libmp3lame ;
+-ObjectHdrs Mp4Mux.c : $(TOP)/contrib/libmp4v2 ;
+-ObjectHdrs Mpeg2Dec.c
+- Scan.c : $(TOP)/contrib/libmpeg2 ;
+-ObjectHdrs Resample.c : $(TOP)/contrib/libsamplerate ;
+-ObjectHdrs OgmMux.c
+- VorbisEnc.c : $(TOP)/contrib/libogg ;
+-ObjectHdrs VorbisEnc.c : $(TOP)/contrib/libvorbis ;
++ HandBrake.c
++ MpgaDec.c
++ Scale.c : %%LIBAVCODEC%% ;
+ ObjectHdrs X264Enc.c : $(TOP)/contrib/libx264 ;
+-ObjectHdrs XvidEnc.c : $(TOP)/contrib/libxvidcore ;
+
diff --git a/multimedia/handbrake/files/patch-core_MpgaDec.c b/multimedia/handbrake/files/patch-core_MpgaDec.c
new file mode 100644
index 000000000000..7c0501c01011
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_MpgaDec.c
@@ -0,0 +1,11 @@
+--- core/MpgaDec.c.orig Mon Nov 22 21:58:23 2004
++++ core/MpgaDec.c Mon Nov 22 21:28:54 2004
+@@ -6,7 +6,7 @@
+
+ #include "HBInternal.h"
+
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ struct HBWork
+ {
diff --git a/multimedia/handbrake/files/patch-core_Scale.c b/multimedia/handbrake/files/patch-core_Scale.c
new file mode 100644
index 000000000000..56de0cc6dda8
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_Scale.c
@@ -0,0 +1,21 @@
+--- core/Scale.c.orig Mon Nov 22 21:59:25 2004
++++ core/Scale.c Mon Nov 22 21:59:48 2004
+@@ -6,7 +6,7 @@
+
+ #include "HBInternal.h"
+
+-#include "ffmpeg/avcodec.h"
++#include "avcodec.h"
+
+ struct HBWork
+ {
+@@ -52,7 +52,8 @@
+ img_resample_full_init( title->outWidth, title->outHeight,
+ title->inWidth, title->inHeight,
+ title->topCrop, title->bottomCrop,
+- title->leftCrop, title->rightCrop );
++ title->leftCrop, title->rightCrop,
++ 0,0,0,0 );
+
+ return w;
+ }
diff --git a/multimedia/handbrake/files/patch-core_Thread.c b/multimedia/handbrake/files/patch-core_Thread.c
new file mode 100644
index 000000000000..b47124180e5d
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_Thread.c
@@ -0,0 +1,66 @@
+diff -urN core/Thread.c core/Thread.c
+--- core/Thread.c Wed May 26 05:51:32 2004
++++ core/Thread.c Fri Nov 19 08:08:07 2004
+@@ -24,7 +24,7 @@
+ /* OS-specific thread id */
+ #if defined( HB_BEOS )
+ int thread;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_t thread;
+ #elif defined( HB_CYGWIN )
+ HANDLE thread;
+@@ -74,7 +74,7 @@
+ t->thread = spawn_thread( (int32 (*)( void * )) ThreadFunc,
+ name, priority, t );
+ resume_thread( t->thread );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_create( &t->thread, NULL,
+ (void * (*)( void * )) ThreadFunc, t );
+ #elif defined( HB_CYGWIN )
+@@ -96,7 +96,7 @@
+ #if defined( HB_BEOS )
+ long exitValue;
+ wait_for_thread( t->thread, &exitValue );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_join( t->thread, NULL );
+ #elif defined( HB_CYGWIN )
+ WaitForSingleObject( t->thread, INFINITE );
+@@ -126,7 +126,7 @@
+
+ #if defined( HB_BEOS )
+ l->sem = create_sem( 1, "sem" );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_init( &l->mutex, NULL );
+ #elif defined( HB_CYGWIN )
+ l->mutex = CreateMutex( 0, FALSE, 0 );
+@@ -141,7 +141,7 @@
+
+ #if defined( HB_BEOS )
+ delete_sem( l->sem );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_destroy( &l->mutex );
+ #elif defined( HB_CYGWIN )
+ CloseHandle( l->mutex );
+@@ -161,7 +161,7 @@
+
+ #if defined( HB_BEOS )
+ c->thread = -1;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_init( &c->cond, NULL );
+ #elif defined( HB_CYGWIN )
+ c->event = CreateEvent( NULL, FALSE, FALSE, NULL );
+@@ -175,7 +175,7 @@
+ HBCond * c = *_c;
+
+ #if defined( HB_BEOS )
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_destroy( &c->cond );
+ #elif defined( HB_CYGWIN )
+ CloseHandle( c->event );
diff --git a/multimedia/handbrake/files/patch-core_Thread.h b/multimedia/handbrake/files/patch-core_Thread.h
new file mode 100644
index 000000000000..59171d047127
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_Thread.h
@@ -0,0 +1,75 @@
+diff -urN core/Thread.h core/Thread.h
+--- core/Thread.h Wed May 26 05:51:32 2004
++++ core/Thread.h Fri Nov 19 08:08:07 2004
+@@ -10,7 +10,7 @@
+ /* System headers */
+ #if defined( HB_BEOS )
+ # include <OS.h>
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ # include <pthread.h>
+ #elif defined( HB_CYGWIN )
+ # include <windows.h>
+@@ -25,7 +25,7 @@
+ #elif defined( HB_MACOSX )
+ # define HB_LOW_PRIORITY 0
+ # define HB_NORMAL_PRIORITY 31
+-#elif defined( HB_LINUX ) || defined( HB_CYGWIN )
++#elif defined( HB_LINUX ) || defined( HB_CYGWIN ) || defined( HB_FREEBSD )
+ /* Actually unused */
+ # define HB_LOW_PRIORITY 0
+ # define HB_NORMAL_PRIORITY 0
+@@ -57,7 +57,7 @@
+ {
+ #if defined( HB_BEOS )
+ sem_id sem;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_t mutex;
+ #elif defined( HB_CYGWIN )
+ HANDLE mutex;
+@@ -68,7 +68,7 @@
+ {
+ #if defined( HB_BEOS )
+ acquire_sem( l->sem );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_lock( &l->mutex );
+ #elif defined( HB_CYGWIN )
+ WaitForSingleObject( l->mutex, INFINITE );
+@@ -79,7 +79,7 @@
+ {
+ #if defined( HB_BEOS )
+ release_sem( l->sem );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_mutex_unlock( &l->mutex );
+ #elif defined( HB_CYGWIN )
+ ReleaseMutex( l->mutex );
+@@ -94,7 +94,7 @@
+ {
+ #if defined( HB_BEOS )
+ int thread;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_t cond;
+ #elif defined( HB_CYGWIN )
+ HANDLE event;
+@@ -110,7 +110,7 @@
+ suspend_thread( c->thread );
+ acquire_sem( lock->sem );
+ c->thread = -1;
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_wait( &c->cond, &lock->mutex );
+ #elif defined( HB_CYGWIN )
+ SignalObjectAndWait( lock->mutex, c->event, INFINITE, FALSE );
+@@ -134,7 +134,7 @@
+ release_sem() and suspend_thread() lines, wait a bit */
+ snooze( 5000 );
+ }
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ pthread_cond_signal( &c->cond );
+ #elif defined( HB_CYGWIN )
+ PulseEvent( c->event );
diff --git a/multimedia/handbrake/files/patch-core_Utils.c b/multimedia/handbrake/files/patch-core_Utils.c
new file mode 100644
index 000000000000..17600fd81cc9
--- /dev/null
+++ b/multimedia/handbrake/files/patch-core_Utils.c
@@ -0,0 +1,12 @@
+diff -urN core/Utils.c core/Utils.c
+--- core/Utils.c Wed May 26 05:51:32 2004
++++ core/Utils.c Fri Nov 19 08:08:07 2004
+@@ -38,7 +38,7 @@
+ {
+ #if defined( HB_BEOS )
+ snooze( time );
+-#elif defined( HB_MACOSX ) || defined( HB_LINUX )
++#elif defined( HB_MACOSX ) || defined( HB_LINUX ) || defined( HB_FREEBSD )
+ usleep( time );
+ #elif defined( HB_CYGWIN )
+ Sleep( time / 1000 );
diff --git a/multimedia/handbrake/files/patch-gtk2_main.c b/multimedia/handbrake/files/patch-gtk2_main.c
new file mode 100644
index 000000000000..e093de43990f
--- /dev/null
+++ b/multimedia/handbrake/files/patch-gtk2_main.c
@@ -0,0 +1,10 @@
+--- gtk2/main.c.orig Sat Nov 20 19:20:18 2004
++++ gtk2/main.c Sat Nov 20 19:21:02 2004
+@@ -85,6 +85,7 @@
+
+ /* build dvd list */
+ items = g_list_append (items, "" );
++ items = g_list_append (items, "/dev/%%DVD_DEVICE%%" );
+ items = g_list_append (items, "/dev/dvd" );
+ gtk_combo_set_popdown_strings( GTK_COMBO(lookup_widget( hb_win_main, "combo1") ), items );
+
diff --git a/multimedia/handbrake/pkg-descr b/multimedia/handbrake/pkg-descr
new file mode 100644
index 000000000000..10fc32f61e54
--- /dev/null
+++ b/multimedia/handbrake/pkg-descr
@@ -0,0 +1,22 @@
+HandBrake is a GPL'd multi-platform, multithreaded DVD to MPEG-4
+ripper and
+converter. HandBrake was originally available on the BeOS, but now has
+been
+ported over to MacOS X, GNU/Linux and FreeBSD.
+
+Features:
+ * Can encode directly from DVDs (even encrypted ones) or from
+VIDEO_TS folders
+ * Supports AC3, LPCM and MPEG audio tracks
+ * Outputs MP4, AVI or OGM files
+ * Outputs AAC, MP3 or Vorbis audio
+ * Supports 2-pass encoding
+ * Supports encoding of two audio tracks
+ * Includes a bitrate calculator
+ * Supports picture deinterlacing, cropping and scaling
+
+Known limitations:
+ * Does not handle DTS audio tracks
+ * Does not handle single VOB files or any other file format
+
+WWW: http://handbrake.m0k.org/