From e23a7eec6894f07887669b0541c0ab207e77ae84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 25 Jul 2006 16:47:04 +0000 Subject: [PATCH] gst/id3demux/id3tags.c: Extract frames for ID3v2 versions prior to ID3v2.3.0 properly as well, and add the version to... Original commit message from CVS: * gst/id3demux/id3tags.c: (id3demux_add_id3v2_frame_blob_to_taglist): Extract frames for ID3v2 versions prior to ID3v2.3.0 properly as well, and add the version to the blob's buffer caps, since that information will be needed for deserialisation later on (#348644). --- ChangeLog | 8 ++++++++ gst/id3demux/id3tags.c | 24 ++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8dbd681eb..58dca7da1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-07-25 Tim-Philipp Müller + + * gst/id3demux/id3tags.c: + (id3demux_add_id3v2_frame_blob_to_taglist): + Extract frames for ID3v2 versions prior to ID3v2.3.0 properly as + well, and add the version to the blob's buffer caps, since that + information will be needed for deserialisation later on (#348644). + 2006-07-25 Stefan Kost * gst/avi/gstavidemux.c: (gst_avi_demux_read_subindexes), diff --git a/gst/id3demux/id3tags.c b/gst/id3demux/id3tags.c index 6af215d948..7e354f2a5f 100644 --- a/gst/id3demux/id3tags.c +++ b/gst/id3demux/id3tags.c @@ -338,10 +338,23 @@ id3demux_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size) GstCaps *caps; guint8 *frame_data; gchar *media_type; - guint frame_size; + guint frame_size, header_size; - frame_data = work->hdr.frame_data - ID3V2_HDR_SIZE; - frame_size = size + ID3V2_HDR_SIZE; + switch (ID3V2_VER_MAJOR (work->hdr.version)) { + case 1: + case 2: + header_size = 3 + 3; + break; + case 3: + case 4: + header_size = 4 + 4 + 2; + break; + default: + g_return_if_reached (); + } + + frame_data = work->hdr.frame_data - header_size; + frame_size = size + header_size; blob = gst_buffer_new_and_alloc (frame_size); memcpy (GST_BUFFER_DATA (blob), frame_data, frame_size); @@ -349,11 +362,14 @@ id3demux_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size) media_type = g_strdup_printf ("application/x-gst-id3v2-%c%c%c%c-frame", g_ascii_tolower (frame_data[0]), g_ascii_tolower (frame_data[1]), g_ascii_tolower (frame_data[2]), g_ascii_tolower (frame_data[3])); - caps = gst_caps_new_simple (media_type, NULL); + caps = gst_caps_new_simple (media_type, "version", G_TYPE_INT, + (gint) ID3V2_VER_MAJOR (work->hdr.version), NULL); gst_buffer_set_caps (blob, caps); gst_caps_unref (caps); g_free (media_type); + /* gst_util_dump_mem (GST_BUFFER_DATA (blob), GST_BUFFER_SIZE (blob)); */ + gst_tag_list_add (work->tags, GST_TAG_MERGE_APPEND, GST_ID3_DEMUX_TAG_ID3V2_FRAME, blob, NULL); gst_buffer_unref (blob);