From 9498a072861cd1815de839d80f6f7d56defbe33b Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Sat, 26 Dec 2015 14:12:42 +0000
Subject: [PATCH] community/kodi: add patch

---
 .../prevent-taglib-from-crashing-kodi.patch   | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 community/kodi/prevent-taglib-from-crashing-kodi.patch

diff --git a/community/kodi/prevent-taglib-from-crashing-kodi.patch b/community/kodi/prevent-taglib-from-crashing-kodi.patch
new file mode 100644
index 000000000..79c2b79aa
--- /dev/null
+++ b/community/kodi/prevent-taglib-from-crashing-kodi.patch
@@ -0,0 +1,96 @@
+--- xbmc/music/tags/TagLoaderTagLib.cpp.orig	2015-12-26 07:34:56.449019063 +0100
++++ xbmc/music/tags/TagLoaderTagLib.cpp	2015-12-26 08:26:13.905598496 +0100
+@@ -134,48 +134,55 @@
+   TagLib::RIFF::WAV::File *  wavFile = NULL;
+   TagLib::RIFF::AIFF::File * aiffFile = NULL;
+ 
+-  if (strExtension == "ape")
+-    file = apeFile = new APE::File(stream);
+-  else if (strExtension == "asf" || strExtension == "wmv" || strExtension == "wma")
+-    file = asfFile = new ASF::File(stream);
+-  else if (strExtension == "flac")
+-    file = flacFile = new FLAC::File(stream, ID3v2::FrameFactory::instance());
+-  else if (strExtension == "it")
+-    file = itFile = new IT::File(stream);
+-  else if (strExtension == "mod" || strExtension == "module" || strExtension == "nst" || strExtension == "wow")
+-    file = modFile = new Mod::File(stream);
+-  else if (strExtension == "mp4" || strExtension == "m4a" || 
+-           strExtension == "m4r" || strExtension == "m4b" || 
+-           strExtension == "m4p" || strExtension == "3g2")
+-    file = mp4File = new MP4::File(stream);
+-  else if (strExtension == "mpc")
+-    file = mpcFile = new MPC::File(stream);
+-  else if (strExtension == "mp3" || strExtension == "aac")
+-    file = mpegFile = new MPEG::File(stream, ID3v2::FrameFactory::instance());
+-  else if (strExtension == "s3m")
+-    file = s3mFile = new S3M::File(stream);
+-  else if (strExtension == "tta")
+-    file = ttaFile = new TrueAudio::File(stream, ID3v2::FrameFactory::instance());
+-  else if (strExtension == "wv")
+-    file = wvFile = new WavPack::File(stream);
+-  else if (strExtension == "aif" || strExtension == "aiff")
+-    file = aiffFile = new RIFF::AIFF::File(stream);
+-  else if (strExtension == "wav")
+-    file = wavFile = new RIFF::WAV::File(stream);
+-  else if (strExtension == "xm")
+-    file = xmFile = new XM::File(stream);
+-  else if (strExtension == "ogg")
+-    file = oggVorbisFile = new Ogg::Vorbis::File(stream);
+-  else if (strExtension == "oga") // Leave this madness until last - oga container can have Vorbis or FLAC
++  try
+   {
+-    file = oggFlacFile = new Ogg::FLAC::File(stream);
+-    if (!file || !file->isValid())
+-    {
+-      delete file;
+-      oggFlacFile = NULL;
++    if (strExtension == "ape")
++      file = apeFile = new APE::File(stream);
++    else if (strExtension == "asf" || strExtension == "wmv" || strExtension == "wma")
++      file = asfFile = new ASF::File(stream);
++    else if (strExtension == "flac")
++      file = flacFile = new FLAC::File(stream, ID3v2::FrameFactory::instance());
++    else if (strExtension == "it")
++      file = itFile = new IT::File(stream);
++    else if (strExtension == "mod" || strExtension == "module" || strExtension == "nst" || strExtension == "wow")
++      file = modFile = new Mod::File(stream);
++    else if (strExtension == "mp4" || strExtension == "m4a" || 
++             strExtension == "m4r" || strExtension == "m4b" || 
++             strExtension == "m4p" || strExtension == "3g2")
++      file = mp4File = new MP4::File(stream);
++    else if (strExtension == "mpc")
++      file = mpcFile = new MPC::File(stream);
++    else if (strExtension == "mp3" || strExtension == "aac")
++      file = mpegFile = new MPEG::File(stream, ID3v2::FrameFactory::instance());
++    else if (strExtension == "s3m")
++      file = s3mFile = new S3M::File(stream);
++    else if (strExtension == "tta")
++      file = ttaFile = new TrueAudio::File(stream, ID3v2::FrameFactory::instance());
++    else if (strExtension == "wv")
++      file = wvFile = new WavPack::File(stream);
++    else if (strExtension == "aif" || strExtension == "aiff")
++      file = aiffFile = new RIFF::AIFF::File(stream);
++    else if (strExtension == "wav")
++      file = wavFile = new RIFF::WAV::File(stream);
++    else if (strExtension == "xm")
++      file = xmFile = new XM::File(stream);
++    else if (strExtension == "ogg")
+       file = oggVorbisFile = new Ogg::Vorbis::File(stream);
++    else if (strExtension == "oga") // Leave this madness until last - oga container can have Vorbis or FLAC
++    {
++      file = oggFlacFile = new Ogg::FLAC::File(stream);
++      if (!file || !file->isValid())
++      {
++        delete file;
++        oggFlacFile = NULL;
++        file = oggVorbisFile = new Ogg::Vorbis::File(stream);
++      }
+     }
+   }
++  catch (const std::exception& ex)
++  {
++    CLog::Log(LOGERROR, "Taglib exception: %s", ex.what());
++  }
+ 
+   if (!file || !file->isOpen())
+   {