summaryrefslogtreecommitdiffstats
path: root/gst/id3demux/id3tags.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-07 16:02:23 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-07 16:02:23 +0100
commit2e05af387614b9850a9b0782e5ee1ab1a78362fd (patch)
tree12df5b19f19252916372f3223fa051e69a31c744 /gst/id3demux/id3tags.c
parentc42f0ad5b6aefd42a8336bd73d6e856fce306908 (diff)
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.
Diffstat (limited to 'gst/id3demux/id3tags.c')
-rw-r--r--gst/id3demux/id3tags.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gst/id3demux/id3tags.c b/gst/id3demux/id3tags.c
index 1d511f33..96d25521 100644
--- a/gst/id3demux/id3tags.c
+++ b/gst/id3demux/id3tags.c
@@ -97,7 +97,7 @@ id3demux_calc_id3v2_tag_size (GstBuffer * buf)
return size;
}
-static guint8 *
+guint8 *
id3demux_ununsync_data (const guint8 * unsync_data, guint32 * size)
{
const guint8 *end;
@@ -195,7 +195,10 @@ id3demux_read_id3v2_tag (GstBuffer * buffer, guint * id3v2_size,
else
work.hdr.frame_data_size = read_size - ID3V2_HDR_SIZE;
- if ((flags & ID3V2_HDR_FLAG_UNSYNC)) {
+ /* in v2.3 the frame sizes are not syncsafe, so the entire tag had to be
+ * unsynced. In v2.4 the frame sizes are syncsafe so it's just the frame
+ * data that needs un-unsyncing, but not the frame headers. */
+ if ((flags & ID3V2_HDR_FLAG_UNSYNC) != 0 && ID3V2_VER_MAJOR (version) <= 3) {
GST_DEBUG ("Un-unsyncing entire tag");
uu_data = id3demux_ununsync_data (work.hdr.frame_data,
&work.hdr.frame_data_size);