Mail archive
alpine-aports

[alpine-aports] [PATCH 07/15] testing/motion: patch for ffmpeg 4

From: Drew DeVault <sir_at_cmpwn.com>
Date: Mon, 29 Oct 2018 20:11:29 -0400

---
 testing/motion/APKBUILD      |  5 ++++-
 testing/motion/ffmpeg4.patch | 43 ++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 testing/motion/ffmpeg4.patch
diff --git a/testing/motion/APKBUILD b/testing/motion/APKBUILD
index ec74858b84..ca7f8eca6a 100644
--- a/testing/motion/APKBUILD
+++ b/testing/motion/APKBUILD
_at_@ -17,10 +17,12 @@ depends_dev=""
 makedepends="$depends_dev autoconf automake bash jpeg-dev v4l-utils-dev linux-headers ffmpeg-dev"
 install="$pkgname.pre-install"
 subpackages="$pkgname-doc"
+# ffmpeg4.patch courtesy of Arch Linux
 source="$pkgname-$pkgver.tar.gz::https://github.com/Motion-Project/$pkgname/archive/release-$pkgver.tar.gz
 	motion.confd
 	motion.initd
 	motion-dist.conf.in.patch
+	ffmpeg4.patch
 	"
 
 builddir="$srcdir"/$pkgname-release-$pkgver
_at_@ -55,4 +57,5 @@ package() {
 sha512sums="3b08d464f9243ccfc4b53b16cfc2001d1e0d206bf0295d55d8914914bc14ad0248ce5ac622cb7eb89ed32e1913a9a10add1b56497c4094ba876f7f85d6ad4143  motion-4.1.1.tar.gz
 8a67b5b0360924e58ba3136a737ce73bb43201a49b2b6e2c632426561b830f6ab55cbbeaa89be7f1683aa8fd322b4f31b9f560e67a93eaceb964c9f56ceef363  motion.confd
 be30f19595dba27f2d0ca8133c93e134161781935a152bd1701e581410039e37742acd11987c38e6e64f495b1fd2b0a74a8c61ae0e6e211a475fca7994172501  motion.initd
-c27d7ded3ed7a56101791bca86eb083450f5b8a1f431b3f7ee8538f682ac5f5d4b50104d9d61f40be964f1f1975a114313ba3d30d7357035dc25ebe925db6a89  motion-dist.conf.in.patch"
+c27d7ded3ed7a56101791bca86eb083450f5b8a1f431b3f7ee8538f682ac5f5d4b50104d9d61f40be964f1f1975a114313ba3d30d7357035dc25ebe925db6a89  motion-dist.conf.in.patch
+808a43fe51dd2d9436320fa3ba3ac3b3f87c829b276f175b52c77313acaa647dda43cd2acc0f9c6a3106ca0dec568ee12c6db7ad89cc49f501e34cd223bfb65e  ffmpeg4.patch"
diff --git a/testing/motion/ffmpeg4.patch b/testing/motion/ffmpeg4.patch
new file mode 100644
index 0000000000..3ac4c7967b
--- /dev/null
+++ b/testing/motion/ffmpeg4.patch
_at_@ -0,0 +1,43 @@
+diff --git a/ffmpeg.c b/ffmpeg.c
+index 1e6cdf6..4299ba3 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+_at_@ -67,6 +67,19 @@
+ 
+ #endif
+ 
++/*********************************************/
++#if (LIBAVCODEC_VERSION_MAJOR >= 57)
++
++#define MY_CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
++#define MY_CODEC_FLAG_QSCALE        AV_CODEC_FLAG_QSCALE
++
++#else
++
++#define MY_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER
++#define MY_CODEC_FLAG_QSCALE        CODEC_FLAG_QSCALE
++
++#endif
++
+ /*********************************************/
+ AVFrame *my_frame_alloc(void){
+     AVFrame *pic;
+_at_@ -548,7 +561,7 @@ static int ffmpeg_set_quality(struct ffmpeg *ffmpeg){
+         /* The selection of 8000 is a subjective number based upon viewing output files */
+         if (ffmpeg->vbr > 0){
+             ffmpeg->vbr =(int)(((100-ffmpeg->vbr)*(100-ffmpeg->vbr)*(100-ffmpeg->vbr) * 8000) / 1000000) + 1;
+-            ffmpeg->ctx_codec->flags |= CODEC_FLAG_QSCALE;
++            ffmpeg->ctx_codec->flags |= MY_CODEC_FLAG_QSCALE;
+             ffmpeg->ctx_codec->global_quality=ffmpeg->vbr;
+         }
+     }
+_at_@ -673,7 +686,7 @@ static int ffmpeg_set_codec(struct ffmpeg *ffmpeg){
+       ffmpeg->ctx_codec->strict_std_compliance = -2;
+       ffmpeg->ctx_codec->level = 3;
+     }
+-    ffmpeg->ctx_codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
++    ffmpeg->ctx_codec->flags |= MY_CODEC_FLAG_GLOBAL_HEADER;
+ 
+     retcd = ffmpeg_set_quality(ffmpeg);
+     if (retcd < 0){
+
-- 
2.18.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon Oct 29 2018 - 20:11:29 UTC