summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/mpv/0001-video-filter-fix-PIC-compile-on-x86.patch77
-rw-r--r--main/mpv/APKBUILD55
-rw-r--r--main/mpv/no-ebp.patch15
3 files changed, 147 insertions, 0 deletions
diff --git a/main/mpv/0001-video-filter-fix-PIC-compile-on-x86.patch b/main/mpv/0001-video-filter-fix-PIC-compile-on-x86.patch
new file mode 100644
index 000000000..8a00bdd9d
--- /dev/null
+++ b/main/mpv/0001-video-filter-fix-PIC-compile-on-x86.patch
@@ -0,0 +1,77 @@
+From b7b7649fe791fc460ba973463f37a368191c5c87 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 26 Nov 2013 08:46:53 +0000
+Subject: [PATCH] video/filter: fix PIC compile on x86
+
+When using PIC on x86 (eg with hardened toolchains) the ebx register is
+reserverd and cannot be used in assembly code.
+
+For vf_eq we allow the compiler to use memory as input.
+
+For vf_noise we temoporarily borrow the ebp register.
+
+This fixes #361.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ video/filter/vf_eq.c | 3 ++-
+ video/filter/vf_noise.c | 9 +++++++--
+ 2 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/video/filter/vf_eq.c b/video/filter/vf_eq.c
+index 1bca39b..3cba73b 100644
+--- a/video/filter/vf_eq.c
++++ b/video/filter/vf_eq.c
+@@ -133,6 +133,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src,
+ int pel;
+ short brvec[4];
+ short contvec[4];
++ unsigned wcount = w >> 3;
+
+ // printf("\nmmx: src=%p dst=%p w=%d h=%d ds=%d ss=%d\n",src,dst,w,h,dstride,sstride);
+
+@@ -170,7 +171,7 @@ void affine_1d_MMX (eq2_param_t *par, unsigned char *dst, unsigned char *src,
+ "decl %%eax \n\t"
+ "jnz 1b \n\t"
+ : "=r" (src), "=r" (dst)
+- : "0" (src), "1" (dst), "r" (w >> 3), "r" (brvec), "r" (contvec)
++ : "0" (src), "1" (dst), "g" (wcount), "r" (brvec), "r" (contvec)
+ : "%eax"
+ );
+
+diff --git a/video/filter/vf_noise.c b/video/filter/vf_noise.c
+index c81a1d1..5e7bf75 100644
+--- a/video/filter/vf_noise.c
++++ b/video/filter/vf_noise.c
+@@ -216,13 +216,16 @@ static inline void lineNoise_C(uint8_t *dst, uint8_t *src, int8_t *noise, int le
+ #if HAVE_MMX
+ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t **shift){
+ x86_reg mmx_len= len&(~7);
++ uint8_t *src_mmx_len = src+mmx_len;
+
+ __asm__ volatile(
++ "push %%"REG_BP" \n\t"
++ "mov %0, %%"REG_BP" \n\t"
+ "mov %5, %%"REG_a" \n\t"
+ ".align 4 \n\t"
+ "1: \n\t"
+ "movq (%1, %%"REG_a"), %%mm1 \n\t"
+- "movq (%0, %%"REG_a"), %%mm0 \n\t"
++ "movq (%%"REG_BP", %%"REG_a"), %%mm0 \n\t"
+ "paddb (%2, %%"REG_a"), %%mm1 \n\t"
+ "paddb (%3, %%"REG_a"), %%mm1 \n\t"
+ "movq %%mm0, %%mm2 \n\t"
+@@ -243,7 +246,9 @@ static inline void lineNoiseAvg_MMX(uint8_t *dst, uint8_t *src, int len, int8_t
+ "movq %%mm1, (%4, %%"REG_a") \n\t"
+ "add $8, %%"REG_a" \n\t"
+ " js 1b \n\t"
+- :: "r" (src+mmx_len), "r" (shift[0]+mmx_len), "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
++ "pop %%"REG_BP" \n\t"
++ :: "g" (src_mmx_len), "r" (shift[0]+mmx_len),
++ "r" (shift[1]+mmx_len), "r" (shift[2]+mmx_len),
+ "r" (dst+mmx_len), "g" (-mmx_len)
+ : "%"REG_a
+ );
+--
+1.8.4.3
+
diff --git a/main/mpv/APKBUILD b/main/mpv/APKBUILD
new file mode 100644
index 000000000..b2de381e7
--- /dev/null
+++ b/main/mpv/APKBUILD
@@ -0,0 +1,55 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=mpv
+pkgver=0.2.4
+pkgrel=1
+pkgdesc="Video player based on MPlayer/mplayer2"
+url="http://mpv.io/"
+arch="all"
+license="GPL"
+depends=
+makedepends="libxxf86dga-dev libxv-dev libmad-dev lame-dev libao-dev
+ libtheora-dev xvidcore-dev zlib-dev sdl-dev freetype-dev
+ x264-dev faac-dev ttf-dejavu libxvmc-dev alsa-lib-dev live-media-dev
+ mesa-dev ffmpeg-dev libass-dev perl lua5.2-dev libvdpau-dev"
+install=""
+subpackages=""
+source="$pkgname-$pkgver.tar.gz::https://github.com/mpv-player/mpv/archive/v$pkgver.tar.gz
+ 0001-video-filter-fix-PIC-compile-on-x86.patch
+ no-ebp.patch
+ "
+
+_builddir="$srcdir"/mpv-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr \
+ --mandir=/usr/share/man \
+ --confdir=/etc/mpv \
+ || return 1
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+}
+
+md5sums="465e99ed24478f3a2afe5ae1c4fdd7f4 mpv-0.2.4.tar.gz
+dbb4ec33ed594468ab75c96cee37c56d 0001-video-filter-fix-PIC-compile-on-x86.patch
+438d24181e0b58e94cbe380909432b3d no-ebp.patch"
+sha256sums="34a12a82b25bf3337d44c26dd8fa750746032c1a8806b85f6b8db652710827bf mpv-0.2.4.tar.gz
+033abba4e17132497f325d89e704a439843380978f0001644cabc14229256323 0001-video-filter-fix-PIC-compile-on-x86.patch
+d6ff4eabd3e9b598d4a236028690e0e30719d722a41371f1b42cbb35faa64e94 no-ebp.patch"
+sha512sums="72214d02fc459b1789831e54de2841ff0a8d83c97f1ba76b18d31e970372571569b45a036fe7e7e67d6fa9460f73216cc0f1e1e6149cb24a99c490d5cdfb5ec1 mpv-0.2.4.tar.gz
+bd83dcada498d7ec210750f2675e844fe33858b99893b5a972883458395c386947b4427fa64f9c3d30b31a6e5c18411131fec0fc8f5d674baace4e53368a99e1 0001-video-filter-fix-PIC-compile-on-x86.patch
+acbf0d8fb9f8d693022bc2a9130116b7aae2b0b24b0a16f6ab6602dd00965bd8a55385c25ea8fb9b15e22145a94e518d48fbf26238129635fc53348d806566ef no-ebp.patch"
diff --git a/main/mpv/no-ebp.patch b/main/mpv/no-ebp.patch
new file mode 100644
index 000000000..82bb19d73
--- /dev/null
+++ b/main/mpv/no-ebp.patch
@@ -0,0 +1,15 @@
+gcc-4.8.2 does not allow use of ebp in asm
+
+diff --git a/configure b/configure
+index 2c41e05..3907655 100755
+--- a/configure
++++ b/configure
+@@ -3525,7 +3525,7 @@ $def_pthreads
+ #define HAVE_INLINE_ASM 1
+
+ /* Use these registers in x86 inline asm. No proper detection yet. */
+-#define HAVE_EBP_AVAILABLE 1
++#define HAVE_EBP_AVAILABLE 0
+
+ #endif /* MPLAYER_CONFIG_H */
+ EOF