summaryrefslogtreecommitdiff
path: root/media-sound/easytag/files/easytag-2.4.3-fix-build-taglib2.patch
blob: d27e5cdc9fe775c135e4b5684f36b03dfb0ca982 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
from https://gitlab.gnome.org/GNOME/easytag/-/merge_requests/16.patch
compatibility added with taglib1

diff '--color=auto' -uNr a/src/tags/gio_wrapper.cc b/src/tags/gio_wrapper.cc
--- a/src/tags/gio_wrapper.cc
+++ b/src/tags/gio_wrapper.cc
@@ -47,11 +47,15 @@
 }
 
 TagLib::ByteVector
+#if (TAGLIB_MAJOR_VERSION == 2)
+GIO_InputStream::readBlock (ulong len)
+#else
 GIO_InputStream::readBlock (TagLib::ulong len)
+#endif
 {
     if (error)
     {
-        return TagLib::ByteVector::null;
+        return TagLib::ByteVector();
     }
 
     TagLib::ByteVector rv (len, 0);
@@ -69,15 +73,25 @@
 }
 
 void
+#if (TAGLIB_MAJOR_VERSION == 2)
+GIO_InputStream::insert (TagLib::ByteVector const &data,
+                         TagLib::offset_t start,
+                         size_t replace)
+#else
 GIO_InputStream::insert (TagLib::ByteVector const &data,
                          TagLib::ulong start,
                          TagLib::ulong replace)
+#endif
 {
     g_warning ("%s", "Trying to write to read-only file!");
 }
 
 void
+#if (TAGLIB_MAJOR_VERSION == 2)
+GIO_InputStream::removeBlock (TagLib::offset_t start, size_t len)
+#else
 GIO_InputStream::removeBlock (TagLib::ulong start, TagLib::ulong len)
+#endif
 {
     g_warning ("%s", "Trying to write to read-only file!");
 }
@@ -200,11 +214,15 @@
 }
 
 TagLib::ByteVector
+#if (TAGLIB_MAJOR_VERSION == 2)
+GIO_IOStream::readBlock (ulong len)
+#else
 GIO_IOStream::readBlock (TagLib::ulong len)
+#endif
 {
     if (error)
     {
-        return TagLib::ByteVector::null;
+        return TagLib::ByteVector();
     }
 
     gsize bytes = 0;
@@ -238,9 +256,15 @@
 }
 
 void
+#if (TAGLIB_MAJOR_VERSION == 2)
+GIO_IOStream::insert (TagLib::ByteVector const &data,
+                      TagLib::offset_t start,
+                      size_t replace)
+#else
 GIO_IOStream::insert (TagLib::ByteVector const &data,
                       TagLib::ulong start,
                       TagLib::ulong replace)
+#endif
 {
     if (error)
     {
@@ -351,9 +375,15 @@
 }
 
 void
+#if (TAGLIB_MAJOR_VERSION == 2)
+GIO_IOStream::removeBlock (TagLib::offset_t start, size_t len)
+{
+    if (start + len >= (ulong)length ())
+#else
 GIO_IOStream::removeBlock (TagLib::ulong start, TagLib::ulong len)
 {
     if (start + len >= (TagLib::ulong)length ())
+#endif
     {
         truncate (start);
         return;
diff '--color=auto' -uNr a/src/tags/gio_wrapper.h b/src/tags/gio_wrapper.h
--- a/src/tags/gio_wrapper.h
+++ b/src/tags/gio_wrapper.h
@@ -33,10 +33,17 @@
     GIO_InputStream (GFile *file_);
     virtual ~GIO_InputStream ();
     virtual TagLib::FileName name () const;
+#if (TAGLIB_MAJOR_VERSION == 2)
+    virtual TagLib::ByteVector readBlock (ulong length);
+    virtual void writeBlock (TagLib::ByteVector const &data);
+    virtual void insert (TagLib::ByteVector const &data, TagLib::offset_t start = 0, size_t replace = 0);
+    virtual void removeBlock (TagLib::offset_t start = 0, size_t length = 0);
+#else
     virtual TagLib::ByteVector readBlock (TagLib::ulong length);
     virtual void writeBlock (TagLib::ByteVector const &data);
     virtual void insert (TagLib::ByteVector const &data, TagLib::ulong start = 0, TagLib::ulong replace = 0);
     virtual void removeBlock (TagLib::ulong start = 0, TagLib::ulong length = 0);
+#endif
     virtual bool readOnly () const;
     virtual bool isOpen () const;
     virtual void seek (long int offset, TagLib::IOStream::Position p = TagLib::IOStream::Beginning);
@@ -61,10 +68,17 @@
     GIO_IOStream (GFile *file_);
     virtual ~GIO_IOStream ();
     virtual TagLib::FileName name () const;
+#if (TAGLIB_MAJOR_VERSION == 2)
+    virtual TagLib::ByteVector readBlock (ulong length);
+    virtual void writeBlock (TagLib::ByteVector const &data);
+    virtual void insert (TagLib::ByteVector const &data, TagLib::offset_t start = 0, size_t replace = 0);
+    virtual void removeBlock (TagLib::offset_t start = 0, size_t len = 0);
+#else
     virtual TagLib::ByteVector readBlock (TagLib::ulong length);
     virtual void writeBlock (TagLib::ByteVector const &data);
     virtual void insert (TagLib::ByteVector const &data, TagLib::ulong start = 0, TagLib::ulong replace = 0);
     virtual void removeBlock (TagLib::ulong start = 0, TagLib::ulong len = 0);
+#endif
     virtual bool readOnly () const;
     virtual bool isOpen () const;
     virtual void seek (long int offset, TagLib::IOStream::Position p = TagLib::IOStream::Beginning);
diff '--color=auto' -uNr a/src/tags/mp4_header.cc b/src/tags/mp4_header.cc
--- a/src/tags/mp4_header.cc
+++ b/src/tags/mp4_header.cc
@@ -105,7 +105,7 @@
     ETFileInfo->bitrate = properties->bitrate ();
     ETFileInfo->samplerate = properties->sampleRate ();
     ETFileInfo->mode = properties->channels ();
-    ETFileInfo->duration = properties->length ();
+    ETFileInfo->duration = properties->lengthInSeconds ();
 
     return TRUE;
 }
diff '--color=auto' -uNr a/src/tags/mp4_tag.cc b/src/tags/mp4_tag.cc
--- a/src/tags/mp4_tag.cc
+++ b/src/tags/mp4_tag.cc
@@ -222,7 +222,7 @@
         FileTag->encoded_by = g_strdup (encodedbys.front ().toCString (true));
     }
 
-    const TagLib::MP4::ItemListMap &extra_items = tag->itemListMap ();
+    const TagLib::MP4::ItemMap &extra_items = tag->itemMap ();
 
     /* Album Artist */
 #if (TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION < 10)
@@ -437,25 +437,12 @@
         fields.insert ("ENCODEDBY", string);
     }
 
-    TagLib::MP4::ItemListMap &extra_items = tag->itemListMap ();
-
     /* Album artist. */
     if (!et_str_empty (FileTag->album_artist))
     {
         TagLib::String string (FileTag->album_artist, TagLib::String::UTF8);
-#if (TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION < 10)
-        /* No "ALBUMARTIST" support in TagLib until 1.10; use atom directly. */
-        extra_items.insert ("aART", TagLib::MP4::Item (string));
-#else
         fields.insert ("ALBUMARTIST", string);
-#endif
     }
-#if (TAGLIB_MAJOR_VERSION == 1) && (TAGLIB_MINOR_VERSION < 10)
-    else
-    {
-        extra_items.erase ("aART");
-    }
-#endif
 
     /***********
      * Picture *
@@ -491,12 +478,12 @@
         TagLib::MP4::CoverArt art (f, TagLib::ByteVector((char *)data,
                                                          data_size));
 
-        extra_items.insert ("covr",
+        tag->setItem("covr",
                             TagLib::MP4::Item (TagLib::MP4::CoverArtList ().append (art)));
     }
     else
     {
-        extra_items.erase ("covr");
+        tag->removeItem("covr");
     }
 
     tag->setProperties (fields);