Yocto 2.4

Move OpenBMC to Yocto 2.4(rocko)

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I12057b18610d6fb0e6903c60213690301e9b0c67
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-parser-needs-limits.h.patch b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-parser-needs-limits.h.patch
deleted file mode 100644
index 4edaf4d..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-parser-needs-limits.h.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 005ac9d2fa000912c8fb8257020a0471b1c6176c Mon Sep 17 00:00:00 2001
-From: Gustavo Zacarias <gustavo@zacarias.com.ar>
-Date: Wed, 21 Dec 2016 19:46:34 -0300
-Subject: [PATCH] ucm: parser needs limits.h
-
-It's using PATH_MAX which is defined there, otherwise the build fails on
-musl libc.
-
-Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-
-Upstream-Status: Accepted [expected in 1.1.4]
-
-Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
----
- src/ucm/parser.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/ucm/parser.c b/src/ucm/parser.c
-index c98373a9..f520abc5 100644
---- a/src/ucm/parser.c
-+++ b/src/ucm/parser.c
-@@ -32,6 +32,7 @@
- 
- #include "ucm_local.h"
- #include <dirent.h>
-+#include <limits.h>
- 
- /** The name of the environment variable containing the UCM directory */
- #define ALSA_CONFIG_UCM_VAR "ALSA_CONFIG_UCM"
--- 
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib_1.1.3.bb b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib_1.1.4.1.bb
similarity index 83%
rename from import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib_1.1.3.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib_1.1.4.1.bb
index 191a036..acdeae1 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib_1.1.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-lib_1.1.4.1.bb
@@ -11,10 +11,9 @@
 SRC_URI = "ftp://ftp.alsa-project.org/pub/lib/${BP}.tar.bz2 \
            file://Check-if-wordexp-function-is-supported.patch \
            file://avoid-including-sys-poll.h-directly.patch \
-           file://0001-ucm-parser-needs-limits.h.patch \
 "
-SRC_URI[md5sum] = "eefe5992567ba00d6110a540657aaf5c"
-SRC_URI[sha256sum] = "71282502184c592c1a008e256c22ed0ba5728ca65e05273ceb480c70f515969c"
+SRC_URI[md5sum] = "29fa3e69122d3cf3e8f0e01a0cb1d183"
+SRC_URI[sha256sum] = "91bb870c14d1c7c269213285eeed874fa3d28112077db061a3af8010d0885b76"
 
 inherit autotools pkgconfig
 
@@ -23,8 +22,6 @@
 
 EXTRA_OECONF += "--disable-python"
 
-EXTRA_OECONF_append_libc-uclibc = " --with-versioned=no "
-
 PACKAGES =+ "alsa-server libasound alsa-conf alsa-doc"
 FILES_libasound = "${libdir}/libasound.so.*"
 FILES_alsa-server = "${bindir}/*"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-plugins_1.1.1.bb b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-plugins_1.1.4.bb
similarity index 96%
rename from import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-plugins_1.1.1.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-plugins_1.1.4.bb
index 16686a0..b7f79b7 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-plugins_1.1.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-plugins_1.1.4.bb
@@ -21,8 +21,8 @@
 "
 
 SRC_URI = "ftp://ftp.alsa-project.org/pub/plugins/${BP}.tar.bz2"
-SRC_URI[md5sum] = "69f9f3e2de3c97fc71d496e91e271fe5"
-SRC_URI[sha256sum] = "8ea4d1e082c36528a896a2581e5eb62d4dc2683238e353050d0d624e65f901f1"
+SRC_URI[md5sum] = "de51130a7444b79b2dd3c25e28420754"
+SRC_URI[sha256sum] = "530d1c3bdaeb058f2a03607a33b9e16ee5369bfd30a96bc09bd2c69b4ddd1a8a"
 
 DEPENDS += "alsa-lib"
 
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils-scripts_1.1.3.bb b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils-scripts_1.1.4.bb
similarity index 100%
rename from import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils-scripts_1.1.3.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils-scripts_1.1.4.bb
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils_1.1.3.bb b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils_1.1.4.bb
similarity index 92%
rename from import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils_1.1.3.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils_1.1.4.bb
index f374a17..c8f4b86 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils_1.1.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/alsa/alsa-utils_1.1.4.bb
@@ -23,8 +23,8 @@
            file://0001-alsactl-don-t-let-systemd-unit-restore-the-volume-wh.patch \
           "
 
-SRC_URI[md5sum] = "2bf94d3e3410dcc74bb0dae10d46a979"
-SRC_URI[sha256sum] = "127217a54eea0f9a49700a2f239a2d4f5384aa094d68df04a8eb80132eb6167c"
+SRC_URI[md5sum] = "01e3934ca5bd22a80c27289d1b0adcdc"
+SRC_URI[sha256sum] = "a7831044de92c5bf33bf3365a3f36e49397f4191e934df460ae1ca15138c9d9d"
 
 # On build machines with python-docutils (not python3-docutils !!) installed
 # rst2man (not rst2man.py) is detected and compile fails with
@@ -32,12 +32,6 @@
 # Avoid this by disabling expicitly
 EXTRA_OECONF = "--disable-rst2man"
 
-# lazy hack. needs proper fixing in gettext.m4, see
-# http://bugs.openembedded.org/show_bug.cgi?id=2348
-# please close bug and remove this comment when properly fixed
-#
-EXTRA_OECONF_append_libc-uclibc = " --disable-nls"
-
 inherit autotools gettext pkgconfig manpages
 
 # This are all packages that we need to make. Also, the now empty alsa-utils
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-build-fix-for-mips.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-build-fix-for-mips.patch
new file mode 100644
index 0000000..3f8224a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/0001-build-fix-for-mips.patch
@@ -0,0 +1,44 @@
+From f34c567045bea5a7ded9bcfa8e785cfd24cc7dde Mon Sep 17 00:00:00 2001
+From: Shivraj Patil <shivraj.patil@imgtec.com>
+Date: Tue, 4 Apr 2017 18:56:01 +0530
+Subject: [PATCH] build fix for mips
+
+Signed-off-by: Shivraj Patil <shivraj.patil@imgtec.com>
+Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
+---
+Upstream-Status: Backport
+
+ libavcodec/mips/hevcpred_init_mips.c | 3 ++-
+ libavcodec/mips/hevcpred_msa.c       | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/libavcodec/mips/hevcpred_init_mips.c b/libavcodec/mips/hevcpred_init_mips.c
+index 331cfac115..e987698d66 100644
+--- a/libavcodec/mips/hevcpred_init_mips.c
++++ b/libavcodec/mips/hevcpred_init_mips.c
+@@ -18,7 +18,8 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ 
+-#include "libavcodec/hevc.h"
++#include "config.h"
++#include "libavutil/attributes.h"
+ #include "libavcodec/mips/hevcpred_mips.h"
+ 
+ #if HAVE_MSA
+diff --git a/libavcodec/mips/hevcpred_msa.c b/libavcodec/mips/hevcpred_msa.c
+index 6a3b2815fd..963c64c861 100644
+--- a/libavcodec/mips/hevcpred_msa.c
++++ b/libavcodec/mips/hevcpred_msa.c
+@@ -18,7 +18,7 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ 
+-#include "libavcodec/hevc.h"
++#include "libavcodec/hevcdec.h"
+ #include "libavutil/mips/generic_macros_msa.h"
+ #include "hevcpred_mips.h"
+ 
+-- 
+2.13.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14054.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14054.patch
new file mode 100644
index 0000000..e8baa188
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14054.patch
@@ -0,0 +1,39 @@
+From 124eb202e70678539544f6268efc98131f19fa49 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=20and=20=E5=BC=A0=E6=B4=AA=E4=BA=AE=28?=
+ =?UTF-8?q?=E6=9C=9B=E5=88=9D=29?= <tony.sh and wangchu.zhl@alibaba-inc.com>
+Date: Fri, 25 Aug 2017 01:15:28 +0200
+Subject: [PATCH] avformat/rmdec: Fix DoS due to lack of eof check
+
+Fixes: loop.ivr
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14054
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/rmdec.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
+index 178eaea..d6d7d9c 100644
+--- a/libavformat/rmdec.c
++++ b/libavformat/rmdec.c
+@@ -1223,8 +1223,11 @@ static int ivr_read_header(AVFormatContext *s)
+             av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val);
+         } else if (type == 4) {
+             av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
+-            for (j = 0; j < len; j++)
++            for (j = 0; j < len; j++) {
++                if (avio_feof(pb))
++                    return AVERROR_INVALIDDATA;
+                 av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
++            }
+             av_log(s, AV_LOG_DEBUG, "'\n");
+         } else if (len == 4 && type == 3 && !strncmp(key, "StreamCount", tlen)) {
+             nb_streams = value = avio_rb32(pb);
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14055.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14055.patch
new file mode 100644
index 0000000..37d0d1a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14055.patch
@@ -0,0 +1,34 @@
+From 4f05e2e2dc1a89f38cd9f0960a6561083d714f1e Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michael@niedermayer.cc>
+Date: Fri, 25 Aug 2017 01:15:30 +0200
+Subject: [PATCH] avformat/mvdec: Fix DoS due to lack of eof check
+
+Fixes: loop.mv
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14055
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/mvdec.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
+index 0e12c8c..f7aa4cb 100644
+--- a/libavformat/mvdec.c
++++ b/libavformat/mvdec.c
+@@ -342,6 +342,8 @@ static int mv_read_header(AVFormatContext *avctx)
+             uint32_t pos   = avio_rb32(pb);
+             uint32_t asize = avio_rb32(pb);
+             uint32_t vsize = avio_rb32(pb);
++            if (avio_feof(pb))
++                return AVERROR_INVALIDDATA;
+             avio_skip(pb, 8);
+             av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
+             av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14056.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14056.patch
new file mode 100644
index 0000000..088b357
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14056.patch
@@ -0,0 +1,51 @@
+From 96f24d1bee7fe7bac08e2b7c74db1a046c9dc0de Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=20and=20=E5=BC=A0=E6=B4=AA=E4=BA=AE=28?=
+ =?UTF-8?q?=E6=9C=9B=E5=88=9D=29?= <tony.sh and wangchu.zhl@alibaba-inc.com>
+Date: Fri, 25 Aug 2017 01:15:29 +0200
+Subject: [PATCH] avformat/rl2: Fix DoS due to lack of eof check
+
+Fixes: loop.rl2
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14056
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/rl2.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/libavformat/rl2.c b/libavformat/rl2.c
+index 0bec8f1..eb1682d 100644
+--- a/libavformat/rl2.c
++++ b/libavformat/rl2.c
+@@ -170,12 +170,21 @@ static av_cold int rl2_read_header(AVFormatContext *s)
+     }
+ 
+     /** read offset and size tables */
+-    for(i=0; i < frame_count;i++)
++    for(i=0; i < frame_count;i++) {
++        if (avio_feof(pb))
++            return AVERROR_INVALIDDATA;
+         chunk_size[i] = avio_rl32(pb);
+-    for(i=0; i < frame_count;i++)
++    }
++    for(i=0; i < frame_count;i++) {
++        if (avio_feof(pb))
++            return AVERROR_INVALIDDATA;
+         chunk_offset[i] = avio_rl32(pb);
+-    for(i=0; i < frame_count;i++)
++    }
++    for(i=0; i < frame_count;i++) {
++        if (avio_feof(pb))
++            return AVERROR_INVALIDDATA;
+         audio_size[i] = avio_rl32(pb) & 0xFFFF;
++    }
+ 
+     /** build the sample index */
+     for(i=0;i<frame_count;i++){
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14057.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14057.patch
new file mode 100644
index 0000000..b301d23
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14057.patch
@@ -0,0 +1,44 @@
+From 7f9ec5593e04827249e7aeb466da06a98a0d7329 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=20and=20=E5=BC=A0=E6=B4=AA=E4=BA=AE=28?=
+ =?UTF-8?q?=E6=9C=9B=E5=88=9D=29?= <tony.sh and wangchu.zhl@alibaba-inc.com>
+Date: Fri, 25 Aug 2017 12:37:25 +0200
+Subject: [PATCH] avformat/asfdec: Fix DoS due to lack of eof check
+
+Fixes: loop.asf
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14057
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/asfdec_f.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
+index be09a92..f3acbae 100644
+--- a/libavformat/asfdec_f.c
++++ b/libavformat/asfdec_f.c
+@@ -749,13 +749,15 @@ static int asf_read_marker(AVFormatContext *s, int64_t size)
+     count = avio_rl32(pb);    // markers count
+     avio_rl16(pb);            // reserved 2 bytes
+     name_len = avio_rl16(pb); // name length
+-    for (i = 0; i < name_len; i++)
+-        avio_r8(pb); // skip the name
++    avio_skip(pb, name_len);
+ 
+     for (i = 0; i < count; i++) {
+         int64_t pres_time;
+         int name_len;
+ 
++        if (avio_feof(pb))
++            return AVERROR_INVALIDDATA;
++
+         avio_rl64(pb);             // offset, 8 bytes
+         pres_time = avio_rl64(pb); // presentation time
+         pres_time -= asf->hdr.preroll * 10000;
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14058.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14058.patch
new file mode 100644
index 0000000..95803ce
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14058.patch
@@ -0,0 +1,94 @@
+From 7ec414892ddcad88313848494b6fc5f437c9ca4a Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michael@niedermayer.cc>
+Date: Sat, 26 Aug 2017 01:26:58 +0200
+Subject: [PATCH] avformat/hls: Fix DoS due to infinite loop
+
+Fixes: loop.m3u
+
+The default max iteration count of 1000 is arbitrary and ideas for a better solution are welcome
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+
+Previous version reviewed-by: Steven Liu <lingjiujianke@gmail.com>
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14058
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ doc/demuxers.texi | 18 ++++++++++++++++++
+ libavformat/hls.c |  7 +++++++
+ 2 files changed, 25 insertions(+)
+
+diff --git a/doc/demuxers.texi b/doc/demuxers.texi
+index 29a23d4..73dc0fe 100644
+--- a/doc/demuxers.texi
++++ b/doc/demuxers.texi
+@@ -300,6 +300,24 @@ used to end the output video at the length of the shortest input file,
+ which in this case is @file{input.mp4} as the GIF in this example loops
+ infinitely.
+ 
++@section hls
++
++HLS demuxer
++
++It accepts the following options:
++
++@table @option
++@item live_start_index
++segment index to start live streams at (negative values are from the end).
++
++@item allowed_extensions
++',' separated list of file extensions that hls is allowed to access.
++
++@item max_reload
++Maximum number of times a insufficient list is attempted to be reloaded.
++Default value is 1000.
++@end table
++
+ @section image2
+ 
+ Image file demuxer.
+diff --git a/libavformat/hls.c b/libavformat/hls.c
+index 01731bd..0995345 100644
+--- a/libavformat/hls.c
++++ b/libavformat/hls.c
+@@ -205,6 +205,7 @@ typedef struct HLSContext {
+     AVDictionary *avio_opts;
+     int strict_std_compliance;
+     char *allowed_extensions;
++    int max_reload;
+ } HLSContext;
+ 
+ static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
+@@ -1263,6 +1264,7 @@ static int read_data(void *opaque, uint8_t *buf, int buf_size)
+     HLSContext *c = v->parent->priv_data;
+     int ret, i;
+     int just_opened = 0;
++    int reload_count = 0;
+ 
+ restart:
+     if (!v->needed)
+@@ -1294,6 +1296,9 @@ restart:
+         reload_interval = default_reload_interval(v);
+ 
+ reload:
++        reload_count++;
++        if (reload_count > c->max_reload)
++            return AVERROR_EOF;
+         if (!v->finished &&
+             av_gettime_relative() - v->last_load_time >= reload_interval) {
+             if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) {
+@@ -2150,6 +2155,8 @@ static const AVOption hls_options[] = {
+         OFFSET(allowed_extensions), AV_OPT_TYPE_STRING,
+         {.str = "3gp,aac,avi,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
+         INT_MIN, INT_MAX, FLAGS},
++    {"max_reload", "Maximum number of times a insufficient list is attempted to be reloaded",
++        OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS},
+     {NULL}
+ };
+ 
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14059.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14059.patch
new file mode 100644
index 0000000..34fde0b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14059.patch
@@ -0,0 +1,40 @@
+From 7e80b63ecd259d69d383623e75b318bf2bd491f6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=20and=20=E5=BC=A0=E6=B4=AA=E4=BA=AE=28?=
+ =?UTF-8?q?=E6=9C=9B=E5=88=9D=29?= <tony.sh and wangchu.zhl@alibaba-inc.com>
+Date: Fri, 25 Aug 2017 01:15:27 +0200
+Subject: [PATCH] avformat/cinedec: Fix DoS due to lack of eof check
+
+Fixes: loop.cine
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14059
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/cinedec.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c
+index 763b93b..de34fb9 100644
+--- a/libavformat/cinedec.c
++++ b/libavformat/cinedec.c
+@@ -267,8 +267,12 @@ static int cine_read_header(AVFormatContext *avctx)
+ 
+     /* parse image offsets */
+     avio_seek(pb, offImageOffsets, SEEK_SET);
+-    for (i = 0; i < st->duration; i++)
++    for (i = 0; i < st->duration; i++) {
++        if (avio_feof(pb))
++            return AVERROR_INVALIDDATA;
++
+         av_add_index_entry(st, avio_rl64(pb), i, 0, 0, AVINDEX_KEYFRAME);
++    }
+ 
+     return 0;
+ }
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14169.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14169.patch
new file mode 100644
index 0000000..e1284fa
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14169.patch
@@ -0,0 +1,39 @@
+From 9d00fb9d70ee8c0cc7002b89318c5be00f1bbdad Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=28=E6=99=93=E9=BB=91=29?=
+ <tony.sh@alibaba-inc.com>
+Date: Tue, 29 Aug 2017 23:59:21 +0200
+Subject: [PATCH] avformat/mxfdec: Fix Sign error in mxf_read_primer_pack()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes: 20170829B.mxf
+
+Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14169
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/mxfdec.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
+index 6adb77d..91731a7 100644
+--- a/libavformat/mxfdec.c
++++ b/libavformat/mxfdec.c
+@@ -500,7 +500,7 @@ static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, U
+         avpriv_request_sample(pb, "Primer pack item length %d", item_len);
+         return AVERROR_PATCHWELCOME;
+     }
+-    if (item_num > 65536) {
++    if (item_num > 65536 || item_num < 0) {
+         av_log(mxf->fc, AV_LOG_ERROR, "item_num %d is too large\n", item_num);
+         return AVERROR_INVALIDDATA;
+     }
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14170.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14170.patch
new file mode 100644
index 0000000..8860125
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14170.patch
@@ -0,0 +1,49 @@
+From 900f39692ca0337a98a7cf047e4e2611071810c2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=28=E6=99=93=E9=BB=91=29?=
+ <tony.sh@alibaba-inc.com>
+Date: Tue, 29 Aug 2017 23:59:21 +0200
+Subject: [PATCH] avformat/mxfdec: Fix DoS issues in
+ mxf_read_index_entry_array()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes: 20170829A.mxf
+
+Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14170
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/mxfdec.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
+index f8d0f9e..6adb77d 100644
+--- a/libavformat/mxfdec.c
++++ b/libavformat/mxfdec.c
+@@ -899,6 +899,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
+     segment->nb_index_entries = avio_rb32(pb);
+ 
+     length = avio_rb32(pb);
++    if(segment->nb_index_entries && length < 11)
++        return AVERROR_INVALIDDATA;
+ 
+     if (!(segment->temporal_offset_entries=av_calloc(segment->nb_index_entries, sizeof(*segment->temporal_offset_entries))) ||
+         !(segment->flag_entries          = av_calloc(segment->nb_index_entries, sizeof(*segment->flag_entries))) ||
+@@ -909,6 +911,8 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
+     }
+ 
+     for (i = 0; i < segment->nb_index_entries; i++) {
++        if(avio_feof(pb))
++            return AVERROR_INVALIDDATA;
+         segment->temporal_offset_entries[i] = avio_r8(pb);
+         avio_r8(pb);                                        /* KeyFrameOffset */
+         segment->flag_entries[i] = avio_r8(pb);
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14171.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14171.patch
new file mode 100644
index 0000000..e2ae204
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14171.patch
@@ -0,0 +1,44 @@
+From c24bcb553650b91e9eff15ef6e54ca73de2453b7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E5=AD=99=E6=B5=A9=28=E6=99=93=E9=BB=91=29?=
+ <tony.sh@alibaba-inc.com>
+Date: Tue, 29 Aug 2017 23:59:21 +0200
+Subject: [PATCH] avformat/nsvdec: Fix DoS due to lack of eof check in
+ nsvs_file_offset loop.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes: 20170829.nsv
+
+Co-Author: 张洪亮(望初)" <wangchu.zhl@alibaba-inc.com>
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14171
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/nsvdec.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
+index c6ddb67..d8ce656 100644
+--- a/libavformat/nsvdec.c
++++ b/libavformat/nsvdec.c
+@@ -335,8 +335,11 @@ static int nsv_parse_NSVf_header(AVFormatContext *s)
+         if (!nsv->nsvs_file_offset)
+             return AVERROR(ENOMEM);
+ 
+-        for(i=0;i<table_entries_used;i++)
++        for(i=0;i<table_entries_used;i++) {
++            if (avio_feof(pb))
++                return AVERROR_INVALIDDATA;
+             nsv->nsvs_file_offset[i] = avio_rl32(pb) + size;
++        }
+ 
+         if(table_entries > table_entries_used &&
+            avio_rl32(pb) == MKTAG('T','O','C','2')) {
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14222.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14222.patch
new file mode 100644
index 0000000..ee02037
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14222.patch
@@ -0,0 +1,40 @@
+From 9cb4eb772839c5e1de2855d126bf74ff16d13382 Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michael@niedermayer.cc>
+Date: Tue, 5 Sep 2017 00:16:29 +0200
+Subject: [PATCH] avformat/mov: Fix DoS in read_tfra()
+
+Fixes: Missing EOF check in loop
+No testcase
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14222
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/mov.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/libavformat/mov.c b/libavformat/mov.c
+index 994e9c6..2519707 100644
+--- a/libavformat/mov.c
++++ b/libavformat/mov.c
+@@ -6094,6 +6094,13 @@ static int read_tfra(MOVContext *mov, AVIOContext *f)
+     }
+     for (i = 0; i < index->item_count; i++) {
+         int64_t time, offset;
++
++        if (avio_feof(f)) {
++            index->item_count = 0;
++            av_freep(&index->items);
++            return AVERROR_INVALIDDATA;
++        }
++
+         if (version == 1) {
+             time   = avio_rb64(f);
+             offset = avio_rb64(f);
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14223.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14223.patch
new file mode 100644
index 0000000..d1fef6b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14223.patch
@@ -0,0 +1,38 @@
+From afc9c683ed9db01edb357bc8c19edad4282b3a97 Mon Sep 17 00:00:00 2001
+From: Michael Niedermayer <michael@niedermayer.cc>
+Date: Tue, 5 Sep 2017 00:16:29 +0200
+Subject: [PATCH] avformat/asfdec: Fix DoS in asf_build_simple_index()
+
+Fixes: Missing EOF check in loop
+No testcase
+
+Found-by: Xiaohei and Wangchu from Alibaba Security Team
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14223
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ libavformat/asfdec_f.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
+index f3acbae..cc648b9 100644
+--- a/libavformat/asfdec_f.c
++++ b/libavformat/asfdec_f.c
+@@ -1610,6 +1610,11 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
+             int64_t pos       = s->internal->data_offset + s->packet_size * (int64_t)pktnum;
+             int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
+ 
++            if (avio_feof(s->pb)) {
++                ret = AVERROR_INVALIDDATA;
++                goto end;
++            }
++
+             if (pos != last_pos) {
+                 av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d  pts: %"PRId64"\n",
+                        pktnum, pktct, index_pts);
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14225.patch b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14225.patch
new file mode 100644
index 0000000..ce6845e
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2017-14225.patch
@@ -0,0 +1,49 @@
+Subject: [PATCH] ffprobe: Fix null pointer dereference with color primaries
+
+Found-by: AD-lab of venustech
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
+
+CVE: CVE-2017-14225
+Upstream-Status: Backport
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ ffprobe.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/ffprobe.c b/ffprobe.c
+index a219fc1..df22b30 100644
+--- a/ffprobe.c
++++ b/ffprobe.c
+@@ -1899,6 +1899,16 @@ static void print_pkt_side_data(WriterContext *w,
+     writer_print_section_footer(w);
+ }
+ 
++static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries)
++{
++    const char *val = av_color_primaries_name(color_primaries);
++    if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) {
++	print_str_opt("color_primaries", "unknown");
++    } else {
++	print_str("color_primaries", val);
++    }
++}
++
+ static void clear_log(int need_lock)
+ {
+     int i;
+@@ -2420,10 +2430,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
+         else
+             print_str_opt("color_transfer", av_color_transfer_name(par->color_trc));
+ 
+-        if (par->color_primaries != AVCOL_PRI_UNSPECIFIED)
+-            print_str("color_primaries", av_color_primaries_name(par->color_primaries));
+-        else
+-            print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries));
++        print_primaries(w, par->color_primaries);
+ 
+         if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
+             print_str("chroma_location", av_chroma_location_name(par->chroma_location));
+-- 
+2.1.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg_3.2.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg_3.3.3.bb
similarity index 87%
rename from import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg_3.2.4.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg_3.3.3.bb
index 3216f8e..c1ebecf 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg_3.2.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/ffmpeg/ffmpeg_3.3.3.bb
@@ -25,9 +25,22 @@
 
 SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
            file://mips64_cpu_detection.patch \
+           file://0001-build-fix-for-mips.patch \
+           file://CVE-2017-14054.patch \
+           file://CVE-2017-14055.patch \
+           file://CVE-2017-14056.patch \
+           file://CVE-2017-14057.patch \
+           file://CVE-2017-14058.patch \
+           file://CVE-2017-14059.patch \
+           file://CVE-2017-14169.patch \
+           file://CVE-2017-14170.patch \
+           file://CVE-2017-14171.patch \
+           file://CVE-2017-14222.patch \
+           file://CVE-2017-14223.patch \
+           file://CVE-2017-14225.patch \
           "
-SRC_URI[md5sum] = "39fd71024ac76ba35f04397021af5606"
-SRC_URI[sha256sum] = "6e38ff14f080c98b58cf5967573501b8cb586e3a173b591f3807d8f0660daf7a"
+SRC_URI[md5sum] = "743dc66ebe67180283b92d029f690d0f"
+SRC_URI[sha256sum] = "d2a9002cdc6b533b59728827186c044ad02ba64841f1b7cd6c21779875453a1e"
 
 # Build fails when thumb is enabled: https://bugzilla.yoctoproject.org/show_bug.cgi?id=7717
 ARM_INSTRUCTION_SET = "arm"
@@ -42,7 +55,7 @@
 
 PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc \
                    bzlib gpl lzma theora x264 \
-                   ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 xv', '', d)}"
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xv', '', d)}"
 
 # libraries to build in addition to avutil
 PACKAGECONFIG[avdevice] = "--enable-avdevice,--disable-avdevice"
@@ -64,12 +77,12 @@
 PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
 PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
 PACKAGECONFIG[schroedinger] = "--enable-libschroedinger,--disable-libschroedinger,schroedinger"
+PACKAGECONFIG[sdl2] = "--enable-sdl2,--disable-sdl2,virtual/libsdl2"
 PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
 PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora"
 PACKAGECONFIG[vaapi] = "--enable-vaapi,--disable-vaapi,libva"
 PACKAGECONFIG[vdpau] = "--enable-vdpau,--disable-vdpau,libvdpau"
 PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
-PACKAGECONFIG[x11] = "--enable-x11grab,--disable-x11grab,virtual/libx11 libxfixes libxext xproto virtual/libsdl"
 PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
 PACKAGECONFIG[xv] = "--enable-outdev=xv,--disable-outdev=xv,libxv"
 
@@ -87,6 +100,10 @@
     --enable-pic \
     --enable-shared \
     --enable-pthreads \
+    --disable-libxcb \
+    --disable-libxcb-shm \
+    --disable-libxcb-xfixes \
+    --disable-libxcb-shape \
     ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
     \
     --cross-prefix=${TARGET_PREFIX} \
@@ -107,6 +124,7 @@
     --datadir=${datadir}/ffmpeg \
     ${@bb.utils.contains('AVAILTUNES', 'mips32r2', '', '--disable-mipsdsp --disable-mipsdspr2', d)} \
     --cpu=${@cpu(d)} \
+    --pkg-config=pkg-config \
 "
 
 EXTRA_OECONF_append_linux-gnux32 = " --disable-asm"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/0001-gtk-play-Disable-visualizations.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/0001-gtk-play-Disable-visualizations.patch
deleted file mode 100644
index ea88120..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/0001-gtk-play-Disable-visualizations.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 6cf42c468e93b0aaa171961e059bc3e2fb915889 Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Fri, 28 Apr 2017 14:35:19 +0300
-Subject: [PATCH] gtk-play: Disable visualizations
-
-This is a workaround for [YOCTO #11410] (audio playback is broken in
-mediaplayer if vaapi is used). It disables visualizations and makes
-sure we clear the window (otherwise nothing does that and result is
-very ugly).
-
-This patch should be removed when 11410 is fixed.
-
-Upstream-Status: Inappropriate [bug workaround]
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
----
- gtk/gtk-play.c | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index 8ae0fea..63b9bb0 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -1401,6 +1401,15 @@ get_child_position (GtkOverlay * overlay, GtkWidget * widget,
-   return TRUE;
- }
- 
-+/* Hack to make sure something gets drawn if visualizations are disabled */
-+static gboolean
-+draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
-+{
-+  cairo_set_source_rgb (cr, 0, 0, 0);
-+  cairo_paint (cr);
-+  return FALSE;
-+}
-+
- static void
- create_ui (GtkPlay * play)
- {
-@@ -1431,6 +1440,8 @@ create_ui (GtkPlay * play)
-     play->video_area = gtk_drawing_area_new ();
-     g_signal_connect (play->video_area, "realize",
-         G_CALLBACK (video_area_realize_cb), play);
-+    g_signal_connect (play->video_area, "draw",
-+        G_CALLBACK (draw_cb), NULL);
-   }
-   gtk_widget_set_events (play->video_area, GDK_EXPOSURE_MASK
-       | GDK_LEAVE_NOTIFY_MASK
-@@ -1753,7 +1764,7 @@ gtk_play_constructor (GType type, guint n_construct_params,
- 
-   /* enable visualization (by default playbin uses goom) */
-   /* if visualization is enabled then use the first element */
--  gst_player_set_visualization_enabled (self->player, TRUE);
-+  gst_player_set_visualization_enabled (self->player, FALSE);
- 
-   g_signal_connect (G_OBJECT (self), "show", G_CALLBACK (show_cb), NULL);
- 
--- 
-2.1.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/Add-error-signal-emission-for-missing-plugins.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/Add-error-signal-emission-for-missing-plugins.patch
deleted file mode 100644
index 712d46d..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/Add-error-signal-emission-for-missing-plugins.patch
+++ /dev/null
@@ -1,252 +0,0 @@
-From d64c7edb66f4a64ff49c4306cf77fd269b7079ab Mon Sep 17 00:00:00 2001
-From: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Date: Mon, 16 Mar 2015 13:45:30 +0200
-Subject: [PATCH] Add error signal emission for missing plugins
-
-Add a missing plugins error signal to gst-player. Note that this error
-does not necessarily mean the playback has completely failed, but in
-practice the user experience will be bad (think, e.g. of a mp4 file
-where H.264 codec is missing: AAC playback still works...).
-
-Use the signal in gtk-play to show a infobar if plugins are missing.
-
-Submitted upstream at https://github.com/sdroege/gst-player/pull/11
-
-Upstream-Status: Submitted
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
----
- configure.ac               |  2 +-
- gtk/gtk-play.c             | 54 +++++++++++++++++++++++++++++++++++++++++++++-
- lib/gst/player/gstplayer.c | 22 +++++++++++++++++++
- lib/gst/player/gstplayer.h |  3 ++-
- 4 files changed, 78 insertions(+), 3 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 90ab74c..6cdb4eb 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -53,7 +53,7 @@ AC_SUBST(LT_AGE)
- PKG_PROG_PKG_CONFIG
- 
- PKG_CHECK_MODULES(GLIB, [glib-2.0 gobject-2.0])
--PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0 >= 1.4 gstreamer-video-1.0 >= 1.4])
-+PKG_CHECK_MODULES(GSTREAMER, [gstreamer-1.0 >= 1.4 gstreamer-video-1.0 >= 1.4 gstreamer-pbutils-1.0])
- 
- GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
- AC_SUBST(GLIB_PREFIX)
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index b92773b..e2b605a 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -30,6 +30,8 @@ typedef struct
-   GtkWidget *prev_button, *next_button;
-   GtkWidget *seekbar;
-   GtkWidget *video_area;
-+  GtkWidget *info_label;
-+  GtkWidget *info_bar;
-   GtkWidget *volume_button;
-   gulong seekbar_value_changed_signal_id;
-   gboolean playing;
-@@ -141,6 +143,13 @@ play_pause_clicked_cb (GtkButton * button, GtkPlay * play)
- }
- 
- static void
-+clear_missing_plugins (GtkPlay * play)
-+{
-+  gtk_label_set_text (GTK_LABEL (play->info_label), "");
-+  gtk_widget_hide (play->info_bar);
-+}
-+
-+static void
- skip_prev_clicked_cb (GtkButton * button, GtkPlay * play)
- {
-   GList *prev;
-@@ -155,6 +164,7 @@ skip_prev_clicked_cb (GtkButton * button, GtkPlay * play)
- 
-   gtk_widget_set_sensitive (play->next_button, TRUE);
-   gst_player_set_uri (play->player, prev->data);
-+  clear_missing_plugins (play);
-   gst_player_play (play->player);
-   set_title (play, prev->data);
-   gtk_widget_set_sensitive (play->prev_button, g_list_previous (prev) != NULL);
-@@ -175,6 +185,7 @@ skip_next_clicked_cb (GtkButton * button, GtkPlay * play)
- 
-   gtk_widget_set_sensitive (play->prev_button, TRUE);
-   gst_player_set_uri (play->player, next->data);
-+  clear_missing_plugins (play);
-   gst_player_play (play->player);
-   set_title (play, next->data);
-   gtk_widget_set_sensitive (play->next_button, g_list_next (next) != NULL);
-@@ -193,10 +204,16 @@ volume_changed_cb (GtkScaleButton * button, gdouble value, GtkPlay * play)
-   gst_player_set_volume (play->player, value);
- }
- 
-+void
-+info_bar_response_cb (GtkInfoBar * bar, gint response, GtkPlay * play)
-+{
-+  gtk_widget_hide (GTK_WIDGET (bar));
-+}
-+
- static void
- create_ui (GtkPlay * play)
- {
--  GtkWidget *controls, *main_hbox, *main_vbox;
-+  GtkWidget *controls, *main_hbox, *main_vbox, *info_bar, *content_area;
- 
-   play->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-   g_signal_connect (G_OBJECT (play->window), "delete-event",
-@@ -208,6 +225,20 @@ create_ui (GtkPlay * play)
-   g_signal_connect (play->video_area, "realize",
-       G_CALLBACK (video_area_realize_cb), play);
- 
-+  play->info_bar = gtk_info_bar_new ();
-+  gtk_info_bar_set_message_type (GTK_INFO_BAR (play->info_bar),
-+      GTK_MESSAGE_WARNING);
-+  //gtk_info_bar_set_show_close_button (GTK_INFO_BAR (play->info_bar),
-+  //    TRUE);
-+  gtk_widget_set_no_show_all (play->info_bar, TRUE);
-+  g_signal_connect (play->info_bar, "response",
-+      G_CALLBACK (info_bar_response_cb), play);
-+
-+  content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (play->info_bar));
-+  play->info_label = gtk_label_new ("");
-+  gtk_container_add (GTK_CONTAINER (content_area), play->info_label);
-+  gtk_widget_show (play->info_label);
-+
-   /* Unified play/pause button */
-   play->play_pause_button =
-       gtk_button_new_from_icon_name ("media-playback-pause",
-@@ -258,6 +289,7 @@ create_ui (GtkPlay * play)
- 
-   main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-   gtk_box_pack_start (GTK_BOX (main_vbox), main_hbox, TRUE, TRUE, 0);
-+  gtk_box_pack_start (GTK_BOX (main_vbox), play->info_bar, FALSE, FALSE, 0);
-   gtk_box_pack_start (GTK_BOX (main_vbox), controls, FALSE, FALSE, 0);
-   gtk_container_add (GTK_CONTAINER (play->window), main_vbox);
- 
-@@ -322,6 +354,7 @@ eos_cb (GstPlayer * unused, GtkPlay * play)
-       gtk_widget_set_sensitive (play->next_button, g_list_next (next) != NULL);
- 
-       gst_player_set_uri (play->player, next->data);
-+      clear_missing_plugins (play);
-       gst_player_play (play->player);
-       set_title (play, next->data);
-     } else {
-@@ -330,6 +363,24 @@ eos_cb (GstPlayer * unused, GtkPlay * play)
-   }
- }
- 
-+static void
-+error_cb (GstPlayer * player, GError * err, GtkPlay * play)
-+{
-+  char *message;
-+
-+  if (g_error_matches (err, gst_player_error_quark (),
-+      GST_PLAYER_ERROR_MISSING_PLUGIN)) {
-+    // add message to end of any existing message: there may be
-+    // multiple missing plugins.
-+    message = g_strdup_printf ("%s%s. ",
-+        gtk_label_get_text (GTK_LABEL (play->info_label)), err->message);
-+    gtk_label_set_text (GTK_LABEL (play->info_label), message);
-+    g_free (message);
-+
-+    gtk_widget_show (play->info_bar);
-+  }
-+}
-+
- int
- main (gint argc, gchar ** argv)
- {
-@@ -422,6 +473,7 @@ main (gint argc, gchar ** argv)
-   g_signal_connect (play.player, "video-dimensions-changed",
-       G_CALLBACK (video_dimensions_changed_cb), &play);
-   g_signal_connect (play.player, "end-of-stream", G_CALLBACK (eos_cb), &play);
-+  g_signal_connect (play.player, "error", G_CALLBACK (error_cb), &play);
- 
-   /* We have file(s) that need playing. */
-   set_title (&play, g_list_first (play.uris)->data);
-diff --git a/lib/gst/player/gstplayer.c b/lib/gst/player/gstplayer.c
-index bd682d9..78e7ba1 100644
---- a/lib/gst/player/gstplayer.c
-+++ b/lib/gst/player/gstplayer.c
-@@ -47,6 +47,7 @@
- 
- #include <gst/gst.h>
- #include <gst/video/video.h>
-+#include <gst/pbutils/missing-plugins.h>
- 
- GST_DEBUG_CATEGORY_STATIC (gst_player_debug);
- #define GST_CAT_DEFAULT gst_player_debug
-@@ -238,6 +239,7 @@ gst_player_class_init (GstPlayerClass * klass)
-       g_signal_new ("video-dimensions-changed", G_TYPE_FROM_CLASS (klass),
-       G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
-       NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-+
- }
- 
- static void
-@@ -619,6 +621,21 @@ error_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
-   g_mutex_unlock (&self->priv->lock);
- }
- 
-+static void
-+element_cb (GstBus * bus, GstMessage * msg, gpointer user_data)
-+{
-+  GstPlayer *self = GST_PLAYER (user_data);
-+
-+  if (gst_is_missing_plugin_message (msg)) {
-+    gchar *desc;
-+
-+    desc = gst_missing_plugin_message_get_description (msg);
-+    emit_error (self, g_error_new (GST_PLAYER_ERROR,
-+        GST_PLAYER_ERROR_MISSING_PLUGIN, "Missing plugin '%s'", desc));
-+    g_free (desc);
-+  }
-+}
-+
- static gboolean
- eos_dispatch (gpointer user_data)
- {
-@@ -1059,6 +1076,8 @@ gst_player_main (gpointer data)
-       NULL, NULL);
-   g_source_attach (bus_source, self->priv->context);
- 
-+  g_signal_connect (G_OBJECT (bus), "message::element",
-+      G_CALLBACK (element_cb), self);
-   g_signal_connect (G_OBJECT (bus), "message::error", G_CALLBACK (error_cb),
-       self);
-   g_signal_connect (G_OBJECT (bus), "message::eos", G_CALLBACK (eos_cb), self);
-@@ -1560,6 +1579,7 @@ gst_player_error_get_type (void)
-   static gsize id = 0;
-   static const GEnumValue values[] = {
-     {C_ENUM (GST_PLAYER_ERROR_FAILED), "GST_PLAYER_ERROR_FAILED", "failed"},
-+    {C_ENUM (GST_PLAYER_ERROR_MISSING_PLUGIN), "GST_PLAYER_ERROR_MISSING_PLUGIN", "missing-plugin"},
-     {0, NULL, NULL}
-   };
- 
-@@ -1577,6 +1597,8 @@ gst_player_error_get_name (GstPlayerError error)
-   switch (error) {
-     case GST_PLAYER_ERROR_FAILED:
-       return "failed";
-+    case GST_PLAYER_ERROR_MISSING_PLUGIN:
-+      return "missing-plugin";
-   }
- 
-   g_assert_not_reached ();
-diff --git a/lib/gst/player/gstplayer.h b/lib/gst/player/gstplayer.h
-index c438513..35fb5bb 100644
---- a/lib/gst/player/gstplayer.h
-+++ b/lib/gst/player/gstplayer.h
-@@ -44,7 +44,8 @@ GType        gst_player_error_get_type                (void);
- #define      GST_TYPE_PLAYER_ERROR                    (gst_player_error_get_type ())
- 
- typedef enum {
--  GST_PLAYER_ERROR_FAILED = 0
-+  GST_PLAYER_ERROR_FAILED = 0,
-+  GST_PLAYER_ERROR_MISSING_PLUGIN
- } GstPlayerError;
- 
- const gchar *gst_player_error_get_name                (GstPlayerError error);
--- 
-2.1.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/Fix-pause-play.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/Fix-pause-play.patch
deleted file mode 100644
index 783c42a..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/Fix-pause-play.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-Fix pause/play
-
-The current player state is now notified via the state-changed signal,
-and in the GTK UI it was only used to keep track of the desired state.
-
-This is a backport of upstream commit 738479c7a0.
-
-Upstream-Status: Backport
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
-
----
- gtk/gtk-play.c             |  8 ++++++--
- lib/gst/player/gstplayer.c | 12 ------------
- lib/gst/player/gstplayer.h |  2 --
- 3 files changed, 6 insertions(+), 16 deletions(-)
-
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index 6e7a098..e2b605a 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -34,6 +34,7 @@ typedef struct
-   GtkWidget *info_bar;
-   GtkWidget *volume_button;
-   gulong seekbar_value_changed_signal_id;
-+  gboolean playing;
- } GtkPlay;
- 
- /* Compat stubs */
-@@ -118,12 +119,13 @@ play_pause_clicked_cb (GtkButton * button, GtkPlay * play)
- {
-   GtkWidget *image;
- 
--  if (gst_player_is_playing (play->player)) {
-+  if (play->playing) {
-     gst_player_pause (play->player);
-     image =
-         gtk_image_new_from_icon_name ("media-playback-start",
-         GTK_ICON_SIZE_BUTTON);
-     gtk_button_set_image (GTK_BUTTON (play->play_pause_button), image);
-+    play->playing = FALSE;
-   } else {
-     gchar *title;
- 
-@@ -136,6 +138,7 @@ play_pause_clicked_cb (GtkButton * button, GtkPlay * play)
-     title = gst_player_get_uri (play->player);
-     set_title (play, title);
-     g_free (title);
-+    play->playing = TRUE;
-   }
- }
- 
-@@ -335,7 +338,7 @@ video_dimensions_changed_cb (GstPlayer * unused, gint width, gint height,
- static void
- eos_cb (GstPlayer * unused, GtkPlay * play)
- {
--  if (gst_player_is_playing (play->player)) {
-+  if (play->playing) {
-     GList *next = NULL;
-     gchar *uri;
- 
-@@ -452,6 +455,7 @@ main (gint argc, gchar ** argv)
-   }
- 
-   play.player = gst_player_new ();
-+  play.playing = TRUE;
- 
-   g_object_set (play.player, "dispatch-to-main-context", TRUE, NULL);
- 
-diff --git a/lib/gst/player/gstplayer.c b/lib/gst/player/gstplayer.c
-index 069b284..78e7ba1 100644
---- a/lib/gst/player/gstplayer.c
-+++ b/lib/gst/player/gstplayer.c
-@@ -1422,18 +1422,6 @@ gst_player_set_uri (GstPlayer * self, const gchar * val)
-   g_object_set (self, "uri", val, NULL);
- }
- 
--gboolean
--gst_player_is_playing (GstPlayer * self)
--{
--  gboolean val;
--
--  g_return_val_if_fail (GST_IS_PLAYER (self), FALSE);
--
--  g_object_get (self, "is-playing", &val, NULL);
--
--  return val;
--}
--
- GstClockTime
- gst_player_get_position (GstPlayer * self)
- {
-diff --git a/lib/gst/player/gstplayer.h b/lib/gst/player/gstplayer.h
-index 6933dd7..35fb5bb 100644
---- a/lib/gst/player/gstplayer.h
-+++ b/lib/gst/player/gstplayer.h
-@@ -93,8 +93,6 @@ gchar *      gst_player_get_uri                       (GstPlayer    * player);
- void         gst_player_set_uri                       (GstPlayer    * player,
-                                                        const gchar  * uri);
- 
--gboolean     gst_player_is_playing                    (GstPlayer    * player);
--
- GstClockTime gst_player_get_position                  (GstPlayer    * player);
- GstClockTime gst_player_get_duration                  (GstPlayer    * player);
- 
--- 
-2.1.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/filechooser.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/filechooser.patch
deleted file mode 100644
index 7bf1b03..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player/filechooser.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-Upstream-Status: Submitted
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-From 43d4b19ab611d844156e26c4840cc54ddb73ae03 Mon Sep 17 00:00:00 2001
-From: Ross Burton <ross.burton@intel.com>
-Date: Thu, 26 Feb 2015 17:17:05 +0000
-Subject: [PATCH] gtk-play: show a file chooser if no URIs were passed
-
----
- gtk/gtk-play.c |   28 ++++++++++++++++++++++++++--
- 1 file changed, 26 insertions(+), 2 deletions(-)
-
-diff --git a/gtk/gtk-play.c b/gtk/gtk-play.c
-index f015077..9766a72 100644
---- a/gtk/gtk-play.c
-+++ b/gtk/gtk-play.c
-@@ -319,8 +319,32 @@ main (gint argc, gchar ** argv)
-   // FIXME: Add support for playlists and stuff
-   /* Parse the list of the file names we have to play. */
-   if (!file_names) {
--    g_print ("Usage: %s FILE(s)|URI(s)\n", APP_NAME);
--    return 1;
-+    GtkWidget *chooser;
-+    int res;
-+
-+    chooser = gtk_file_chooser_dialog_new ("Select files to play", NULL,
-+                                          GTK_FILE_CHOOSER_ACTION_OPEN,
-+                                          "_Cancel", GTK_RESPONSE_CANCEL,
-+                                          "_Open", GTK_RESPONSE_ACCEPT,
-+                                          NULL);
-+    g_object_set (chooser,
-+                  "local-only", FALSE,
-+                  "select-multiple", TRUE,
-+                  NULL);
-+
-+    res = gtk_dialog_run (GTK_DIALOG (chooser));
-+    if (res == GTK_RESPONSE_ACCEPT) {
-+      GSList *l;
-+
-+      l = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (chooser));
-+      while (l) {
-+        play.uris = g_list_append (play.uris, l->data);
-+        l = g_slist_delete_link (l, l);
-+      }
-+    } else {
-+      return 0;
-+    }
-+    gtk_widget_destroy (chooser);
-   } else {
-     guint i;
- 
--- 
-1.7.10.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player_git.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player_git.bb
index cb12a46..4fe8fde 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gst-player_git.bb
@@ -5,14 +5,11 @@
 DEPENDS = "glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad gtk+3 glib-2.0-native"
 
 SRC_URI = "git://github.com/sdroege/gst-player.git \
-           file://filechooser.patch;apply=0 \
-           file://Fix-pause-play.patch;apply=0 \
-           file://Add-error-signal-emission-for-missing-plugins.patch;apply=0 \
-           file://0001-gtk-play-Disable-visualizations.patch \
            file://gst-player.desktop"
 
 SRCREV = "ee3c226c82767a089743e4e06058743e67f73cdb"
 PV = "0.0.1+git${SRCPV}"
+UPSTREAM_VERSION_UNKNOWN = "1"
 
 S = "${WORKDIR}/git"
 
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer-vaapi/vaapivideobufferpool-create-allocator-if-needed.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer-vaapi/vaapivideobufferpool-create-allocator-if-needed.patch
deleted file mode 100644
index f666adc..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer-vaapi/vaapivideobufferpool-create-allocator-if-needed.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
-Upstream-Status: Backport [commit 59a731be6b in '1.10' branch]
-
-
-From 02a6002c3a80b3a5301c0943b1a1518bbdf439fc Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?=
- <vjaquez@igalia.com>
-Date: Fri, 21 Apr 2017 19:07:18 +0200
-Subject: [PATCH] vaapivideobufferpool: create allocator if needed
-
-Backport to branch 1.10
-
-Sometimes a video decoder could set different buffer pool
-configurations, because their frame size changes. In this case we
-did not reconfigure the allocator.
-
-This patch enables this use case, creating a new allocator inside
-the VAAPI buffer pool if the caps changed, if it is not dmabuf-based.
-If so, it is just reconfigured, since it doesn't have a surface pool.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=781577
----
- gst/vaapi/gstvaapivideobufferpool.c | 21 +++++++++++++++++++++
- 1 file changed, 21 insertions(+)
-
-diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c
-index a3b9223f..9a50614b 100644
---- a/gst/vaapi/gstvaapivideobufferpool.c
-+++ b/gst/vaapi/gstvaapivideobufferpool.c
-@@ -159,6 +159,27 @@ gst_vaapi_video_buffer_pool_set_config (GstBufferPool * pool,
-     gst_object_replace ((GstObject **) & priv->allocator, NULL);
-   priv->video_info = new_vip;
- 
-+  {
-+    guint surface_alloc_flags;
-+    gboolean vinfo_changed = FALSE;
-+
-+    if (allocator) {
-+      const GstVideoInfo *alloc_vinfo =
-+          gst_allocator_get_vaapi_video_info (allocator, &surface_alloc_flags);
-+      vinfo_changed = gst_video_info_changed (alloc_vinfo, &new_vip);
-+    }
-+
-+    if (vinfo_changed && allocator && priv->use_dmabuf_memory) {
-+      gst_allocator_set_vaapi_video_info (allocator, &new_vip,
-+          surface_alloc_flags);
-+    } else if (!priv->use_dmabuf_memory && (vinfo_changed || !allocator)) {
-+      /* let's destroy the other allocator and create a new one */
-+      allocator = gst_vaapi_video_allocator_new (priv->display, &new_vip,
-+          surface_alloc_flags);
-+      gst_buffer_pool_config_set_allocator (config, allocator, NULL);
-+    }
-+  }
-+
-   if (!gst_buffer_pool_config_has_option (config,
-           GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META))
-     goto error_no_vaapi_video_meta_option;
--- 
-2.11.0
-
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-configure-check-for-armv7ve-variant.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-configure-check-for-armv7ve-variant.patch
new file mode 100644
index 0000000..b80d073
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-configure-check-for-armv7ve-variant.patch
@@ -0,0 +1,35 @@
+From aac5902d3c9cb35c771e760d0e487622aa2e116a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 20 Apr 2017 10:38:18 -0700
+Subject: [PATCH] configure: check for armv7ve variant
+
+OE passes -mcpu and -march via cmdline and if
+package tries to detect one of it own then it
+should be compatible otherwise, newer gcc7+ will
+error out
+
+Check for relevant preprocessor macro to determine
+armv7ve architecture
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ gst-libs/ext/libav/configure | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gst-libs/ext/libav/configure b/gst-libs/ext/libav/configure
+index 4a5e477..727818e 100755
+--- a/gst-libs/ext/libav/configure
++++ b/gst-libs/ext/libav/configure
+@@ -4295,6 +4295,7 @@ elif enabled arm; then
+         elif check_arm_arch 6Z;       then echo armv6z
+         elif check_arm_arch 6ZK;      then echo armv6zk
+         elif check_arm_arch 6T2;      then echo armv6t2
++        elif check_arm_arch EXT_IDIV; then echo armv7ve
+         elif check_arm_arch 7;        then echo armv7
+         elif check_arm_arch 7A  7_A;  then echo armv7-a
+         elif check_arm_arch 7S;       then echo armv7-a
+-- 
+2.12.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-hevcpred_msa.c-Fix-build-by-Including-libavcodec-hev.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-hevcpred_msa.c-Fix-build-by-Including-libavcodec-hev.patch
new file mode 100644
index 0000000..afbfc84
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-hevcpred_msa.c-Fix-build-by-Including-libavcodec-hev.patch
@@ -0,0 +1,33 @@
+From b5226c096a0b7049874858e94a59d43e10ba3fd2 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 21 Sep 2017 10:22:56 -0700
+Subject: [PATCH] hevcpred_msa.c: Fix build by Including libavcodec/hevcdec.h
+
+src/libavcodec/mips/hevcpred_msa.c:1913:32: error: unknown type name 'HEVCContext'; did you mean 'HEVCPredContext'?
+ void ff_intra_pred_8_16x16_msa(HEVCContext *s, int x0, int y0, int c_idx)
+                                ^~~~~~~~~~~
+                                HEVCPredContext
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ gst-libs/ext/libav/libavcodec/mips/hevcpred_msa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gst-libs/ext/libav/libavcodec/mips/hevcpred_msa.c b/gst-libs/ext/libav/libavcodec/mips/hevcpred_msa.c
+index 6a3b281..963c64c 100644
+--- a/gst-libs/ext/libav/libavcodec/mips/hevcpred_msa.c
++++ b/gst-libs/ext/libav/libavcodec/mips/hevcpred_msa.c
+@@ -18,7 +18,7 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ 
+-#include "libavcodec/hevc.h"
++#include "libavcodec/hevcdec.h"
+ #include "libavutil/mips/generic_macros_msa.h"
+ #include "hevcpred_mips.h"
+ 
+-- 
+2.14.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.10.4.bb
deleted file mode 100644
index 59d81db..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.10.4.bb
+++ /dev/null
@@ -1,20 +0,0 @@
-require gstreamer1.0-libav.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
-                    file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d \
-                    file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \
-                    file://gst-libs/ext/libav/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
-                    file://gst-libs/ext/libav/COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
-                    file://gst-libs/ext/libav/COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
-                    file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
-
-SRC_URI = " \
-    http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz \
-    file://0001-Disable-yasm-for-libav-when-disable-yasm.patch \
-    file://workaround-to-build-gst-libav-for-i586-with-gcc.patch \
-    file://mips64_cpu_detection.patch \
-"
-SRC_URI[md5sum] = "e2bdd9fde6ca3ff7efffb93df121f4fd"
-SRC_URI[sha256sum] = "6ca0feca75e3d48315e07f20ec37cf6260ed1e9dde58df355febd5016246268b"
-
-S = "${WORKDIR}/gst-libav-${PV}"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.12.2.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.12.2.bb
new file mode 100644
index 0000000..3b5bbd1
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.12.2.bb
@@ -0,0 +1,21 @@
+require gstreamer1.0-libav.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+                    file://COPYING.LIB;md5=6762ed442b3822387a51c92d928ead0d \
+                    file://ext/libav/gstav.h;beginline=1;endline=18;md5=a752c35267d8276fd9ca3db6994fca9c \
+                    file://gst-libs/ext/libav/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+                    file://gst-libs/ext/libav/COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
+                    file://gst-libs/ext/libav/COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
+                    file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
+
+SRC_URI = "http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-${PV}.tar.xz \
+           file://0001-Disable-yasm-for-libav-when-disable-yasm.patch \
+           file://workaround-to-build-gst-libav-for-i586-with-gcc.patch \
+           file://mips64_cpu_detection.patch \
+           file://0001-configure-check-for-armv7ve-variant.patch \
+           file://0001-hevcpred_msa.c-Fix-build-by-Including-libavcodec-hev.patch \
+           "
+SRC_URI[md5sum] = "8788aecc032a287227b4bd239d1b998a"
+SRC_URI[sha256sum] = "5bb735b9bb218b652ae4071ea6f6be8eaae55e9d3233aec2f36b882a27542db3"
+
+S = "${WORKDIR}/gst-libav-${PV}"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-meta-base.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-meta-base.bb
index c542b13..016e176 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-meta-base.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-meta-base.bb
@@ -37,7 +37,7 @@
     gstreamer1.0-plugins-base-videoscale \
     gstreamer1.0-plugins-base-videoconvert \
     gstreamer1.0-plugins-good-autodetect \
-    gstreamer1.0-plugins-good-souphttpsrc"
+    gstreamer1.0-plugins-good-soup"
 
 RRECOMMENDS_gstreamer1.0-meta-x11-base = "\
     gstreamer1.0-plugins-base-ximagesink \
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx.inc
index 05562b1..5d92351 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx.inc
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx.inc
@@ -29,10 +29,17 @@
         d.setVar("PACKAGE_ARCH", d.getVar("MACHINE_ARCH"))
 }
 
+delete_pkg_m4_file() {
+    # Delete m4 files which we provide patched versions of but will be ignored
+    # if these exist
+	rm -f "${S}/common/m4/pkg.m4"
+	rm -f "${S}/common/m4/gtk-doc.m4"
+}
+do_configure[prefuncs] += "delete_pkg_m4_file"
+
 set_omx_core_name() {
 	sed -i -e "s;^core-name=.*;core-name=${GSTREAMER_1_0_OMX_CORE_NAME};" "${D}${sysconfdir}/xdg/gstomx.conf"
 }
-
 do_install[postfuncs] += " set_omx_core_name "
 
 FILES_${PN} += "${libdir}/gstreamer-1.0/*.so"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12.2.bb
similarity index 69%
rename from import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.10.4.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12.2.bb
index dfeefa5..a1d4576 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.10.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12.2.bb
@@ -5,7 +5,7 @@
 
 SRC_URI = "http://gstreamer.freedesktop.org/src/gst-omx/gst-omx-${PV}.tar.xz"
 
-SRC_URI[md5sum] = "cedb230f1c47d0cf4b575d70dff66ff2"
-SRC_URI[sha256sum] = "45072925cf262f0fd528fab78f0de52734e46a5a88aa802fae51c67c09c81aa2"
+SRC_URI[md5sum] = "4a1404a20b72e4ab6e826500218ec308"
+SRC_URI[sha256sum] = "1b22398f45a027e977d2b5309625ec91cdcaf0da8751cbc7f596d639a45ba298"
 
 S = "${WORKDIR}/gst-omx-${PV}"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad.inc
index 0ccfc89..7be15d9 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad.inc
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad.inc
@@ -20,7 +20,7 @@
     ${GSTREAMER_ORC} \
     ${PACKAGECONFIG_GL} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'directfb', d)} \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'directfb vulkan', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland egl', '', d)} \
     bz2 curl dash dtls hls neon rsvg sbc smoothstreaming sndfile uvch264 webp \
 "
@@ -40,9 +40,7 @@
 PACKAGECONFIG[fluidsynth]      = "--enable-fluidsynth,--disable-fluidsynth,fluidsynth"
 PACKAGECONFIG[gles2]           = "--enable-gles2,--disable-gles2,virtual/libgles2"
 PACKAGECONFIG[gtk]             = "--enable-gtk3,--disable-gtk3,gtk+3"
-# ensure OpenSSL is used for HLS AES description instead of nettle
-# (OpenSSL is a shared dependency with dtls)
-PACKAGECONFIG[hls]             = "--enable-hls --with-hls-crypto=openssl,--disable-hls,openssl"
+PACKAGECONFIG[hls]             = "--enable-hls --with-hls-crypto=nettle,--disable-hls,nettle"
 PACKAGECONFIG[kms]             = "--enable-kms,--disable-kms,libdrm"
 PACKAGECONFIG[libmms]          = "--enable-libmms,--disable-libmms,libmms"
 PACKAGECONFIG[libssh2]         = "--enable-libssh2,--disable-libssh2,libssh2"
@@ -66,19 +64,15 @@
 PACKAGECONFIG[uvch264]         = "--enable-uvch264,--disable-uvch264,libusb1 libgudev"
 PACKAGECONFIG[voaacenc]        = "--enable-voaacenc,--disable-voaacenc,vo-aacenc"
 PACKAGECONFIG[voamrwbenc]      = "--enable-voamrwbenc,--disable-voamrwbenc,vo-amrwbenc"
-PACKAGECONFIG[wayland]         = "--enable-wayland,--disable-wayland,wayland-native wayland wayland-protocols"
+PACKAGECONFIG[vulkan]          = "--enable-vulkan,--disable-vulkan,vulkan"
+PACKAGECONFIG[wayland]         = "--enable-wayland,--disable-wayland,wayland-native wayland wayland-protocols libdrm"
 PACKAGECONFIG[webp]            = "--enable-webp,--disable-webp,libwebp"
 
-# these plugins have not been ported to 1.0 (yet):
-#   apexsink linsys nas timidity sdl xvid wininet
-#   sndio cdxaparse dccp faceoverlay hdvparse tta mve nuvdemux
-#   patchdetect sdi videomeasure
-
 # these plugins have no corresponding library in OE-core or meta-openembedded:
-#   openni2 winks direct3d directsound winscreencap acm apple_media
+#   openni2 winks direct3d directsound winscreencap acm apple_media iqa
 #   android_media avc bs2b chromaprint daala dts fdkaac gme gsm kate ladspa libde265
-#   lv2 mimic mpeg2enc mplex musepack nvenc ofa openh264 opensles pvr soundtouch spandsp
-#   spc teletextdec tinyalsa vdpau vulkan wasapi x265 zbar
+#   lv2 mpeg2enc mplex msdk musepack nvenc ofa openh264 opensles soundtouch spandsp
+#   spc teletextdec tinyalsa vdpau wasapi x265 zbar webrtcdsp
 
 # qt5 support is disabled, because it is not present in OE core, and requires more work than
 # just adding a packageconfig (it requires access to moc, uic, rcc, and qmake paths).
@@ -94,7 +88,6 @@
     --enable-vcd \
     --disable-acm \
     --disable-android_media \
-    --disable-apexsink \
     --disable-apple_media \
     --disable-avc \
     --disable-bs2b \
@@ -107,43 +100,34 @@
     --disable-fdk_aac \
     --disable-gme \
     --disable-gsm \
+    --disable-iqa \
     --disable-kate \
     --disable-ladspa \
     --disable-libde265 \
-    --disable-libvisual \
-    --disable-linsys \
     --disable-lv2 \
-    --disable-mimic \
     --disable-mpeg2enc \
     --disable-mplex \
+    --disable-msdk \
     --disable-musepack \
-    --disable-nas \
     --disable-nvenc \
     --disable-ofa \
     --disable-openexr \
     --disable-openh264 \
     --disable-openni2 \
     --disable-opensles \
-    --disable-pvr \
     --disable-qt \
-    --disable-sdl \
-    --disable-sdltest \
-    --disable-sndio \
     --disable-soundtouch \
     --disable-spandsp \
     --disable-spc \
     --disable-teletextdec \
-    --disable-timidity \
     --disable-tinyalsa \
     --disable-vdpau \
-    --disable-vulkan \
     --disable-wasapi \
+    --disable-webrtcdsp \
     --disable-wildmidi \
-    --disable-wininet \
     --disable-winks \
     --disable-winscreencap \
     --disable-x265 \
-    --disable-xvid \
     --disable-zbar \
     ${@bb.utils.contains("TUNE_FEATURES", "mx32", "--disable-yadif", "", d)} \
 "
@@ -157,3 +141,7 @@
 FILES_${PN}-freeverb += "${datadir}/gstreamer-${LIBV}/presets/GstFreeverb.prs"
 FILES_${PN}-opencv += "${datadir}/gst-plugins-bad/${LIBV}/opencv*"
 FILES_${PN}-voamrwbenc += "${datadir}/gstreamer-${LIBV}/presets/GstVoAmrwbEnc.prs"
+
+do_compile_prepend() {
+    export GIR_EXTRA_LIBS_PATH="${B}/gst-libs/gst/allocators/.libs"
+}
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
index 43f1ee0..8d99dc6 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
@@ -1,4 +1,4 @@
-From cff6fbf555a072408c21da1e818209c9d3814dd3 Mon Sep 17 00:00:00 2001
+From 7592e793b3906355d76ca9a59f8fea2749ea2a4e Mon Sep 17 00:00:00 2001
 From: Alexander Kanavin <alex.kanavin@gmail.com>
 Date: Tue, 27 Oct 2015 14:36:58 +0200
 Subject: [PATCH] Makefile.am: don't hardcode libtool name when running
@@ -7,17 +7,34 @@
 Upstream-Status: Pending [review on oe-core list]
 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
 
----
- gst-libs/gst/gl/Makefile.am        | 2 +-
- gst-libs/gst/insertbin/Makefile.am | 2 +-
- gst-libs/gst/mpegts/Makefile.am    | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
+%% original patch: 0001-Makefile.am-don-t-hardcode-libtool-name-when-running.patch
 
-Index: gst-plugins-bad-1.10.1/gst-libs/gst/gl/Makefile.am
-===================================================================
---- gst-plugins-bad-1.10.1.orig/gst-libs/gst/gl/Makefile.am
-+++ gst-plugins-bad-1.10.1/gst-libs/gst/gl/Makefile.am
-@@ -171,7 +171,7 @@ GstGL-@GST_API_VERSION@.gir: $(INTROSPEC
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
+---
+ gst-libs/gst/allocators/Makefile.am | 2 +-
+ gst-libs/gst/gl/Makefile.am         | 2 +-
+ gst-libs/gst/insertbin/Makefile.am  | 2 +-
+ gst-libs/gst/mpegts/Makefile.am     | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am
+index e50d077..623f092 100644
+--- a/gst-libs/gst/allocators/Makefile.am
++++ b/gst-libs/gst/allocators/Makefile.am
+@@ -37,7 +37,7 @@ GstBadAllocators-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstbadalloca
+ 		--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
+ 		--library=libgstbadallocators-@GST_API_VERSION@.la \
+ 		--include=Gst-@GST_API_VERSION@ \
+-		--libtool="$(top_builddir)/libtool" \
++		--libtool="$(LIBTOOL)" \
+ 		--pkg gstreamer-@GST_API_VERSION@ \
+ 		--pkg-export gstreamer-badallocators-@GST_API_VERSION@ \
+ 		--output $@ \
+diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
+index 2ae4773..dfa7a7d 100644
+--- a/gst-libs/gst/gl/Makefile.am
++++ b/gst-libs/gst/gl/Makefile.am
+@@ -178,7 +178,7 @@ GstGL-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstgl-@GST_API_VERSION@
  		--include=Gst-@GST_API_VERSION@ \
  		--include=GstBase-@GST_API_VERSION@ \
  		--include=GstVideo-@GST_API_VERSION@ \
@@ -26,11 +43,11 @@
  		--pkg gstreamer-@GST_API_VERSION@ \
  		--pkg gstreamer-base-@GST_API_VERSION@ \
  		--pkg gstreamer-video-@GST_API_VERSION@ \
-Index: gst-plugins-bad-1.10.1/gst-libs/gst/insertbin/Makefile.am
-===================================================================
---- gst-plugins-bad-1.10.1.orig/gst-libs/gst/insertbin/Makefile.am
-+++ gst-plugins-bad-1.10.1/gst-libs/gst/insertbin/Makefile.am
-@@ -45,7 +45,7 @@ GstInsertBin-@GST_API_VERSION@.gir: $(IN
+diff --git a/gst-libs/gst/insertbin/Makefile.am b/gst-libs/gst/insertbin/Makefile.am
+index 1f8ea30..4b98ef6 100644
+--- a/gst-libs/gst/insertbin/Makefile.am
++++ b/gst-libs/gst/insertbin/Makefile.am
+@@ -45,7 +45,7 @@ GstInsertBin-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstinsertbin-@GS
  		--library=libgstinsertbin-@GST_API_VERSION@.la \
  		--include=Gst-@GST_API_VERSION@ \
  		--include=GstBase-@GST_API_VERSION@ \
@@ -39,11 +56,11 @@
  		--pkg gstreamer-@GST_API_VERSION@ \
  		--pkg gstreamer-base-@GST_API_VERSION@ \
  		--pkg-export gstreamer-insertbin-@GST_API_VERSION@ \
-Index: gst-plugins-bad-1.10.1/gst-libs/gst/mpegts/Makefile.am
-===================================================================
---- gst-plugins-bad-1.10.1.orig/gst-libs/gst/mpegts/Makefile.am
-+++ gst-plugins-bad-1.10.1/gst-libs/gst/mpegts/Makefile.am
-@@ -79,7 +79,7 @@ GstMpegts-@GST_API_VERSION@.gir: $(INTRO
+diff --git a/gst-libs/gst/mpegts/Makefile.am b/gst-libs/gst/mpegts/Makefile.am
+index aeea32e..929d9cc 100644
+--- a/gst-libs/gst/mpegts/Makefile.am
++++ b/gst-libs/gst/mpegts/Makefile.am
+@@ -79,7 +79,7 @@ GstMpegts-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstmpegts-@GST_API_
  		--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-video-@GST_API_VERSION@` \
  		--library=libgstmpegts-@GST_API_VERSION@.la \
  		--include=Gst-@GST_API_VERSION@ \
@@ -52,3 +69,6 @@
  		--pkg gstreamer-@GST_API_VERSION@ \
  		--pkg gstreamer-video-@GST_API_VERSION@ \
  		--pkg-export gstreamer-mpegts-@GST_API_VERSION@ \
+-- 
+2.4.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Prepend-PKG_CONFIG_SYSROOT_DIR-to-pkg-config-output.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Prepend-PKG_CONFIG_SYSROOT_DIR-to-pkg-config-output.patch
index 86a4495..48d93ab 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Prepend-PKG_CONFIG_SYSROOT_DIR-to-pkg-config-output.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-Prepend-PKG_CONFIG_SYSROOT_DIR-to-pkg-config-output.patch
@@ -1,34 +1,38 @@
-From c271503d7e233428ac0323c51d6517113e26bef7 Mon Sep 17 00:00:00 2001
+From 7c8f68c5428380b930579dc9ef27c853264448fd Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 1 Dec 2016 00:27:13 -0800
+Date: Mon, 15 May 2017 15:06:11 +0300
 Subject: [PATCH] Prepend PKG_CONFIG_SYSROOT_DIR to pkg-config output
 
 In cross environment we have to prepend the sysroot to the path found by
 pkgconfig since the path returned from pkgconfig does not have sysroot prefixed
 it ends up using the files from host system. If build host has wayland installed
-the build will succeed but if you dont have wayland-protocols installed on build host then
-it wont find the files on build host
+the build will succeed but if you dont have wayland-protocols installed on build
+host then it wont find the files on build host
 
-This should work ok with non sysrooted builds too since in those cases PKG_CONFIG_SYSROOT_DIR
-will be empty
+This should work ok with non sysrooted builds too since
+in those cases PKG_CONFIG_SYSROOT_DIR will be empty
 
 Upstream-Status: Pending
 
 Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
 ---
  configure.ac | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: gst-plugins-bad-1.10.1/configure.ac
-===================================================================
---- gst-plugins-bad-1.10.1.orig/configure.ac
-+++ gst-plugins-bad-1.10.1/configure.ac
-@@ -2233,7 +2233,7 @@ AG_GST_CHECK_FEATURE(WAYLAND, [wayland s
-     PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, wayland-protocols >= 1.4, [
-       if test "x$wayland_scanner" != "x"; then
-         HAVE_WAYLAND="yes"
--        AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-protocols`)
-+        AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, ${WAYLAND_PROTOCOLS_SYSROOT_DIR}`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`)
-       else
-         AC_MSG_RESULT([wayland-scanner is required to build the wayland plugin])
-         HAVE_WAYLAND="no"
+diff --git a/configure.ac b/configure.ac
+index e307be6..83cdeb0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2272,7 +2272,7 @@ AG_GST_CHECK_FEATURE(WAYLAND, [wayland sink], wayland , [
+   PKG_CHECK_MODULES(WAYLAND, wayland-client >= 1.4.0 libdrm >= 2.4.55 wayland-protocols >= 1.4, [
+     if test "x$wayland_scanner" != "x"; then
+       HAVE_WAYLAND="yes"
+-      AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-protocols`)
++      AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, ${WAYLAND_PROTOCOLS_SYSROOT_DIR}`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`)
+     else
+       AC_MSG_RESULT([wayland-scanner is required to build the wayland plugin])
+       HAVE_WAYLAND="no"
+-- 
+2.4.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch
index 9fc91d8..2235a57 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-gstreamer-gl.pc.in-don-t-append-GL_CFLAGS-to-CFLAGS.patch
@@ -1,24 +1,29 @@
-From a93ca63d01e7cd1e40b5be576992f77fac364bd5 Mon Sep 17 00:00:00 2001
+From 5622ca3b61603dc316a0f1fbede3f9aa353a5e48 Mon Sep 17 00:00:00 2001
 From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Mon, 21 Mar 2016 18:21:17 +0200
+Date: Fri, 12 May 2017 16:47:12 +0300
 Subject: [PATCH] gstreamer-gl.pc.in: don't append GL_CFLAGS to CFLAGS
 
 Dependencies' include directories should not be added in this way;
 it causes problems when cross-compiling in sysroot environments.
 
 Upstream-Status: Pending
+
 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+Signed-off-by: Maxin B. John <maxin.john@intel.com>
 ---
  pkgconfig/gstreamer-gl.pc.in | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: gst-plugins-bad-1.10.1/pkgconfig/gstreamer-gl.pc.in
-===================================================================
---- gst-plugins-bad-1.10.1.orig/pkgconfig/gstreamer-gl.pc.in
-+++ gst-plugins-bad-1.10.1/pkgconfig/gstreamer-gl.pc.in
-@@ -10,4 +10,4 @@ Version: @VERSION@
+diff --git a/pkgconfig/gstreamer-gl.pc.in b/pkgconfig/gstreamer-gl.pc.in
+index 8e7a303..d167be1 100644
+--- a/pkgconfig/gstreamer-gl.pc.in
++++ b/pkgconfig/gstreamer-gl.pc.in
+@@ -13,4 +13,4 @@ Version: @VERSION@
  Requires: gstreamer-base-@GST_API_VERSION@ gstreamer-@GST_API_VERSION@
  
- Libs: -L${libdir} -lgstgl-@GST_API_VERSION@ @GL_LIBS@
+ Libs: -L${libdir} -lgstgl-@GST_API_VERSION@
 -Cflags: -I${includedir} -I${libdir}/gstreamer-@GST_API_VERSION@/include @GL_CFLAGS@
 +Cflags: -I${includedir} -I${libdir}/gstreamer-@GST_API_VERSION@/include
+-- 
+2.4.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-mssdemux-improved-live-playback-support.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-mssdemux-improved-live-playback-support.patch
deleted file mode 100644
index 4832c18..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-mssdemux-improved-live-playback-support.patch
+++ /dev/null
@@ -1,929 +0,0 @@
-From 73721ad4e9e2d32e1c8b6a3b4aaa98401530e58a Mon Sep 17 00:00:00 2001
-From: Philippe Normand <philn@igalia.com>
-Date: Tue, 29 Nov 2016 14:43:41 +0100
-Subject: [PATCH] mssdemux: improved live playback support
-
-When a MSS server hosts a live stream the fragments listed in the
-manifest usually don't have accurate timestamps and duration, except
-for the first fragment, which additionally stores timing information
-for the few upcoming fragments. In this scenario it is useless to
-periodically fetch and update the manifest and the fragments list can
-be incrementally built by parsing the first/current fragment.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=755036
----
-Upstream-Status: Backport
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
- ext/smoothstreaming/Makefile.am               |   2 +
- ext/smoothstreaming/gstmssdemux.c             |  60 ++++++
- ext/smoothstreaming/gstmssfragmentparser.c    | 266 ++++++++++++++++++++++++++
- ext/smoothstreaming/gstmssfragmentparser.h    |  84 ++++++++
- ext/smoothstreaming/gstmssmanifest.c          | 158 ++++++++++++++-
- ext/smoothstreaming/gstmssmanifest.h          |   7 +
- gst-libs/gst/adaptivedemux/gstadaptivedemux.c |  27 ++-
- gst-libs/gst/adaptivedemux/gstadaptivedemux.h |  14 ++
- 8 files changed, 606 insertions(+), 12 deletions(-)
- create mode 100644 ext/smoothstreaming/gstmssfragmentparser.c
- create mode 100644 ext/smoothstreaming/gstmssfragmentparser.h
-
-diff --git a/ext/smoothstreaming/Makefile.am b/ext/smoothstreaming/Makefile.am
-index 4faf9df9f..a5e1ad6ae 100644
---- a/ext/smoothstreaming/Makefile.am
-+++ b/ext/smoothstreaming/Makefile.am
-@@ -13,8 +13,10 @@ libgstsmoothstreaming_la_LIBADD = \
- libgstsmoothstreaming_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS}
- libgstsmoothstreaming_la_SOURCES = gstsmoothstreaming-plugin.c \
- 	gstmssdemux.c \
-+	gstmssfragmentparser.c \
- 	gstmssmanifest.c
- libgstsmoothstreaming_la_LIBTOOLFLAGS = --tag=disable-static
- 
- noinst_HEADERS = gstmssdemux.h \
-+	gstmssfragmentparser.h \
- 	gstmssmanifest.h
-diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c
-index 12fb40497..120d9c22b 100644
---- a/ext/smoothstreaming/gstmssdemux.c
-+++ b/ext/smoothstreaming/gstmssdemux.c
-@@ -135,11 +135,18 @@ gst_mss_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream);
- static gboolean gst_mss_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek);
- static gint64
- gst_mss_demux_get_manifest_update_interval (GstAdaptiveDemux * demux);
-+static gint64
-+gst_mss_demux_stream_get_fragment_waiting_time (GstAdaptiveDemuxStream *
-+    stream);
- static GstFlowReturn
- gst_mss_demux_update_manifest_data (GstAdaptiveDemux * demux,
-     GstBuffer * buffer);
- static gboolean gst_mss_demux_get_live_seek_range (GstAdaptiveDemux * demux,
-     gint64 * start, gint64 * stop);
-+static GstFlowReturn gst_mss_demux_data_received (GstAdaptiveDemux * demux,
-+    GstAdaptiveDemuxStream * stream, GstBuffer * buffer);
-+static gboolean
-+gst_mss_demux_requires_periodical_playlist_update (GstAdaptiveDemux * demux);
- 
- static void
- gst_mss_demux_class_init (GstMssDemuxClass * klass)
-@@ -192,10 +199,15 @@ gst_mss_demux_class_init (GstMssDemuxClass * klass)
-       gst_mss_demux_stream_select_bitrate;
-   gstadaptivedemux_class->stream_update_fragment_info =
-       gst_mss_demux_stream_update_fragment_info;
-+  gstadaptivedemux_class->stream_get_fragment_waiting_time =
-+      gst_mss_demux_stream_get_fragment_waiting_time;
-   gstadaptivedemux_class->update_manifest_data =
-       gst_mss_demux_update_manifest_data;
-   gstadaptivedemux_class->get_live_seek_range =
-       gst_mss_demux_get_live_seek_range;
-+  gstadaptivedemux_class->data_received = gst_mss_demux_data_received;
-+  gstadaptivedemux_class->requires_periodical_playlist_update =
-+      gst_mss_demux_requires_periodical_playlist_update;
- 
-   GST_DEBUG_CATEGORY_INIT (mssdemux_debug, "mssdemux", 0, "mssdemux plugin");
- }
-@@ -650,6 +662,13 @@ gst_mss_demux_get_manifest_update_interval (GstAdaptiveDemux * demux)
-   return interval;
- }
- 
-+static gint64
-+gst_mss_demux_stream_get_fragment_waiting_time (GstAdaptiveDemuxStream * stream)
-+{
-+  /* Wait a second for live streams so we don't try premature fragments downloading */
-+  return GST_SECOND;
-+}
-+
- static GstFlowReturn
- gst_mss_demux_update_manifest_data (GstAdaptiveDemux * demux,
-     GstBuffer * buffer)
-@@ -670,3 +689,44 @@ gst_mss_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start,
- 
-   return gst_mss_manifest_get_live_seek_range (mssdemux->manifest, start, stop);
- }
-+
-+static GstFlowReturn
-+gst_mss_demux_data_received (GstAdaptiveDemux * demux,
-+    GstAdaptiveDemuxStream * stream, GstBuffer * buffer)
-+{
-+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
-+  GstMssDemuxStream *mssstream = (GstMssDemuxStream *) stream;
-+  gsize available;
-+
-+  if (!gst_mss_manifest_is_live (mssdemux->manifest)) {
-+    return GST_ADAPTIVE_DEMUX_CLASS (parent_class)->data_received (demux,
-+        stream, buffer);
-+  }
-+
-+  if (gst_mss_stream_fragment_parsing_needed (mssstream->manifest_stream)) {
-+    gst_mss_manifest_live_adapter_push (mssstream->manifest_stream, buffer);
-+    available =
-+        gst_mss_manifest_live_adapter_available (mssstream->manifest_stream);
-+    // FIXME: try to reduce this minimal size.
-+    if (available < 4096) {
-+      return GST_FLOW_OK;
-+    } else {
-+      GST_LOG_OBJECT (stream->pad, "enough data, parsing fragment.");
-+      buffer =
-+          gst_mss_manifest_live_adapter_take_buffer (mssstream->manifest_stream,
-+          available);
-+      gst_mss_stream_parse_fragment (mssstream->manifest_stream, buffer);
-+    }
-+  }
-+
-+  return GST_ADAPTIVE_DEMUX_CLASS (parent_class)->data_received (demux, stream,
-+      buffer);
-+}
-+
-+static gboolean
-+gst_mss_demux_requires_periodical_playlist_update (GstAdaptiveDemux * demux)
-+{
-+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
-+
-+  return (!gst_mss_manifest_is_live (mssdemux->manifest));
-+}
-diff --git a/ext/smoothstreaming/gstmssfragmentparser.c b/ext/smoothstreaming/gstmssfragmentparser.c
-new file mode 100644
-index 000000000..b554d4f31
---- /dev/null
-+++ b/ext/smoothstreaming/gstmssfragmentparser.c
-@@ -0,0 +1,266 @@
-+/*
-+ * Microsoft Smooth-Streaming fragment parsing library
-+ *
-+ * gstmssfragmentparser.h
-+ *
-+ * Copyright (C) 2016 Igalia S.L
-+ * Copyright (C) 2016 Metrological
-+ *   Author: Philippe Normand <philn@igalia.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library (COPYING); if not, write to the
-+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ * Boston, MA 02111-1307, USA.
-+ */
-+
-+#include "gstmssfragmentparser.h"
-+#include <gst/base/gstbytereader.h>
-+#include <string.h>
-+
-+GST_DEBUG_CATEGORY_EXTERN (mssdemux_debug);
-+#define GST_CAT_DEFAULT mssdemux_debug
-+
-+void
-+gst_mss_fragment_parser_init (GstMssFragmentParser * parser)
-+{
-+  parser->status = GST_MSS_FRAGMENT_HEADER_PARSER_INIT;
-+  parser->tfrf.entries_count = 0;
-+}
-+
-+void
-+gst_mss_fragment_parser_clear (GstMssFragmentParser * parser)
-+{
-+  parser->tfrf.entries_count = 0;
-+  if (parser->tfrf.entries) {
-+    g_free (parser->tfrf.entries);
-+    parser->tfrf.entries = 0;
-+  }
-+}
-+
-+static gboolean
-+_parse_tfrf_box (GstMssFragmentParser * parser, GstByteReader * reader)
-+{
-+  guint8 version;
-+  guint32 flags = 0;
-+  guint8 fragment_count = 0;
-+  guint8 index = 0;
-+
-+  if (!gst_byte_reader_get_uint8 (reader, &version)) {
-+    GST_ERROR ("Error getting box's version field");
-+    return FALSE;
-+  }
-+
-+  if (!gst_byte_reader_get_uint24_be (reader, &flags)) {
-+    GST_ERROR ("Error getting box's flags field");
-+    return FALSE;
-+  }
-+
-+  gst_byte_reader_get_uint8 (reader, &fragment_count);
-+  parser->tfrf.entries_count = fragment_count;
-+  parser->tfrf.entries =
-+      g_malloc (sizeof (GstTfrfBoxEntry) * parser->tfrf.entries_count);
-+  for (index = 0; index < fragment_count; index++) {
-+    guint64 absolute_time = 0;
-+    guint64 absolute_duration = 0;
-+    if (version & 0x01) {
-+      gst_byte_reader_get_uint64_be (reader, &absolute_time);
-+      gst_byte_reader_get_uint64_be (reader, &absolute_duration);
-+    } else {
-+      guint32 time = 0;
-+      guint32 duration = 0;
-+      gst_byte_reader_get_uint32_be (reader, &time);
-+      gst_byte_reader_get_uint32_be (reader, &duration);
-+      time = ~time;
-+      duration = ~duration;
-+      absolute_time = ~time;
-+      absolute_duration = ~duration;
-+    }
-+    parser->tfrf.entries[index].time = absolute_time;
-+    parser->tfrf.entries[index].duration = absolute_duration;
-+  }
-+
-+  GST_LOG ("tfrf box parsed");
-+  return TRUE;
-+}
-+
-+static gboolean
-+_parse_tfxd_box (GstMssFragmentParser * parser, GstByteReader * reader)
-+{
-+  guint8 version;
-+  guint32 flags = 0;
-+  guint64 absolute_time = 0;
-+  guint64 absolute_duration = 0;
-+
-+  if (!gst_byte_reader_get_uint8 (reader, &version)) {
-+    GST_ERROR ("Error getting box's version field");
-+    return FALSE;
-+  }
-+
-+  if (!gst_byte_reader_get_uint24_be (reader, &flags)) {
-+    GST_ERROR ("Error getting box's flags field");
-+    return FALSE;
-+  }
-+
-+  if (version & 0x01) {
-+    gst_byte_reader_get_uint64_be (reader, &absolute_time);
-+    gst_byte_reader_get_uint64_be (reader, &absolute_duration);
-+  } else {
-+    guint32 time = 0;
-+    guint32 duration = 0;
-+    gst_byte_reader_get_uint32_be (reader, &time);
-+    gst_byte_reader_get_uint32_be (reader, &duration);
-+    time = ~time;
-+    duration = ~duration;
-+    absolute_time = ~time;
-+    absolute_duration = ~duration;
-+  }
-+
-+  parser->tfxd.time = absolute_time;
-+  parser->tfxd.duration = absolute_duration;
-+  GST_LOG ("tfxd box parsed");
-+  return TRUE;
-+}
-+
-+gboolean
-+gst_mss_fragment_parser_add_buffer (GstMssFragmentParser * parser,
-+    GstBuffer * buffer)
-+{
-+  GstByteReader reader;
-+  GstMapInfo info;
-+  guint32 size;
-+  guint32 fourcc;
-+  const guint8 *uuid;
-+  gboolean error = FALSE;
-+  gboolean mdat_box_found = FALSE;
-+
-+  static const guint8 tfrf_uuid[] = {
-+    0xd4, 0x80, 0x7e, 0xf2, 0xca, 0x39, 0x46, 0x95,
-+    0x8e, 0x54, 0x26, 0xcb, 0x9e, 0x46, 0xa7, 0x9f
-+  };
-+
-+  static const guint8 tfxd_uuid[] = {
-+    0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
-+    0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
-+  };
-+
-+  static const guint8 piff_uuid[] = {
-+    0xa2, 0x39, 0x4f, 0x52, 0x5a, 0x9b, 0x4f, 0x14,
-+    0xa2, 0x44, 0x6c, 0x42, 0x7c, 0x64, 0x8d, 0xf4
-+  };
-+
-+  if (!gst_buffer_map (buffer, &info, GST_MAP_READ)) {
-+    return FALSE;
-+  }
-+
-+  gst_byte_reader_init (&reader, info.data, info.size);
-+  GST_TRACE ("Total buffer size: %u", gst_byte_reader_get_size (&reader));
-+
-+  size = gst_byte_reader_get_uint32_be_unchecked (&reader);
-+  fourcc = gst_byte_reader_get_uint32_le_unchecked (&reader);
-+  if (fourcc == GST_MSS_FRAGMENT_FOURCC_MOOF) {
-+    GST_TRACE ("moof box found");
-+    size = gst_byte_reader_get_uint32_be_unchecked (&reader);
-+    fourcc = gst_byte_reader_get_uint32_le_unchecked (&reader);
-+    if (fourcc == GST_MSS_FRAGMENT_FOURCC_MFHD) {
-+      gst_byte_reader_skip_unchecked (&reader, size - 8);
-+
-+      size = gst_byte_reader_get_uint32_be_unchecked (&reader);
-+      fourcc = gst_byte_reader_get_uint32_le_unchecked (&reader);
-+      if (fourcc == GST_MSS_FRAGMENT_FOURCC_TRAF) {
-+        size = gst_byte_reader_get_uint32_be_unchecked (&reader);
-+        fourcc = gst_byte_reader_get_uint32_le_unchecked (&reader);
-+        if (fourcc == GST_MSS_FRAGMENT_FOURCC_TFHD) {
-+          gst_byte_reader_skip_unchecked (&reader, size - 8);
-+
-+          size = gst_byte_reader_get_uint32_be_unchecked (&reader);
-+          fourcc = gst_byte_reader_get_uint32_le_unchecked (&reader);
-+          if (fourcc == GST_MSS_FRAGMENT_FOURCC_TRUN) {
-+            GST_TRACE ("trun box found, size: %" G_GUINT32_FORMAT, size);
-+            if (!gst_byte_reader_skip (&reader, size - 8)) {
-+              GST_WARNING ("Failed to skip trun box, enough data?");
-+              error = TRUE;
-+              goto beach;
-+            }
-+          }
-+        }
-+      }
-+    }
-+  }
-+
-+  while (!mdat_box_found) {
-+    GST_TRACE ("remaining data: %u", gst_byte_reader_get_remaining (&reader));
-+    if (!gst_byte_reader_get_uint32_be (&reader, &size)) {
-+      GST_WARNING ("Failed to get box size, enough data?");
-+      error = TRUE;
-+      break;
-+    }
-+
-+    GST_TRACE ("box size: %" G_GUINT32_FORMAT, size);
-+    if (!gst_byte_reader_get_uint32_le (&reader, &fourcc)) {
-+      GST_WARNING ("Failed to get fourcc, enough data?");
-+      error = TRUE;
-+      break;
-+    }
-+
-+    if (fourcc == GST_MSS_FRAGMENT_FOURCC_MDAT) {
-+      GST_LOG ("mdat box found");
-+      mdat_box_found = TRUE;
-+      break;
-+    }
-+
-+    if (fourcc != GST_MSS_FRAGMENT_FOURCC_UUID) {
-+      GST_ERROR ("invalid UUID fourcc: %" GST_FOURCC_FORMAT,
-+          GST_FOURCC_ARGS (fourcc));
-+      error = TRUE;
-+      break;
-+    }
-+
-+    if (!gst_byte_reader_peek_data (&reader, 16, &uuid)) {
-+      GST_ERROR ("not enough data in UUID box");
-+      error = TRUE;
-+      break;
-+    }
-+
-+    if (memcmp (uuid, piff_uuid, 16) == 0) {
-+      gst_byte_reader_skip_unchecked (&reader, size - 8);
-+      GST_LOG ("piff box detected");
-+    }
-+
-+    if (memcmp (uuid, tfrf_uuid, 16) == 0) {
-+      gst_byte_reader_get_data (&reader, 16, &uuid);
-+      if (!_parse_tfrf_box (parser, &reader)) {
-+        GST_ERROR ("txrf box parsing error");
-+        error = TRUE;
-+        break;
-+      }
-+    }
-+
-+    if (memcmp (uuid, tfxd_uuid, 16) == 0) {
-+      gst_byte_reader_get_data (&reader, 16, &uuid);
-+      if (!_parse_tfxd_box (parser, &reader)) {
-+        GST_ERROR ("tfrf box parsing error");
-+        error = TRUE;
-+        break;
-+      }
-+    }
-+  }
-+
-+beach:
-+
-+  if (!error)
-+    parser->status = GST_MSS_FRAGMENT_HEADER_PARSER_FINISHED;
-+
-+  GST_LOG ("Fragment parsing successful: %s", error ? "no" : "yes");
-+  gst_buffer_unmap (buffer, &info);
-+  return !error;
-+}
-diff --git a/ext/smoothstreaming/gstmssfragmentparser.h b/ext/smoothstreaming/gstmssfragmentparser.h
-new file mode 100644
-index 000000000..cf4711865
---- /dev/null
-+++ b/ext/smoothstreaming/gstmssfragmentparser.h
-@@ -0,0 +1,84 @@
-+/*
-+ * Microsoft Smooth-Streaming fragment parsing library
-+ *
-+ * gstmssfragmentparser.h
-+ *
-+ * Copyright (C) 2016 Igalia S.L
-+ * Copyright (C) 2016 Metrological
-+ *   Author: Philippe Normand <philn@igalia.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library (COPYING); if not, write to the
-+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ * Boston, MA 02111-1307, USA.
-+ */
-+
-+#ifndef __GST_MSS_FRAGMENT_PARSER_H__
-+#define __GST_MSS_FRAGMENT_PARSER_H__
-+
-+#include <gst/gst.h>
-+
-+G_BEGIN_DECLS
-+
-+#define GST_MSS_FRAGMENT_FOURCC_MOOF GST_MAKE_FOURCC('m','o','o','f')
-+#define GST_MSS_FRAGMENT_FOURCC_MFHD GST_MAKE_FOURCC('m','f','h','d')
-+#define GST_MSS_FRAGMENT_FOURCC_TRAF GST_MAKE_FOURCC('t','r','a','f')
-+#define GST_MSS_FRAGMENT_FOURCC_TFHD GST_MAKE_FOURCC('t','f','h','d')
-+#define GST_MSS_FRAGMENT_FOURCC_TRUN GST_MAKE_FOURCC('t','r','u','n')
-+#define GST_MSS_FRAGMENT_FOURCC_UUID GST_MAKE_FOURCC('u','u','i','d')
-+#define GST_MSS_FRAGMENT_FOURCC_MDAT GST_MAKE_FOURCC('m','d','a','t')
-+
-+typedef struct _GstTfxdBox
-+{
-+  guint8 version;
-+  guint32 flags;
-+
-+  guint64 time;
-+  guint64 duration;
-+} GstTfxdBox;
-+
-+typedef struct _GstTfrfBoxEntry
-+{
-+  guint64 time;
-+  guint64 duration;
-+} GstTfrfBoxEntry;
-+
-+typedef struct _GstTfrfBox
-+{
-+  guint8 version;
-+  guint32 flags;
-+
-+  gint entries_count;
-+  GstTfrfBoxEntry *entries;
-+} GstTfrfBox;
-+
-+typedef enum _GstFragmentHeaderParserStatus
-+{
-+  GST_MSS_FRAGMENT_HEADER_PARSER_INIT,
-+  GST_MSS_FRAGMENT_HEADER_PARSER_FINISHED
-+} GstFragmentHeaderParserStatus;
-+
-+typedef struct _GstMssFragmentParser
-+{
-+  GstFragmentHeaderParserStatus status;
-+  GstTfxdBox tfxd;
-+  GstTfrfBox tfrf;
-+} GstMssFragmentParser;
-+
-+void gst_mss_fragment_parser_init (GstMssFragmentParser * parser);
-+void gst_mss_fragment_parser_clear (GstMssFragmentParser * parser);
-+gboolean gst_mss_fragment_parser_add_buffer (GstMssFragmentParser * parser, GstBuffer * buf);
-+
-+G_END_DECLS
-+
-+#endif /* __GST_MSS_FRAGMENT_PARSER_H__ */
-diff --git a/ext/smoothstreaming/gstmssmanifest.c b/ext/smoothstreaming/gstmssmanifest.c
-index 144bbb42d..e1031ba55 100644
---- a/ext/smoothstreaming/gstmssmanifest.c
-+++ b/ext/smoothstreaming/gstmssmanifest.c
-@@ -1,5 +1,7 @@
- /* GStreamer
-  * Copyright (C) 2012 Smart TV Alliance
-+ * Copyright (C) 2016 Igalia S.L
-+ * Copyright (C) 2016 Metrological
-  *  Author: Thiago Sousa Santos <thiago.sousa.santos@collabora.com>, Collabora Ltd.
-  *
-  * gstmssmanifest.c:
-@@ -31,6 +33,7 @@
- #include <gst/codecparsers/gsth264parser.h>
- 
- #include "gstmssmanifest.h"
-+#include "gstmssfragmentparser.h"
- 
- GST_DEBUG_CATEGORY_EXTERN (mssdemux_debug);
- #define GST_CAT_DEFAULT mssdemux_debug
-@@ -74,12 +77,17 @@ struct _GstMssStream
-   gboolean active;              /* if the stream is currently being used */
-   gint selectedQualityIndex;
- 
-+  gboolean has_live_fragments;
-+  GstAdapter *live_adapter;
-+
-   GList *fragments;
-   GList *qualities;
- 
-   gchar *url;
-   gchar *lang;
- 
-+  GstMssFragmentParser fragment_parser;
-+
-   guint fragment_repetition_index;
-   GList *current_fragment;
-   GList *current_quality;
-@@ -96,6 +104,7 @@ struct _GstMssManifest
- 
-   gboolean is_live;
-   gint64 dvr_window;
-+  guint64 look_ahead_fragment_count;
- 
-   GString *protection_system_id;
-   gchar *protection_data;
-@@ -235,7 +244,8 @@ compare_bitrate (GstMssStreamQuality * a, GstMssStreamQuality * b)
- }
- 
- static void
--_gst_mss_stream_init (GstMssStream * stream, xmlNodePtr node)
-+_gst_mss_stream_init (GstMssManifest * manifest, GstMssStream * stream,
-+    xmlNodePtr node)
- {
-   xmlNodePtr iter;
-   GstMssFragmentListBuilder builder;
-@@ -248,9 +258,21 @@ _gst_mss_stream_init (GstMssStream * stream, xmlNodePtr node)
-   stream->url = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_URL);
-   stream->lang = (gchar *) xmlGetProp (node, (xmlChar *) MSS_PROP_LANGUAGE);
- 
-+  /* for live playback each fragment usually has timing
-+   * information for the few next look-ahead fragments so the
-+   * playlist can be built incrementally from the first fragment
-+   * of the manifest.
-+   */
-+
-+  GST_DEBUG ("Live stream: %s, look-ahead fragments: %" G_GUINT64_FORMAT,
-+      manifest->is_live ? "yes" : "no", manifest->look_ahead_fragment_count);
-+  stream->has_live_fragments = manifest->is_live
-+      && manifest->look_ahead_fragment_count;
-+
-   for (iter = node->children; iter; iter = iter->next) {
-     if (node_has_type (iter, MSS_NODE_STREAM_FRAGMENT)) {
--      gst_mss_fragment_list_builder_add (&builder, iter);
-+      if (!stream->has_live_fragments || !builder.fragments)
-+        gst_mss_fragment_list_builder_add (&builder, iter);
-     } else if (node_has_type (iter, MSS_NODE_STREAM_QUALITY)) {
-       GstMssStreamQuality *quality = gst_mss_stream_quality_new (iter);
-       stream->qualities = g_list_prepend (stream->qualities, quality);
-@@ -259,17 +281,24 @@ _gst_mss_stream_init (GstMssStream * stream, xmlNodePtr node)
-     }
-   }
- 
--  stream->fragments = g_list_reverse (builder.fragments);
-+  if (stream->has_live_fragments) {
-+    stream->live_adapter = gst_adapter_new ();
-+  }
-+
-+  if (builder.fragments) {
-+    stream->fragments = g_list_reverse (builder.fragments);
-+    stream->current_fragment = stream->fragments;
-+  }
- 
-   /* order them from smaller to bigger based on bitrates */
-   stream->qualities =
-       g_list_sort (stream->qualities, (GCompareFunc) compare_bitrate);
--
--  stream->current_fragment = stream->fragments;
-   stream->current_quality = stream->qualities;
- 
-   stream->regex_bitrate = g_regex_new ("\\{[Bb]itrate\\}", 0, 0, NULL);
-   stream->regex_position = g_regex_new ("\\{start[ _]time\\}", 0, 0, NULL);
-+
-+  gst_mss_fragment_parser_init (&stream->fragment_parser);
- }
- 
- 
-@@ -315,6 +344,7 @@ gst_mss_manifest_new (GstBuffer * data)
-   xmlNodePtr nodeiter;
-   gchar *live_str;
-   GstMapInfo mapinfo;
-+  gchar *look_ahead_fragment_count_str;
- 
-   if (!gst_buffer_map (data, &mapinfo, GST_MAP_READ)) {
-     return NULL;
-@@ -335,6 +365,7 @@ gst_mss_manifest_new (GstBuffer * data)
-   /* the entire file is always available for non-live streams */
-   if (!manifest->is_live) {
-     manifest->dvr_window = 0;
-+    manifest->look_ahead_fragment_count = 0;
-   } else {
-     /* if 0, or non-existent, the length is infinite */
-     gchar *dvr_window_str = (gchar *) xmlGetProp (root,
-@@ -346,6 +377,17 @@ gst_mss_manifest_new (GstBuffer * data)
-         manifest->dvr_window = 0;
-       }
-     }
-+
-+    look_ahead_fragment_count_str =
-+        (gchar *) xmlGetProp (root, (xmlChar *) "LookAheadFragmentCount");
-+    if (look_ahead_fragment_count_str) {
-+      manifest->look_ahead_fragment_count =
-+          g_ascii_strtoull (look_ahead_fragment_count_str, NULL, 10);
-+      xmlFree (look_ahead_fragment_count_str);
-+      if (manifest->look_ahead_fragment_count <= 0) {
-+        manifest->look_ahead_fragment_count = 0;
-+      }
-+    }
-   }
- 
-   for (nodeiter = root->children; nodeiter; nodeiter = nodeiter->next) {
-@@ -354,7 +396,7 @@ gst_mss_manifest_new (GstBuffer * data)
-       GstMssStream *stream = g_new0 (GstMssStream, 1);
- 
-       manifest->streams = g_slist_append (manifest->streams, stream);
--      _gst_mss_stream_init (stream, nodeiter);
-+      _gst_mss_stream_init (manifest, stream, nodeiter);
-     }
- 
-     if (nodeiter->type == XML_ELEMENT_NODE
-@@ -371,6 +413,11 @@ gst_mss_manifest_new (GstBuffer * data)
- static void
- gst_mss_stream_free (GstMssStream * stream)
- {
-+  if (stream->live_adapter) {
-+    gst_adapter_clear (stream->live_adapter);
-+    g_object_unref (stream->live_adapter);
-+  }
-+
-   g_list_free_full (stream->fragments, g_free);
-   g_list_free_full (stream->qualities,
-       (GDestroyNotify) gst_mss_stream_quality_free);
-@@ -379,6 +426,7 @@ gst_mss_stream_free (GstMssStream * stream)
-   g_regex_unref (stream->regex_position);
-   g_regex_unref (stream->regex_bitrate);
-   g_free (stream);
-+  gst_mss_fragment_parser_clear (&stream->fragment_parser);
- }
- 
- void
-@@ -1079,6 +1127,9 @@ GstFlowReturn
- gst_mss_stream_advance_fragment (GstMssStream * stream)
- {
-   GstMssStreamFragment *fragment;
-+  const gchar *stream_type_name =
-+      gst_mss_stream_type_name (gst_mss_stream_get_type (stream));
-+
-   g_return_val_if_fail (stream->active, GST_FLOW_ERROR);
- 
-   if (stream->current_fragment == NULL)
-@@ -1086,14 +1137,20 @@ gst_mss_stream_advance_fragment (GstMssStream * stream)
- 
-   fragment = stream->current_fragment->data;
-   stream->fragment_repetition_index++;
--  if (stream->fragment_repetition_index < fragment->repetitions) {
--    return GST_FLOW_OK;
--  }
-+  if (stream->fragment_repetition_index < fragment->repetitions)
-+    goto beach;
- 
-   stream->fragment_repetition_index = 0;
-   stream->current_fragment = g_list_next (stream->current_fragment);
-+
-+  GST_DEBUG ("Advanced to fragment #%d on %s stream", fragment->number,
-+      stream_type_name);
-   if (stream->current_fragment == NULL)
-     return GST_FLOW_EOS;
-+
-+beach:
-+  gst_mss_fragment_parser_clear (&stream->fragment_parser);
-+  gst_mss_fragment_parser_init (&stream->fragment_parser);
-   return GST_FLOW_OK;
- }
- 
-@@ -1173,6 +1230,11 @@ gst_mss_stream_seek (GstMssStream * stream, gboolean forward,
-   GST_DEBUG ("Stream %s seeking to %" G_GUINT64_FORMAT, stream->url, time);
-   for (iter = stream->fragments; iter; iter = g_list_next (iter)) {
-     fragment = iter->data;
-+    if (stream->has_live_fragments) {
-+      if (fragment->time + fragment->repetitions * fragment->duration > time)
-+        stream->current_fragment = iter;
-+      break;
-+    }
-     if (fragment->time + fragment->repetitions * fragment->duration > time) {
-       stream->current_fragment = iter;
-       stream->fragment_repetition_index =
-@@ -1256,9 +1318,14 @@ static void
- gst_mss_stream_reload_fragments (GstMssStream * stream, xmlNodePtr streamIndex)
- {
-   xmlNodePtr iter;
--  guint64 current_gst_time = gst_mss_stream_get_fragment_gst_timestamp (stream);
-+  guint64 current_gst_time;
-   GstMssFragmentListBuilder builder;
- 
-+  if (stream->has_live_fragments)
-+    return;
-+
-+  current_gst_time = gst_mss_stream_get_fragment_gst_timestamp (stream);
-+
-   gst_mss_fragment_list_builder_init (&builder);
- 
-   GST_DEBUG ("Current position: %" GST_TIME_FORMAT,
-@@ -1514,3 +1581,74 @@ gst_mss_manifest_get_live_seek_range (GstMssManifest * manifest, gint64 * start,
- 
-   return ret;
- }
-+
-+void
-+gst_mss_manifest_live_adapter_push (GstMssStream * stream, GstBuffer * buffer)
-+{
-+  gst_adapter_push (stream->live_adapter, buffer);
-+}
-+
-+gsize
-+gst_mss_manifest_live_adapter_available (GstMssStream * stream)
-+{
-+  return gst_adapter_available (stream->live_adapter);
-+}
-+
-+GstBuffer *
-+gst_mss_manifest_live_adapter_take_buffer (GstMssStream * stream, gsize nbytes)
-+{
-+  return gst_adapter_take_buffer (stream->live_adapter, nbytes);
-+}
-+
-+gboolean
-+gst_mss_stream_fragment_parsing_needed (GstMssStream * stream)
-+{
-+  return stream->fragment_parser.status == GST_MSS_FRAGMENT_HEADER_PARSER_INIT;
-+}
-+
-+void
-+gst_mss_stream_parse_fragment (GstMssStream * stream, GstBuffer * buffer)
-+{
-+  GstMssStreamFragment *current_fragment = NULL;
-+  const gchar *stream_type_name;
-+  guint8 index;
-+
-+  if (!stream->has_live_fragments)
-+    return;
-+
-+  if (!gst_mss_fragment_parser_add_buffer (&stream->fragment_parser, buffer))
-+    return;
-+
-+  current_fragment = stream->current_fragment->data;
-+  current_fragment->time = stream->fragment_parser.tfxd.time;
-+  current_fragment->duration = stream->fragment_parser.tfxd.duration;
-+
-+  stream_type_name =
-+      gst_mss_stream_type_name (gst_mss_stream_get_type (stream));
-+
-+  for (index = 0; index < stream->fragment_parser.tfrf.entries_count; index++) {
-+    GList *l = g_list_last (stream->fragments);
-+    GstMssStreamFragment *last;
-+    GstMssStreamFragment *fragment;
-+
-+    if (l == NULL)
-+      break;
-+
-+    last = (GstMssStreamFragment *) l->data;
-+
-+    if (last->time == stream->fragment_parser.tfrf.entries[index].time)
-+      continue;
-+
-+    fragment = g_new (GstMssStreamFragment, 1);
-+    fragment->number = last->number + 1;
-+    fragment->repetitions = 1;
-+    fragment->time = stream->fragment_parser.tfrf.entries[index].time;
-+    fragment->duration = stream->fragment_parser.tfrf.entries[index].duration;
-+
-+    stream->fragments = g_list_append (stream->fragments, fragment);
-+    GST_LOG ("Adding fragment number: %u to %s stream, time: %" G_GUINT64_FORMAT
-+        ", duration: %" G_GUINT64_FORMAT ", repetitions: %u",
-+        fragment->number, stream_type_name,
-+        fragment->time, fragment->duration, fragment->repetitions);
-+  }
-+}
-diff --git a/ext/smoothstreaming/gstmssmanifest.h b/ext/smoothstreaming/gstmssmanifest.h
-index 6b7b1f971..03b066ae5 100644
---- a/ext/smoothstreaming/gstmssmanifest.h
-+++ b/ext/smoothstreaming/gstmssmanifest.h
-@@ -26,6 +26,7 @@
- #include <glib.h>
- #include <gio/gio.h>
- #include <gst/gst.h>
-+#include <gst/base/gstadapter.h>
- 
- G_BEGIN_DECLS
- 
-@@ -73,5 +74,11 @@ const gchar * gst_mss_stream_get_lang (GstMssStream * stream);
- 
- const gchar * gst_mss_stream_type_name (GstMssStreamType streamtype);
- 
-+void gst_mss_manifest_live_adapter_push(GstMssStream * stream, GstBuffer * buffer);
-+gsize gst_mss_manifest_live_adapter_available(GstMssStream * stream);
-+GstBuffer * gst_mss_manifest_live_adapter_take_buffer(GstMssStream * stream, gsize nbytes);
-+gboolean gst_mss_stream_fragment_parsing_needed(GstMssStream * stream);
-+void gst_mss_stream_parse_fragment(GstMssStream * stream, GstBuffer * buffer);
-+
- G_END_DECLS
- #endif /* __GST_MSS_MANIFEST_H__ */
-diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
-index 634e4f388..ddca726b6 100644
---- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
-+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
-@@ -291,6 +291,9 @@ gst_adaptive_demux_wait_until (GstClock * clock, GCond * cond, GMutex * mutex,
-     GstClockTime end_time);
- static gboolean gst_adaptive_demux_clock_callback (GstClock * clock,
-     GstClockTime time, GstClockID id, gpointer user_data);
-+static gboolean
-+gst_adaptive_demux_requires_periodical_playlist_update_default (GstAdaptiveDemux
-+    * demux);
- 
- /* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
-  * method to get to the padtemplates */
-@@ -412,6 +415,9 @@ gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass)
-   klass->data_received = gst_adaptive_demux_stream_data_received_default;
-   klass->finish_fragment = gst_adaptive_demux_stream_finish_fragment_default;
-   klass->update_manifest = gst_adaptive_demux_update_manifest_default;
-+  klass->requires_periodical_playlist_update =
-+      gst_adaptive_demux_requires_periodical_playlist_update_default;
-+
- }
- 
- static void
-@@ -686,7 +692,9 @@ gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
-             demux->priv->stop_updates_task = FALSE;
-             g_mutex_unlock (&demux->priv->updates_timed_lock);
-             /* Task to periodically update the manifest */
--            gst_task_start (demux->priv->updates_task);
-+            if (demux_class->requires_periodical_playlist_update (demux)) {
-+              gst_task_start (demux->priv->updates_task);
-+            }
-           }
-         } else {
-           /* no streams */
-@@ -2125,6 +2133,13 @@ gst_adaptive_demux_stream_data_received_default (GstAdaptiveDemux * demux,
-   return gst_adaptive_demux_stream_push_buffer (stream, buffer);
- }
- 
-+static gboolean
-+gst_adaptive_demux_requires_periodical_playlist_update_default (GstAdaptiveDemux
-+    * demux)
-+{
-+  return TRUE;
-+}
-+
- static GstFlowReturn
- _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
- {
-@@ -3338,7 +3353,15 @@ gst_adaptive_demux_stream_download_loop (GstAdaptiveDemuxStream * stream)
-       GST_DEBUG_OBJECT (stream->pad, "EOS, checking to stop download loop");
-       /* we push the EOS after releasing the object lock */
-       if (gst_adaptive_demux_is_live (demux)) {
--        if (gst_adaptive_demux_stream_wait_manifest_update (demux, stream)) {
-+        GstAdaptiveDemuxClass *demux_class =
-+            GST_ADAPTIVE_DEMUX_GET_CLASS (demux);
-+
-+        /* this might be a fragment download error, refresh the manifest, just in case */
-+        if (!demux_class->requires_periodical_playlist_update (demux)) {
-+          ret = gst_adaptive_demux_update_manifest (demux);
-+          break;
-+        } else if (gst_adaptive_demux_stream_wait_manifest_update (demux,
-+                stream)) {
-           goto end;
-         }
-         gst_task_stop (stream->download_task);
-diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
-index 780f4d93f..9a1a1b7d1 100644
---- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
-+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
-@@ -459,6 +459,20 @@ struct _GstAdaptiveDemuxClass
-    * selected period.
-    */
-   GstClockTime (*get_period_start_time) (GstAdaptiveDemux *demux);
-+
-+  /**
-+   * requires_periodical_playlist_update:
-+   * @demux: #GstAdaptiveDemux
-+   *
-+   * Some adaptive streaming protocols allow the client to download
-+   * the playlist once and build up the fragment list based on the
-+   * current fragment metadata. For those protocols the demuxer
-+   * doesn't need to periodically refresh the playlist. This vfunc
-+   * is relevant only for live playback scenarios.
-+   *
-+   * Return: %TRUE if the playlist needs to be refreshed periodically by the demuxer.
-+   */
-+  gboolean (*requires_periodical_playlist_update) (GstAdaptiveDemux * demux);
- };
- 
- GType    gst_adaptive_demux_get_type (void);
--- 
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-smoothstreaming-implement-adaptivedemux-s-get_live_s.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-smoothstreaming-implement-adaptivedemux-s-get_live_s.patch
deleted file mode 100644
index 76d29e1..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-smoothstreaming-implement-adaptivedemux-s-get_live_s.patch
+++ /dev/null
@@ -1,183 +0,0 @@
-From e9178fa082116d4bf733b184a8b6951112c17900 Mon Sep 17 00:00:00 2001
-From: Matthew Waters <matthew@centricular.com>
-Date: Thu, 10 Nov 2016 17:18:36 +1100
-Subject: [PATCH] smoothstreaming: implement adaptivedemux's
- get_live_seek_range()
-
-Allows seeking through the available fragments that are still available
-on the server as specified by the DVRWindowLength attribute in the
-manifest.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=774178
----
-Upstream-Status: Backport
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
- ext/smoothstreaming/gstmssdemux.c    | 13 ++++++
- ext/smoothstreaming/gstmssmanifest.c | 84 ++++++++++++++++++++++++++++++++++++
- ext/smoothstreaming/gstmssmanifest.h |  1 +
- 3 files changed, 98 insertions(+)
-
-diff --git a/ext/smoothstreaming/gstmssdemux.c b/ext/smoothstreaming/gstmssdemux.c
-index 9d0aece2b..b66e19514 100644
---- a/ext/smoothstreaming/gstmssdemux.c
-+++ b/ext/smoothstreaming/gstmssdemux.c
-@@ -138,6 +138,8 @@ gst_mss_demux_get_manifest_update_interval (GstAdaptiveDemux * demux);
- static GstFlowReturn
- gst_mss_demux_update_manifest_data (GstAdaptiveDemux * demux,
-     GstBuffer * buffer);
-+static gboolean gst_mss_demux_get_live_seek_range (GstAdaptiveDemux * demux,
-+    gint64 * start, gint64 * stop);
- 
- static void
- gst_mss_demux_class_init (GstMssDemuxClass * klass)
-@@ -192,6 +194,8 @@ gst_mss_demux_class_init (GstMssDemuxClass * klass)
-       gst_mss_demux_stream_update_fragment_info;
-   gstadaptivedemux_class->update_manifest_data =
-       gst_mss_demux_update_manifest_data;
-+  gstadaptivedemux_class->get_live_seek_range =
-+      gst_mss_demux_get_live_seek_range;
- 
-   GST_DEBUG_CATEGORY_INIT (mssdemux_debug, "mssdemux", 0, "mssdemux plugin");
- }
-@@ -659,3 +663,12 @@ gst_mss_demux_update_manifest_data (GstAdaptiveDemux * demux,
-   gst_mss_manifest_reload_fragments (mssdemux->manifest, buffer);
-   return GST_FLOW_OK;
- }
-+
-+static gboolean
-+gst_mss_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start,
-+    gint64 * stop)
-+{
-+  GstMssDemux *mssdemux = GST_MSS_DEMUX_CAST (demux);
-+
-+  return gst_mss_manifest_get_live_seek_range (mssdemux->manifest, start, stop);
-+}
-diff --git a/ext/smoothstreaming/gstmssmanifest.c b/ext/smoothstreaming/gstmssmanifest.c
-index 1b72e8de1..317b3cef9 100644
---- a/ext/smoothstreaming/gstmssmanifest.c
-+++ b/ext/smoothstreaming/gstmssmanifest.c
-@@ -42,6 +42,7 @@ GST_DEBUG_CATEGORY_EXTERN (mssdemux_debug);
- 
- #define MSS_PROP_BITRATE              "Bitrate"
- #define MSS_PROP_DURATION             "d"
-+#define MSS_PROP_DVR_WINDOW_LENGTH    "DVRWindowLength"
- #define MSS_PROP_LANGUAGE             "Language"
- #define MSS_PROP_NUMBER               "n"
- #define MSS_PROP_REPETITIONS          "r"
-@@ -94,6 +95,7 @@ struct _GstMssManifest
-   xmlNodePtr xmlrootnode;
- 
-   gboolean is_live;
-+  gint64 dvr_window;
- 
-   GString *protection_system_id;
-   gchar *protection_data;
-@@ -330,6 +332,22 @@ gst_mss_manifest_new (GstBuffer * data)
-     xmlFree (live_str);
-   }
- 
-+  /* the entire file is always available for non-live streams */
-+  if (!manifest->is_live) {
-+    manifest->dvr_window = 0;
-+  } else {
-+    /* if 0, or non-existent, the length is infinite */
-+    gchar *dvr_window_str = (gchar *) xmlGetProp (root,
-+        (xmlChar *) MSS_PROP_DVR_WINDOW_LENGTH);
-+    if (dvr_window_str) {
-+      manifest->dvr_window = g_ascii_strtoull (dvr_window_str, NULL, 10);
-+      xmlFree (dvr_window_str);
-+      if (manifest->dvr_window <= 0) {
-+        manifest->dvr_window = 0;
-+      }
-+    }
-+  }
-+
-   for (nodeiter = root->children; nodeiter; nodeiter = nodeiter->next) {
-     if (nodeiter->type == XML_ELEMENT_NODE
-         && (strcmp ((const char *) nodeiter->name, "StreamIndex") == 0)) {
-@@ -1406,3 +1424,69 @@ gst_mss_stream_get_lang (GstMssStream * stream)
- {
-   return stream->lang;
- }
-+
-+static GstClockTime
-+gst_mss_manifest_get_dvr_window_length_clock_time (GstMssManifest * manifest)
-+{
-+  gint64 timescale;
-+
-+  /* the entire file is always available for non-live streams */
-+  if (manifest->dvr_window == 0)
-+    return GST_CLOCK_TIME_NONE;
-+
-+  timescale = gst_mss_manifest_get_timescale (manifest);
-+  return (GstClockTime) gst_util_uint64_scale_round (manifest->dvr_window,
-+      GST_SECOND, timescale);
-+}
-+
-+static gboolean
-+gst_mss_stream_get_live_seek_range (GstMssStream * stream, gint64 * start,
-+    gint64 * stop)
-+{
-+  GList *l;
-+  GstMssStreamFragment *fragment;
-+  guint64 timescale = gst_mss_stream_get_timescale (stream);
-+
-+  g_return_val_if_fail (stream->active, FALSE);
-+
-+  /* XXX: assumes all the data in the stream is still available */
-+  l = g_list_first (stream->fragments);
-+  fragment = (GstMssStreamFragment *) l->data;
-+  *start = gst_util_uint64_scale_round (fragment->time, GST_SECOND, timescale);
-+
-+  l = g_list_last (stream->fragments);
-+  fragment = (GstMssStreamFragment *) l->data;
-+  *stop = gst_util_uint64_scale_round (fragment->time + fragment->duration *
-+      fragment->repetitions, GST_SECOND, timescale);
-+
-+  return TRUE;
-+}
-+
-+gboolean
-+gst_mss_manifest_get_live_seek_range (GstMssManifest * manifest, gint64 * start,
-+    gint64 * stop)
-+{
-+  GSList *iter;
-+  gboolean ret = FALSE;
-+
-+  for (iter = manifest->streams; iter; iter = g_slist_next (iter)) {
-+    GstMssStream *stream = iter->data;
-+
-+    if (stream->active) {
-+      /* FIXME: bound this correctly for multiple streams */
-+      if (!(ret = gst_mss_stream_get_live_seek_range (stream, start, stop)))
-+        break;
-+    }
-+  }
-+
-+  if (ret && gst_mss_manifest_is_live (manifest)) {
-+    GstClockTime dvr_window =
-+        gst_mss_manifest_get_dvr_window_length_clock_time (manifest);
-+
-+    if (GST_CLOCK_TIME_IS_VALID (dvr_window) && *stop - *start > dvr_window) {
-+      *start = *stop - dvr_window;
-+    }
-+  }
-+
-+  return ret;
-+}
-diff --git a/ext/smoothstreaming/gstmssmanifest.h b/ext/smoothstreaming/gstmssmanifest.h
-index af7419c23..6b7b1f971 100644
---- a/ext/smoothstreaming/gstmssmanifest.h
-+++ b/ext/smoothstreaming/gstmssmanifest.h
-@@ -54,6 +54,7 @@ void gst_mss_manifest_reload_fragments (GstMssManifest * manifest, GstBuffer * d
- GstClockTime gst_mss_manifest_get_min_fragment_duration (GstMssManifest * manifest);
- const gchar * gst_mss_manifest_get_protection_system_id (GstMssManifest * manifest);
- const gchar * gst_mss_manifest_get_protection_data (GstMssManifest * manifest);
-+gboolean gst_mss_manifest_get_live_seek_range (GstMssManifest * manifest, gint64 * start, gint64 * stop);
- 
- GstMssStreamType gst_mss_stream_get_type (GstMssStream *stream);
- GstCaps * gst_mss_stream_get_caps (GstMssStream * stream);
--- 
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-smoothstreaming-use-the-duration-from-the-list-of-fr.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-smoothstreaming-use-the-duration-from-the-list-of-fr.patch
deleted file mode 100644
index 4e51040..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-smoothstreaming-use-the-duration-from-the-list-of-fr.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 0fbee8f37427b88339194b22ba9aa210772a8613 Mon Sep 17 00:00:00 2001
-From: Matthew Waters <matthew@centricular.com>
-Date: Thu, 10 Nov 2016 17:20:27 +1100
-Subject: [PATCH] smoothstreaming: use the duration from the list of fragments
- if not present in the manifest
-
-Provides a more accurate duration for live streams that may be minutes
-or hours in front of the earliest fragment.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=774178
----
-Upstream-Status: Backport
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
- ext/smoothstreaming/gstmssmanifest.c | 24 ++++++++++++++++++++++++
- 1 file changed, 24 insertions(+)
-
-diff --git a/ext/smoothstreaming/gstmssmanifest.c b/ext/smoothstreaming/gstmssmanifest.c
-index 317b3cef9..144bbb42d 100644
---- a/ext/smoothstreaming/gstmssmanifest.c
-+++ b/ext/smoothstreaming/gstmssmanifest.c
-@@ -888,6 +888,7 @@ gst_mss_manifest_get_duration (GstMssManifest * manifest)
-   gchar *duration;
-   guint64 dur = -1;
- 
-+  /* try the property */
-   duration =
-       (gchar *) xmlGetProp (manifest->xmlrootnode,
-       (xmlChar *) MSS_PROP_STREAM_DURATION);
-@@ -895,6 +896,29 @@ gst_mss_manifest_get_duration (GstMssManifest * manifest)
-     dur = g_ascii_strtoull (duration, NULL, 10);
-     xmlFree (duration);
-   }
-+  /* else use the fragment list */
-+  if (dur <= 0) {
-+    guint64 max_dur = 0;
-+    GSList *iter;
-+
-+    for (iter = manifest->streams; iter; iter = g_slist_next (iter)) {
-+      GstMssStream *stream = iter->data;
-+
-+      if (stream->active) {
-+        if (stream->fragments) {
-+          GList *l = g_list_last (stream->fragments);
-+          GstMssStreamFragment *fragment = (GstMssStreamFragment *) l->data;
-+          guint64 frag_dur =
-+              fragment->time + fragment->duration * fragment->repetitions;
-+          max_dur = MAX (frag_dur, max_dur);
-+        }
-+      }
-+    }
-+
-+    if (max_dur != 0)
-+      dur = max_dur;
-+  }
-+
-   return dur;
- }
- 
--- 
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-vkdisplay-Use-ifdef-for-platform-specific-defines.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-vkdisplay-Use-ifdef-for-platform-specific-defines.patch
new file mode 100644
index 0000000..caaa62d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-vkdisplay-Use-ifdef-for-platform-specific-defines.patch
@@ -0,0 +1,37 @@
+From 1523ab462c1bf19055960ced255f4872b6cf9f5c Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Wed, 5 Jul 2017 11:00:42 +0300
+Subject: [PATCH 1/2] vkdisplay: Use ifdef for platform specific defines
+
+VK_KHR_*_SURFACE_EXTENSION_NAME are only available when corresponding
+WSI is enabled.
+
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=784539]
+---
+ ext/vulkan/vkdisplay.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/ext/vulkan/vkdisplay.c b/ext/vulkan/vkdisplay.c
+index 550134cd8..ade5d4583 100644
+--- a/ext/vulkan/vkdisplay.c
++++ b/ext/vulkan/vkdisplay.c
+@@ -448,11 +448,15 @@ gst_vulkan_display_type_to_extension_string (GstVulkanDisplayType type)
+   if (type == GST_VULKAN_DISPLAY_TYPE_NONE)
+     return NULL;
+ 
++#if GST_VULKAN_HAVE_WINDOW_XCB
+   if (type & GST_VULKAN_DISPLAY_TYPE_XCB)
+     return VK_KHR_XCB_SURFACE_EXTENSION_NAME;
++#endif
+ 
++#if GST_VULKAN_HAVE_WINDOW_WAYLAND
+   if (type & GST_VULKAN_DISPLAY_TYPE_WAYLAND)
+     return VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
++#endif
+ 
+   return NULL;
+ }
+-- 
+2.13.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-vulkan-Use-the-generated-version-of-vkconfig.h.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-vulkan-Use-the-generated-version-of-vkconfig.h.patch
new file mode 100644
index 0000000..0df145d
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-vulkan-Use-the-generated-version-of-vkconfig.h.patch
@@ -0,0 +1,64 @@
+From c23e1dc22deb495561cffb877edb2746b740a1fa Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Wed, 5 Jul 2017 11:07:05 +0300
+Subject: [PATCH 2/2] vulkan: Use the generated version of vkconfig.h
+
+Build fails in ext/vulkan/xcb and ext/vulkan/wayland when:
+* building from tarball
+* building out-of-tree
+* Only one WSI integration (xcb or wayland) is enabled by configure.ac
+This is because vkconfig.h from source directory gets used instead
+of the generated one.
+
+Add the correct build directory to "-I". Use angle bracket
+include in vkapi.h so that it actually looks in the include search
+path instead of defaulting to the same (source tree) directory.
+
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=784539]
+---
+ ext/vulkan/vkapi.h             | 2 +-
+ ext/vulkan/wayland/Makefile.am | 1 +
+ ext/vulkan/xcb/Makefile.am     | 1 +
+ 3 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/ext/vulkan/vkapi.h b/ext/vulkan/vkapi.h
+index e9c23aa92..a37c29d0f 100644
+--- a/ext/vulkan/vkapi.h
++++ b/ext/vulkan/vkapi.h
+@@ -23,7 +23,7 @@
+ 
+ #define VK_PROTOTYPES
+ 
+-#include "vkconfig.h"
++#include <vkconfig.h>
+ #include "vk_fwd.h"
+ #include "vkmacros.h"
+ 
+diff --git a/ext/vulkan/wayland/Makefile.am b/ext/vulkan/wayland/Makefile.am
+index f92d85e2c..10cfb70e6 100644
+--- a/ext/vulkan/wayland/Makefile.am
++++ b/ext/vulkan/wayland/Makefile.am
+@@ -14,6 +14,7 @@ noinst_HEADERS = \
+ 
+ libgstvulkan_wayland_la_CFLAGS = \
+ 	-I$(top_srcdir)/gst-libs \
++	-I$(top_builddir)/ext/vulkan \
+ 	-I$(top_srcdir)/ext/vulkan \
+ 	-I$(top_builddir)/gst-libs \
+ 	$(GST_PLUGINS_BASE_CFLAGS) \
+diff --git a/ext/vulkan/xcb/Makefile.am b/ext/vulkan/xcb/Makefile.am
+index 7debcff9e..b5103551b 100644
+--- a/ext/vulkan/xcb/Makefile.am
++++ b/ext/vulkan/xcb/Makefile.am
+@@ -14,6 +14,7 @@ noinst_HEADERS = \
+ 
+ libgstvulkan_xcb_la_CFLAGS = \
+ 	-I$(top_srcdir)/gst-libs \
++	-I$(top_builddir)/ext/vulkan \
+ 	-I$(top_srcdir)/ext/vulkan \
+ 	-I$(top_builddir)/gst-libs \
+ 	$(GST_PLUGINS_BASE_CFLAGS) \
+-- 
+2.13.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/link-with-libvchostif.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/link-with-libvchostif.patch
new file mode 100644
index 0000000..c382b17
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/link-with-libvchostif.patch
@@ -0,0 +1,35 @@
+Add -lvchostif to link when using -lEGL on rpi
+
+This is required because libEGL from userland uses sybols
+from this library.
+
+lib/libEGL.so.1.0.0                                                                                                                                                                                                                              121: 00000000     0 FUNC    GLOBAL DEFAULT  UND vc_dispmanx_element_add
+  1552: 00000000     0 FUNC    GLOBAL DEFAULT  UND vc_dispmanx_element_add
+
+These symbols are provided by libvchostif as seen below
+
+lib/libvchostif.so
+   252: 0000b161   192 FUNC    GLOBAL DEFAULT    9 vc_dispmanx_element_add
+   809: 0000b161   192 FUNC    GLOBAL DEFAULT    9 vc_dispmanx_element_add
+
+With this explicit link, plugins fail during runtime
+
+(gst-plugin-scanner:571): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstomx.so': Error relocating /usr/lib/libgstgl-1.0.so.0: vc_dispmanx_element_add: symbol not found
+(gst-plugin-scanner:571): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-1.0/libgstopengl.so': Error relocating /usr/lib/libgstgl-1.0.so.0: vc_dispmanx_element_add: symbol not found
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+Index: gst-plugins-bad-1.10.4/configure.ac
+===================================================================
+--- gst-plugins-bad-1.10.4.orig/configure.ac
++++ gst-plugins-bad-1.10.4/configure.ac
+@@ -785,7 +785,7 @@ case $host in
+                             HAVE_EGL=yes
+                             HAVE_GLES2=yes
+                             HAVE_EGL_RPI=yes
+-                            EGL_LIBS="-lbcm_host -lvcos -lvchiq_arm"
++                            EGL_LIBS="-lbcm_host -lvchostif -lvcos -lvchiq_arm"
+                             EGL_CFLAGS=""
+                             AC_DEFINE(USE_EGL_RPI, [1], [Use RPi platform])
+                           ])
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.12.2.bb
similarity index 61%
rename from import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.4.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.12.2.bb
index 0bb4053..8321da0 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.12.2.bb
@@ -1,9 +1,7 @@
 require gstreamer1.0-plugins-bad.inc
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=73a5855a8119deb017f5f13cf327095d \
-                    file://COPYING.LIB;md5=21682e4e8fea52413fd26c60acb907e5 \
-                    file://gst/tta/crc32.h;beginline=12;endline=29;md5=27db269c575d1e5317fffca2d33b3b50 \
-                    file://gst/tta/filters.h;beginline=12;endline=29;md5=8a08270656f2f8ad7bb3655b83138e5a"
+                    file://COPYING.LIB;md5=21682e4e8fea52413fd26c60acb907e5 "
 
 SRC_URI = " \
     http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-${PV}.tar.xz \
@@ -15,12 +13,12 @@
     file://0009-glimagesink-Downrank-to-marginal.patch \
     file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \
     file://0001-Prepend-PKG_CONFIG_SYSROOT_DIR-to-pkg-config-output.patch \
-    file://0001-smoothstreaming-implement-adaptivedemux-s-get_live_s.patch \
-    file://0001-smoothstreaming-use-the-duration-from-the-list-of-fr.patch \
-    file://0001-mssdemux-improved-live-playback-support.patch \
+    file://link-with-libvchostif.patch \
+    file://0001-vkdisplay-Use-ifdef-for-platform-specific-defines.patch \
+    file://0002-vulkan-Use-the-generated-version-of-vkconfig.h.patch \
 "
-SRC_URI[md5sum] = "2757103e57a096a1a05b3ab85b8381af"
-SRC_URI[sha256sum] = "23ddae506b3a223b94869a0d3eea3e9a12e847f94d2d0e0b97102ce13ecd6966"
+SRC_URI[md5sum] = "5683f0ea91f9e1e0613b0f6f729980a7"
+SRC_URI[sha256sum] = "9c2c7edde4f59d74eb414e0701c55131f562e5c605a3ce9b091754f106c09e37"
 
 S = "${WORKDIR}/gst-plugins-bad-${PV}"
 
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/encodebin-Need-more-buffers-in-output-queue-for-bett.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/encodebin-Need-more-buffers-in-output-queue-for-bett.patch
deleted file mode 100644
index 5341e3c..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/encodebin-Need-more-buffers-in-output-queue-for-bett.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 540e02c92c75e08b90326863dc787fa5cadf9da6 Mon Sep 17 00:00:00 2001
-From: Song Bing <b06498@freescale.com>
-Date: Fri, 13 Mar 2015 18:04:31 +0800
-Subject: [PATCH] encodebin: Need more buffers in output queue for better
- performance
-
-Need more buffers in output queue for better performance
-
-Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=744191]
-
-Signed-off-by: Song Bing <b06498@freescale.com>
----
- gst/encoding/gstencodebin.c |    3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c
-index 6728e58..32daae4 100644
---- a/gst/encoding/gstencodebin.c
-+++ b/gst/encoding/gstencodebin.c
-@@ -1228,8 +1228,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
-    * We only use a 1buffer long queue here, the actual queueing will be done
-    * in the input queue */
-   last = sgroup->outqueue = gst_element_factory_make ("queue", NULL);
--  g_object_set (sgroup->outqueue, "max-size-buffers", (guint32) 1,
--      "max-size-bytes", (guint32) 0, "max-size-time", (guint64) 0,
-+  g_object_set (sgroup->outqueue, "max-size-time", (guint64) 0,
-       "silent", TRUE, NULL);
- 
-   gst_bin_add (GST_BIN (ebin), sgroup->outqueue);
--- 
-1.7.9.5
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.12.2.bb
similarity index 78%
rename from import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.10.4.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.12.2.bb
index 7c81670..5de0b8b 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.10.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.12.2.bb
@@ -9,11 +9,10 @@
     file://get-caps-from-src-pad-when-query-caps.patch \
     file://0003-ssaparse-enhance-SSA-text-lines-parsing.patch \
     file://0004-subparse-set-need_segment-after-sink-pad-received-GS.patch \
-    file://encodebin-Need-more-buffers-in-output-queue-for-bett.patch \
     file://make-gio_unix_2_0-dependency-configurable.patch \
     file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \
 "
-SRC_URI[md5sum] = "f6b46f8fac01eb773d556e3efc369e86"
-SRC_URI[sha256sum] = "f6d245b6b3d4cb733f81ebb021074c525ece83db0c10e932794b339b8d935eb7"
+SRC_URI[md5sum] = "77f5379c4ca677616b415e3b3ff95578"
+SRC_URI[sha256sum] = "5067dce3afe197a9536fea0107c77213fab536dff4a213b07fc60378d5510675"
 
 S = "${WORKDIR}/gst-plugins-base-${PV}"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2-Fix-4K-colorimetry.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2-Fix-4K-colorimetry.patch
new file mode 100644
index 0000000..f78818a
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2-Fix-4K-colorimetry.patch
@@ -0,0 +1,48 @@
+From 545646cccba243236e10362fe7325f89be57da1f Mon Sep 17 00:00:00 2001
+From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
+Date: Tue, 18 Jul 2017 11:28:37 -0400
+Subject: [PATCH] v4l2: Fix 4K colorimetry
+
+Since 1.6, the transfer function for BT2020 has been changed from BT709
+to BT2020_12. It's the same function, but with more precision. As a side
+effect, the V4L2 colorpsace didn't match GStreamer colorspace. When
+GStreamer ended up making a guess, it would not match anything supported
+by V4L2 anymore. This this by using BT2020_12 for BT2020 colorspace and
+BT2020 transfer function in replacement of BT709 whenever a 4K
+resolution is detected.
+
+Upstream-Status: Backport
+Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
+
+---
+ sys/v4l2/gstv4l2object.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
+index 61244455f..aae2c55e7 100644
+--- a/sys/v4l2/gstv4l2object.c
++++ b/sys/v4l2/gstv4l2object.c
+@@ -1960,7 +1960,7 @@ gst_v4l2_object_get_colorspace (struct v4l2_format *fmt,
+     case V4L2_COLORSPACE_BT2020:
+       cinfo->range = GST_VIDEO_COLOR_RANGE_16_235;
+       cinfo->matrix = GST_VIDEO_COLOR_MATRIX_BT2020;
+-      cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
++      cinfo->transfer = GST_VIDEO_TRANSFER_BT2020_12;
+       cinfo->primaries = GST_VIDEO_COLOR_PRIMARIES_BT2020;
+       break;
+     case V4L2_COLORSPACE_SMPTE240M:
+@@ -2062,7 +2062,10 @@ gst_v4l2_object_get_colorspace (struct v4l2_format *fmt,
+ 
+   switch (transfer) {
+     case V4L2_XFER_FUNC_709:
+-      cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
++      if (fmt->fmt.pix.height > 2160)
++        cinfo->transfer = GST_VIDEO_TRANSFER_BT2020_12;
++      else
++        cinfo->transfer = GST_VIDEO_TRANSFER_BT709;
+       break;
+     case V4L2_XFER_FUNC_SRGB:
+       cinfo->transfer = GST_VIDEO_TRANSFER_SRGB;
+-- 
+2.14.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2object-Also-add-videometa-if-there-is-padding-to.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2object-Also-add-videometa-if-there-is-padding-to.patch
deleted file mode 100644
index 2a9a23e..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good/0001-v4l2object-Also-add-videometa-if-there-is-padding-to.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 22be02612adc757f6a43cefc6ee65ecaef68f0d9 Mon Sep 17 00:00:00 2001
-From: Carlos Rafael Giani <dv@pseudoterminal.org>
-Date: Thu, 23 Mar 2017 22:13:05 +0100
-Subject: [PATCH] v4l2object: Also add videometa if there is padding to the
- right and bottom
-
-https://bugzilla.gnome.org/show_bug.cgi?id=780478
-
-Upstream-Status: Backport [1.10.5]
-
-Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
----
- sys/v4l2/gstv4l2object.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
-index 91c8ff0..ed4654e 100644
---- a/sys/v4l2/gstv4l2object.c
-+++ b/sys/v4l2/gstv4l2object.c
-@@ -3070,9 +3070,10 @@ store_info:
-   GST_DEBUG_OBJECT (v4l2object->element, "Got sizeimage %" G_GSIZE_FORMAT,
-       info->size);
- 
--  /* to avoid copies we need video meta if top or left padding */
-+  /* to avoid copies we need video meta if there is padding */
-   v4l2object->need_video_meta =
--      ((align->padding_top + align->padding_left) != 0);
-+      ((align->padding_top + align->padding_left + align->padding_right +
-+          align->padding_bottom) != 0);
- 
-   /* ... or if stride is non "standard" */
-   if (!standard_stride)
--- 
-2.7.4
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.12.2.bb
similarity index 73%
rename from import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.10.4.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.12.2.bb
index 57447bf..f9593c9 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.10.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.12.2.bb
@@ -10,9 +10,12 @@
     file://avoid-including-sys-poll.h-directly.patch \
     file://ensure-valid-sentinel-for-gst_structure_get.patch \
     file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \
-    file://0001-v4l2object-Also-add-videometa-if-there-is-padding-to.patch \
+    file://0001-v4l2-Fix-4K-colorimetry.patch \
 "
-SRC_URI[md5sum] = "cc0cc13cdb07d4237600b6886b81f31d"
-SRC_URI[sha256sum] = "8a86c61434a8c44665365bd0b3557a040937d1f44bf69caee4e9ea816ce74d7e"
+SRC_URI[md5sum] = "20254217d9805484532e08ff1c3aa296"
+SRC_URI[sha256sum] = "5591ee7208ab30289a30658a82b76bf87169c927572d9b794f3a41ed48e1ee96"
 
 S = "${WORKDIR}/gst-plugins-good-${PV}"
+
+RPROVIDES_${PN}-pulseaudio += "${PN}-pulse"
+RPROVIDES_${PN}-soup += "${PN}-souphttpsrc"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly.inc
index 708ad7a..60aa968 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly.inc
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly.inc
@@ -18,7 +18,6 @@
 PACKAGECONFIG[cdio]     = "--enable-cdio,--disable-cdio,libcdio"
 PACKAGECONFIG[dvdread]  = "--enable-dvdread,--disable-dvdread,libdvdread"
 PACKAGECONFIG[lame]     = "--enable-lame,--disable-lame,lame"
-PACKAGECONFIG[mad]      = "--enable-mad,--disable-mad,libmad"
 PACKAGECONFIG[mpeg2dec] = "--enable-mpeg2dec,--disable-mpeg2dec,mpeg2dec"
 PACKAGECONFIG[mpg123]   = "--enable-mpg123,--disable-mpg123,mpg123"
 PACKAGECONFIG[x264]     = "--enable-x264,--disable-x264,x264"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.12.2.bb
similarity index 76%
rename from import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.10.4.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.12.2.bb
index 92a2caa..6956c85 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.10.4.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.12.2.bb
@@ -7,7 +7,7 @@
     http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-${PV}.tar.xz \
     file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \
 "
-SRC_URI[md5sum] = "c68d0509c9980b0b70a4b836ff73fff1"
-SRC_URI[sha256sum] = "6386c77ca8459cba431ed0b63da780c7062c7cc48055d222024d8eaf198ffa59"
+SRC_URI[md5sum] = "eb639021905a32cf3013ca5bac1b694d"
+SRC_URI[sha256sum] = "1cc3942bbf3ea87da3e35437d4e014e991b103db22a6174f62a98c89c3f5f466"
 
 S = "${WORKDIR}/gst-plugins-ugly-${PV}"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins.inc
index 3f6d4c3..c40d398 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins.inc
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins.inc
@@ -49,3 +49,6 @@
 do_configure[prefuncs] += " delete_pkg_m4_file patch_gtk_doc_makefiles"
 
 PACKAGES_DYNAMIC = "^${PN}-.*"
+
+# qemu-mips64: error while loading shared libraries: .../recipe-sysroot/usr/lib/libgthread-2.0.so.0: ELF file data encoding not little-endian
+EXTRA_OECONF_append_mips64 = " --disable-introspection "
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python.inc
new file mode 100644
index 0000000..961b930
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python.inc
@@ -0,0 +1,35 @@
+SUMMARY = "Python bindings for GStreamer 1.0"
+HOMEPAGE = "http://cgit.freedesktop.org/gstreamer/gst-python/"
+SECTION = "multimedia"
+LICENSE = "LGPLv2.1"
+
+DEPENDS = "gstreamer1.0 python3-pygobject"
+RDEPENDS_${PN} += "gstreamer1.0 python3-pygobject"
+
+PNREAL = "gst-python"
+
+SRC_URI = "http://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz"
+
+S = "${WORKDIR}/${PNREAL}-${PV}"
+
+inherit autotools pkgconfig distutils3-base upstream-version-is-even gobject-introspection
+
+do_install_append() {
+    # gstpythonplugin hardcodes the location of the libpython from the build
+    # workspace and then fails at runtime. We can override it using
+    # --with-libpython-dir=${libdir}, but it still fails because it looks for a
+    # symlinked library ending in .so instead of the actually library with
+    # LIBNAME.so.MAJOR.MINOR. Although we could patch the code to use the path
+    # we want, it will break again if the library version ever changes. We need
+    # to think about the best way of handling this and possibly consult
+    # upstream.
+    #
+    # Note that this particular find line is taken from the Debian packaging for
+    # gst-python1.0.
+    find "${D}" \
+        -name '*.pyc' -o \
+        -name '*.pyo' -o \
+        -name '*.la' -o \
+        -name 'libgstpythonplugin*' \
+        -delete
+}
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.12.2.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.12.2.bb
new file mode 100644
index 0000000..b2dc05b
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.12.2.bb
@@ -0,0 +1,7 @@
+require gstreamer1.0-python.inc
+
+SRC_URI = "http://gstreamer.freedesktop.org/src/${PNREAL}/${PNREAL}-${PV}.tar.xz"
+SRC_URI[md5sum] = "da5c9fa42290bc3006661c869e076ffe"
+SRC_URI[sha256sum] = "f4cc32ad46a653e1ae2f27ac2a16078b00075c9106b2784a1a8d1f31c5069e47"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=c34deae4e395ca07e725ab0076a5f740"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server.inc
index 7191f98..68173ce 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server.inc
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server.inc
@@ -36,3 +36,5 @@
 
 do_configure[prefuncs] += " delete_pkg_m4_file patch_gtk_doc_makefiles"
 
+# Needs to be disable due to a dependency on gstreamer-plugins introspection files
+EXTRA_OECONF_append_mips64 = " --disable-introspection "
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.10.4.bb
deleted file mode 100644
index 6aa9a53..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.10.4.bb
+++ /dev/null
@@ -1,6 +0,0 @@
-require gstreamer1.0-rtsp-server.inc
-
-SRC_URI[md5sum] = "ef587fa6393e09bc26f884510596e305"
-SRC_URI[sha256sum] = "2f6e12fd4e3568ee190dc24e57e4c3a878971c3a3fb6904a9674404fac256de6"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.12.2.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.12.2.bb
new file mode 100644
index 0000000..2426cca
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.12.2.bb
@@ -0,0 +1,6 @@
+require gstreamer1.0-rtsp-server.inc
+
+SRC_URI[md5sum] = "022757cab183f5b970086e9101c60a98"
+SRC_URI[sha256sum] = "d8ba9264e8ae6e440293328e759e40456f161aa66077b3143dd07581136190b3"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi.inc
index ef0734b..abfcc65 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi.inc
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi.inc
@@ -22,12 +22,21 @@
 
 PACKAGES =+ "${PN}-tests"
 
+# OpenGL packageconfig factored out to make it easy for distros
+# and BSP layers to pick either glx, egl, or no GL. By default,
+# try detecting X11 first, and if found (with OpenGL), use GLX,
+# otherwise try to check if EGL can be used.
+PACKAGECONFIG_GL ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'glx', \
+                        bb.utils.contains('DISTRO_FEATURES',     'opengl', 'egl', \
+                                                                       '', d), d)}"
+
 PACKAGECONFIG ??= "drm \
-                   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'glx', '', d)} \
+                   ${PACKAGECONFIG_GL} \
                    ${@bb.utils.filter('DISTRO_FEATURES', 'wayland x11', d)}"
 
 PACKAGECONFIG[drm] = "--enable-drm,--disable-drm,udev libdrm"
-PACKAGECONFIG[glx] = "--enable-glx,--disable-glx,virtual/mesa"
+PACKAGECONFIG[egl] = "--enable-egl,--disable-egl,virtual/egl"
+PACKAGECONFIG[glx] = "--enable-glx,--disable-glx,virtual/libgl"
 PACKAGECONFIG[wayland] = "--enable-wayland,--disable-wayland,wayland"
 PACKAGECONFIG[x11] = "--enable-x11,--disable-x11,virtual/libx11 libxrandr libxrender"
 
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.10.4.bb
deleted file mode 100644
index 44c66de..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.10.4.bb
+++ /dev/null
@@ -1,7 +0,0 @@
-require gstreamer1.0-vaapi.inc
-SRC_URI[md5sum] = "318af17f906637570b61dd7be9b5581d"
-SRC_URI[sha256sum] = "03e690621594d9f9495d86c7dac8b8590b3a150462770ed070dc76f66a70de75"
-
-SRC_URI += "file://vaapivideobufferpool-create-allocator-if-needed.patch"
-
-DEPENDS += "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.12.2.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.12.2.bb
new file mode 100644
index 0000000..fbd9f86
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-vaapi_1.12.2.bb
@@ -0,0 +1,5 @@
+require gstreamer1.0-vaapi.inc
+SRC_URI[md5sum] = "bea015f33696a15ad9575fb71af862ed"
+SRC_URI[sha256sum] = "23c714e0474b3c7ae6ff8884aebf8503a1bc3ded335fa2d2b2ac31788466163a"
+
+DEPENDS += "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-bad"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0.inc b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0.inc
index 72d7ce6..3291934 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0.inc
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0.inc
@@ -25,10 +25,10 @@
 PACKAGECONFIG[valgrind] = "--enable-valgrind,--disable-valgrind,valgrind,"
 PACKAGECONFIG[gst-tracer-hooks] = "--enable-gst-tracer-hooks,--disable-gst-tracer-hooks,"
 PACKAGECONFIG[unwind] = "--with-unwind,--without-unwind,libunwind"
+PACKAGECONFIG[dw] = "--with-dw,--without-dw,elfutils"
 
 EXTRA_OECONF = " \
     --disable-dependency-tracking \
-    --disable-docbook \
     --disable-examples \
 "
 
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-configure-Add-switches-for-enabling-disabling-libdw-.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-configure-Add-switches-for-enabling-disabling-libdw-.patch
new file mode 100644
index 0000000..1132fd5
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/0001-configure-Add-switches-for-enabling-disabling-libdw-.patch
@@ -0,0 +1,70 @@
+From a0cb41ba72913eda06049d266ec43ea8f52b5bee Mon Sep 17 00:00:00 2001
+From: Carlos Rafael Giani <dv@pseudoterminal.org>
+Date: Fri, 11 Aug 2017 21:21:36 +0200
+Subject: [PATCH] configure: Add switches for enabling/disabling libdw and
+ libunwind
+
+[Original patch modified to be applicable to 1.12.2]
+
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=778193]
+
+Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
+---
+ configure.ac | 38 ++++++++++++++++++++++++++++++++------
+ 1 file changed, 32 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b6b2923..32dd827 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -821,15 +821,41 @@ fi
+ AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
+ 
+ dnl libunwind is optionally used by the leaks tracer
+-PKG_CHECK_MODULES(UNWIND, libunwind, HAVE_UNWIND=yes, HAVE_UNWIND=no)
+-if test "x$HAVE_UNWIND" = "xyes"; then
+-  AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])
++AC_ARG_WITH([unwind],[AS_HELP_STRING([--with-unwind=yes|no|auto],[use libunwind])],
++            [], [with_unwind=auto])
++if [ test "x${with_unwind}" != "xno" ]; then
++  PKG_CHECK_MODULES(UNWIND, [libunwind],
++      [
++        HAVE_UNWIND=yes
++        AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])
++      ],
++      [
++        HAVE_UNWIND=no
++        if [ test "x${with_unwind}" = "xyes" ]; then
++          AC_MSG_ERROR([could not find libunwind])
++        fi
++      ])
++else
++  HAVE_UNWIND=no
+ fi
+ 
+ dnl libdw is optionally used to add source lines and numbers to backtraces
+-PKG_CHECK_MODULES(DW, libdw, HAVE_DW=yes, HAVE_DW=no)
+-if test "x$HAVE_DW" = "xyes"; then
+-  AC_DEFINE(HAVE_DW, 1, [libdw available])
++AC_ARG_WITH([dw],[AS_HELP_STRING([--with-dw=yes|no|auto],[use libdw])],
++            [], [with_dw=auto])
++if [ test "x${with_dw}" != "xno" ]; then
++  PKG_CHECK_MODULES(DW, [libdw],
++      [
++        HAVE_DW=yes
++        AC_DEFINE(HAVE_DW, 1, [libdw available])
++      ],
++      [
++        HAVE_DW=no
++        if [ test "x${with_dw}" = "xyes" ]; then
++          AC_MSG_ERROR([could not find libdw])
++        fi
++      ])
++else
++  HAVE_DW=no
+ fi
+ 
+ dnl Check for backtrace() from libc
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/deterministic-unwind.patch b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/deterministic-unwind.patch
deleted file mode 100644
index e39e6ca..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0/deterministic-unwind.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Make the detection of libunwind deterministic.
-
-Upstream-Status: Pending
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-diff --git a/configure.ac b/configure.ac
-index ac88fb2..182c19a 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -829,3 +828,0 @@ AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
--dnl libunwind is optionally used by the leaks tracer
--PKG_CHECK_MODULES(UNWIND, libunwind, HAVE_UNWIND=yes, HAVE_UNWIND=no)
--
-@@ -839,3 +836,7 @@ AC_CHECK_FUNC(backtrace, [
--if test "x$HAVE_UNWIND" = "xyes"; then
--  AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])
--fi
-+dnl libunwind is optionally used by the leaks tracer
-+AC_ARG_WITH([unwind],[AS_HELP_STRING([--with-unwind],[use libunwind])],
-+            [], [with_unwind=yes])
-+AS_IF([test "$with_unwind" = yes],
-+      [PKG_CHECK_MODULES(UNWIND, libunwind)
-+       AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])]
-+)
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.10.4.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.10.4.bb
deleted file mode 100644
index 2a67993..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.10.4.bb
+++ /dev/null
@@ -1,13 +0,0 @@
-require gstreamer1.0.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \
-                    file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d"
-
-SRC_URI = " \
-    http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \
-    file://deterministic-unwind.patch \
-"
-SRC_URI[md5sum] = "7c91a97e4a2dc81eafd59d0a2f8b0d6e"
-SRC_URI[sha256sum] = "50c2f5af50a6cc6c0a3f3ed43bdd8b5e2bff00bacfb766d4be139ec06d8b5218"
-
-S = "${WORKDIR}/gstreamer-${PV}"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.12.2.bb b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.12.2.bb
new file mode 100644
index 0000000..8d41a59
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.12.2.bb
@@ -0,0 +1,13 @@
+require gstreamer1.0.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=6762ed442b3822387a51c92d928ead0d \
+                    file://gst/gst.h;beginline=1;endline=21;md5=e059138481205ee2c6fc1c079c016d0d"
+
+SRC_URI = " \
+    http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \
+    file://0001-configure-Add-switches-for-enabling-disabling-libdw-.patch \
+"
+SRC_URI[md5sum] = "4748860621607ffd96244fb79c86c238"
+SRC_URI[sha256sum] = "9fde3f39a2ea984f9e07ce09250285ce91f6e3619d186889f75b5154ecf994ba"
+
+S = "${WORKDIR}/gstreamer-${PV}"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/lame/lame/CVE-2017-13712.patch b/import-layers/yocto-poky/meta/recipes-multimedia/lame/lame/CVE-2017-13712.patch
new file mode 100644
index 0000000..f9ec766
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/lame/lame/CVE-2017-13712.patch
@@ -0,0 +1,309 @@
+Upstream-Status: Backport [http://lame.cvs.sourceforge.net/viewvc/lame/lame/libmp3lame/id3tag.c?r1=1.79&r2=1.80]
+
+Backport patch to fix CVE-2017-13712 for lame.
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+--- a/libmp3lame/id3tag.c	2017/08/22 19:44:05	1.79
++++ b/libmp3lame/id3tag.c	2017/08/28 15:39:51	1.80
+@@ -194,7 +194,11 @@
+ }
+ #endif
+ 
+-
++static int
++is_lame_internal_flags_null(lame_t gfp)
++{
++    return (gfp && gfp->internal_flags) ? 0 : 1;
++}
+ 
+ static int
+ id3v2_add_ucs2_lng(lame_t gfp, uint32_t frame_id, unsigned short const *desc, unsigned short const *text);
+@@ -238,8 +242,7 @@
+ static void
+ id3v2AddAudioDuration(lame_t gfp, double ms)
+ {
+-    lame_internal_flags *gfc = gfp != 0 ? gfp->internal_flags : 0;
+-    SessionConfig_t const *const cfg = &gfc->cfg;
++    SessionConfig_t const *const cfg = &gfp->internal_flags->cfg; /* caller checked pointers */
+     char    buffer[1024];
+     double const max_ulong = MAX_U_32_NUM;
+     unsigned long playlength_ms;
+@@ -280,7 +283,12 @@
+ void
+ id3tag_init(lame_t gfp)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return;
++    }
++    gfc = gfp->internal_flags;
+     free_id3tag(gfc);
+     memset(&gfc->tag_spec, 0, sizeof gfc->tag_spec);
+     gfc->tag_spec.genre_id3v1 = GENRE_NUM_UNKNOWN;
+@@ -293,7 +301,12 @@
+ void
+ id3tag_add_v2(lame_t gfp)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return;
++    }
++    gfc = gfp->internal_flags;
+     gfc->tag_spec.flags &= ~V1_ONLY_FLAG;
+     gfc->tag_spec.flags |= ADD_V2_FLAG;
+ }
+@@ -301,7 +314,12 @@
+ void
+ id3tag_v1_only(lame_t gfp)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return;
++    }
++    gfc = gfp->internal_flags;
+     gfc->tag_spec.flags &= ~(ADD_V2_FLAG | V2_ONLY_FLAG);
+     gfc->tag_spec.flags |= V1_ONLY_FLAG;
+ }
+@@ -309,7 +327,12 @@
+ void
+ id3tag_v2_only(lame_t gfp)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return;
++    }
++    gfc = gfp->internal_flags;
+     gfc->tag_spec.flags &= ~V1_ONLY_FLAG;
+     gfc->tag_spec.flags |= V2_ONLY_FLAG;
+ }
+@@ -317,7 +340,12 @@
+ void
+ id3tag_space_v1(lame_t gfp)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return;
++    }
++    gfc = gfp->internal_flags;
+     gfc->tag_spec.flags &= ~V2_ONLY_FLAG;
+     gfc->tag_spec.flags |= SPACE_V1_FLAG;
+ }
+@@ -331,7 +359,12 @@
+ void
+ id3tag_set_pad(lame_t gfp, size_t n)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return;
++    }
++    gfc = gfp->internal_flags;
+     gfc->tag_spec.flags &= ~V1_ONLY_FLAG;
+     gfc->tag_spec.flags |= PAD_V2_FLAG;
+     gfc->tag_spec.flags |= ADD_V2_FLAG;
+@@ -583,22 +616,29 @@
+ int
+ id3tag_set_albumart(lame_t gfp, const char *image, size_t size)
+ {
+-    int     mimetype = 0;
+-    unsigned char const *data = (unsigned char const *) image;
+-    lame_internal_flags *gfc = gfp->internal_flags;
+-
+-    /* determine MIME type from the actual image data */
+-    if (2 < size && data[0] == 0xFF && data[1] == 0xD8) {
+-        mimetype = MIMETYPE_JPEG;
+-    }
+-    else if (4 < size && data[0] == 0x89 && strncmp((const char *) &data[1], "PNG", 3) == 0) {
+-        mimetype = MIMETYPE_PNG;
+-    }
+-    else if (4 < size && strncmp((const char *) data, "GIF8", 4) == 0) {
+-        mimetype = MIMETYPE_GIF;
++    int     mimetype = MIMETYPE_NONE;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
+     }
+-    else {
+-        return -1;
++    gfc = gfp->internal_flags;
++
++    if (image != 0) {
++        unsigned char const *data = (unsigned char const *) image;
++        /* determine MIME type from the actual image data */
++        if (2 < size && data[0] == 0xFF && data[1] == 0xD8) {
++            mimetype = MIMETYPE_JPEG;
++        }
++        else if (4 < size && data[0] == 0x89 && strncmp((const char *) &data[1], "PNG", 3) == 0) {
++            mimetype = MIMETYPE_PNG;
++        }
++        else if (4 < size && strncmp((const char *) data, "GIF8", 4) == 0) {
++            mimetype = MIMETYPE_GIF;
++        }
++        else {
++            return -1;
++        }
+     }
+     if (gfc->tag_spec.albumart != 0) {
+         free(gfc->tag_spec.albumart);
+@@ -606,7 +646,7 @@
+         gfc->tag_spec.albumart_size = 0;
+         gfc->tag_spec.albumart_mimetype = MIMETYPE_NONE;
+     }
+-    if (size < 1) {
++    if (size < 1 || mimetype == MIMETYPE_NONE) {
+         return 0;
+     }
+     gfc->tag_spec.albumart = lame_calloc(unsigned char, size);
+@@ -959,6 +999,9 @@
+     if (frame_id == 0) {
+         return -1;
+     }
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     if (text == 0) {
+         return 0;
+     }
+@@ -1008,6 +1051,9 @@
+     if (frame_id == 0) {
+         return -1;
+     }
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     if (text == 0) {
+         return 0;
+     }
+@@ -1037,6 +1083,9 @@
+ int
+ id3tag_set_comment_latin1(lame_t gfp, char const *lang, char const *desc, char const *text)
+ {
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     return id3v2_add_latin1(gfp, ID_COMMENT, lang, desc, text);
+ }
+ 
+@@ -1044,6 +1093,9 @@
+ int
+ id3tag_set_comment_utf16(lame_t gfp, char const *lang, unsigned short const *desc, unsigned short const *text)
+ {
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     return id3v2_add_ucs2(gfp, ID_COMMENT, lang, desc, text);
+ }
+ 
+@@ -1054,6 +1106,9 @@
+ int
+ id3tag_set_comment_ucs2(lame_t gfp, char const *lang, unsigned short const *desc, unsigned short const *text)
+ {
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     return id3tag_set_comment_utf16(gfp, lang, desc, text);
+ }
+ 
+@@ -1244,9 +1299,9 @@
+ int
+ id3tag_set_genre(lame_t gfp, const char *genre)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = gfp != 0 ? gfp->internal_flags : 0;
+     int     ret = 0;
+-    if (genre && *genre) {
++    if (gfc && genre && *genre) {
+         int const num = lookupGenre(genre);
+         if (num == -1) return num;
+         gfc->tag_spec.flags |= CHANGED_FLAG;
+@@ -1539,6 +1594,9 @@
+ int
+ id3tag_set_fieldvalue(lame_t gfp, const char *fieldvalue)
+ {
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     if (fieldvalue && *fieldvalue) {
+         if (strlen(fieldvalue) < 5 || fieldvalue[4] != '=') {
+             return -1;
+@@ -1551,6 +1609,9 @@
+ int
+ id3tag_set_fieldvalue_utf16(lame_t gfp, const unsigned short *fieldvalue)
+ {
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     if (fieldvalue && *fieldvalue) {
+         size_t dx = hasUcs2ByteOrderMarker(fieldvalue[0]);
+         unsigned short const separator = fromLatin1Char(fieldvalue, '=');
+@@ -1581,20 +1642,21 @@
+ int
+ id3tag_set_fieldvalue_ucs2(lame_t gfp, const unsigned short *fieldvalue)
+ {
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
+     return id3tag_set_fieldvalue_utf16(gfp, fieldvalue);
+ }
+ 
+ size_t
+ lame_get_id3v2_tag(lame_t gfp, unsigned char *buffer, size_t size)
+ {
+-    lame_internal_flags *gfc;
+-    if (gfp == 0) {
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
+         return 0;
+     }
+     gfc = gfp->internal_flags;
+-    if (gfc == 0) {
+-        return 0;
+-    }
+     if (test_tag_spec_flags(gfc, V1_ONLY_FLAG)) {
+         return 0;
+     }
+@@ -1736,7 +1798,12 @@
+ int
+ id3tag_write_v2(lame_t gfp)
+ {
+-    lame_internal_flags *gfc = gfp->internal_flags;
++    lame_internal_flags *gfc = 0;
++
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
++    gfc = gfp->internal_flags;
+ #if 0
+     debug_tag_spec_flags(gfc, "write v2");
+ #endif
+@@ -1837,10 +1904,15 @@
+ int
+ id3tag_write_v1(lame_t gfp)
+ {
+-    lame_internal_flags *const gfc = gfp->internal_flags;
++    lame_internal_flags* gfc = 0;
+     size_t  i, n, m;
+     unsigned char tag[128];
+ 
++    if (is_lame_internal_flags_null(gfp)) {
++        return 0;
++    }
++    gfc = gfp->internal_flags;
++
+     m = sizeof(tag);
+     n = lame_get_id3v1_tag(gfp, tag, m);
+     if (n > m) {
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/lame/lame_3.99.5.bb b/import-layers/yocto-poky/meta/recipes-multimedia/lame/lame_3.99.5.bb
index 0477611..e5321bb 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/lame/lame_3.99.5.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/lame/lame_3.99.5.bb
@@ -14,7 +14,9 @@
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/lame/lame-${PV}.tar.gz \
            file://no-gtk1.patch \
-           file://lame-3.99.5_fix_for_automake-1.12.x.patch "
+           file://lame-3.99.5_fix_for_automake-1.12.x.patch \
+           file://CVE-2017-13712.patch \
+           "
 
 SRC_URI[md5sum] = "84835b313d4a8b68f5349816d33e07ce"
 SRC_URI[sha256sum] = "24346b4158e4af3bd9f2e194bb23eb473c75fb7377011523353196b19b9a23ff"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libid3tag/libid3tag/0001-Fix-gperf-3.1-incompatibility.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libid3tag/libid3tag/0001-Fix-gperf-3.1-incompatibility.patch
new file mode 100644
index 0000000..54f49f6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libid3tag/libid3tag/0001-Fix-gperf-3.1-incompatibility.patch
@@ -0,0 +1,40 @@
+From 91fcf66b9182c75cd2b96d88991d5a1c6307d4b4 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Wed, 2 Aug 2017 16:27:52 +0300
+Subject: [PATCH] Fix gperf 3.1 incompatibility.
+
+Upstream-Status: Pending
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ compat.h    | 2 +-
+ frametype.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/compat.h b/compat.h
+index 8af71ec..b3d80d9 100644
+--- a/compat.h
++++ b/compat.h
+@@ -34,7 +34,7 @@ struct id3_compat {
+ };
+ 
+ struct id3_compat const *id3_compat_lookup(register char const *,
+-					   register unsigned int);
++					   register size_t);
+ 
+ int id3_compat_fixup(struct id3_tag *);
+ 
+diff --git a/frametype.h b/frametype.h
+index dd064b2..b5b7593 100644
+--- a/frametype.h
++++ b/frametype.h
+@@ -37,6 +37,6 @@ extern struct id3_frametype const id3_frametype_unknown;
+ extern struct id3_frametype const id3_frametype_obsolete;
+ 
+ struct id3_frametype const *id3_frametype_lookup(register char const *,
+-						 register unsigned int);
++						 register size_t);
+ 
+ # endif
+-- 
+2.13.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb b/import-layers/yocto-poky/meta/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb
index 05a8a47..f6139d6 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libid3tag/libid3tag_0.15.1b.bb
@@ -9,10 +9,13 @@
 DEPENDS = "zlib gperf-native"
 PR = "r7"
 
-SRC_URI = "ftp://ftp.mars.org/pub/mpeg/libid3tag-${PV}.tar.gz \
+SRC_URI = "${SOURCEFORGE_MIRROR}/mad/libid3tag-${PV}.tar.gz \
            file://addpkgconfig.patch \
            file://obsolete_automake_macros.patch \
-"
+           file://0001-Fix-gperf-3.1-incompatibility.patch \
+           "
+UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/mad/files/libid3tag/"
+UPSTREAM_CHECK_REGEX = "/projects/mad/files/libid3tag/(?P<pver>.*)/$"
 
 SRC_URI[md5sum] = "e5808ad997ba32c498803822078748c3"
 SRC_URI[sha256sum] = "63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libpng/libpng_1.6.28.bb b/import-layers/yocto-poky/meta/recipes-multimedia/libpng/libpng_1.6.28.bb
deleted file mode 100644
index 9cb2967..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libpng/libpng_1.6.28.bb
+++ /dev/null
@@ -1,25 +0,0 @@
-SUMMARY = "PNG image format decoding library"
-HOMEPAGE = "http://www.libpng.org/"
-SECTION = "libs"
-LICENSE = "Libpng"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=67d8837410863f9821bbd606536f0329 \
-                    file://png.h;endline=144;md5=abfa0497feb393b5842d3d82c1009520"
-DEPENDS = "zlib"
-
-SRC_URI = "${GENTOO_MIRROR}/libpng-${PV}.tar.xz \
-          "
-SRC_URI[md5sum] = "425354f86c392318d31aedca71019372"
-SRC_URI[sha256sum] = "d8d3ec9de6b5db740fefac702c37ffcf96ae46cb17c18c1544635a3852f78f7a"
-
-BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config"
-
-inherit autotools binconfig-disabled pkgconfig
-
-# Work around missing symbols
-EXTRA_OECONF_append_class-target = " ${@bb.utils.contains("TUNE_FEATURES", "neon", "--enable-arm-neon=on", "--enable-arm-neon=off" ,d)}"
-
-PACKAGES =+ "${PN}-tools"
-
-FILES_${PN}-tools = "${bindir}/png-fix-itxt ${bindir}/pngfix ${bindir}/pngcp"
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libpng/libpng_1.6.31.bb b/import-layers/yocto-poky/meta/recipes-multimedia/libpng/libpng_1.6.31.bb
new file mode 100644
index 0000000..c96ea14
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libpng/libpng_1.6.31.bb
@@ -0,0 +1,28 @@
+SUMMARY = "PNG image format decoding library"
+HOMEPAGE = "http://www.libpng.org/"
+SECTION = "libs"
+LICENSE = "Libpng"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=6f21e4e1f795810b5ea491b333bc6ea1 \
+                    file://png.h;endline=144;md5=af300c419a45c53a8d2daa0b7d167a66"
+DEPENDS = "zlib"
+
+LIBV = "16"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/${PV}/${BP}.tar.xz"
+SRC_URI[md5sum] = "1b34eab440263e32cfa39d19413fad54"
+SRC_URI[sha256sum] = "232a602de04916b2b5ce6f901829caf419519e6a16cc9cd7c1c91187d3ee8b41"
+
+MIRRORS += "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/${PV}/ ${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/older-releases/${PV}/"
+
+BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config"
+
+inherit autotools binconfig-disabled pkgconfig
+
+# Work around missing symbols
+EXTRA_OECONF_append_class-target = " ${@bb.utils.contains("TUNE_FEATURES", "neon", "--enable-arm-neon=on", "--enable-arm-neon=off" ,d)}"
+
+PACKAGES =+ "${PN}-tools"
+
+FILES_${PN}-tools = "${bindir}/png-fix-itxt ${bindir}/pngfix ${bindir}/pngcp"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-8362.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-8362.patch
index 771ec92..9ee7e46 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-8362.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1/CVE-2017-8362.patch
@@ -14,20 +14,17 @@
 Upstream-Status: Backport [https://github.com/erikd/libsndfile/commit/ef1dbb2df1c0e741486646de40bd638a9c4cd808]
 
 Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
-
-removed hunk #2 as it was only cosmentic and caused a merge conflict.
-signef-off-by: Armin Kuster <akuster808@gmail.com>
 ---
  src/flac.c | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
 
-Index: libsndfile-1.0.27/src/flac.c
-===================================================================
---- libsndfile-1.0.27.orig/src/flac.c
-+++ libsndfile-1.0.27/src/flac.c
+diff --git a/src/flac.c b/src/flac.c
+index 5a4f8c2..e4f9aaa 100644
+--- a/src/flac.c
++++ b/src/flac.c
 @@ -169,6 +169,14 @@ flac_buffer_copy (SF_PRIVATE *psf)
- 	const FLAC__int32* const *buffer = pflac->wbuffer ;
- 	unsigned i = 0, j, offset ;
+ 	const int32_t* const *buffer = pflac->wbuffer ;
+ 	unsigned i = 0, j, offset, channels, len ;
  
 +	if (psf->sf.channels != (int) frame->header.channels)
 +	{	psf_log_printf (psf, "Error: FLAC frame changed from %d to %d channels\n"
@@ -40,7 +37,15 @@
  	/*
  	**	frame->header.blocksize is variable and we're using a constant blocksize
  	**	of FLAC__MAX_BLOCK_SIZE.
-@@ -410,7 +418,7 @@ sf_flac_meta_callback (const FLAC__Strea
+@@ -202,7 +210,6 @@ flac_buffer_copy (SF_PRIVATE *psf)
+ 		return 0 ;
+ 		} ;
+ 
+-
+ 	len = SF_MIN (pflac->len, frame->header.blocksize) ;
+ 
+ 	if (pflac->remain % channels != 0)
+@@ -436,7 +443,7 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_
  	{	case FLAC__METADATA_TYPE_STREAMINFO :
  			if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels)
  			{	psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n"
@@ -49,3 +54,6 @@
  									psf->sf.channels, metadata->data.stream_info.channels) ;
  				psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ;
  				return ;
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.27.bb b/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
similarity index 86%
rename from import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.27.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
index c6df4e9..281ac82 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.27.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libsndfile/libsndfile1_1.0.28.bb
@@ -12,8 +12,8 @@
            file://CVE-2017-8363.patch \
           "
 
-SRC_URI[md5sum] = "fd1d97c6077f03b5d984d7956ffedb7a"
-SRC_URI[sha256sum] = "a391952f27f4a92ceb2b4c06493ac107896ed6c76be9a613a4731f076d30fac0"
+SRC_URI[md5sum] = "646b5f98ce89ac60cdb060fcd398247c"
+SRC_URI[sha256sum] = "1ff33929f042fa333aed1e8923aa628c3ee9e1eb85512686c55092d1e5a9dfa9"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=e77fe93202736b47c07035910f47974a"
 
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10093.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10093.patch
deleted file mode 100644
index e09bb7f..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10093.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 787c0ee906430b772f33ca50b97b8b5ca070faec Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Sat, 3 Dec 2016 16:40:01 +0000
-Subject: [PATCH] * tools/tiffcp.c: fix uint32 underflow/overflow that can
- cause heap-based buffer overflow. Reported by Agostino Sarubbo. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2610
-
-Upstream-Status: Backport
-CVE: CVE-2016-10093
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-
----
- ChangeLog      | 7 +++++++
- tools/tiffcp.c | 6 +++---
- 2 files changed, 10 insertions(+), 3 deletions(-)
-
-Index: tiff-4.0.7/tools/tiffcp.c
-===================================================================
---- tiff-4.0.7.orig/tools/tiffcp.c
-+++ tiff-4.0.7/tools/tiffcp.c
-@@ -1163,7 +1163,7 @@ bad:
- 
- static void
- cpStripToTile(uint8* out, uint8* in,
--    uint32 rows, uint32 cols, int outskew, int inskew)
-+    uint32 rows, uint32 cols, int outskew, int64 inskew)
- {
- 	while (rows-- > 0) {
- 		uint32 j = cols;
-@@ -1320,7 +1320,7 @@ DECLAREreadFunc(readContigTilesIntoBuffe
- 	tdata_t tilebuf;
- 	uint32 imagew = TIFFScanlineSize(in);
- 	uint32 tilew  = TIFFTileRowSize(in);
--	int iskew = imagew - tilew;
-+	int64 iskew = (int64)imagew - (int64)tilew;
- 	uint8* bufp = (uint8*) buf;
- 	uint32 tw, tl;
- 	uint32 row;
-@@ -1348,7 +1348,7 @@ DECLAREreadFunc(readContigTilesIntoBuffe
- 				status = 0;
- 				goto done;
- 			}
--			if (colb + tilew > imagew) {
-+			if (colb > iskew) {
- 				uint32 width = imagew - colb;
- 				uint32 oskew = tilew - width;
- 				cpStripToTile(bufp + colb,
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10266.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10266.patch
deleted file mode 100644
index e1c90c6..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10266.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 1855407c4e5a27ade006b26c2dec8a31745c356e Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Fri, 2 Dec 2016 21:56:56 +0000
-Subject: [PATCH] * libtiff/tif_read.c, libtiff/tiffiop.h: fix uint32 overflow
- in TIFFReadEncodedStrip() that caused an integer division by zero. Reported
- by Agostino Sarubbo. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2596
-
-Upstream-Status: Backport
-
-CVE: CVE-2016-10266
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
----
- ChangeLog          | 7 +++++++
- libtiff/tif_read.c | 2 +-
- libtiff/tiffiop.h  | 4 ++++
- 3 files changed, 12 insertions(+), 1 deletion(-)
-
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog
-+++ tiff-4.0.7/ChangeLog
-@@ -1,3 +1,10 @@
-+2016-12-02 Even Rouault <even.rouault at spatialys.com>
-+
-+       * libtiff/tif_read.c, libtiff/tiffiop.h: fix uint32 overflow in
-+       TIFFReadEncodedStrip() that caused an integer division by zero.
-+       Reported by Agostino Sarubbo.
-+       Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2596
-+
- 2017-07-15  Even Rouault <even.rouault at spatialys.com>
- 
- 	* tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
-Index: tiff-4.0.7/libtiff/tif_read.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_read.c
-+++ tiff-4.0.7/libtiff/tif_read.c
-@@ -346,7 +346,7 @@ TIFFReadEncodedStrip(TIFF* tif, uint32 s
- 	rowsperstrip=td->td_rowsperstrip;
- 	if (rowsperstrip>td->td_imagelength)
- 		rowsperstrip=td->td_imagelength;
--	stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip);
-+	stripsperplane= TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
- 	stripinplane=(strip%stripsperplane);
- 	plane=(uint16)(strip/stripsperplane);
- 	rows=td->td_imagelength-stripinplane*rowsperstrip;
-Index: tiff-4.0.7/libtiff/tiffiop.h
-===================================================================
---- tiff-4.0.7.orig/libtiff/tiffiop.h
-+++ tiff-4.0.7/libtiff/tiffiop.h
-@@ -250,6 +250,10 @@ struct tiff {
- #define TIFFhowmany_32(x, y) (((uint32)x < (0xffffffff - (uint32)(y-1))) ? \
- 			   ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) : \
- 			   0U)
-+/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
-+/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
-+#define TIFFhowmany_32_maxuint_compat(x, y) \
-+			   (((uint32)(x) / (uint32)(y)) + ((((uint32)(x) % (uint32)(y)) != 0) ? 1 : 0))
- #define TIFFhowmany8_32(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
- #define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
- #define TIFFhowmany_64(x, y) ((((uint64)(x))+(((uint64)(y))-1))/((uint64)(y)))
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10267.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10267.patch
deleted file mode 100644
index f4c5791..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10267.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From f8203c7ab1dbd7b5c59158576bec7da90191f42f Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Sat, 3 Dec 2016 11:15:18 +0000
-Subject: [PATCH] * libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case
- of failure in OJPEGPreDecode(). This will avoid a divide by zero, and
- potential other issues. Reported by Agostino Sarubbo. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2611
-
-Upstream-Status: Backport
-
-CVE: CVE-2016-10267
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
----
- ChangeLog           | 7 +++++++
- libtiff/tif_ojpeg.c | 8 ++++++++
- 2 files changed, 15 insertions(+)
-
-diff --git a/ChangeLog b/ChangeLog
-index 7339c1a..66fbcdc 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,10 @@
-+2016-12-03 Even Rouault <even.rouault at spatialys.com>
-+ 
-+	* libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case of failure in
-+	OJPEGPreDecode(). This will avoid a divide by zero, and potential other issues.
-+	Reported by Agostino Sarubbo.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2611
-+
- 2016-12-02 Even Rouault <even.rouault at spatialys.com>
- 
- 	* libtiff/tif_read.c, libtiff/tiffiop.h: fix uint32 overflow in
-diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c
-index 1ccc3f9..f19e8fd 100644
---- a/libtiff/tif_ojpeg.c
-+++ b/libtiff/tif_ojpeg.c
-@@ -244,6 +244,7 @@ typedef enum {
- 
- typedef struct {
- 	TIFF* tif;
-+        int decoder_ok;
- 	#ifndef LIBJPEG_ENCAP_EXTERNAL
- 	JMP_BUF exit_jmpbuf;
- 	#endif
-@@ -722,6 +723,7 @@ OJPEGPreDecode(TIFF* tif, uint16 s)
- 		}
- 		sp->write_curstrile++;
- 	}
-+	sp->decoder_ok = 1;
- 	return(1);
- }
- 
-@@ -784,8 +786,14 @@ OJPEGPreDecodeSkipScanlines(TIFF* tif)
- static int
- OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
- {
-+        static const char module[]="OJPEGDecode";
- 	OJPEGState* sp=(OJPEGState*)tif->tif_data;
- 	(void)s;
-+        if( !sp->decoder_ok )
-+        {
-+            TIFFErrorExt(tif->tif_clientdata,module,"Cannot decode: decoder not correctly initialized");
-+            return 0;
-+        }
- 	if (sp->libjpeg_jpeg_query_style==0)
- 	{
- 		if (OJPEGDecodeRaw(tif,buf,cc)==0)
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10268.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10268.patch
deleted file mode 100644
index 03b982a..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10268.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 5397a417e61258c69209904e652a1f409ec3b9df Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Fri, 2 Dec 2016 22:13:32 +0000
-Subject: [PATCH] * tools/tiffcp.c: avoid uint32 underflow in cpDecodedStrips
- that can cause various issues, such as buffer overflows in the library.
- Reported by Agostino Sarubbo. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2598
-
-Upstream-Status: Backport
-CVE: CVE-2016-10268
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-
----
- ChangeLog      | 7 +++++++
- tools/tiffcp.c | 2 +-
- 2 files changed, 8 insertions(+), 1 deletion(-)
-
-Index: tiff-4.0.7/tools/tiffcp.c
-===================================================================
---- tiff-4.0.7.orig/tools/tiffcp.c
-+++ tiff-4.0.7/tools/tiffcp.c
-@@ -985,7 +985,7 @@ DECLAREcpFunc(cpDecodedStrips)
- 		tstrip_t s, ns = TIFFNumberOfStrips(in);
- 		uint32 row = 0;
- 		_TIFFmemset(buf, 0, stripsize);
--		for (s = 0; s < ns; s++) {
-+		for (s = 0; s < ns && row < imagelength; s++) {
- 			tsize_t cc = (row + rowsperstrip > imagelength) ?
- 			    TIFFVStripSize(in, imagelength - row) : stripsize;
- 			if (TIFFReadEncodedStrip(in, s, buf, cc) < 0
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10269.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10269.patch
deleted file mode 100644
index d9f4a15..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10269.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From 10f72dd232849d0142a0688bcc9aa71025f120a3 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Fri, 2 Dec 2016 23:05:51 +0000
-Subject: [PATCH 2/4] * libtiff/tif_pixarlog.c, libtiff/tif_luv.c: fix
- heap-based buffer overflow on generation of PixarLog / LUV compressed files,
- with ColorMap, TransferFunction attached and nasty plays with bitspersample.
- The fix for LUV has not been tested, but suffers from the same kind of issue
- of PixarLog. Reported by Agostino Sarubbo. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2604
-
-Upstream-Status: Backport
-
-CVE: CVE-2016-10269
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
----
- ChangeLog              | 10 ++++++++++
- libtiff/tif_luv.c      | 18 ++++++++++++++----
- libtiff/tif_pixarlog.c | 17 +++++++++++++++--
- 3 files changed, 39 insertions(+), 6 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index 2e913b6..0a2c2a7 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,4 +1,14 @@
- 2016-12-03 Even Rouault <even.rouault at spatialys.com>
-+
-+	* libtiff/tif_pixarlog.c, libtiff/tif_luv.c: fix heap-based buffer
-+	overflow on generation of PixarLog / LUV compressed files, with
-+	ColorMap, TransferFunction attached and nasty plays with bitspersample.
-+	The fix for LUV has not been tested, but suffers from the same kind
-+	of issue of PixarLog.
-+	Reported by Agostino Sarubbo.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2604
-+
-+2016-12-03 Even Rouault <even.rouault at spatialys.com>
-  
- 	* libtiff/tif_ojpeg.c: make OJPEGDecode() early exit in case of failure in
- 	OJPEGPreDecode(). This will avoid a divide by zero, and potential other issues.
-diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c
-index f68a9b1..e6783db 100644
---- a/libtiff/tif_luv.c
-+++ b/libtiff/tif_luv.c
-@@ -158,6 +158,7 @@
- typedef struct logLuvState LogLuvState;
- 
- struct logLuvState {
-+        int                     encoder_state;  /* 1 if encoder correctly initialized */
- 	int                     user_datafmt;   /* user data format */
- 	int                     encode_meth;    /* encoding method */
- 	int                     pixel_size;     /* bytes per pixel */
-@@ -1552,6 +1553,7 @@ LogLuvSetupEncode(TIFF* tif)
- 		    td->td_photometric, "must be either LogLUV or LogL");
- 		break;
- 	}
-+	sp->encoder_state = 1;
- 	return (1);
- notsupported:
- 	TIFFErrorExt(tif->tif_clientdata, module,
-@@ -1563,19 +1565,27 @@ notsupported:
- static void
- LogLuvClose(TIFF* tif)
- {
-+        LogLuvState* sp = (LogLuvState*) tif->tif_data;
- 	TIFFDirectory *td = &tif->tif_dir;
- 
-+	assert(sp != 0);
- 	/*
- 	 * For consistency, we always want to write out the same
- 	 * bitspersample and sampleformat for our TIFF file,
- 	 * regardless of the data format being used by the application.
- 	 * Since this routine is called after tags have been set but
- 	 * before they have been recorded in the file, we reset them here.
-+         * Note: this is really a nasty approach. See PixarLogClose
- 	 */
--	td->td_samplesperpixel =
--	    (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
--	td->td_bitspersample = 16;
--	td->td_sampleformat = SAMPLEFORMAT_INT;
-+        if( sp->encoder_state )
-+        {
-+            /* See PixarLogClose. Might avoid issues with tags whose size depends
-+             * on those below, but not completely sure this is enough. */
-+            td->td_samplesperpixel =
-+                (td->td_photometric == PHOTOMETRIC_LOGL) ? 1 : 3;
-+            td->td_bitspersample = 16;
-+            td->td_sampleformat = SAMPLEFORMAT_INT;
-+        }
- }
- 
- static void
-diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c
-index d1246c3..aa99bc9 100644
---- a/libtiff/tif_pixarlog.c
-+++ b/libtiff/tif_pixarlog.c
-@@ -1233,8 +1233,10 @@ PixarLogPostEncode(TIFF* tif)
- static void
- PixarLogClose(TIFF* tif)
- {
-+        PixarLogState* sp = (PixarLogState*) tif->tif_data;
- 	TIFFDirectory *td = &tif->tif_dir;
- 
-+	assert(sp != 0);
- 	/* In a really sneaky (and really incorrect, and untruthful, and
- 	 * troublesome, and error-prone) maneuver that completely goes against
- 	 * the spirit of TIFF, and breaks TIFF, on close, we covertly
-@@ -1243,8 +1245,19 @@ PixarLogClose(TIFF* tif)
- 	 * readers that don't know about PixarLog, or how to set
- 	 * the PIXARLOGDATFMT pseudo-tag.
- 	 */
--	td->td_bitspersample = 8;
--	td->td_sampleformat = SAMPLEFORMAT_UINT;
-+
-+        if (sp->state&PLSTATE_INIT) {
-+            /* We test the state to avoid an issue such as in
-+             * http://bugzilla.maptools.org/show_bug.cgi?id=2604
-+             * What appends in that case is that the bitspersample is 1 and
-+             * a TransferFunction is set. The size of the TransferFunction
-+             * depends on 1<<bitspersample. So if we increase it, an access
-+             * out of the buffer will happen at directory flushing.
-+             * Another option would be to clear those targs. 
-+             */
-+            td->td_bitspersample = 8;
-+            td->td_sampleformat = SAMPLEFORMAT_UINT;
-+        }
- }
- 
- static void
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10270.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10270.patch
deleted file mode 100644
index 43ad6ed..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10270.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From 6e7042c61e300cf9971c645c79d05de974b24308 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Sat, 3 Dec 2016 11:02:15 +0000
-Subject: [PATCH 3/4] * libtiff/tif_dirread.c: modify
- ChopUpSingleUncompressedStrip() to instanciate compute ntrips as
- TIFFhowmany_32(td->td_imagelength, rowsperstrip), instead of a logic based on
- the total size of data. Which is faulty is the total size of data is not
- sufficient to fill the whole image, and thus results in reading outside of
- the StripByCounts/StripOffsets arrays when using TIFFReadScanline(). Reported
- by Agostino Sarubbo. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2608.
-
-* libtiff/tif_strip.c: revert the change in TIFFNumberOfStrips() done
-for http://bugzilla.maptools.org/show_bug.cgi?id=2587 / CVE-2016-9273 since
-the above change is a better fix that makes it unnecessary.
-
-Upstream-Status: Backport
-
-CVE: CVE-2016-10270
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
----
- ChangeLog             | 15 +++++++++++++++
- libtiff/tif_dirread.c | 22 ++++++++++------------
- libtiff/tif_strip.c   |  9 ---------
- 3 files changed, 25 insertions(+), 21 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index 0a2c2a7..6e30e41 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,5 +1,20 @@
- 2016-12-03 Even Rouault <even.rouault at spatialys.com>
- 
-+	* libtiff/tif_dirread.c: modify ChopUpSingleUncompressedStrip() to
-+	instanciate compute ntrips as TIFFhowmany_32(td->td_imagelength, rowsperstrip),
-+	instead of a logic based on the total size of data. Which is faulty is
-+	the total size of data is not sufficient to fill the whole image, and thus
-+	results in reading outside of the StripByCounts/StripOffsets arrays when
-+	using TIFFReadScanline().
-+	Reported by Agostino Sarubbo.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2608.
-+
-+	* libtiff/tif_strip.c: revert the change in TIFFNumberOfStrips() done
-+	for http://bugzilla.maptools.org/show_bug.cgi?id=2587 / CVE-2016-9273 since
-+	the above change is a better fix that makes it unnecessary.
-+
-+2016-12-03 Even Rouault <even.rouault at spatialys.com>
-+
- 	* libtiff/tif_pixarlog.c, libtiff/tif_luv.c: fix heap-based buffer
- 	overflow on generation of PixarLog / LUV compressed files, with
- 	ColorMap, TransferFunction attached and nasty plays with bitspersample.
-diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
-index 3eec79c..570d0c3 100644
---- a/libtiff/tif_dirread.c
-+++ b/libtiff/tif_dirread.c
-@@ -5502,8 +5502,7 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
- 	uint64 rowblockbytes;
- 	uint64 stripbytes;
- 	uint32 strip;
--	uint64 nstrips64;
--	uint32 nstrips32;
-+	uint32 nstrips;
- 	uint32 rowsperstrip;
- 	uint64* newcounts;
- 	uint64* newoffsets;
-@@ -5534,18 +5533,17 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
- 	    return;
- 
- 	/*
--	 * never increase the number of strips in an image
-+	 * never increase the number of rows per strip
- 	 */
- 	if (rowsperstrip >= td->td_rowsperstrip)
- 		return;
--	nstrips64 = TIFFhowmany_64(bytecount, stripbytes);
--	if ((nstrips64==0)||(nstrips64>0xFFFFFFFF)) /* something is wonky, do nothing. */
--	    return;
--	nstrips32 = (uint32)nstrips64;
-+        nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
-+        if( nstrips == 0 )
-+            return;
- 
--	newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64),
-+	newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
- 				"for chopped \"StripByteCounts\" array");
--	newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips32, sizeof (uint64),
-+	newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
- 				"for chopped \"StripOffsets\" array");
- 	if (newcounts == NULL || newoffsets == NULL) {
- 		/*
-@@ -5562,18 +5560,18 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
- 	 * Fill the strip information arrays with new bytecounts and offsets
- 	 * that reflect the broken-up format.
- 	 */
--	for (strip = 0; strip < nstrips32; strip++) {
-+	for (strip = 0; strip < nstrips; strip++) {
- 		if (stripbytes > bytecount)
- 			stripbytes = bytecount;
- 		newcounts[strip] = stripbytes;
--		newoffsets[strip] = offset;
-+		newoffsets[strip] = stripbytes ? offset : 0;
- 		offset += stripbytes;
- 		bytecount -= stripbytes;
- 	}
- 	/*
- 	 * Replace old single strip info with multi-strip info.
- 	 */
--	td->td_stripsperimage = td->td_nstrips = nstrips32;
-+	td->td_stripsperimage = td->td_nstrips = nstrips;
- 	TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
- 
- 	_TIFFfree(td->td_stripbytecount);
-diff --git a/libtiff/tif_strip.c b/libtiff/tif_strip.c
-index 4c46ecf..1676e47 100644
---- a/libtiff/tif_strip.c
-+++ b/libtiff/tif_strip.c
-@@ -63,15 +63,6 @@ TIFFNumberOfStrips(TIFF* tif)
- 	TIFFDirectory *td = &tif->tif_dir;
- 	uint32 nstrips;
- 
--    /* If the value was already computed and store in td_nstrips, then return it,
--       since ChopUpSingleUncompressedStrip might have altered and resized the
--       since the td_stripbytecount and td_stripoffset arrays to the new value
--       after the initial affectation of td_nstrips = TIFFNumberOfStrips() in
--       tif_dirread.c ~line 3612.
--       See http://bugzilla.maptools.org/show_bug.cgi?id=2587 */
--    if( td->td_nstrips )
--        return td->td_nstrips;
--
- 	nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
- 	     TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
- 	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10271.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10271.patch
deleted file mode 100644
index 4fe5bcd..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2016-10271.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 9657bbe3cdce4aaa90e07d50c1c70ae52da0ba6a Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Sat, 3 Dec 2016 11:35:56 +0000
-Subject: [PATCH] * tools/tiffcrop.c: fix readContigStripsIntoBuffer() in -i
- (ignore) mode so that the output buffer is correctly incremented to avoid
- write outside bounds. Reported by Agostino Sarubbo. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2620
-
-Upstream-Status: Backport
-CVE: CVE-2016-10271
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-
----
- ChangeLog        | 7 +++++++
- tools/tiffcrop.c | 2 +-
- 2 files changed, 8 insertions(+), 1 deletion(-)
-
-Index: tiff-4.0.7/tools/tiffcrop.c
-===================================================================
---- tiff-4.0.7.orig/tools/tiffcrop.c
-+++ tiff-4.0.7/tools/tiffcrop.c
-@@ -3698,7 +3698,7 @@ static int readContigStripsIntoBuffer (T
-                                   (unsigned long) strip, (unsigned long)rows);
-                         return 0;
-                 }
--                bufp += bytes_read;
-+                bufp += stripsize;
-         }
- 
-         return 1;
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-10688.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-10688.patch
index ed9c0f5..b0db969 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-10688.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-10688.patch
@@ -18,10 +18,10 @@
  libtiff/tif_dirwrite.c | 20 ++++++++++++++++----
  2 files changed, 24 insertions(+), 4 deletions(-)
 
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog
-+++ tiff-4.0.7/ChangeLog
+diff --git a/ChangeLog b/ChangeLog
+index 0240f0b..42eaeb7 100644
+--- a/ChangeLog
++++ b/ChangeLog
 @@ -1,3 +1,11 @@
 +2017-06-30  Even Rouault <even.rouault at spatialys.com>
 +
@@ -34,11 +34,11 @@
  2017-06-26  Even Rouault <even.rouault at spatialys.com>
  
  	* libtiff/tif_jbig.c: fix memory leak in error code path of JBIGDecode()
-Index: tiff-4.0.7/libtiff/tif_dirwrite.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dirwrite.c
-+++ tiff-4.0.7/libtiff/tif_dirwrite.c
-@@ -2047,7 +2047,10 @@ TIFFWriteDirectoryTagCheckedLong8(TIFF*
+diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c
+index 2967da5..8d6686b 100644
+--- a/libtiff/tif_dirwrite.c
++++ b/libtiff/tif_dirwrite.c
+@@ -2111,7 +2111,10 @@ TIFFWriteDirectoryTagCheckedLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
  {
  	uint64 m;
  	assert(sizeof(uint64)==8);
@@ -50,7 +50,7 @@
  	m=value;
  	if (tif->tif_flags&TIFF_SWAB)
  		TIFFSwabLong8(&m);
-@@ -2060,7 +2063,10 @@ TIFFWriteDirectoryTagCheckedLong8Array(T
+@@ -2124,7 +2127,10 @@ TIFFWriteDirectoryTagCheckedLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* di
  {
  	assert(count<0x20000000);
  	assert(sizeof(uint64)==8);
@@ -62,7 +62,7 @@
  	if (tif->tif_flags&TIFF_SWAB)
  		TIFFSwabArrayOfLong8(value,count);
  	return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_LONG8,count,count*8,value));
-@@ -2072,7 +2078,10 @@ TIFFWriteDirectoryTagCheckedSlong8(TIFF*
+@@ -2136,7 +2142,10 @@ TIFFWriteDirectoryTagCheckedSlong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, u
  {
  	int64 m;
  	assert(sizeof(int64)==8);
@@ -74,7 +74,7 @@
  	m=value;
  	if (tif->tif_flags&TIFF_SWAB)
  		TIFFSwabLong8((uint64*)(&m));
-@@ -2085,7 +2094,10 @@ TIFFWriteDirectoryTagCheckedSlong8Array(
+@@ -2149,7 +2158,10 @@ TIFFWriteDirectoryTagCheckedSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* d
  {
  	assert(count<0x20000000);
  	assert(sizeof(int64)==8);
@@ -86,3 +86,6 @@
  	if (tif->tif_flags&TIFF_SWAB)
  		TIFFSwabArrayOfLong8((uint64*)value,count);
  	return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG8,count,count*8,value));
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-13726.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-13726.patch
new file mode 100644
index 0000000..c60ffa6
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-13726.patch
@@ -0,0 +1,54 @@
+From 5317ce215936ce611846557bb104b49d3b4c8345 Mon Sep 17 00:00:00 2001
+From: Even Rouault <even.rouault@spatialys.com>
+Date: Wed, 23 Aug 2017 13:21:41 +0000
+Subject: [PATCH] * libtiff/tif_dirwrite.c: replace assertion related to not
+ finding the SubIFD tag by runtime check. Fixes
+ http://bugzilla.maptools.org/show_bug.cgi?id=2727 Reported by team OWL337
+
+Upstream-Status: Backport
+[https://github.com/vadz/libtiff/commit/f91ca83a21a6a583050e5a5755ce1441b2bf1d7e]
+
+CVE: CVE-2017-13726
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ ChangeLog              | 7 +++++++
+ libtiff/tif_dirwrite.c | 7 ++++++-
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 6980da8..3e299d9 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2017-08-23  Even Rouault <even.rouault at spatialys.com>
++
++	* libtiff/tif_dirwrite.c: replace assertion related to not finding the
++	SubIFD tag by runtime check.
++	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2727
++	Reported by team OWL337
++
+ 2017-07-15  Even Rouault <even.rouault at spatialys.com>
+ 
+ 	* tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
+diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c
+index 8d6686b..14090ae 100644
+--- a/libtiff/tif_dirwrite.c
++++ b/libtiff/tif_dirwrite.c
+@@ -821,7 +821,12 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
+ 			TIFFDirEntry* nb;
+ 			for (na=0, nb=dir; ; na++, nb++)
+ 			{
+-				assert(na<ndir);
++				if( na == ndir )
++                                {
++                                    TIFFErrorExt(tif->tif_clientdata,module,
++                                                 "Cannot find SubIFD tag");
++                                    goto bad;
++                                }
+ 				if (nb->tdir_tag==TIFFTAG_SUBIFD)
+ 					break;
+ 			}
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-13727.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-13727.patch
new file mode 100644
index 0000000..e228c2f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-13727.patch
@@ -0,0 +1,65 @@
+From a5e8245cc67646f7b448b4ca29258eaac418102c Mon Sep 17 00:00:00 2001
+From: Even Rouault <even.rouault@spatialys.com>
+Date: Wed, 23 Aug 2017 13:33:42 +0000
+Subject: [PATCH] * libtiff/tif_dirwrite.c: replace assertion to tag value not
+ fitting on uint32 when selecting the value of SubIFD tag by runtime check (in
+ TIFFWriteDirectoryTagSubifd()). Fixes
+ http://bugzilla.maptools.org/show_bug.cgi?id=2728 Reported by team OWL337
+
+SubIFD tag by runtime check (in TIFFWriteDirectorySec())
+
+Upstream-Status: Backport
+[https://github.com/vadz/libtiff/commit/b6af137bf9ef852f1a48a50a5afb88f9e9da01cc]
+
+CVE: CVE-2017-13727
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ ChangeLog              | 10 +++++++++-
+ libtiff/tif_dirwrite.c |  9 ++++++++-
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 3e299d9..8f5efe9 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,7 +1,15 @@
+ 2017-08-23  Even Rouault <even.rouault at spatialys.com>
+ 
++	* libtiff/tif_dirwrite.c: replace assertion to tag value not fitting
++	on uint32 when selecting the value of SubIFD tag by runtime check
++	(in TIFFWriteDirectoryTagSubifd()).
++	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2728
++	Reported by team OWL337
++
++2017-08-23  Even Rouault <even.rouault at spatialys.com>
++
+ 	* libtiff/tif_dirwrite.c: replace assertion related to not finding the
+-	SubIFD tag by runtime check.
++	SubIFD tag by runtime check (in TIFFWriteDirectorySec())
+ 	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2727
+ 	Reported by team OWL337
+ 
+diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c
+index 14090ae..f0a4baa 100644
+--- a/libtiff/tif_dirwrite.c
++++ b/libtiff/tif_dirwrite.c
+@@ -1949,7 +1949,14 @@ TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
+ 		for (p=0; p < tif->tif_dir.td_nsubifd; p++)
+ 		{
+                         assert(pa != 0);
+-			assert(*pa <= 0xFFFFFFFFUL);
++
++                        /* Could happen if an classicTIFF has a SubIFD of type LONG8 (which is illegal) */
++                        if( *pa > 0xFFFFFFFFUL)
++                        {
++                            TIFFErrorExt(tif->tif_clientdata,module,"Illegal value for SubIFD tag");
++                            _TIFFfree(o);
++                            return(0);
++                        }
+ 			*pb++=(uint32)(*pa++);
+ 		}
+ 		n=TIFFWriteDirectoryTagCheckedIfdArray(tif,ndir,dir,TIFFTAG_SUBIFD,tif->tif_dir.td_nsubifd,o);
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7592.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7592.patch
deleted file mode 100644
index 5b80445..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7592.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 48780b4fcc425cddc4ef8ffdf536f96a0d1b313b Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Wed, 11 Jan 2017 16:38:26 +0000
-Subject: [PATCH] * libtiff/tif_getimage.c: add explicit uint32 cast in putagreytile to
-avoid UndefinedBehaviorSanitizer warning.
-Patch by Nicolas Pena.
-Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2658
-
-Upstream-Status: Backport
-CVE: CVE-2017-7592
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-24 14:25:10.143926025 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-24 15:20:21.291839230 +0530
-@@ -1,3 +1,10 @@
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
-+	* libtiff/tif_getimage.c: add explicit uint32 cast in putagreytile to
-+	avoid UndefinedBehaviorSanitizer warning.
-+	Patch by Nicolas Pena.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2658
-+
- 2016-12-03 Even Rouault <even.rouault at spatialys.com>
- 
- 	* libtiff/tif_dirread.c: modify ChopUpSingleUncompressedStrip() to
-Index: tiff-4.0.7/libtiff/tif_getimage.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_getimage.c	2016-11-18 08:17:45.000000000 +0530
-+++ tiff-4.0.7/libtiff/tif_getimage.c	2017-04-24 15:17:46.671843283 +0530
-@@ -1305,7 +1305,7 @@
-     while (h-- > 0) {
- 	for (x = w; x-- > 0;)
-         {
--            *cp++ = BWmap[*pp][0] & (*(pp+1) << 24 | ~A1);
-+            *cp++ = BWmap[*pp][0] & ((uint32)*(pp+1) << 24 | ~A1);
-             pp += samplesperpixel;
-         }
- 	cp += toskew;
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7593.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7593.patch
deleted file mode 100644
index 380dfcb..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7593.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From d60332057b9575ada4f264489582b13e30137be1 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Wed, 11 Jan 2017 19:02:49 +0000
-Subject: [PATCH] * libtiff/tiffiop.h, tif_unix.c, tif_win32.c, tif_vms.c: add
- _TIFFcalloc()
-
-* libtiff/tif_read.c: TIFFReadBufferSetup(): use _TIFFcalloc() to zero
-initialize tif_rawdata.
-Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2651
-
-Upstream-Status: Backport
-
-CVE: CVE-2017-7593
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-25 19:03:20.584155452 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-26 12:09:41.986866896 +0530
-@@ -44,6 +44,14 @@
- 
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
- 
-+	* libtiff/tiffiop.h, tif_unix.c, tif_win32.c : add _TIFFcalloc()
-+
-+	* libtiff/tif_read.c: TIFFReadBufferSetup(): use _TIFFcalloc() to zero
-+	initialize tif_rawdata.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2651
-+
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
- 	* libtiff/tif_getimage.c: add explicit uint32 cast in putagreytile to
- 	avoid UndefinedBehaviorSanitizer warning.
- 	Patch by Nicolas Pena.
-Index: tiff-4.0.7/libtiff/tif_read.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_read.c	2017-04-25 19:03:20.584155452 +0530
-+++ tiff-4.0.7/libtiff/tif_read.c	2017-04-26 12:11:42.814863729 +0530
-@@ -986,7 +986,9 @@
- 				 "Invalid buffer size");
- 		    return (0);
- 		}
--		tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize);
-+                /* Initialize to zero to avoid uninitialized buffers in case of */
-+                /* short reads (http://bugzilla.maptools.org/show_bug.cgi?id=2651) */
-+                tif->tif_rawdata = (uint8*) _TIFFcalloc(1, tif->tif_rawdatasize);
- 		tif->tif_flags |= TIFF_MYBUFFER;
- 	}
- 	if (tif->tif_rawdata == NULL) {
-Index: tiff-4.0.7/libtiff/tif_unix.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_unix.c	2015-08-29 03:46:22.707817041 +0530
-+++ tiff-4.0.7/libtiff/tif_unix.c	2017-04-26 12:13:07.442861510 +0530
-@@ -316,6 +316,14 @@
- 	return (malloc((size_t) s));
- }
- 
-+void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)
-+{
-+    if( nmemb == 0 || siz == 0 )
-+        return ((void *) NULL);
-+
-+    return calloc((size_t) nmemb, (size_t)siz);
-+}
-+
- void
- _TIFFfree(void* p)
- {
-Index: tiff-4.0.7/libtiff/tif_win32.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_win32.c	2015-08-29 03:46:22.730570169 +0530
-+++ tiff-4.0.7/libtiff/tif_win32.c	2017-04-26 12:14:12.918859794 +0530
-@@ -360,6 +360,14 @@
- 	return (malloc((size_t) s));
- }
- 
-+void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)
-+{
-+    if( nmemb == 0 || siz == 0 )
-+        return ((void *) NULL);
-+
-+    return calloc((size_t) nmemb, (size_t)siz);
-+}
-+
- void
- _TIFFfree(void* p)
- {
-Index: tiff-4.0.7/libtiff/tiffio.h
-===================================================================
---- tiff-4.0.7.orig/libtiff/tiffio.h	2016-01-24 21:09:51.894442042 +0530
-+++ tiff-4.0.7/libtiff/tiffio.h	2017-04-26 12:15:55.034857117 +0530
-@@ -293,6 +293,7 @@
-  */
- 
- extern void* _TIFFmalloc(tmsize_t s);
-+extern void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz);
- extern void* _TIFFrealloc(void* p, tmsize_t s);
- extern void _TIFFmemset(void* p, int v, tmsize_t c);
- extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c);
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7594-p1.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7594-p1.patch
deleted file mode 100644
index 5c7e460..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7594-p1.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-rom 8283e4d1b7e53340684d12932880cbcbaf23a8c1 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Thu, 12 Jan 2017 17:43:25 +0000
-
-* libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesAcTable
-  when read fails.
-  Patch by Nicolas Pena.
-  Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2659
-
-Upstream-Status: Backport
-
-CVE: CVE-2017-7594 #patch1
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-24 16:13:15.000000000 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-24 16:50:26.465897646 +0530
-@@ -1,3 +1,10 @@
-+2017-01-12 Even Rouault <even.rouault at spatialys.com>
-+
-+	* libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesAcTable
-+	when read fails.
-+	Patch by Nicolás Peña.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2659
-+
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
- 
- 	* libtiff/tif_getimage.c: add explicit uint32 cast in putagreytile to
-Index: tiff-4.0.7/libtiff/tif_ojpeg.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_ojpeg.c	2017-04-24 16:02:29.817973051 +0530
-+++ tiff-4.0.7/libtiff/tif_ojpeg.c	2017-04-24 16:52:27.349894477 +0530
-@@ -1918,7 +1918,10 @@
- 				rb[sizeof(uint32)+5+n]=o[n];
- 			p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
- 			if (p!=q)
-+                        {
-+                                _TIFFfree(rb);
- 				return(0);
-+                        }
- 			sp->actable[m]=rb;
- 			sp->sos_tda[m]=(sp->sos_tda[m]|m);
- 		}
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7594-p2.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7594-p2.patch
deleted file mode 100644
index 82a19c6..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7594-p2.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 2ea32f7372b65c24b2816f11c04bf59b5090d05b Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Thu, 12 Jan 2017 19:23:20 +0000
-Subject: [PATCH 2/2] * libtiff/tif_ojpeg.c: fix leak in
- OJPEGReadHeaderInfoSecTablesQTable, OJPEGReadHeaderInfoSecTablesDcTable and
- OJPEGReadHeaderInfoSecTablesAcTable
-
-Upstream-status: Backport
-
-CVE: CVE-2017-7594 #patch2
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-24 16:50:26.465897646 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-24 16:56:20.685888360 +0530
-@@ -1,6 +1,7 @@
- 2017-01-12 Even Rouault <even.rouault at spatialys.com>
- 
--	* libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesAcTable
-+	* libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesQTable,
-+	OJPEGReadHeaderInfoSecTablesDcTable and OJPEGReadHeaderInfoSecTablesAcTable
- 	when read fails.
- 	Patch by Nicolás Peña.
- 	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2659
-Index: tiff-4.0.7/libtiff/tif_ojpeg.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_ojpeg.c	2017-04-24 16:52:27.349894477 +0530
-+++ tiff-4.0.7/libtiff/tif_ojpeg.c	2017-04-24 16:59:20.001883660 +0530
-@@ -1790,7 +1790,10 @@
- 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 
- 			p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
- 			if (p!=64)
-+                        {
-+                                _TIFFfree(ob);
- 				return(0);
-+                        }
- 			sp->qtable[m]=ob;
- 			sp->sof_tq[m]=m;
- 		}
-@@ -1854,7 +1857,10 @@
- 				rb[sizeof(uint32)+5+n]=o[n];
- 			p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
- 			if (p!=q)
-+                        {
-+                                _TIFFfree(rb);
- 				return(0);
-+                        }
- 			sp->dctable[m]=rb;
- 			sp->sos_tda[m]=(m<<4);
- 		}
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7595.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7595.patch
deleted file mode 100644
index 851a37f..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7595.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-commit 618d490090bfd10e613ac574ecff31a293904b44
-Author: erouault <erouault>
-Date:   Wed Jan 11 12:15:01 2017 +0000
-
-    * libtiff/tif_jpeg.c: avoid integer division by zero
-      in JPEGSetupEncode() when horizontal or vertical sampling is set to 0.
-      Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2653
-
-Upstream-Status: Backport
-
-CVE: CVE-2017-7595
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-24 17:31:40.013832807 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-24 18:03:34.769782616 +0530
-@@ -8,6 +8,12 @@
- 
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
- 
-+	* libtiff/tif_jpeg.c: avoid integer division by zero in
-+	JPEGSetupEncode() when horizontal or vertical sampling is set to 0.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2653
-+
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
- 	* libtiff/tif_getimage.c: add explicit uint32 cast in putagreytile to
- 	avoid UndefinedBehaviorSanitizer warning.
- 	Patch by Nicolas Pena.
-Index: tiff-4.0.7/libtiff/tif_jpeg.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_jpeg.c	2016-01-24 21:09:51.781641625 +0530
-+++ tiff-4.0.7/libtiff/tif_jpeg.c	2017-04-24 18:05:59.777778815 +0530
-@@ -1626,6 +1626,13 @@
- 	case PHOTOMETRIC_YCBCR:
- 		sp->h_sampling = td->td_ycbcrsubsampling[0];
- 		sp->v_sampling = td->td_ycbcrsubsampling[1];
-+                if( sp->h_sampling == 0 || sp->v_sampling == 0 )
-+                {
-+                      TIFFErrorExt(tif->tif_clientdata, module,
-+                                   "Invalig horizontal/vertical sampling value");
-+                      return (0);
-+                }
-+
- 		/*
- 		 * A ReferenceBlackWhite field *must* be present since the
- 		 * default value is inappropriate for YCbCr.  Fill in the
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7596.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7596.patch
deleted file mode 100644
index 1945c3d..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7596.patch
+++ /dev/null
@@ -1,308 +0,0 @@
-From 3144e57770c1e4d26520d8abee750f8ac8b75490 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Wed, 11 Jan 2017 16:09:02 +0000
-Subject: [PATCH] * libtiff/tif_dir.c, tif_dirread.c, tif_dirwrite.c: implement
- various clampings of double to other data types to avoid undefined behaviour
- if the output range isn't big enough to hold the input value. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2643
- http://bugzilla.maptools.org/show_bug.cgi?id=2642
- http://bugzilla.maptools.org/show_bug.cgi?id=2646
- http://bugzilla.maptools.org/show_bug.cgi?id=2647
-
-Upstream-Status: Backport
-
-CVE: CVE-2017-7596
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-25 15:53:40.294592812 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-25 16:02:03.238600641 +0530
-@@ -6,6 +6,16 @@
- 	Patch by Nicolás Peña.
- 	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2659
- 
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
-+	* libtiff/tif_dir.c, tif_dirread.c, tif_dirwrite.c: implement various clampings
-+	of double to other data types to avoid undefined behaviour if the output range
-+	isn't big enough to hold the input value.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2643
-+	http://bugzilla.maptools.org/show_bug.cgi?id=2642
-+	http://bugzilla.maptools.org/show_bug.cgi?id=2646
-+	http://bugzilla.maptools.org/show_bug.cgi?id=2647
-+
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
- 
- 	* libtiff/tif_jpeg.c: avoid integer division by zero in
-Index: tiff-4.0.7/libtiff/tif_dir.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dir.c	2016-10-30 04:33:18.856598072 +0530
-+++ tiff-4.0.7/libtiff/tif_dir.c	2017-04-25 16:02:03.238600641 +0530
-@@ -31,6 +31,7 @@
-  * (and also some miscellaneous stuff)
-  */
- #include "tiffiop.h"
-+#include <float.h>
- 
- /*
-  * These are used in the backwards compatibility code...
-@@ -154,6 +155,15 @@
- 	return (0);
- }
- 
-+static float TIFFClampDoubleToFloat( double val )
-+{
-+    if( val > FLT_MAX )
-+        return FLT_MAX;
-+    if( val < -FLT_MAX )
-+        return -FLT_MAX;
-+    return (float)val;
-+}
-+
- static int
- _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
- {
-@@ -312,13 +322,13 @@
-         dblval = va_arg(ap, double);
-         if( dblval < 0 )
-             goto badvaluedouble;
--		td->td_xresolution = (float) dblval;
-+		td->td_xresolution = TIFFClampDoubleToFloat( dblval );
- 		break;
- 	case TIFFTAG_YRESOLUTION:
-         dblval = va_arg(ap, double);
-         if( dblval < 0 )
-             goto badvaluedouble;
--		td->td_yresolution = (float) dblval;
-+		td->td_yresolution = TIFFClampDoubleToFloat( dblval );
- 		break;
- 	case TIFFTAG_PLANARCONFIG:
- 		v = (uint16) va_arg(ap, uint16_vap);
-@@ -327,10 +337,10 @@
- 		td->td_planarconfig = (uint16) v;
- 		break;
- 	case TIFFTAG_XPOSITION:
--		td->td_xposition = (float) va_arg(ap, double);
-+		td->td_xposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
- 		break;
- 	case TIFFTAG_YPOSITION:
--		td->td_yposition = (float) va_arg(ap, double);
-+		td->td_yposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
- 		break;
- 	case TIFFTAG_RESOLUTIONUNIT:
- 		v = (uint16) va_arg(ap, uint16_vap);
-Index: tiff-4.0.7/libtiff/tif_dirread.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dirread.c	2017-04-25 15:53:40.134592810 +0530
-+++ tiff-4.0.7/libtiff/tif_dirread.c	2017-04-25 16:02:03.242600641 +0530
-@@ -40,6 +40,7 @@
-  */
- 
- #include "tiffiop.h"
-+#include <float.h>
- 
- #define IGNORE 0          /* tag placeholder used below */
- #define FAILED_FII    ((uint32) -1)
-@@ -2406,7 +2407,14 @@
- 				ma=(double*)origdata;
- 				mb=data;
- 				for (n=0; n<count; n++)
--					*mb++=(float)(*ma++);
-+                                {
-+                                    double val = *ma++;
-+                                    if( val > FLT_MAX )
-+                                        val = FLT_MAX;
-+                                    else if( val < -FLT_MAX )
-+                                        val = -FLT_MAX;
-+                                    *mb++=(float)val;
-+                                }
- 			}
- 			break;
- 	}
-Index: tiff-4.0.7/libtiff/tif_dirwrite.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dirwrite.c	2016-10-30 04:33:18.876854501 +0530
-+++ tiff-4.0.7/libtiff/tif_dirwrite.c	2017-04-25 16:07:48.670606018 +0530
-@@ -30,6 +30,7 @@
-  * Directory Write Support Routines.
-  */
- #include "tiffiop.h"
-+#include <float.h>
- 
- #ifdef HAVE_IEEEFP
- #define TIFFCvtNativeToIEEEFloat(tif, n, fp)
-@@ -939,6 +940,69 @@
- 	return(0);
- }
- 
-+static float TIFFClampDoubleToFloat( double val )
-+{
-+    if( val > FLT_MAX )
-+        return FLT_MAX;
-+    if( val < -FLT_MAX )
-+        return -FLT_MAX;
-+    return (float)val;
-+}
-+
-+static int8 TIFFClampDoubleToInt8( double val )
-+{
-+    if( val > 127 )
-+        return 127;
-+    if( val < -128 || val != val )
-+        return -128;
-+    return (int8)val;
-+}
-+
-+static int16 TIFFClampDoubleToInt16( double val )
-+{
-+    if( val > 32767 )
-+        return 32767;
-+    if( val < -32768 || val != val )
-+        return -32768;
-+    return (int16)val;
-+}
-+
-+static int32 TIFFClampDoubleToInt32( double val )
-+{
-+    if( val > 0x7FFFFFFF )
-+        return 0x7FFFFFFF;
-+    if( val < -0x7FFFFFFF-1 || val != val )
-+        return -0x7FFFFFFF-1;
-+    return (int32)val;
-+}
-+
-+static uint8 TIFFClampDoubleToUInt8( double val )
-+{
-+    if( val < 0 )
-+        return 0;
-+    if( val > 255 || val != val )
-+        return 255;
-+    return (uint8)val;
-+}
-+
-+static uint16 TIFFClampDoubleToUInt16( double val )
-+{
-+    if( val < 0 )
-+        return 0;
-+    if( val > 65535 || val != val )
-+        return 65535;
-+    return (uint16)val;
-+}
-+
-+static uint32 TIFFClampDoubleToUInt32( double val )
-+{
-+    if( val < 0 )
-+        return 0;
-+    if( val > 0xFFFFFFFFU || val != val )
-+        return 0xFFFFFFFFU;
-+    return (uint32)val;
-+}
-+
- static int
- TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
- {
-@@ -959,7 +1023,7 @@
- 			if (tif->tif_dir.td_bitspersample<=32)
- 			{
- 				for (i = 0; i < count; ++i)
--					((float*)conv)[i] = (float)value[i];
-+					((float*)conv)[i] = TIFFClampDoubleToFloat(value[i]);
- 				ok = TIFFWriteDirectoryTagFloatArray(tif,ndir,dir,tag,count,(float*)conv);
- 			}
- 			else
-@@ -971,19 +1035,19 @@
- 			if (tif->tif_dir.td_bitspersample<=8)
- 			{
- 				for (i = 0; i < count; ++i)
--					((int8*)conv)[i] = (int8)value[i];
-+					((int8*)conv)[i] = TIFFClampDoubleToInt8(value[i]);
- 				ok = TIFFWriteDirectoryTagSbyteArray(tif,ndir,dir,tag,count,(int8*)conv);
- 			}
- 			else if (tif->tif_dir.td_bitspersample<=16)
- 			{
- 				for (i = 0; i < count; ++i)
--					((int16*)conv)[i] = (int16)value[i];
-+					((int16*)conv)[i] = TIFFClampDoubleToInt16(value[i]);
- 				ok = TIFFWriteDirectoryTagSshortArray(tif,ndir,dir,tag,count,(int16*)conv);
- 			}
- 			else
- 			{
- 				for (i = 0; i < count; ++i)
--					((int32*)conv)[i] = (int32)value[i];
-+					((int32*)conv)[i] = TIFFClampDoubleToInt32(value[i]);
- 				ok = TIFFWriteDirectoryTagSlongArray(tif,ndir,dir,tag,count,(int32*)conv);
- 			}
- 			break;
-@@ -991,19 +1055,19 @@
- 			if (tif->tif_dir.td_bitspersample<=8)
- 			{
- 				for (i = 0; i < count; ++i)
--					((uint8*)conv)[i] = (uint8)value[i];
-+					((uint8*)conv)[i] = TIFFClampDoubleToUInt8(value[i]);
- 				ok = TIFFWriteDirectoryTagByteArray(tif,ndir,dir,tag,count,(uint8*)conv);
- 			}
- 			else if (tif->tif_dir.td_bitspersample<=16)
- 			{
- 				for (i = 0; i < count; ++i)
--					((uint16*)conv)[i] = (uint16)value[i];
-+					((uint16*)conv)[i] = TIFFClampDoubleToUInt16(value[i]);
- 				ok = TIFFWriteDirectoryTagShortArray(tif,ndir,dir,tag,count,(uint16*)conv);
- 			}
- 			else
- 			{
- 				for (i = 0; i < count; ++i)
--					((uint32*)conv)[i] = (uint32)value[i];
-+					((uint32*)conv)[i] = TIFFClampDoubleToUInt32(value[i]);
- 				ok = TIFFWriteDirectoryTagLongArray(tif,ndir,dir,tag,count,(uint32*)conv);
- 			}
- 			break;
-@@ -2094,15 +2158,25 @@
- static int
- TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
- {
-+        static const char module[] = "TIFFWriteDirectoryTagCheckedRational";
- 	uint32 m[2];
--	assert(value>=0.0);
- 	assert(sizeof(uint32)==4);
--	if (value<=0.0)
-+	if (value<0)
-+	{
-+            TIFFErrorExt(tif->tif_clientdata,module,"Negative value is illegal");
-+            return 0;
-+	}
-+        else if( value != value )
-+        {
-+            TIFFErrorExt(tif->tif_clientdata,module,"Not-a-number value is illegal");
-+            return 0;
-+        }
-+        else if (value==0.0)
- 	{
- 		m[0]=0;
- 		m[1]=1;
--	}
--	else if (value==(double)(uint32)value)
-+        }
-+        else if (value <= 0xFFFFFFFFU && value==(double)(uint32)value)
- 	{
- 		m[0]=(uint32)value;
- 		m[1]=1;
-@@ -2143,7 +2217,7 @@
- 	}
- 	for (na=value, nb=m, nc=0; nc<count; na++, nb+=2, nc++)
- 	{
--		if (*na<=0.0)
-+                if (*na<=0.0 || *na != *na)
- 		{
- 			nb[0]=0;
- 			nb[1]=1;
-@@ -2153,7 +2227,8 @@
- 			nb[0]=(uint32)(*na);
- 			nb[1]=1;
- 		}
--		else if (*na<1.0)
-+		else if (*na >= 0 && *na <= (float)0xFFFFFFFFU &&
-+                         *na==(float)(uint32)(*na))
- 		{
- 			nb[0]=(uint32)((double)(*na)*0xFFFFFFFF);
- 			nb[1]=0xFFFFFFFF;
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7598.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7598.patch
deleted file mode 100644
index 6d082bb..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7598.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 3cfd62d77c2a7e147a05bd678524c345fa9c2bb8 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Wed, 11 Jan 2017 13:28:01 +0000
-Subject: [PATCH] * libtiff/tif_dirread.c: avoid division by floating point 0
- in TIFFReadDirEntryCheckedRational() and TIFFReadDirEntryCheckedSrational(),
- and return 0 in that case (instead of infinity as before presumably)
- Apparently some sanitizers do not like those divisions by zero. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2644
-
-Upstream-Status: Backport
-
-CVE: CVE-2017-7598
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-25 16:14:59.858612730 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-25 18:11:36.048107127 +0530
-@@ -1,3 +1,4 @@
-+
- 2017-01-12 Even Rouault <even.rouault at spatialys.com>
- 
- 	* libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesQTable,
-@@ -8,6 +9,14 @@
- 
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
- 
-+	* libtiff/tif_dirread.c: avoid division by floating point 0 in
-+	TIFFReadDirEntryCheckedRational() and TIFFReadDirEntryCheckedSrational(),
-+	and return 0 in that case (instead of infinity as before presumably)
-+	Apparently some sanitizers do not like those divisions by zero.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2644
-+
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
- 	* libtiff/tif_dir.c, tif_dirread.c, tif_dirwrite.c: implement various clampings
- 	of double to other data types to avoid undefined behaviour if the output range
- 	isn't big enough to hold the input value.
-Index: tiff-4.0.7/libtiff/tif_dirread.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dirread.c	2017-04-25 16:14:59.858612730 +0530
-+++ tiff-4.0.7/libtiff/tif_dirread.c	2017-04-25 18:16:21.836111576 +0530
-@@ -2880,7 +2880,10 @@
- 		m.l = direntry->tdir_offset.toff_long8;
- 	if (tif->tif_flags&TIFF_SWAB)
- 		TIFFSwabArrayOfLong(m.i,2);
--	if (m.i[0]==0)
-+        /* Not completely sure what we should do when m.i[1]==0, but some */
-+        /* sanitizers do not like division by 0.0: */
-+        /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
-+	if (m.i[0]==0 || m.i[1]==0)
- 		*value=0.0;
- 	else
- 		*value=(double)m.i[0]/(double)m.i[1];
-@@ -2908,7 +2911,10 @@
- 		m.l=direntry->tdir_offset.toff_long8;
- 	if (tif->tif_flags&TIFF_SWAB)
- 		TIFFSwabArrayOfLong(m.i,2);
--	if ((int32)m.i[0]==0)
-+        /* Not completely sure what we should do when m.i[1]==0, but some */
-+        /* sanitizers do not like division by 0.0: */
-+        /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
-+	if ((int32)m.i[0]==0 || m.i[1]==0)
- 		*value=0.0;
- 	else
- 		*value=(double)((int32)m.i[0])/(double)m.i[1];
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7601.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7601.patch
deleted file mode 100644
index 1b3c6c8..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7601.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 0a76a8c765c7b8327c59646284fa78c3c27e5490 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Wed, 11 Jan 2017 16:13:50 +0000
-Subject: [PATCH] * libtiff/tif_jpeg.c: validate BitsPerSample in
- JPEGSetupEncode() to avoid undefined behaviour caused by invalid shift
- exponent. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2648
-
-Upstream-Status: Backport
-
-CVE: CVE-2017-7601
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-25 18:21:32.856116417 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-25 18:35:31.904129477 +0530
-@@ -1,4 +1,3 @@
--
- 2017-01-12 Even Rouault <even.rouault at spatialys.com>
- 
- 	* libtiff/tif_ojpeg.c: fix leak in OJPEGReadHeaderInfoSecTablesQTable,
-@@ -9,6 +8,12 @@
- 
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
- 
-+	* libtiff/tif_jpeg.c: validate BitsPerSample in JPEGSetupEncode() to avoid
-+	undefined behaviour caused by invalid shift exponent.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2648
-+
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
- 	* libtiff/tif_dirread.c: avoid division by floating point 0 in
- 	TIFFReadDirEntryCheckedRational() and TIFFReadDirEntryCheckedSrational(),
- 	and return 0 in that case (instead of infinity as before presumably)
-Index: tiff-4.0.7/libtiff/tif_jpeg.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_jpeg.c	2017-04-25 18:21:32.744116415 +0530
-+++ tiff-4.0.7/libtiff/tif_jpeg.c	2017-04-25 18:38:02.200131817 +0530
-@@ -1632,7 +1632,13 @@
-                                    "Invalig horizontal/vertical sampling value");
-                       return (0);
-                 }
--
-+                if( td->td_bitspersample > 16 )
-+                {
-+                    TIFFErrorExt(tif->tif_clientdata, module,
-+                                 "BitsPerSample %d not allowed for JPEG",
-+                                 td->td_bitspersample);
-+                    return (0);
-+                }
- 		/*
- 		 * A ReferenceBlackWhite field *must* be present since the
- 		 * default value is inappropriate for YCbCr.  Fill in the
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7602.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7602.patch
deleted file mode 100644
index 9ed97e2..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-7602.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 66e7bd59520996740e4df5495a830b42fae48bc4 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Wed, 11 Jan 2017 16:33:34 +0000
-Subject: [PATCH] * libtiff/tif_read.c: avoid potential undefined behaviour on
- signed integer addition in TIFFReadRawStrip1() in isMapped() case. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2650
-
-Upstream-Status: Backport
-
-CVE: CVE-2017-7602
-Signed-off-by: Rajkumar Veer <rveer@mvista.com>
-
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog	2017-04-25 18:42:07.656135638 +0530
-+++ tiff-4.0.7/ChangeLog	2017-04-25 18:54:36.812147299 +0530
-@@ -8,6 +8,12 @@
- 
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
- 
-+	* libtiff/tif_read.c: avoid potential undefined behaviour on signed integer
-+	addition in TIFFReadRawStrip1() in isMapped() case.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2650
-+
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
- 	* libtiff/tif_jpeg.c: validate BitsPerSample in JPEGSetupEncode() to avoid
- 	undefined behaviour caused by invalid shift exponent.
- 	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2648
-Index: tiff-4.0.7/libtiff/tif_read.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_read.c	2017-04-25 18:42:07.132135629 +0530
-+++ tiff-4.0.7/libtiff/tif_read.c	2017-04-25 18:58:25.272150855 +0530
-@@ -420,16 +420,26 @@
- 			return ((tmsize_t)(-1));
- 		}
- 	} else {
--		tmsize_t ma,mb;
-+		tmsize_t ma;
- 		tmsize_t n;
--		ma=(tmsize_t)td->td_stripoffset[strip];
--		mb=ma+size;
--		if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)||(ma>tif->tif_size))
--			n=0;
--		else if ((mb<ma)||(mb<size)||(mb>tif->tif_size))
--			n=tif->tif_size-ma;
--		else
--			n=size;
-+                if ((td->td_stripoffset[strip] > (uint64)TIFF_TMSIZE_T_MAX)||
-+                     ((ma=(tmsize_t)td->td_stripoffset[strip])>tif->tif_size))
-+                {
-+                    n=0;
-+                }
-+                else if( ma > TIFF_TMSIZE_T_MAX - size )
-+                {
-+                    n=0;
-+                }
-+                else
-+                {
-+                    tmsize_t mb=ma+size;
-+                    if (mb>tif->tif_size)
-+                            n=tif->tif_size-ma;
-+                    else
-+                            n=size;
-+                }
-+
- 		if (n!=size) {
- #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
- 			TIFFErrorExt(tif->tif_clientdata, module,
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9147.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9147.patch
index 94f3390..3392285 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9147.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9147.patch
@@ -32,38 +32,38 @@
  libtiff/tif_dirread.c |   4 ++
  4 files changed, 128 insertions(+)
 
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog
-+++ tiff-4.0.7/ChangeLog
+diff --git a/ChangeLog b/ChangeLog
+index ee8d9d0..5739292 100644
+--- a/ChangeLog
++++ b/ChangeLog
 @@ -1,3 +1,23 @@
 +2017-06-01  Even Rouault <even.rouault at spatialys.com>
 +
-+       * libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
-+       and use it in TIFFReadDirectory() so as to ignore fields whose tag is a
-+       codec-specified tag but this codec is not enabled. This avoids TIFFGetField()
-+       to behave differently depending on whether the codec is enabled or not, and
-+       thus can avoid stack based buffer overflows in a number of TIFF utilities
-+       such as tiffsplit, tiffcmp, thumbnail, etc.
-+       Patch derived from 0063-Handle-properly-CODEC-specific-tags.patch
-+       (http://bugzilla.maptools.org/show_bug.cgi?id=2580) by Raphaël Hertzog.
-+       Fixes:
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2580
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2693
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2625 (CVE-2016-10095)
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2564 (CVE-2015-7554)
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2561 (CVE-2016-5318)
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2499 (CVE-2014-8128)
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2441
-+       http://bugzilla.maptools.org/show_bug.cgi?id=2433
++	* libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
++	and use it in TIFFReadDirectory() so as to ignore fields whose tag is a
++	codec-specified tag but this codec is not enabled. This avoids TIFFGetField()
++	to behave differently depending on whether the codec is enabled or not, and
++	thus can avoid stack based buffer overflows in a number of TIFF utilities
++	such as tiffsplit, tiffcmp, thumbnail, etc.
++	Patch derived from 0063-Handle-properly-CODEC-specific-tags.patch
++	(http://bugzilla.maptools.org/show_bug.cgi?id=2580) by Raphaël Hertzog.
++	Fixes:
++	http://bugzilla.maptools.org/show_bug.cgi?id=2580
++	http://bugzilla.maptools.org/show_bug.cgi?id=2693
++	http://bugzilla.maptools.org/show_bug.cgi?id=2625 (CVE-2016-10095)
++	http://bugzilla.maptools.org/show_bug.cgi?id=2564 (CVE-2015-7554)
++	http://bugzilla.maptools.org/show_bug.cgi?id=2561 (CVE-2016-5318)
++	http://bugzilla.maptools.org/show_bug.cgi?id=2499 (CVE-2014-8128)
++	http://bugzilla.maptools.org/show_bug.cgi?id=2441
++	http://bugzilla.maptools.org/show_bug.cgi?id=2433
 +
- 2017-01-11 Even Rouault <even.rouault at spatialys.com>
+ 2017-05-21  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
  
- 	* tools/tiffcp.c: error out cleanly in cpContig2SeparateByRow and
-Index: tiff-4.0.7/libtiff/tif_dir.h
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dir.h
-+++ tiff-4.0.7/libtiff/tif_dir.h
+ 	* configure.ac: libtiff 4.0.8 released.
+diff --git a/libtiff/tif_dir.h b/libtiff/tif_dir.h
+index e12b44b..5206be4 100644
+--- a/libtiff/tif_dir.h
++++ b/libtiff/tif_dir.h
 @@ -291,6 +291,7 @@ struct _TIFFField {
  extern int _TIFFMergeFields(TIFF*, const TIFFField[], uint32);
  extern const TIFFField* _TIFFFindOrRegisterField(TIFF *, uint32, TIFFDataType);
@@ -72,11 +72,11 @@
  
  #if defined(__cplusplus)
  }
-Index: tiff-4.0.7/libtiff/tif_dirinfo.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dirinfo.c
-+++ tiff-4.0.7/libtiff/tif_dirinfo.c
-@@ -956,6 +956,109 @@ TIFFMergeFieldInfo(TIFF* tif, const TIFF
+diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
+index 0c8ef42..97c0df0 100644
+--- a/libtiff/tif_dirinfo.c
++++ b/libtiff/tif_dirinfo.c
+@@ -956,6 +956,109 @@ TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], uint32 n)
  	return 0;
  }
  
@@ -186,11 +186,11 @@
  /* vim: set ts=8 sts=8 sw=8 noet: */
  
  /*
-Index: tiff-4.0.7/libtiff/tif_dirread.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_dirread.c
-+++ tiff-4.0.7/libtiff/tif_dirread.c
-@@ -3566,6 +3566,10 @@ TIFFReadDirectory(TIFF* tif)
+diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
+index 1d4f0b9..f1dc3d7 100644
+--- a/libtiff/tif_dirread.c
++++ b/libtiff/tif_dirread.c
+@@ -3580,6 +3580,10 @@ TIFFReadDirectory(TIFF* tif)
  							goto bad;
  						dp->tdir_tag=IGNORE;
  						break;
@@ -201,3 +201,6 @@
  				}
  			}
  		}
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9936.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9936.patch
index 204949b..fc99363 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9936.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/CVE-2017-9936.patch
@@ -18,10 +18,10 @@
  libtiff/tif_jbig.c | 1 +
  2 files changed, 7 insertions(+)
 
-Index: tiff-4.0.7/ChangeLog
-===================================================================
---- tiff-4.0.7.orig/ChangeLog
-+++ tiff-4.0.7/ChangeLog
+diff --git a/ChangeLog b/ChangeLog
+index 5739292..0240f0b 100644
+--- a/ChangeLog
++++ b/ChangeLog
 @@ -1,3 +1,9 @@
 +2017-06-26  Even Rouault <even.rouault at spatialys.com>
 +
@@ -31,12 +31,12 @@
 +
  2017-06-01  Even Rouault <even.rouault at spatialys.com>
  
-        * libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
-Index: tiff-4.0.7/libtiff/tif_jbig.c
-===================================================================
---- tiff-4.0.7.orig/libtiff/tif_jbig.c
-+++ tiff-4.0.7/libtiff/tif_jbig.c
-@@ -94,6 +94,7 @@ static int JBIGDecode(TIFF* tif, uint8*
+ 	* libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
+diff --git a/libtiff/tif_jbig.c b/libtiff/tif_jbig.c
+index 5f5f75e..c75f31d 100644
+--- a/libtiff/tif_jbig.c
++++ b/libtiff/tif_jbig.c
+@@ -94,6 +94,7 @@ static int JBIGDecode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
  			     jbg_strerror(decodeStatus)
  #endif
  			     );
@@ -44,3 +44,6 @@
  		return 0;
  	}
  
+-- 
+2.7.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2017-5225.patch b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2017-5225.patch
deleted file mode 100644
index 3263353..0000000
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/files/libtiff-CVE-2017-5225.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From a24df1e93833dfeaa69bf4d510518dc4684db64d Mon Sep 17 00:00:00 2001
-From: Li Zhou <li.zhou@windriver.com>
-Date: Wed, 25 Jan 2017 17:07:21 +0800
-Subject: [PATCH] libtiff: fix CVE-2017-5225
-
-tools/tiffcp.c: error out cleanly in cpContig2SeparateByRow
-and cpSeparate2ContigByRow if BitsPerSample != 8 to avoid heap based
-overflow. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2656 and
-http://bugzilla.maptools.org/show_bug.cgi?id=2657
-
-Upstream-Status: Backport
-CVE: CVE-2017-5225
-Signed-off-by: Li Zhou <li.zhou@windriver.com>
----
- ChangeLog      |  7 +++++++
- tools/tiffcp.c | 24 ++++++++++++++++++++++--
- 2 files changed, 29 insertions(+), 2 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index 9b9d397..7e82795 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,10 @@
-+2017-01-11 Even Rouault <even.rouault at spatialys.com>
-+
-+	* tools/tiffcp.c: error out cleanly in cpContig2SeparateByRow and
-+	cpSeparate2ContigByRow if BitsPerSample != 8 to avoid heap based overflow.
-+	Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2656 and
-+	http://bugzilla.maptools.org/show_bug.cgi?id=2657
-+
- 2016-11-19  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
- 
- 	* libtiff 4.0.7 released.
-diff --git a/tools/tiffcp.c b/tools/tiffcp.c
-index 338a3d1..2e84577 100644
---- a/tools/tiffcp.c
-+++ b/tools/tiffcp.c
-@@ -592,7 +592,7 @@ static	copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16);
- static int
- tiffcp(TIFF* in, TIFF* out)
- {
--	uint16 bitspersample, samplesperpixel = 1;
-+	uint16 bitspersample = 1, samplesperpixel = 1;
- 	uint16 input_compression, input_photometric = PHOTOMETRIC_MINISBLACK;
- 	copyFunc cf;
- 	uint32 width, length;
-@@ -1068,6 +1068,16 @@ DECLAREcpFunc(cpContig2SeparateByRow)
- 	register uint32 n;
- 	uint32 row;
- 	tsample_t s;
-+        uint16 bps = 0;
-+
-+        (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
-+        if( bps != 8 )
-+        {
-+            TIFFError(TIFFFileName(in),
-+                      "Error, can only handle BitsPerSample=8 in %s",
-+                      "cpContig2SeparateByRow");
-+            return 0;
-+        }
- 
- 	inbuf = _TIFFmalloc(scanlinesizein);
- 	outbuf = _TIFFmalloc(scanlinesizeout);
-@@ -1121,6 +1131,16 @@ DECLAREcpFunc(cpSeparate2ContigByRow)
- 	register uint32 n;
- 	uint32 row;
- 	tsample_t s;
-+        uint16 bps = 0;
-+
-+        (void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
-+        if( bps != 8 )
-+        {
-+            TIFFError(TIFFFileName(in),
-+                      "Error, can only handle BitsPerSample=8 in %s",
-+                      "cpSeparate2ContigByRow");
-+            return 0;
-+        }
- 
- 	inbuf = _TIFFmalloc(scanlinesizein);
- 	outbuf = _TIFFmalloc(scanlinesizeout);
-@@ -1763,7 +1783,7 @@ pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
- 	uint32 w, l, tw, tl;
- 	int bychunk;
- 
--	(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);
-+	(void) TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &shortv);
- 	if (shortv != config && bitspersample != 8 && samplesperpixel > 1) {
- 		fprintf(stderr,
- 		    "%s: Cannot handle different planar configuration w/ bits/sample != 8\n",
--- 
-1.9.1
-
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/tiff_4.0.8.bb
similarity index 68%
rename from import-layers/yocto-poky/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/libtiff/tiff_4.0.8.bb
index 866e852..cb91baa 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/tiff_4.0.7.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/libtiff/tiff_4.0.8.bb
@@ -6,31 +6,16 @@
 
 SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
            file://libtool2.patch \
-           file://libtiff-CVE-2017-5225.patch \
            file://CVE-2017-9147.patch \
            file://CVE-2017-9936.patch \
            file://CVE-2017-10688.patch \
            file://CVE-2017-11335.patch \
-           file://CVE-2016-10271.patch \
-           file://CVE-2016-10093.patch \
-           file://CVE-2016-10268.patch \
-           file://CVE-2016-10266.patch \
-           file://CVE-2016-10267.patch \
-           file://CVE-2016-10269.patch \
-           file://CVE-2016-10270.patch \
-           file://CVE-2017-7592.patch \
-           file://CVE-2017-7594-p1.patch \
-           file://CVE-2017-7594-p2.patch \
-           file://CVE-2017-7595.patch \
-           file://CVE-2017-7596.patch \
-           file://CVE-2017-7598.patch \
-           file://CVE-2017-7601.patch \
-           file://CVE-2017-7602.patch \
-           file://CVE-2017-7593.patch \
-        "
+           file://CVE-2017-13726.patch \
+           file://CVE-2017-13727.patch \
+          "
 
-SRC_URI[md5sum] = "77ae928d2c6b7fb46a21c3a29325157b"
-SRC_URI[sha256sum] = "9f43a2cfb9589e5cecaa66e16bf87f814c945f22df7ba600d63aac4632c4f019"
+SRC_URI[md5sum] = "2a7d1c1318416ddf36d5f6fa4600069b"
+SRC_URI[sha256sum] = "59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910"
 
 # exclude betas
 UPSTREAM_CHECK_REGEX = "tiff-(?P<pver>\d+(\.\d+)+).tar"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/0001-check-for-available-arm-optimizations.patch b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/0001-check-for-available-arm-optimizations.patch
new file mode 100644
index 0000000..5bf68b3
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/0001-check-for-available-arm-optimizations.patch
@@ -0,0 +1,55 @@
+From cbcff58ed670c8edc0be1004384cbe0fd07d8d26 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 5 Jul 2017 18:49:21 -0700
+Subject: [PATCH 1/2] check for available arm optimizations
+
+Taken From
+http://sources.debian.net/src/mpeg2dec/0.5.1-7/debian/patches/65_arm-test-with-compiler.patch/
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index acdcb1e..2c0a721 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -59,7 +59,7 @@ elif test x"$GCC" = x"yes"; then
+     AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"])
+ 
+     dnl arch-specific flags
+-    arm_conditional=false
++    build_arm_opt=false
+     case "$host" in
+     i?86-* | k?-* | x86_64-* | amd64-*)
+ 	AC_DEFINE([ARCH_X86],,[x86 architecture])
+@@ -102,8 +102,12 @@ elif test x"$GCC" = x"yes"; then
+     alpha*)
+ 	AC_DEFINE([ARCH_ALPHA],,[alpha architecture]);;
+     arm*)
+-	arm_conditional=:
+-	AC_DEFINE([ARCH_ARM],,[ARM architecture]);;
++	AC_LANG(C)
++	AC_COMPILE_IFELSE(
++		[AC_LANG_SOURCE([[
++			void foo(void) { __asm__ volatile("pld [r1]"); }]])],
++		build_arm_opt=true; AC_DEFINE([ARCH_ARM],,[ARM architecture]),
++		build_arm_opt=false);;
+     esac
+ elif test x"$CC" = x"tendracc"; then
+     dnl TenDRA portability checking compiler
+@@ -123,7 +127,7 @@ else
+     esac
+ fi
+ 
+-AM_CONDITIONAL(ARCH_ARM, ${arm_conditional})
++AM_CONDITIONAL(ARCH_ARM, test x$build_arm_opt = xtrue)
+ 
+ dnl Checks for libtool - this must be done after we set cflags
+ AC_LIBTOOL_WIN32_DLL
+-- 
+2.13.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/0002-Set-visibility-of-global-symbols-used-in-ARM-specifi.patch b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/0002-Set-visibility-of-global-symbols-used-in-ARM-specifi.patch
new file mode 100644
index 0000000..8301692
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/0002-Set-visibility-of-global-symbols-used-in-ARM-specifi.patch
@@ -0,0 +1,63 @@
+From f9d9dc92d75f8910e3cd5fdcbea72e505cdf3493 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 5 Jul 2017 19:03:36 -0700
+Subject: [PATCH 2/2] Set visibility of global symbols used in ARM specific
+ assembly file to internal
+
+Taken from
+http://sources.debian.net/src/mpeg2dec/0.5.1-7/debian/patches/60_arm-private-symbols.patch/
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libmpeg2/motion_comp_arm_s.S | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/libmpeg2/motion_comp_arm_s.S b/libmpeg2/motion_comp_arm_s.S
+index f6c3d7d..c921f7c 100644
+--- a/libmpeg2/motion_comp_arm_s.S
++++ b/libmpeg2/motion_comp_arm_s.S
+@@ -23,7 +23,8 @@
+ 
+ @ ----------------------------------------------------------------
+ 	.align
+-	.global MC_put_o_16_arm
++	.global   MC_put_o_16_arm
++	.internal MC_put_o_16_arm
+ MC_put_o_16_arm:
+ 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ 	pld [r1]
+@@ -83,7 +84,8 @@ MC_put_o_16_arm_align_jt:
+ 
+ @ ----------------------------------------------------------------
+ 	.align
+-	.global MC_put_o_8_arm
++	.global   MC_put_o_8_arm
++	.internal MC_put_o_8_arm
+ MC_put_o_8_arm:
+ 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ 	pld [r1]
+@@ -152,7 +154,8 @@ MC_put_o_8_arm_align_jt:
+ .endm
+ 
+ 	.align
+-	.global MC_put_x_16_arm
++	.global   MC_put_x_16_arm
++	.internal MC_put_x_16_arm
+ MC_put_x_16_arm:
+ 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ 	pld [r1]
+@@ -244,7 +247,8 @@ MC_put_x_16_arm_align_jt:
+ 
+ @ ----------------------------------------------------------------
+ 	.align
+-	.global MC_put_x_8_arm
++	.global   MC_put_x_8_arm
++	.internal MC_put_x_8_arm
+ MC_put_x_8_arm:
+ 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
+ 	pld [r1]
+-- 
+2.13.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec-0.4.1/altivec_h_needed.patch b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/altivec_h_needed.patch
similarity index 85%
rename from import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec-0.4.1/altivec_h_needed.patch
rename to import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/altivec_h_needed.patch
index 7dc5643..5113ad4 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec-0.4.1/altivec_h_needed.patch
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/files/altivec_h_needed.patch
@@ -24,10 +24,10 @@
 
 Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
 
-diff -ruN mpeg2dec-0.4.1-orig/configure.in mpeg2dec-0.4.1/configure.in
---- mpeg2dec-0.4.1-orig/configure.in	2010-09-14 20:55:42.399687663 +0800
-+++ mpeg2dec-0.4.1/configure.in	2010-09-14 20:56:43.403204648 +0800
-@@ -75,11 +75,11 @@
+diff -ruN a/configure.in b/configure.in
+--- a/configure.ac	2010-09-14 20:55:42.399687663 +0800
++++ b/configure.ac	2010-09-14 20:56:43.403204648 +0800
+@@ -79,11 +79,11 @@
  		 CFLAGS="$OPT_CFLAGS $TRY_CFLAGS $CFLAGS"
  		 AC_MSG_CHECKING([if <altivec.h> is needed])
  		 AC_TRY_COMPILE([],
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec_0.4.1.bb b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec_0.5.1.bb
similarity index 71%
rename from import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec_0.4.1.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec_0.5.1.bb
index fe765da..7711c2d 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec_0.4.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/mpeg2dec/mpeg2dec_0.5.1.bb
@@ -4,15 +4,18 @@
 LICENSE = "GPLv2+"
 LICENSE_FLAGS = "commercial"
 LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
-                    file://include/mpeg2.h;beginline=1;endline=22;md5=ead62602d4638329d3b5b86a55803154"
+                    file://include/mpeg2.h;beginline=1;endline=22;md5=7766f4fcb58f0f8413c49a746f2ab89b"
 
-PR = "r2"
+SRC_URI = "http://libmpeg2.sourceforge.net/files/libmpeg2-${PV}.tar.gz \
+           file://altivec_h_needed.patch \
+           file://0001-check-for-available-arm-optimizations.patch \
+           file://0002-Set-visibility-of-global-symbols-used-in-ARM-specifi.patch \
+           "
 
-SRC_URI = "http://libmpeg2.sourceforge.net/files/mpeg2dec-${PV}.tar.gz \
-           file://altivec_h_needed.patch"
+S = "${WORKDIR}/libmpeg2-${PV}"
 
-SRC_URI[md5sum] = "7631b0a4bcfdd0d78c0bb0083080b0dc"
-SRC_URI[sha256sum] = "c74a76068f8ec36d4bb59a03bf1157be44118ca02252180e8b358b0b5e3edeee"
+SRC_URI[md5sum] = "0f92c7454e58379b4a5a378485bbd8ef"
+SRC_URI[sha256sum] = "dee22e893cb5fc2b2b6ebd60b88478ab8556cb3b93f9a0d7ce8f3b61851871d4"
 
 UPSTREAM_CHECK_URI = "http://libmpeg2.sourceforge.net/downloads.html"
 
@@ -30,11 +33,13 @@
 FILES_libmpeg2convert = "${libdir}/libmpeg2convert.so.*"
 FILES_libmpeg2-dev = "${libdir}/libmpeg2.so \
                       ${libdir}/libmpeg2.la \
+                      ${libdir}/libmpeg2arch.la \
                       ${libdir}/pkgconfig/libmpeg2.pc \
                       ${includedir}/mpeg2dec/mpeg2.h"
 FILES_libmpeg2-staticdev = "${libdir}/libmpeg2.a"
 FILES_libmpeg2convert-dev = "${libdir}/libmpeg2convert.so \
                              ${libdir}/libmpeg2convert.la \
+                             ${libdir}/libmpeg2convertarch.la \
                              ${libdir}/pkgconfig/libmpeg2convert.pc \
                              ${includedir}/mpeg2dec/mpeg2convert.h"
 FILES_libmpeg2convert-staticdev = "${libdir}/libmpeg2convert.a"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/mpg123/mpg123_1.23.8.bb b/import-layers/yocto-poky/meta/recipes-multimedia/mpg123/mpg123_1.25.6.bb
similarity index 86%
rename from import-layers/yocto-poky/meta/recipes-multimedia/mpg123/mpg123_1.23.8.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/mpg123/mpg123_1.25.6.bb
index e0a7038..cb86199 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/mpg123/mpg123_1.23.8.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/mpg123/mpg123_1.25.6.bb
@@ -11,9 +11,8 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=1e86753638d3cf2512528b99079bc4f3"
 
 SRC_URI = "https://www.mpg123.de/download/${BP}.tar.bz2"
-
-SRC_URI[md5sum] = "4dde045123a2ad1e385a0a82c0ef9268"
-SRC_URI[sha256sum] = "de2303c8ecb65593e39815c0a2f2f2d91f708c43b85a55fdd1934c82e677cf8e"
+SRC_URI[md5sum] = "43336bef78f67c2e66c4f6c288ca1eb3"
+SRC_URI[sha256sum] = "0f0458c9b87799bc2c9bf9455279cc4d305e245db43b51a39ef27afe025c5a8e"
 
 inherit autotools pkgconfig
 
@@ -39,15 +38,9 @@
 EXTRA_OECONF = " \
     --enable-shared \
     --with-audio='${AUDIOMODS}' \
-    --with-module-suffix=.so \
     ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-cpu=neon', '', d)} \
     ${@bb.utils.contains('TUNE_FEATURES', 'altivec', '--with-cpu=altivec', '', d)} \
 "
-
-# The x86 assembler optimisations contains text relocations and there are no
-# upstream plans to fix them: http://sourceforge.net/p/mpg123/bugs/168/
-INSANE_SKIP_${PN}_append_x86 = " textrel"
-
 # Fails to build with thumb-1 (qemuarm)
 #| {standard input}: Assembler messages:
 #| {standard input}:47: Error: selected processor does not support Thumb mode `smull r5,r6,r7,r4'
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/pulseaudio/pulseaudio/pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch b/import-layers/yocto-poky/meta/recipes-multimedia/pulseaudio/pulseaudio/pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch
new file mode 100644
index 0000000..11b56ab
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/pulseaudio/pulseaudio/pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch
@@ -0,0 +1,59 @@
+From patchwork Sat Feb  4 12:19:01 2017
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [pulseaudio-discuss] iochannel: don't use variable length array in
+ union
+From: Tanu Kaskinen <tanuk@iki.fi>
+X-Patchwork-Id: 136885
+Message-Id: <20170204121901.17428-1-tanuk@iki.fi>
+To: pulseaudio-discuss@lists.freedesktop.org
+Date: Sat,  4 Feb 2017 14:19:01 +0200
+
+Clang didn't like the variable length array:
+
+pulsecore/iochannel.c:358:17: error: fields must have a constant size:
+'variable length array in structure' extension will never be supported
+        uint8_t data[CMSG_SPACE(sizeof(int) * nfd)];
+                ^
+
+Commit 451d1d6762 introduced the variable length array in order to have
+the correct value in msg_controllen. This patch reverts that commit and
+uses a different way to achieve the same goal.
+
+BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=99458
+---
+Upstream-Status: Backport
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+ src/pulsecore/iochannel.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
+index 8ace297ff..897337522 100644
+--- a/src/pulsecore/iochannel.c
++++ b/src/pulsecore/iochannel.c
+@@ -355,7 +355,7 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
+     struct iovec iov;
+     union {
+         struct cmsghdr hdr;
+-        uint8_t data[CMSG_SPACE(sizeof(int) * nfd)];
++        uint8_t data[CMSG_SPACE(sizeof(int) * MAX_ANCIL_DATA_FDS)];
+     } cmsg;
+ 
+     pa_assert(io);
+@@ -382,7 +382,13 @@ ssize_t pa_iochannel_write_with_fds(pa_iochannel*io, const void*data, size_t l,
+     mh.msg_iov = &iov;
+     mh.msg_iovlen = 1;
+     mh.msg_control = &cmsg;
+-    mh.msg_controllen = sizeof(cmsg);
++
++    /* If we followed the example on the cmsg man page, we'd use
++     * sizeof(cmsg.data) here, but if nfd < MAX_ANCIL_DATA_FDS, then the data
++     * buffer is larger than needed, and the kernel doesn't like it if we set
++     * msg_controllen to a larger than necessary value. The commit message for
++     * commit 451d1d6762 contains a longer explanation. */
++    mh.msg_controllen = CMSG_SPACE(sizeof(int) * nfd);
+ 
+     if ((r = sendmsg(io->ofd, &mh, MSG_NOSIGNAL)) >= 0) {
+         io->writable = io->hungup = false;
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb b/import-layers/yocto-poky/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb
index f3a8573..9a34afa 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb
@@ -3,6 +3,7 @@
 SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
            file://0001-padsp-Make-it-compile-on-musl.patch \
            file://0001-client-conf-Add-allow-autospawn-for-root.patch \
+           file://pulseaudio-discuss-iochannel-don-t-use-variable-length-array-in-union.patch \
            file://volatiles.04_pulse \
 "
 SRC_URI[md5sum] = "4950d2799bf55ab91f6b7f990b7f0971"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/sbc/sbc_1.3.bb b/import-layers/yocto-poky/meta/recipes-multimedia/sbc/sbc_1.3.bb
index 2d7f31b..2bb895d 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/sbc/sbc_1.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/sbc/sbc_1.3.bb
@@ -2,8 +2,12 @@
 DESCRIPTION = "Bluetooth low-complexity, subband codec (SBC) library."
 HOMEPAGE = "https://www.bluez.org"
 SECTION = "libs"
-LICENSE = "GPLv2"
+LICENSE = "GPLv2+ & LGPLv2.1+"
+LICENSE_${PN} = "LGPLv2.1+"
+LICENSE_${PN}-examples = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
+                    file://COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09 \
+                    file://src/sbcenc.c;beginline=1;endline=24;md5=08e7a70b127f4100ff2cd7d629147d8d \
                     file://sbc/sbc.h;beginline=1;endline=26;md5=0f57d0df22b0d40746bdd29805a4361b"
 
 DEPENDS = "libsndfile1"
@@ -14,3 +18,6 @@
 SRC_URI[sha256sum] = "e61022cf576f14190241e7071753fdacdce5d1dea89ffd704110fc50be689309"
 
 inherit autotools pkgconfig
+
+PACKAGES =+ "${PN}-examples"
+FILES_${PN}-examples += "${bindir}/*"
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/speex/speex_1.2rc2.bb b/import-layers/yocto-poky/meta/recipes-multimedia/speex/speex_1.2.0.bb
similarity index 68%
rename from import-layers/yocto-poky/meta/recipes-multimedia/speex/speex_1.2rc2.bb
rename to import-layers/yocto-poky/meta/recipes-multimedia/speex/speex_1.2.0.bb
index f7d23db..19636bb 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/speex/speex_1.2rc2.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/speex/speex_1.2.0.bb
@@ -7,10 +7,11 @@
                     file://include/speex/speex.h;beginline=1;endline=34;md5=ef8c8ea4f7198d71cf3509c6ed05ea50"
 DEPENDS = "libogg speexdsp"
 
-SRC_URI = "http://downloads.us.xiph.org/releases/speex/speex-${PV}.tar.gz"
+SRC_URI = "http://downloads.xiph.org/releases/speex/speex-${PV}.tar.gz"
+UPSTREAM_CHECK_REGEX = "speex-(?P<pver>\d+(\.\d+)+)\.tar"
 
-SRC_URI[md5sum] = "6ae7db3bab01e1d4b86bacfa8ca33e81"
-SRC_URI[sha256sum] = "caa27c7247ff15c8521c2ae0ea21987c9e9710a8f2d3448e8b79da9806bce891"
+SRC_URI[md5sum] = "8ab7bb2589110dfaf0ed7fa7757dc49c"
+SRC_URI[sha256sum] = "eaae8af0ac742dc7d542c9439ac72f1f385ce838392dc849cae4536af9210094"
 
 inherit autotools pkgconfig lib_package
 
diff --git a/import-layers/yocto-poky/meta/recipes-multimedia/x264/x264_git.bb b/import-layers/yocto-poky/meta/recipes-multimedia/x264/x264_git.bb
index 69f52c2..c5476c7 100644
--- a/import-layers/yocto-poky/meta/recipes-multimedia/x264/x264_git.bb
+++ b/import-layers/yocto-poky/meta/recipes-multimedia/x264/x264_git.bb
@@ -12,6 +12,7 @@
            file://don-t-default-to-cortex-a9-with-neon.patch \
            file://Fix-X32-build-by-disabling-asm.patch \
            "
+UPSTREAM_VERSION_UNKNOWN = "1"
 
 SRCREV = "2b741f81e51f92d053d87a49f59ff1026553a0f6"