Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties: Breakup module #372

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Lofty writes tags. These are best used as global user-configurable options, as most options will
not apply to all files. The defaults are set to be as safe as possible,
see [here](https://docs.rs/lofty/latest/lofty/struct.WriteOptions.html#impl-Default-for-WriteOptions).
- **ChannelMask** ([PR](https://github.com/Serial-ATA/lofty-rs/pull/370))
- **ChannelMask** ([PR](https://github.com/Serial-ATA/lofty-rs/pull/371))
- `BitAnd` and `BitOr` implementations
- Associated constants for common channels, ex. `ChannelMask::FRONT_LEFT`

### Changed
- **Properties**: `FileProperties` and `ChannelMask` have been moved from the root to the new `lofty::properties`
module ([PR](https://github.com/Serial-ATA/lofty-rs/pull/372))

### Fixed
- **Vorbis**: Fix panic when reading properties of zero-length files ([issue](https://github.com/Serial-ATA/lofty-rs/issues/342)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/365))
- **ID3v2**: Fix panic when reading an RVA2 frame with a peak larger than 248 bits ([issue](https://github.com/Serial-ATA/lofty-rs/issues/295)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/364))
Expand Down
3 changes: 2 additions & 1 deletion examples/custom_resolver/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use lofty::ape::ApeTag;
use lofty::error::Result as LoftyResult;
use lofty::id3::v2::Id3v2Tag;
use lofty::properties::FileProperties;
use lofty::resolve::FileResolver;
use lofty::{FileProperties, FileType, GlobalOptions, ParseOptions, TagType};
use lofty::{FileType, GlobalOptions, ParseOptions, TagType};
use lofty_attr::LoftyFile;

use std::fs::File;
Expand Down
4 changes: 2 additions & 2 deletions lofty_attr/src/lofty_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ fn generate_audiofile_impl(file: &LoftyFile) -> syn::Result<proc_macro2::TokenSt

let properties_field_ty = &properties_field.ty;
let assert_properties_impl = quote_spanned! {properties_field_ty.span()=>
struct _AssertIntoFileProperties where #properties_field_ty: ::std::convert::Into<::lofty::FileProperties>;
struct _AssertIntoFileProperties where #properties_field_ty: ::std::convert::Into<::lofty::properties::FileProperties>;
};

let struct_name = &file.struct_info.name;
Expand Down Expand Up @@ -537,7 +537,7 @@ fn generate_from_taggedfile_impl(file: &LoftyFile) -> proc_macro2::TokenStream {

::lofty::TaggedFile::new(
#file_type_variant,
::lofty::FileProperties::from(input.properties),
::lofty::properties::FileProperties::from(input.properties),
{
let mut tags: Vec<::lofty::Tag> = Vec::new();
#( #conditions )*
Expand Down
3 changes: 1 addition & 2 deletions src/iff/wav/properties.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::error::Result;
use crate::macros::decode_err;
use crate::math::RoundedDivision;
use crate::properties::FileProperties;
use crate::ChannelMask;
use crate::properties::{ChannelMask, FileProperties};

use std::time::Duration;

Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub mod musepack;
pub mod ogg;
pub(crate) mod picture;
mod probe;
pub(crate) mod properties;
pub mod properties;
pub mod resolve;
pub(crate) mod tag;
mod traits;
Expand All @@ -181,7 +181,6 @@ pub use crate::write_options::WriteOptions;

pub use crate::file::{AudioFile, BoundTaggedFile, FileType, TaggedFile, TaggedFileExt};
pub use crate::picture::{MimeType, Picture, PictureType};
pub use crate::properties::{ChannelMask, FileProperties};
pub use crate::tag::{Tag, TagType};
pub use tag::item::{ItemKey, ItemValue, TagItem};
pub use util::text::TextEncoding;
Expand Down
3 changes: 1 addition & 2 deletions src/mpeg/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use super::header::{ChannelMode, Emphasis, Header, Layer, MpegVersion, XingHeade
use crate::error::Result;
use crate::math::RoundedDivision;
use crate::mpeg::header::{cmp_header, rev_search_for_frame_sync, HeaderCmpResult, HEADER_MASK};
use crate::properties::FileProperties;
use crate::ChannelMask;
use crate::properties::{ChannelMask, FileProperties};

use std::io::{Read, Seek, SeekFrom};
use std::time::Duration;
Expand Down
Loading