summaryrefslogtreecommitdiff
path: root/multimedia/ffmpeg/patches
diff options
context:
space:
mode:
authorjoerg <joerg>2008-09-11 12:08:41 +0000
committerjoerg <joerg>2008-09-11 12:08:41 +0000
commit40fda9e37ad0b16ccfb74b7282667df8d064c0e9 (patch)
treeccb0419c2e4914a06c28c006f5dd33eb9e236d23 /multimedia/ffmpeg/patches
parent59663b0e1d7cef6952b2b9e35a49336f7fdcdecc (diff)
downloadpkgsrc-40fda9e37ad0b16ccfb74b7282667df8d064c0e9.tar.gz
Provide code pathes using posix_memalign, applies at leas to NetBSD
current.
Diffstat (limited to 'multimedia/ffmpeg/patches')
-rw-r--r--multimedia/ffmpeg/patches/patch-configure33
-rw-r--r--multimedia/ffmpeg/patches/patch-mem.c42
2 files changed, 71 insertions, 4 deletions
diff --git a/multimedia/ffmpeg/patches/patch-configure b/multimedia/ffmpeg/patches/patch-configure
index 37448b0e63f..f02506753cf 100644
--- a/multimedia/ffmpeg/patches/patch-configure
+++ b/multimedia/ffmpeg/patches/patch-configure
@@ -1,8 +1,16 @@
-$NetBSD: patch-configure,v 1.2 2008/09/08 00:16:35 ahoka Exp $
+$NetBSD: patch-configure,v 1.3 2008/09/11 12:08:41 joerg Exp $
--- configure.orig 2008-07-24 12:53:32.000000000 +0200
+++ configure
-@@ -891,7 +891,7 @@ rtp_muxer_deps="network rtp_protocol"
+@@ -763,6 +763,7 @@ HAVE_LIST="
+ memalign
+ mkstemp
+ pld
++ posix_memalign
+ ppc64
+ round
+ roundf
+@@ -891,7 +892,7 @@ rtp_muxer_deps="network rtp_protocol"
rtsp_demuxer_deps="sdp_demuxer"
sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
v4l_demuxer_deps="linux_videodev_h"
@@ -11,7 +19,7 @@ $NetBSD: patch-configure,v 1.2 2008/09/08 00:16:35 ahoka Exp $
vfwcap_demuxer_deps="capCreateCaptureWindow"
vfwcap_demuxer_extralibs="-lvfw32"
x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
-@@ -1586,10 +1586,14 @@ enabled vis && add_cflags "-mcpu=ultrasp
+@@ -1586,10 +1587,14 @@ enabled vis && add_cflags "-mcpu=ultrasp
# ---
# big/little-endian test
@@ -29,7 +37,24 @@ $NetBSD: patch-configure,v 1.2 2008/09/08 00:16:35 ahoka Exp $
# ---
# check availability of some header files
-@@ -1789,6 +1793,7 @@ EOF
+@@ -1605,6 +1610,7 @@ check_func gethrtime
+ check_func getrusage
+ check_func inet_aton $network_extralibs
+ check_func memalign
++check_func posix_memalign
+ check_func mkstemp
+ check_func2 windows.h GetProcessTimes
+
+@@ -1616,7 +1622,7 @@ check_header sys/mman.h
+ check_header sys/resource.h
+ check_header termios.h
+
+-if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
++if ! enabled_any memalign memalign_hack posix_memalign && enabled need_memalign ; then
+ die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
+ fi
+
+@@ -1789,6 +1795,7 @@ EOF
check_header linux/videodev.h
check_header linux/videodev2.h
diff --git a/multimedia/ffmpeg/patches/patch-mem.c b/multimedia/ffmpeg/patches/patch-mem.c
new file mode 100644
index 00000000000..22453a655c5
--- /dev/null
+++ b/multimedia/ffmpeg/patches/patch-mem.c
@@ -0,0 +1,42 @@
+$NetBSD: patch-mem.c,v 1.1 2008/09/11 12:08:41 joerg Exp $
+
+--- libavutil/mem.c.orig 2008-05-23 14:37:52.000000000 +0200
++++ libavutil/mem.c
+@@ -85,6 +85,9 @@ void *av_malloc(unsigned int size)
+
+ btw, malloc seems to do 8 byte alignment by default here
+ */
++#elif defined (HAVE_MEMALIGN)
++ if (posix_memalign(&ptr, 16, size))
++ return NULL;
+ #else
+ ptr = malloc(size);
+ #endif
+@@ -95,6 +98,8 @@ void *av_realloc(void *ptr, unsigned int
+ {
+ #ifdef CONFIG_MEMALIGN_HACK
+ int diff;
++#elif defined (HAVE_MEMALIGN)
++ void *new_ptr;
+ #endif
+
+ /* let's disallow possible ambiguous cases */
+@@ -106,6 +111,18 @@ void *av_realloc(void *ptr, unsigned int
+ if(!ptr) return av_malloc(size);
+ diff= ((char*)ptr)[-1];
+ return (char*)realloc((char*)ptr - diff, size + diff) + diff;
++#elif defined (HAVE_MEMALIGN)
++ new_ptr = realloc(ptr, size);
++ if (((size_t)new_ptr & 15) == 0)
++ return new_ptr;
++
++ if (posix_memalign(&ptr, 16, size)) {
++ free(new_ptr);
++ return NULL;
++ }
++ memcpy(ptr, new_ptr, size);
++ free(new_ptr);
++ return ptr;
+ #else
+ return realloc(ptr, size);
+ #endif