Bug 74754 - [maintainer-update] free() fix for multimedia/handbrake
Summary: [maintainer-update] free() fix for multimedia/handbrake
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Michael Johnson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-06 02:40 UTC by Andrew Thompson
Modified: 2004-12-19 02:00 UTC (History)
0 users

See Also:


Attachments
file.diff (2.60 KB, patch)
2004-12-06 02:40 UTC, Andrew Thompson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Thompson 2004-12-06 02:40:21 UTC
1. libavcodec will modify the pointer from avcodec_alloc_frame() to align the 
memory. handbrake will free this pointer without taking this into account and 
cause "modified (chunk-) pointer" warnings. Use av_free() to fix this.

2. Depend on mpeg4ip-libmp4v2 now that the headers are fixed.

3. Link to gnugetopt on 4.x to fix the build. I have had 4.x users email me 
and this *is* required (i've submitted this before). The build uses jam so the 
USE_GETOPT_LONG magic doesnt apply.
Comment 1 Michael Johnson freebsd_committer freebsd_triage 2004-12-06 03:12:19 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ahze

Grab
Comment 2 Michael Johnson freebsd_committer freebsd_triage 2004-12-06 03:13:33 UTC
Hey,
	ffmpeg has been updated to 0.4.9.p1 in ports today, could you test 
handbrake with that version so we don't have to use that snapshot and 
statically link to libavcodec ?

Micahael
Comment 3 Andrew Thompson 2004-12-18 23:05:23 UTC
On Sun, Dec 05, 2004 at 10:13:33PM -0500, mike johnson wrote:
> Hey,
> 	ffmpeg has been updated to 0.4.9.p1 in ports today, could you test 
> handbrake with that version so we don't have to use that snapshot and 
> statically link to libavcodec ?
> 
> Micahael

ffmpeg in ports works fine now. Updated patch attached, also @
http://www.fud.org.nz/~andy/handbrake.diff

cheers,

Andrew



diff -burN multimedia/handbrake.orig/Makefile multimedia/handbrake/Makefile
--- multimedia/handbrake.orig/Makefile	Sun Dec 19 10:51:34 2004
+++ multimedia/handbrake/Makefile	Sun Dec 19 11:50:49 2004
@@ -7,12 +7,10 @@
 
 PORTNAME=	handbrake
 PORTVERSION=	0.6.2
+PORTREVISION=	1
 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}
+MASTER_SITES=	http://people.via.ecp.fr/~titer/handbrake/
+DISTNAME=	HandBrake-${PORTVERSION}-src
 
 MAINTAINER=	andy@fud.org.nz
 COMMENT=	A DVD to MPEG-4 ripper and encoder
@@ -20,20 +18,18 @@
 BUILD_DEPENDS=	jam:${PORTSDIR}/devel/jam \
 		nasm:${PORTSDIR}/devel/nasm
 LIB_DEPENDS=	a52.0:${PORTSDIR}/audio/liba52 \
+		avcodec.1:${PORTSDIR}/multimedia/ffmpeg \
 		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 \
+		mp4v2.0:${PORTSDIR}/multimedia/mpeg4ip-libmp4v2 \
 		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}
 
@@ -43,35 +39,16 @@
 
 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-a52 \
-			--enable-xvid
-
 .include <bsd.port.pre.mk>
 
 .if ${OSVERSION} < 500000
 USE_GETOPT_LONG=	yes
-MAKE_ENV=		EXTRA_LIBS="-lcipher"
+MAKE_ENV=		EXTRA_LIBS="-lcipher -lgnugetopt"
 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)
 
@@ -91,23 +68,5 @@
 # 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}|' \
-		-e 's|-Wall||' \
-		${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 -burN multimedia/handbrake.orig/files/ffmpeg-patch multimedia/handbrake/files/ffmpeg-patch
--- multimedia/handbrake.orig/files/ffmpeg-patch	Sun Dec 19 10:51:34 2004
+++ multimedia/handbrake/files/ffmpeg-patch	Thu Jan  1 12:00:00 1970
@@ -1,56 +0,0 @@
---- 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 -burN multimedia/handbrake.orig/files/patch-Jamfile multimedia/handbrake/files/patch-Jamfile
--- multimedia/handbrake.orig/files/patch-Jamfile	Sun Dec 19 10:51:34 2004
+++ multimedia/handbrake/files/patch-Jamfile	Sun Dec 19 11:15:08 2004
@@ -1,20 +1,21 @@
 --- Jamfile.orig	Wed May 26 05:51:32 2004
-+++ Jamfile	Mon Nov 22 20:29:09 2004
-@@ -54,6 +54,20 @@
++++ Jamfile	Sun Dec 19 11:14:57 2004
+@@ -54,6 +54,21 @@
      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
++    SystemLibraries $(TEST_BIN) : -L%%PREFIX%%/lib %%PTHREAD_LIBS%% -la52
++    		-lavcodec -ldvdcss -ldvdread -lfaac -lmp3lame -lmp4v2 -lmpeg2
++		-logg -lsamplerate -lvorbis -lvorbisenc -lxvidcore
++		$(EXTRA_LIBS) ;
++    SystemLibraries $(GTK2_BIN) : -L%%PREFIX%%/lib %%PTHREAD_LIBS%% 
++    		$(EXTRA_LIBS) `pkg-config gtk+-2.0 --libs` -la52 -lavcodec
 +    		-ldvdcss -ldvdread -lfaac -lmp3lame -lmp4v2 -lmpeg2 -logg
-+		-lsamplerate -lvorbis -lvorbisenc -lxvidcore $(EXTRA_LIBS) ;
-+    SystemLibraries $(GTK2_BIN) : %%LIBAVCODEC%%/libavcodec.a
-+    		-L%%PREFIX%%/lib %%PTHREAD_LIBS%% $(EXTRA_LIBS) `pkg-config gtk+-2.0 --libs`
-+    		-la52 -ldvdcss -ldvdread -lfaac -lmp3lame -lmp4v2
-+		-lmpeg2 -logg -lsamplerate -lvorbis -lvorbisenc -lxvidcore ;
++		-lsamplerate -lvorbis -lvorbisenc -lxvidcore ;
++    ObjectCcFlags   $(TEST_SRC) : -I%%PREFIX%%/include ;
 +    ObjectCcFlags   $(GTK2_SRC) : `pkg-config gtk+-2.0 --cflags` ;
 +    Main            $(GTK2_BIN) : $(GTK2_SRC) ;
 +}
diff -burN multimedia/handbrake.orig/files/patch-core_FfmpegEnc.c multimedia/handbrake/files/patch-core_FfmpegEnc.c
--- multimedia/handbrake.orig/files/patch-core_FfmpegEnc.c	Sun Dec 19 10:51:34 2004
+++ multimedia/handbrake/files/patch-core_FfmpegEnc.c	Sun Dec 19 11:17:21 2004
@@ -1,11 +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"
+--- core/FfmpegEnc.c.orig	Sun Dec 19 11:16:49 2004
++++ core/FfmpegEnc.c	Sun Dec 19 11:16:58 2004
+@@ -132,7 +132,7 @@
+     }
 
- /* libavcodec */
--#include "ffmpeg/avcodec.h"
-+#include "avcodec.h"
+     HBBufferClose( &scaledBuffer );
+-    free( frame );
++    av_free( frame );
 
- struct HBWork
- {
+     return 1;
+ }
diff -burN multimedia/handbrake.orig/files/patch-core_HandBrake.c multimedia/handbrake/files/patch-core_HandBrake.c
--- multimedia/handbrake.orig/files/patch-core_HandBrake.c	Sun Dec 19 10:51:34 2004
+++ multimedia/handbrake/files/patch-core_HandBrake.c	Sun Dec 19 11:03:59 2004
@@ -1,14 +1,5 @@
 --- 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 * );
++++ core/HandBrake.c	Sun Dec 19 11:02:32 2004
 @@ -277,7 +277,8 @@
          img_resample_full_init( t->outWidth, t->outHeight,
                                  t->inWidth, t->inHeight,
diff -burN multimedia/handbrake.orig/files/patch-core_MpgaDec.c multimedia/handbrake/files/patch-core_MpgaDec.c
--- multimedia/handbrake.orig/files/patch-core_MpgaDec.c	Sun Dec 19 10:51:34 2004
+++ multimedia/handbrake/files/patch-core_MpgaDec.c	Sun Dec 19 11:04:31 2004
@@ -1,11 +0,0 @@
---- 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 -burN multimedia/handbrake.orig/files/patch-core_Scale.c multimedia/handbrake/files/patch-core_Scale.c
--- multimedia/handbrake.orig/files/patch-core_Scale.c	Sun Dec 19 10:51:34 2004
+++ multimedia/handbrake/files/patch-core_Scale.c	Sun Dec 19 11:04:52 2004
@@ -1,14 +1,5 @@
---- 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
- {
+--- core/Scale.c.orig	Wed May 26 05:51:32 2004
++++ core/Scale.c	Sun Dec 19 11:02:44 2004
 @@ -52,7 +52,8 @@
          img_resample_full_init( title->outWidth, title->outHeight,
                                  title->inWidth,  title->inHeight,
Comment 4 Michael Johnson freebsd_committer freebsd_triage 2004-12-19 01:59:53 UTC
State Changed
From-To: open->closed

Committed, Thanks!