Commit graph

46 commits

Author SHA1 Message Date
Edward Hervey 6f5c9db1cc id3v2: re-fix handling of v2.4 extended headers
The various id3v2 specs handle the extended header sizes differently
(because hey, it wouldn't be fun otherwise).

http://id3.org/id3v2.3.0 states:
"Where the 'Extended header size', currently 6 or 10 bytes, excludes
 itself."

http://id3.org/id3v2.4.0-structure states:
  Extended header size   4 * %0xxxxxxx
     Number of flag bytes       $01
     Extended Flags             $xx

   Where the 'Extended header size' is the size of the whole extended
   header, stored as a 32 bit synchsafe integer. An extended header can
   thus never have a size of fewer than six bytes.

So in id3v2.4.0 it's the *whole* extended header size (a-la ISOBMFF
atom), whereas in id3v2.3.0 it's the extended header size *excluding*
those 4 initial bytes.

And for other versions, god knows..

Fixes regression introduced in commit da607005.

https://bugzilla.gnome.org/show_bug.cgi?id=792983
2018-03-01 12:42:10 +00:00
Tim-Philipp Müller a1af74feda tag: id3v2: don't leak stack pointer outside of block where it's valid
https://bugzilla.gnome.org/show_bug.cgi?id=788548
2018-01-19 20:43:57 +00:00
Thomas Bluemel da6070054f id3v2: fix handling of tags with extended headers
The extended header size value does not include itself.

https://bugzilla.gnome.org/show_bug.cgi?id=770355
2016-12-25 10:35:47 +00:00
Tim-Philipp Müller 2cfb446eb9 tag: id3v2: turn redundant check into an assert
We checked this already earlier, so this is dead code.
Leave an assert in place for consistency with the other
branch and in case the rest of the code changes.

CID 1397350.
2016-12-18 12:29:42 +00:00
Jan Schmidt 7ff1de380f 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.
2016-12-09 18:06:35 +11:00
Jan Schmidt d178f7626a id3v2: Add missing overrun check for frame sizes
When frames claim to have a footer, ensure they
are large enough to contain one to avoid an invalid
read overrun.

Spotted by Joshua Yabut
2016-12-09 18:06:35 +11:00
Tim-Philipp Müller 93a92d7f70 tags: id3: make sure to register private-id3v2-frame tag before using it 2015-11-20 19:15:22 +00:00
Matthieu Bouron 7b3ca538fd tag: id3: encapsulate ID3V2 blob frames in GstSample
id3mux and id3v2mux expect GST_TAG_ID3V2_FRAME type to be stored in a
GstSample and not a buffer, which is also needed because we can't
attach extradata/caps to buffers any more. These are private tags
no one should be poking at, and also the extra info is missing.

https://bugzilla.gnome.org/show_bug.cgi?id=707765
2013-09-09 23:49:14 +01:00
Tim-Philipp Müller 5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Mark Nauwelaerts c629a44162 replace gst_tag_list_free with gst_tag_list_unref 2012-09-14 17:53:21 +02:00
Tim-Philipp Müller 36f32d3f93 tag: fix month/day extraction in ID3v2 tags
We were passing month/day in the wrong order to
gst_date_time_new_ymd().
2012-08-02 00:23:28 +01:00
Tim-Philipp Müller 54e9581a59 tag: extract dates from ID3v2 tags into GstDateTime instead of GDate
We may only have a year, or year and month+day, or (in future)
both date and time.
2012-07-14 15:37:46 +01:00
Edward Hervey 2817bdadc9 libs: Remove "Since" markers and minor doc fixups 2012-07-13 12:11:06 +02:00
Tim-Philipp Müller af7dc60479 tag: don't use GstStructure API on tag lists 2012-05-26 19:56:30 +01:00
Wim Taymans fcdc385aa1 port to new map API 2012-01-25 12:30:53 +01:00
Tim-Philipp Müller 5ee51e47a1 ext, gst, gst-libs, tests: update for tag list API changes 2011-10-31 14:22:39 +00:00
Wim Taymans d3b93e839a tagdemux: port to 0.11 2011-08-17 10:57:52 +02:00
Tim-Philipp Müller 169c5033f0 tag: id3v2: avoid some relocations, make table static 2011-08-15 00:10:34 +01:00
Tim-Philipp Müller f25c715104 tag: id3v2: add debug category for ID3 tag parsing 2011-08-15 00:10:34 +01:00
Mark Nauwelaerts 08e6b5c54e tag: id3v2: add id3v2 tag parsing helpers
https://bugzilla.gnome.org/show_bug.cgi?id=654388
2011-08-15 00:10:34 +01:00
Stefan Kost 4f042aeb1a tag: id3v2: return ID3TAGS_BROKEN_TAG for unsupported versions
This prevents us for trying to work with a NULL taglist.
2011-08-15 00:10:34 +01:00
Edward Hervey d2cec9e102 tag: id3v2: Sanitize id3 frame names
This is similar to what is done in qtdemux. Avoids providing invalid
structure/tags names
2011-08-15 00:10:34 +01:00
Benjamin Otte 50a6cb5450 Add -Wwrite-strings to the configure flags
... and fix all warnings
2011-08-15 00:10:34 +01:00
Josep Torra ad10b0185a tag: id3v2: fixes warnings building on macosx
Another round on the formating of that debug line.
2011-08-15 00:10:33 +01:00
Stefan Kost aa6ff34c57 tag: id3v2: cast pointer math results to glong 2011-08-15 00:10:33 +01:00
Stefan Kost dd3826a3a6 tag: id3v2: don't cast, but use the right format specified instead
This correct some of the previous macos fixes.
2011-08-15 00:10:33 +01:00
Josep Torra 67fabdb461 tag: id3v2: fix printf warnings on macosx 2011-08-15 00:10:33 +01:00
Tim-Philipp Müller 891ed455e7 tag: id3v2: fix typo in debug message 2011-08-15 00:10:32 +01:00
Tim-Philipp Müller c2c21806ba tag: id3v2: 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.
2011-08-15 00:10:32 +01:00
Tim-Philipp Müller 941d5080fa tag: id3v2: parse unsynchronised tags properly
We didn't handle unsynchronization at all up to now, which might have
caused frames to not be extracted - esp. frames after an APIC picture
frame. Fixes #577468.
2011-08-15 00:10:32 +01:00
Tim-Philipp Müller bd738166a7 tag: id3v2: pass the right size value for size of all frames to the parser
Frame data size is tag size adjusted for size of the tag header and
footer, not tag size including header and footer.
2011-08-15 00:10:32 +01:00
Tim-Philipp Müller 1dd5350109 tag: id3v2: We don't want the same string multiple times in a tag list for the same tag ever, for any tag, not jus...
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c:
* gst-libs/gst/tag/id3v2.h:
* gst-libs/gst/tag/id3v2frames.c: (id3v2_tag_to_taglist):
We don't want the same string multiple times in a tag list for the
same tag ever, for any tag, not just for GST_TAG_GENRE, so make sure
this doesn't happen and remove special-case code for GST_TAG_GENRE.
2011-08-15 00:10:31 +01:00
Tim-Philipp Müller 2ff93c3826 tag: id3v2: Port ID3 tag demuxer over to the new GstTagDemux in -base (now would be a good time to test re-importi...
Original commit message from CVS:
* gst-libs/gst/tag/gstid3demux.c:
* gst-libs/gst/tag/gstid3demux.h:
* gst-libs/gst/tag/id3v2.c:
* gst-libs/gst/tag/id3v2.h:
* gst-libs/gst/tag/id3v2frames.c:
Port ID3 tag demuxer over to the new GstTagDemux in -base
(now would be a good time to test re-importing your music
collection).
2011-08-15 00:10:31 +01:00
Tim-Philipp Müller c76c78670d tag: id3v2: Do not convert obsolete TDA/TDAT frames to TDRC frames, otherwise the four-digit number will be interp...
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c: (id3demux_id3v2_frames_to_tag_list):
* gst-libs/gst/tag/id3v2.h:
* gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame),
(parse_obsolete_tdat_frame):
Do not convert obsolete TDA/TDAT frames to TDRC frames, otherwise
the four-digit number will be interpreted as a year, whereas it is
month and day in DDMM format. Instead, parse TDAT frames and fix up
the date in the GST_TAG_DATE tag later if we also extracted a year.
Fixes #407349.
2011-08-15 00:10:30 +01:00
Tim-Philipp Müller 2444a6459b tag: id3v2: Extract frames for ID3v2 versions prior to ID3v2.3.0 properly as well, and add the version to...
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.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).
2011-08-15 00:10:29 +01:00
Tim-Philipp Müller 3f1bc48d0b tag: id3v2: On second thought, it might be wiser and more efficient not to do tag registration from a streaming th...
Original commit message from CVS:
* gst-libs/gst/tag/gstid3demux.c: (plugin_init):
* gst-libs/gst/tag/id3v2.c:
(id3demux_add_id3v2_frame_blob_to_taglist):
* gst-libs/gst/tag/id3v2.h:
On second thought, it might be wiser and more efficient
not to do tag registration from a streaming thread.
2011-08-15 00:10:29 +01:00
Tim-Philipp Müller ba3a9d3b9d tag: id3v2: Put ID3v2 frames we can't parse as binary blobs into private tags, so that they are not lost ...
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c:
(id3demux_add_id3v2_frame_blob_to_taglist),
(id3demux_id3v2_frames_to_tag_list):
Put ID3v2 frames we can't parse as binary blobs into private
tags, so that they are not lost when retagging, at least once
id3v2mux has been taught to re-inject those frames again.
See bug #334375.
2011-08-15 00:10:29 +01:00
Wim Taymans 488a625bb4 tag: id3v2: Don't use \n in debug lines
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream),
(gst_avi_demux_process_next_entry):
Fix some leaks.
* gst-libs/gst/tag/id3v2.c: (id3demux_id3v2_frames_to_tag_list):
Don't use \n in debug lines.
2011-08-15 00:10:29 +01:00
Alex Lancaster e3aa8b3163 tag: id3v2: Recognise TCO (Genre) tags in ID3v2.2
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c:
Recognise TCO (Genre) tags in ID3v2.2. Patch by Alex Lancaster
(Fixes #338713)
2011-08-15 00:10:27 +01:00
Jan Schmidt a2e391cb68 tag: id3v2: Don't attempt typefinding on too-short buffers that have been completely trimmed away.
Original commit message from CVS:
* gst/apetag/gsttagdemux.c: (gst_tag_demux_chain):
* gst-libs/gst/tag/gstid3demux.c: (gst_id3demux_chain):
Don't attempt typefinding on too-short buffers that have been
completely trimmed away.
* gst-libs/gst/tag/id3v2.c: (id3demux_read_id3v2_tag):
Improve the debug output
2011-08-15 00:10:27 +01:00
Jan Schmidt dbcf8fc320 tag: id3v2: Handle 0 data size in otherwise valid frames.
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c: (id3demux_id3v2_frames_to_tag_list):
* gst-libs/gst/tag/id3v2frames.c: (id3v2_genre_fields_to_taglist):
Handle 0 data size in otherwise valid frames.
Handle numeric strings in 2.4.0 even when not in parentheses
2011-08-15 00:10:27 +01:00
Jan Schmidt e4af0fe41f tag: id3v2: 3 2.3.0 used synch-safe integers for the tag size, but not for the frame size. (Fixes #331368)
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c: (id3demux_id3v2_frames_to_tag_list):
ID3 2.3.0 used synch-safe integers for the tag size, but not for the
frame size. (Fixes #331368)
2011-08-15 00:10:27 +01:00
Jan Schmidt 78aa922244 tag: id3v2: Someone should kick my butt. Remove ID3v1 tags from the end of the file.
Original commit message from CVS:

* gst-libs/gst/tag/gstid3demux.c: (gst_id3demux_chain),
(gst_id3demux_read_id3v1), (gst_id3demux_sink_activate),
(gst_id3demux_send_tag_event):
* gst-libs/gst/tag/id3v2.c: (id3demux_read_id3v1_tag):
Someone should kick my butt. Remove ID3v1 tags from the end of the
file.

Improve error messages. Send the TAG message as soon as we complete
typefinding, instead of waiting until we send the first buffer.
Downstream tag event is still sent before the first buffer.
2011-08-15 00:10:26 +01:00
Jan Schmidt a6f7ebffa2 tag: id3v2: Rewrite parsing of text tags to handle multiple NULL terminated strings. Parse numeric genre strings a...
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c: (id3demux_read_id3v2_tag):
* gst-libs/gst/tag/id3v2.h:
* gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame),
(parse_comment_frame), (parse_text_identification_frame),
(id3v2_tag_to_taglist), (id3v2_are_digits),
(id3v2_genre_string_to_taglist), (id3v2_genre_fields_to_taglist),
(parse_split_strings), (free_tag_strings):
Rewrite parsing of text tags to handle multiple NULL terminated
strings. Parse numeric genre strings and ID3v2 type
"(3)(6)Alternative" style genre strings.
Parse dates that are only YYYY or YYYY-mm format.
2011-08-15 00:10:26 +01:00
Jan Schmidt a2415c8edb tag: id3v2: If a broken tag has 0 bytes payload, at least still skip the 10 byte header
Original commit message from CVS:
* gst-libs/gst/tag/id3v2.c: (id3demux_read_id3v2_tag):
If a broken tag has 0 bytes payload, at least still skip
the 10 byte header
2011-08-15 00:10:25 +01:00
Jan Schmidt 83bffb642c tag: id3v2: all new LGPL id3 demuxer, can use zlib for compressed frames
Original commit message from CVS:
* configure.ac:
Check for optional dependency on zlib for id3demux

* gst-libs/gst/tag/Makefile.am:
* gst-libs/gst/tag/gstid3demux.c: (gst_gst_id3demux_get_type),
(gst_id3demux_base_init), (gst_id3demux_class_init),
(gst_id3demux_reset), (gst_id3demux_init), (gst_id3demux_dispose),
(gst_id3demux_add_srcpad), (gst_id3demux_remove_srcpad),
(gst_id3demux_trim_buffer), (gst_id3demux_chain),
(gst_id3demux_set_property), (gst_id3demux_get_property),
(id3demux_get_upstream_size), (gst_id3demux_srcpad_event),
(gst_id3demux_read_id3v1), (gst_id3demux_read_id3v2),
(gst_id3demux_sink_activate), (gst_id3demux_src_activate_pull),
(gst_id3demux_src_checkgetrange), (gst_id3demux_read_range),
(gst_id3demux_src_getrange), (gst_id3demux_change_state),
(gst_id3demux_pad_query), (gst_id3demux_get_query_types),
(simple_find_peek), (simple_find_suggest),
(gst_id3demux_do_typefind), (gst_id3demux_send_tag_event),
(plugin_init):
* gst-libs/gst/tag/gstid3demux.h:
* gst-libs/gst/tag/id3v2.c: (read_synch_uint),
(id3demux_read_id3v1_tag), (id3demux_read_id3v2_tag),
(id3demux_id3v2_frame_hdr_size), (convert_fid_to_v240),
(id3demux_id3v2_frames_to_tag_list):
* gst-libs/gst/tag/id3v2.h:
* gst-libs/gst/tag/id3v2.4.0-frames.txt:
* gst-libs/gst/tag/id3v2.4.0-structure.txt:
* gst-libs/gst/tag/id3v2frames.c: (id3demux_id3v2_parse_frame),
(parse_comment_frame), (parse_text_identification_frame),
(id3v2_tag_to_taglist), (parse_split_strings):
All new LGPL id3 demuxer. Can use zlib for compressed frames,
otherwise it discards them. Works on my test files.

* gst/wavparse/gstwavparse.c: (gst_wavparse_loop):
Don't send EOS to a non-existing srcpad
The debug category can be static
2011-08-15 00:09:53 +01:00