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

chore: Update bitflags to 2.6.0 #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions symphonia-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ opt-simd = [

[dependencies]
arrayvec = "0.7.1"
bitflags = "1.2.1"
bitflags = "2.6.0"
bytemuck = "1.7"
lazy_static = "1.4.0"
log = "0.4"

[dependencies.rustfft]
version = "6.1.0"
optional = true
default-features = false
default-features = false
30 changes: 4 additions & 26 deletions symphonia-core/src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ bitflags! {
/// The first 18 defined channels are guaranteed to be identical to those specified by
/// Microsoft's WAVEFORMATEXTENSIBLE structure. Channels after 18 are defined by Symphonia and
/// no order is guaranteed.
#[derive(Default)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]
pub struct Channels: u32 {
/// Front-left (left) or the Mono channel.
const FRONT_LEFT = 0x0000_0001;
Expand Down Expand Up @@ -90,40 +90,18 @@ bitflags! {
}

/// An iterator over individual channels within a `Channels` bitmask.
pub struct ChannelsIter {
channels: Channels,
}

impl Iterator for ChannelsIter {
type Item = Channels;

fn next(&mut self) -> Option<Self::Item> {
if !self.channels.is_empty() {
let channel = Channels::from_bits_truncate(1 << self.channels.bits.trailing_zeros());
self.channels ^= channel;
Some(channel)
}
else {
None
}
}
}
pub type ChannelsIter = bitflags::iter::Iter<Channels>;

impl Channels {
/// Gets the number of channels.
pub fn count(self) -> usize {
self.bits.count_ones() as usize
}

/// Gets an iterator over individual channels.
pub fn iter(&self) -> ChannelsIter {
ChannelsIter { channels: *self }
self.bits().count_ones() as usize
}
}

impl fmt::Display for Channels {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:#032b}", self.bits)
write!(f, "{:#032b}", self.bits())
}
}

Expand Down