@@ -162,6 +162,13 @@ class MP4Parser extends TagParser {
162162 } else if (box.type[0 ] == "©" ||
163163 ["gnre" , "trkn" , "disk" , "tmpo" , "cpil" , "too" , "covr" , "pgap" , "gen" ]
164164 .contains (box.type)) {
165+ final boxName = (box.type[0 ] == "©" ) ? box.type.substring (1 ) : box.type;
166+
167+ if (boxName == "covr" && ! fetchImage) {
168+ buffer.skip (box.size - 8 );
169+ return ;
170+ }
171+
165172 final metadataValue = buffer.read (box.size - 8 );
166173
167174 // sometimes the data is stored inside another box called `data`
@@ -178,8 +185,6 @@ class MP4Parser extends TagParser {
178185 value = latin1.decode (data);
179186 }
180187
181- final boxName = (box.type[0 ] == "©" ) ? box.type.substring (1 ) : box.type;
182-
183188 switch (boxName) {
184189 case "nam" :
185190 tags.title = value;
@@ -215,13 +220,12 @@ class MP4Parser extends TagParser {
215220 break ;
216221
217222 case "covr" :
218- if (fetchImage) {
219- final imageData = data;
220- tags.picture = Picture (
221- imageData,
222- lookupMimeType ("no path" , headerBytes: imageData) ?? "" ,
223- PictureType .coverFront);
224- }
223+ final imageData = data;
224+ tags.picture = Picture (
225+ imageData,
226+ lookupMimeType ("no path" , headerBytes: imageData) ?? "" ,
227+ PictureType .coverFront);
228+ break ;
225229 case "trkn" :
226230 final a = getUint16 (data.sublist (2 , 4 ));
227231 final totalTracks = getUint16 (data.sublist (4 , 6 ));
0 commit comments