summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2016-12-09 17:59:09 +1100
committerJan Schmidt <jan@centricular.com>2016-12-09 18:06:35 +1100
commit7ff1de380f38f208759b6410ce1c1036e258638f (patch)
tree7dacd94845b87b636ad001fa4dd128fe6699e264
parentd178f7626aa44dffcf995bb6fda3a0d6db5f7d18 (diff)
id3v2: Clarify id3v2_add_id3v2_frame_blob_to_taglist()
Pass the frame data and size explicitly to id3v2_add_id3v2_frame_blob_to_taglist() and add a comment that it's being deliberately / manually passed the full ID3v2 frame including header.
-rw-r--r--gst-libs/gst/tag/id3v2.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/gst-libs/gst/tag/id3v2.c b/gst-libs/gst/tag/id3v2.c
index 54f38fca1..642514814 100644
--- a/gst-libs/gst/tag/id3v2.c
+++ b/gst-libs/gst/tag/id3v2.c
@@ -53,6 +53,7 @@ id3v2_ensure_debug_category (void)
#endif /* GST_DISABLE_GST_DEBUG */
+/* Synch safe uints have 28 bits (256MB max) available. */
guint
id3v2_read_synch_uint (const guint8 * data, guint size)
{
@@ -398,34 +399,17 @@ convert_fid_to_v240 (gchar * frame_id)
/* add unknown or unhandled ID3v2 frames to the taglist as binary blobs */
static void
-id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
+id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work,
+ guint8 * frame_data, guint frame_size)
{
GstBuffer *blob;
GstSample *sample;
- guint8 *frame_data;
#if 0
GstCaps *caps;
gchar *media_type;
#endif
- guint frame_size, header_size;
guint i;
- 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);
gst_buffer_fill (blob, 0, frame_data, frame_size);
@@ -595,7 +579,9 @@ id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size)
GST_LOG ("Extracted frame with id %s", frame_id);
} else {
GST_LOG ("Failed to extract frame with id %s", frame_id);
- id3v2_add_id3v2_frame_blob_to_taglist (work, frame_size);
+ /* Rewind the frame data / size to pass the header too */
+ id3v2_add_id3v2_frame_blob_to_taglist (work,
+ work->hdr.frame_data - frame_hdr_size, frame_hdr_size + frame_size);
}
}
work->hdr.frame_data += frame_size;