--- /dev/null
+From bd59735b4f97ae9dff864debdecc2318b0cb8f94 Mon Sep 17 00:00:00 2001
+From: Dan Dennedy <dan@dennedy.org>
+Date: Mon, 12 Feb 2018 12:21:19 -0800
+Subject: [PATCH] Fix compile error with libav.
+
+---
+ src/modules/avformat/producer_avformat.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c
+index 214c8b325..7de997cc2 100644
+--- a/src/modules/avformat/producer_avformat.c
++++ b/src/modules/avformat/producer_avformat.c
+@@ -1,6 +1,6 @@
+ /*
+ * producer_avformat.c -- avformat producer
+- * Copyright (C) 2003-2017 Meltytech, LLC
++ * Copyright (C) 2003-2018 Meltytech, LLC
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+@@ -1266,7 +1266,7 @@ static int pick_av_pixel_format( int *pix_fmt )
+ return 0;
+ }
+
+-#if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT( 3, 1, 101 )
++#if defined(FFUDIV) && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT( 3, 1, 101 )
+ struct sliced_pix_fmt_conv_t
+ {
+ int width, height, slice_w;
+@@ -1461,7 +1461,7 @@ static int convert_image( producer_avformat self, AVFrame *frame, uint8_t *buffe
+ sws_freeContext( context );
+ }
+ else
+-#if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT( 3, 1, 101 )
++#if defined(FFUDIV) && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT( 3, 1, 101 )
+ {
+ int i, c;
+ struct sliced_pix_fmt_conv_t ctx =
--- /dev/null
+From 56e3affe1ff425d979ea9f2a5e086d769852c3fc Mon Sep 17 00:00:00 2001
+From: Dan Dennedy <dan@dennedy.org>
+Date: Fri, 16 Feb 2018 09:55:29 -0800
+Subject: [PATCH] Fix compile error with libav.
+
+---
+ src/modules/avformat/producer_avformat.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c
+index 7de997cc2..2fafd00e8 100644
+--- a/src/modules/avformat/producer_avformat.c
++++ b/src/modules/avformat/producer_avformat.c
+@@ -1266,7 +1266,7 @@ static int pick_av_pixel_format( int *pix_fmt )
+ return 0;
+ }
+
+-#if defined(FFUDIV) && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT( 3, 1, 101 )
++#if defined(FFUDIV) && (LIBSWSCALE_VERSION_INT >= ((3<<16)+(1<<8)+101))
+ struct sliced_pix_fmt_conv_t
+ {
+ int width, height, slice_w;
+@@ -1461,7 +1461,7 @@ static int convert_image( producer_avformat self, AVFrame *frame, uint8_t *buffe
+ sws_freeContext( context );
+ }
+ else
+-#if defined(FFUDIV) && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT( 3, 1, 101 )
++#if defined(FFUDIV) && (LIBSWSCALE_VERSION_INT >= ((3<<16)+(1<<8)+101))
+ {
+ int i, c;
+ struct sliced_pix_fmt_conv_t ctx =
--- /dev/null
+From 53181a4e4629e2cd22c6f5d16a459aa843f4bd65 Mon Sep 17 00:00:00 2001
+From: Dan Dennedy <dan@dennedy.org>
+Date: Fri, 23 Feb 2018 10:04:47 -0800
+Subject: [PATCH] Fix compile error with libav.
+
+---
+ src/modules/avformat/consumer_avformat.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c
+index 6deb76df5..ba5c900c7 100644
+--- a/src/modules/avformat/consumer_avformat.c
++++ b/src/modules/avformat/consumer_avformat.c
+@@ -1647,7 +1647,9 @@ static void *consumer_thread( void *arg )
+ enc_ctx->audio_avframe->format = c->sample_fmt;
+ enc_ctx->audio_avframe->nb_samples = enc_ctx->audio_input_frame_size;
+ enc_ctx->audio_avframe->channel_layout = c->channel_layout;
++#if LIBAVCODEC_VERSION_INT >= ((57<<16)+(96<<8)) && LIBAVCODEC_VERSION_MICRO >= 100
+ enc_ctx->audio_avframe->channels = c->channels;
++#endif
+ } else {
+ mlt_log_error( MLT_CONSUMER_SERVICE(consumer), "failed to allocate audio AVFrame\n" );
+ mlt_events_fire( properties, "consumer-fatal-error", NULL );
DOCS=( AUTHORS ChangeLog NEWS README docs/{framework,melt,mlt{++,-xml}}.txt )
-PATCHES=( "${FILESDIR}"/${P}-vorbis-ffmpeg-3.4.patch )
+PATCHES=(
+ "${FILESDIR}"/${P}-vorbis-ffmpeg-3.4.patch
+ "${FILESDIR}"/${P}-libav-{1,2,3}.patch
+)
pkg_setup() {
use python && python-single-r1_pkg_setup