mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-14 00:17:07 +00:00
35 KiB
35 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased
Added
- ParseOptions:
ParseOptions::allocation_limit
to change the default allocation limit. (PR)
Changed
- VorbisComments: When converting from
Tag
toVorbisComments
,ItemKey::Unknown
s will be checked for spec compliance. (PR) - Alloc: The default allocation limit for any single tag item is now 16MB. (PR)
- Probe:
Probe::set_file_type()
will return theProbe
to allow for builder-style usage. (PR)
Fixed
- MP4: Verify atom identifiers fall within a subset of characters (PR)
- For a multitude of reasons, garbage data can be left at the end of an atom, resulting in Lofty attempting to parse it as another atom definition. As the specification is broad, there is no way for us to say with certainty that an identifier is invalid. Now we unfortunately have to guess the validity based on the commonly known atoms. For this, we follow TagLib's checks.
- ID3v2: No longer error on inputs shorter than 128 bytes (the length of an ID3v1 tag). (PR)
Removed
- MP4:
Ilst::{track_total, disc_number, disc_total}
(PR)- These existed prior to the methods on
Accessor
. There is no need to keep them around, as they behave the same.
- These existed prior to the methods on
0.16.1 - 2023-10-15
Fixed
- MP4: Skip unexpected or empty data atoms in ilst (PR)
- It is possible for an
ilst
item to have both emptydata
atoms and unexpected (likely vendor-specific) atoms other thandata
. These are both cases we can safely ignore unless usingParsingMode::Strict
.
- It is possible for an
0.16.0 - 2023-10-01
Added
- ID3v2:
- MP4 (PR):
Atom::into_data
Atom::merge
- OGG: Support for reading "COVERART" fields, an old deprecated image storage format. (issue) (PR)
Changed
- ID3v2:
- Tag header parsing errors will be ignored unless using
ParsingMode::Strict
(PR) - For spec compliance,
Id3v2Tag::insert
will now check for frames that are only meant to appear in a tag once and remove them. Those frames are: "MCDI", "ETCO", "MLLT", "SYTC", "RVRB", "PCNT", "RBUF", "POSS", "OWNE", "SEEK", and "ASPI". (PR) Id3v2Tag::remove
will now take aFrameId
rather than&str
(PR)FrameId
now implementsInto<Cow<'_, str>>
, making it possible to use it inFrame::new
(PR)Id3v2Tag
getters will now use&FrameId
instead of&str
for IDs (PR)
- Tag header parsing errors will be ignored unless using
- MP4 (PR):
Ilst::remove
will now return all of the removed atomsIlst::insert_picture
will now combine all pictures into a singlecovr
atomIlst::insert
will now merge atoms with the same identifier into a single atom
- FLAC:
- Allow multiple Vorbis Comment blocks when not using
ParsingMode::Strict
(PR)- This is not allowed by spec, but is still possible to encounter in the wild. Now we will just take whichever tag happens to be latest in the stream and use it, they will not be merged.
- Allow picture types greater than 255 when not using
ParsingMode::Strict
(issue) (PR)- This is not allowed by spec, but has been encountered in the wild. Now we will just cap the picture type at 255.
- Allow multiple Vorbis Comment blocks when not using
Fixed
- WavPack: Custom sample rates will no longer be overwritten (PR)
- When a custom sample rate (or multiplier) was encountered, it would accidentally be overwritten with 0, causing incorrect duration and bitrate values.
- APE: Reading properties on older files will no longer error (PR)
- Older APE stream versions were not properly handled, leading to incorrect properties and errors.
- ID3v2: Don't expect text frames to be null terminated (issue) (PR)
0.15.0 - 2023-07-11
Added
- ID3v2:
- ParseOptions:
ParseOptions::max_junk_bytes
, allowing the parser to sift through junk bytes to find required information, rather than immediately declare a file invalid. (discussion) (PR) - WavPack:
WavPackProperties
now contains the channel mask, accessible throughWavPackProperties::channel_mask()
(PR) - AIFF:
AiffProperties
to hold additional AIFF-specific information- AIFC compression types are now exposed through
AiffCompressionType
Changed
- ID3v2:
- APE: The default track/disk number is now
0
to line up with ID3v2. This is only used whenset_{track, disk}_total
is used without a correspondingset_{track, disk}
. - VorbisComments: When writing, items larger than
u32::MAX
will throwErrorKind::TooMuchData
, rather than be silently discarded. - AIFF:
AiffFile
will no longer useFileProperties
. It now usesAiffProperties
.
Fixed
- APE: Track/Disk number pairs are properly converted when writing (issue) (PR)
- ID3v2: TIPL/TMCL frames will no longer be read as a single terminated string (issue) (PR)
- WavPack: Multichannel files will no longer be marked as mono, supporting up to 4095 channels (PR)
0.14.0 - 2023-06-08
Added
- ParsingMode: A new variant,
BestAttempt
will attempt to fill holes in otherwise valid tag items (PR) - 🎉 Support for Musepack files (issue) (PR)
Changed
- Probe: The default
ParsingMode
is nowParsingMode::BestAttempt
(It was previouslyParsingMode::Strict
) - Alloc:
Fixed
Removed
- ID3v2: Removed
id3::util::synchsafe::unsynch_content
. This has been replaced with UnsynchronizedStream.
0.13.0 - 2023-05-08
Added
- Tag/ItemValue:
Tag::remove_empty
/ItemValue::is_empty
(PR) - ItemKey: Variants for MusicBrainz Release group/Artist/Release artist/Work IDs (PR)
- ID3v2:
- VorbisComments:
ItemKey::Barcode
mapping (PR)
Changed
- ID3v1:
ID3v1Tag
->Id3v1Tag
- ID3v2:
- FileType/TagType/ItemKey: All variants have been changed to UpperCamelCase (PR)
- MPEG:
MPEGFile
->MpegFile
MPEGProperties
->MpegProperties
Fixed
- ID3v2: Compressed frames are now properly handled (PR)
Removed
- ID3v2:
- All uses of
ID3v2ErrorKind::Other
have been replaced with concrete errors SyncTextInformation
andGEOBInformation
have been flattened into their respective items (PR)
- All uses of
0.12.1 - 2023-04-10
Fixed
- WAV: Fix division by zero when reading the properties of an empty stream (issue) (PR)
- ID3v2 (PR):
- Export
id3::v2::UniqueFileIdentifierFrame
- Export
id3::v2::Popularimeter
- Export
0.12.0 - 2023-04-04
Added
- Properties: Expose channel mask (only supported for WAV and MPEG for now) (PR)
- ItemKey:
InitialKey
mapping for Vorbis Comments (PR) - VorbisComments:
VorbisComments::push
to allow for a non-replacing insertion (PR) - Tags:
<Tag>::new()
as an alias for<Tag>::default()
(PR) - Picture:
Picture::into_data()
(PR)
Changed
- APE/ID3v1/ID3v2/Tag:
- VorbisComments (PR):
- Keys will now be verified according to spec before insertion
- Getters will now case-insensitively search for keys
TRACKNUM
will now be considered in theAccessor::*track
methods
- Tags: Method names are more consistent (PR)
Fixed
- ID3v2:
- MP4 (PR):
- Fix the incorrect size being written for newly created
moov.udta.meta
atoms- Previously, the 8 bytes for the size and identifier were not accounted for
- The parser has been further restricted to avoid going out of bounds
- This was only an issue if there was garbage data after the
moov
item and the parser had not yet found themoov.udta
atom.
- This was only an issue if there was garbage data after the
- Fix the incorrect size being written for newly created
- WavPack (PR):
- Fewer errors are suppressed
- Metadata sub-blocks are now properly parsed
- Bitrate calculation will now properly round down
0.11.0 - 2023-01-29
Added
- MP4:
- Vorbis Comments:
- Additional mappings for the
Label
,Remixer
, andEncodedBy
ItemKey
variants (PR)
- Additional mappings for the
- ID3v2: A new
id3v2_compression_support
feature to optionally depend onflate2
for decompressing frames - ItemKey:
- New Variants:
AppleXid
,Director
,Color
- New Variants:
- AudioFile:
AudioFile::save_to{_path}
(PR) - Files:
<File>::set_{tag}
- FLAC:
FlacProperties
- Previously, FLAC files used
FileProperties
.FlacProperties
was added to support getting the MD5 signature of the audio data.
- Previously, FLAC files used
- OGG:
OggPictureStorage
- This was added to cover the overlap in functionality between
VorbisComments
andFlacFile
in that they both store(Picture, PictureInformation)
.
- This was added to cover the overlap in functionality between
- TagExt:
TagExt::len
Changed
- MP4:
AtomIdent
stores freeform identifiers asCow<str>
opposed toString
(PR)- This allows freeform identifiers to be constructed in a const context.
- ID3v2:
FrameID
now usesCow<str>
opposed toString
(PR) - FLAC:
FlacFile
now stores pictures separately from itsVorbisComments
tag
Removed
- Metadata format features (PR):
- All of the format-specific features have been removed, as they served no purpose. They used to bring in optional dependencies, but they have long since been removed.
Fixed
- Tag: Handling of the
Year
tag has been improved.- Previously, setting a year with
Tag::set_year
required aRecordingDate
. Now it will check if the format supports theYear
tag, and if not, then it will set aRecordingDate
.
- Previously, setting a year with
- OGG: Writing of large packets would corrupt the stream (issue) (PR)
ogg_pager
0.10.0 - 2022-12-27
Added
- TagExt:
TagExt::contains
- Ilst:
AtomData::Bool
for the various flag atoms such ascpil
,pcst
, etc. - BoundTaggedFile: A
TaggedFile
variant bound to aFile
handle. (issue) (PR)
Changed
- Files: Return the removed tag from
<File>::remove(TagType)
(PR)- Previously, the only way to remove and take ownership of a tag was through
TaggedFile::take
. This was not possible when using a concrete type, such asOpusFile
.
- Previously, the only way to remove and take ownership of a tag was through
- TaggedFile: Renamed
TaggedFile::take
toTaggedFile::remove
(PR) - lofty_attr: The
lofty_attr::LoftyFile
derive proc macro is now exported aslofty::LoftyFile
. - TaggedFile: All methods have been split out into a new trait,
TaggedFileExt
. (PR) - Accessor: All methods returning string values now return
Cow<str>
. (PR)- This is an unfortunate change that needed to be made in order to accommodate the handling of the different possible text separators between ID3v2 versions.
- ID3v2: Support reading of duplicate tags (issue) (PR)
- Previously, if we were reading a file and encountered an ID3v2 tag after having already read one, we would overwrite the last one, losing all of its information. Now we preserve all of the information, overwriting frames as necessary.
Fixed
- ID3v2: The
'/'
character is no longer used as a separator (issue) - MP4: Stopped expecting certain flags for the
gnre
atom prior to upgrading it (issue) (PR)
ogg_pager
0.9.0 - 2022-10-30
Added
ParseOptions
(issue) (PR):- ⚠️ Important ⚠️: This update introduces
ParseOptions
to allow for finer grained control over error eagerness and other settings. Previously, when reading a file the only option available wasread_properties
, specified with abool
inread_from{_path}
. This will now default totrue
, and can be overridden when usingProbe
.
- ⚠️ Important ⚠️: This update introduces
- 🎉 Support for AAC (ADTS) files (issue) (PR)
- FileProperties:
FileProperties::new
- Debug logging via the log crate for exposing recoverable errors.
- Error:
ErrorKind::SizeMismatch
Changed
- ID3v2:
- Frame/tag flags with optional additional data are now
Option<T>
instead of(bool, T)
id3::v2::TextEncoding
is now exported aslofty::TextEncoding
- Frame/tag flags with optional additional data are now
read_from{_path}
will no longer take abool
for reading properties, and will do it by default. To change this behavior, you must now useProbe
.- FileType:
primary_tag_type
will no longer change its return depending on the enabled features. - lofty_attr: Simplified the
file_type
attribute:- Before, you had to specify custom file types as
#[lofty(file_type = "Custom(\"MyFile\")")]
. Now you can simply do#[lofty(file_type = "MyFile")]
and it will infer the rest.
- Before, you had to specify custom file types as
- IFF:
WAV
andAIFF
items are no longer combined in theiff
module. They are now separated into their own modules atiff::wav
andiff::aiff
respectively.
Fixed
Removed
- lofty_attr: The
#[lofty(always_present)]
attribute has been removed, and is now inferred.
0.8.1 - 2022-09-09
Added
- VorbisComments:
VorbisComments::get_all
, same asTag::get_strings
(issue)
Fixed
- ID3v2: Handle tag-wide unsynchronisation flag (amberol#235)
- MP3: Stop using partial frame headers (PR)
0.8.0 - 2022-08-10
Added
- A new file resolver system:
- New module:
lofty::resolve
- With this, you will be able to create your own
FileType
s, while continuing to use lofty's traditional API. Read the module docs for more info.
- New module:
- A proc macro for file creation:
- With the new
lofty_attr
crate, file creation has been simplified significantly. It is available for both internal and external usage.
- With the new
- ID3v2: Exposed internal functions
id3::v2::util::{synch_u32, unsynch_u32}
- MP4:
Atom::push_data
Changed
- TaggedFile:
tag{_mut}
no longer takes a reference toTagType
- ID3v2:
LanguageFrame
'slang
field has changed type -String
->[u8; 3]
- MP3:
- Renamed
lofty::mp3
->lofty::mpeg
- Renamed
MP3File
->MPEGFile
- Renamed
MP3Properties
->MPEGProperties
- Renamed
- MP4:
Atom::data
will now return all values - Vorbis Comments: Recognize lowercase
METADATA_BLOCK_PICTURE
as a picture (issue)
Fixed
- ID3v2:
ItemKey::InitialKey
now maps toTKEY
(PR)
0.7.3 - 2022-07-22
Added
- FileType:
FileType::from_ext
detects MP1/MP2 asFileType::MP3
, allowing these files to be read withread_from_path
/Probe::open
. - ItemKey:
ItemKey::{REPLAYGAIN_ALBUM_GAIN, REPLAYGAIN_ALBUM_PEAK, REPLAYGAIN_TRACK_GAIN, REPLAYGAIN_TRACK_PEAK}
Changed
- ID3v2:
TXXX
/WXXX
frames will be stored by their descriptions inID3v2Tag
->Tag
conversions- Stopped allowing empty strings in
Accessor::set_*
Fixed
- Tag: The
Accessor::set_*
methods will stop falling through, and adding empty strings
0.7.2 - 2022-07-13
This release mostly addresses issues uncovered by fuzzing, thanks to @5225225!
Changed
- Tag: The
Accessor::set_*
methods will now remove the item when given an empty string
Fixed
- AIFF/WAV: Stop relying on the file-provided size when reading (Fixes OOM)
- MP3/APE: Stop trusting the lengths of APE tag items (Fixes OOM)
- PictureInformation: Fix potential integer overflow in
{from_jpeg, from_png}
- MP4: The parser has received a major facelift, and shouldn't be so eager to allocate or trust user data (Fixes OOM)
- FLAC: Return early when encountering invalid zero-sized blocks
- FLAC/Opus/Vorbis/Speex: Add better length validity checks while reading Vorbis Comments (Fixes OOM)
0.7.1 - 2022-07-08
Added
- Vorbis Comments:
VorbisComments::{pictures, set_picture, remove_picture}
- Tag:
Tag::{set_picture, remove_picture}
- MP4: Support property reading for files with FLAC audio
Changed
- ID3v2:
ID3v2Tag
now derivesEq
0.7.0 - 2022-06-27
Added
- WavPack support
- Accessor:
- The following new accessor methods have been added:
track
track_total
disk
disk_total
year
comment
- The following new accessor methods have been added:
Changed
- Bitrates in properties will be rounded up, similar to FFmpeg and TagLib
- ID3v1: Renamed
Id3v1Tag
->ID3v1Tag
- ID3v2:
- Insert multi-value frames separately when converting to
Tag
- E.g. An artist of "foo/bar/baz" will become 3 different
TagItem
s withItemKey::TrackArtist
- E.g. An artist of "foo/bar/baz" will become 3 different
- Join multiple artists with "/" during
Tag
->Id3v2Tag
conversion- Inverse of the previous entry
- Properly capitalized the following:
Id3v2Error
->ID3v2Error
Id3v2ErrorKind
->ID3v2ErrorKind
ErrorKind::Id3v2
->ErrorKind::ID3v2
Id3v2TagFlags
->ID3v2TagFlags
Id3v2Version
->ID3v2Version
Id3v2Tag
->ID3v2Tag
- Insert multi-value frames separately when converting to
- Properly capitalized the variants of
TagType
Ape
->APE
Id3v1
->ID3v1
Id3v2
->ID3v2
Mp4Ilst
->MP4ilst
RiffInfo
->RIFFInfo
AiffText
->AIFFText
- All types implementing
PartialEq
now implementEq
- MP4:
Ilst::track_number
has been moved to theAccessor::track
implementation - Tag: Renamed
Tag::get_texts
toTag::get_strings
- AIFF: Renamed
AiffTextChunks
->AIFFTextChunks
- WAV: Renamed
RiffInfoList
->RIFFInfoList
Fixed
- AIFF: Fixed division by zero panic during property reading (issue)
- ID3v2: Support decoding UTF-16 T/WXXX frames with missing content BOM (issue)
0.6.3 - 2022-05-18
Added
- MP4:
- Support atoms with multiple values (issue)
Atom::from_collection
Changed
- ID3v2: Discard empty frames, rather than error
- APE: Allow empty tag items
- Rather than error on empty items, they will just be discarded
Fixed
- Pictures: Treat "image/jpg" as
MimeType::Jpeg
(PR) - MP3:
- Properly validate the contents of Xing/LAME/VBRI headers (issue)
- A header with any field zeroed out would result in a division by zero panic
- Fix duration estimation for files with Xing headers without the necessary flags
- Properly validate the contents of Xing/LAME/VBRI headers (issue)
- FLAC: Fix property reading of zero-length files (issue)
- Vorbis Comments: Fix reading of vendor strings with invalid mixed UTF-8 and UTF-16 encodings
- ID3v2:
- Fix reading of zero-size tags
- Attempt to read invalid v2 frame IDs in v3 tags
- For some reason, some apps write v2 frame IDs in otherwise valid v3 frames
- Attempt to decode invalid
COMM
languages
- MP4:
- Fix hang when reading invalid padding (issue)
- If invalid padding was encountered at the end of the file, the reader would get stuck in an infinite loop attempting to read zero size atoms
- Fallback to bitrate calculation from
mdat
when necessary (issue)- When reading a file that doesn't provide a valid bitrate or duration, a division by zero panic would occur.
Now, it attempts to calculate the bitrate from the
mdat
atom.
- When reading a file that doesn't provide a valid bitrate or duration, a division by zero panic would occur.
Now, it attempts to calculate the bitrate from the
- Fix hang when reading invalid padding (issue)
0.6.2 - 2022-04-24
Fixed
- MP3: Fix panic when reading files with no MPEG frames (issue)
- Attempting to read an MP3 file with
read_properties = true
would result in a panic if the file contained no MPEG frames
- Attempting to read an MP3 file with
0.6.1 - 2022-04-09
Fixed
- MP3: Fix reading of ID3v2 tags with an extended header
- Restrictions were unnecessarily put on the reader, keeping it from continuing to read into the extended header if it was present
- ID3v2: Fix reading of tags with an extended header
- The size of the extended header was not being subtracted from the total tag size, causing the reading to continue outside the tag boundaries
0.6.0 - 2022-04-05
Added
TagItem::{into_key, into_value, consume}
- MP4:
Mp4Codec::MP3
- MP4:
mp4::AudioObjectType
- This new type is used in
mp4::Mp4Properties
, accessible withMp4Properties::audio_object_type
. This provides additional information for the type of audio being dealt with.
- This new type is used in
TagExt::clear
- This allows tags to be cleared of any items or pictures, while retaining any flags (if applicable)
- ID3v2: Respect
Id3v2TagFlags::crc
when writing- Previously, this flag was ignored, but it will now calculate a CRC for the extended header
- ID3v2:
FrameValue::Popularimeter
ItemValue::{into_string, into_binary}
Tag::take_strings
TaggedFile
now implementsAudioFile
Changed
- MP4: Sample rates and channels are now retrieved from the audio specific config (if possible).
If the information is invalid or unavailable, the existing value from the
mp4a
box will be used instead. - Vorbis Comments: Support non-PNG/JPEG images in
PictureInformation::from_picture
- The method still only supports PNG and JPEG, but rather than error when it encounters an unknown image, it will return
PictureInformation::default
- The method still only supports PNG and JPEG, but rather than error when it encounters an unknown image, it will return
lofty::read_from
will now wrap theFile
in aBufReader
- FLAC: FLAC now has its own module at
lofty::flac
- ID3v2:
FrameValue
is now#[non_exhaustive]
TagType::remove_from
now works for ID3v2 tags in APE and FLAC files- This previously verified that the
FileType
supported the tag. It now has special exceptions for these formats to allow stripping out these unsupported tags
- This previously verified that the
- MP4: Renamed
AdvisoryRating::None
toAdvisoryRating::Inoffensive
- Renamed
TaggedFile::remove_tag
toTaggedFile::take
- Vorbis Comments:
VorbisComments::insert_picture
now accepts a user providedPictureInformation
- Vorbis Comments: Rename
VorbisComments::{get_item, insert_item, remove_key}
toVorbisComments::{get, insert, remove}
- Vorbis Comments:
VorbisComments::remove
now returns an iterator over the removed items
Fixed
- MP4: Non-full
meta
atoms are now properly handled.-
It is possible for these to be a regular atom (no version or flags). This information was assumed to be present and would get skipped, which would affect the reading of subsequent atoms.
This behavior has been noticed by:
-
- MP4: Properly search for
soun
atom- The search wasn't adding read bytes correctly, but tests passed due to the atom being immediately available. It would attempt to read until it reached an EOF if it managed to make it through multiple iterations.
- FLAC: Support files with an ID3v2 tag
- This will be read only just like APE, but will allow such files to be read
- ID3v2: Fix writing certain proprietary Apple frames
- When writing, frame IDs are verified with their content. The Apple specific frames "MVNM" and "MVIN" were missing,
causing an error if they were written with their proper type (
FrameValue::Text
)
- When writing, frame IDs are verified with their content. The Apple specific frames "MVNM" and "MVIN" were missing,
causing an error if they were written with their proper type (
- ID3v2: Stop writing a BOM for
TextEncoding::UTF16BE
0.5.3 - 2022-03-03
ogg_pager
0.5.2 - 2022-02-26
Added
- MP4:
Ilst::{atoms, retain}
Fixed
- ID3v2: The footer flag is written to the tag
- ID3v2: Pictures are written when using
Tag
0.5.1 - 2022-02-21
Changed
- MP4: Padding atoms (
free
) are used when writing - Opus: Channel count is verified in accordance to the channel mapping family
Fixed
- MP4:
meta
atoms are written correctly
0.5.0 - 2022-02-20
Added
- Support for Speex files
TagExt
trait to unify tag behaviordoc_cfg
feature for docs.rs- Fallible allocation with
ErrorKind::Alloc
to help prevent OOM - New dependency:
cfg-if
- MP3: Emphasis struct (
mp3::Emphasis
) for use inMp3Properties
- ID3v2: Respect the footer flag (
id3::v2::Id3v2TagFlags::footer
) when writing - MP4: Constants for all well-known data types (
mp4::constants
) - MP4: Support
rtng
(Parental advisory) atom, with correspondingmp4::AdvisoryRating
enum
Changed
- Added
#[non_exhaustive]
toMimeType
- Added
#[non_exhaustive]
toPictureType
- Added
#[non_exhaustive]
toMp4Codec
- APE: Clarify why ID3v2 is read only
- MP3: No longer error on missing Xing/VBRI header when reading properties
- MP3: Read the entire MPEG frame header, which is exposed in
Mp3Properties
AudioFile
now requiresInto<TaggedFile>
- MP4: Empty atoms are discarded
- MP4: Variable-size integers are shrunk when writing
Fixed
- MP4: Panic in
Mp4File::read_from
(commit) - WAV/AIFF: Chunk reading now makes use of fallible allocation, preventing OOM
- ID3v2: Text is properly encoded when writing
- ID3v2:
MVNM
andMVIN
frames are now treated as text frames - ID3v2: Text encodings are verified for V2 tags
- MP4:
plID
atom is properly treated as a 64-bit signed integer (issue) - MP4:
rate
andrtng
now map to the correctItemKey
- MP4: Integer pairs are now written correctly
TagType
andFileType
are no longer taken by reference in any method
Removed
ErrorKind::BadExtension