summaryrefslogtreecommitdiff
path: root/libre/kodi/prevent-taglib-from-crashing-kodi.patch
blob: 79c2b79aabedb9040125c263598d46106875d870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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())
   {