GNOME Bugzilla – Bug 588148
[id3demux] APIC tag not found mp3 file
Last modified: 2009-08-07 15:58:25 UTC
sometime the image inserted in mp3 is not found by id3demux. With read-metadata test program the image tag doesn't appear. EasyTag could find the image. I have check with an hexa editor APIC tag is present in the file. In id3tags.c in function id3demux_id3v2_frames_to_tag_list the test if (frame_size > work->hdr.frame_data_size || strcmp (frame_id, "") == 0) failed because frame_size is > work->hdr.frame_data_size.
Created attachment 138112 [details] test file with image not found by read-metadata
id3 frame header describe the size of the frame as the size of unsynchronous data contain in this frame. if unsynchronisation flag is found id3v2 header we un-unsynchronouse all the data, the result is that we have "less" data in buffer than expected id3 frame header so the frame is drop. A solution could to not un-unsynchronise all data when the flag is set in id3v2 header but only after get it out of the frame.
Created attachment 138201 [details] [review] patch draft, not clean, but fonctionnal is this patch need more work to be clean and maybe the change done for APIC parse sohould be apply on all other tags
Created attachment 140003 [details] MP3 with apic issue
This should fix it: commit 2e05af387614b9850a9b0782e5ee1ab1a78362fd Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Fri Aug 7 16:02:23 2009 +0100 id3demux: fix parsing of unsync'ed ID3 v2.4 tags and frames Reversing the unsynchronisation seems to work slightly differently for ID3 v2.3 tags and v2.4 tags: v2.3 tags don't have syncsafe frame sizes in the frame header, so the unsynchronisation is applied to the whole frame data including all the frame headers. v2.4 frames have sync-safe sizes, however, so the unsynchronisation only needs to be applied to the actual frame data, and it seems that's what's being done as well. So we need to undo the unsynchronisation on a per-frame basis for v2.4 tags for things to work properly. Fixes extraction of coverart/images from APIC frames in ID3 v2.4 tags (#588148). Add unit test for this as well. Sorry it took so long. Was pretty busy with other stuff. (Your patch would've broken parsing of unsynced v2.3 tags IIRC.)