Skip to content

Commit d604ee1

Browse files
committed
aud_io: Move math utils from lofty
1 parent d70cf00 commit d604ee1

File tree

12 files changed

+14
-12
lines changed

12 files changed

+14
-12
lines changed

aud_io/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pub mod text;
22
pub mod error;
33
pub(crate) mod macros;
4+
pub mod math;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// This is implemented for all unsigned integers.
44
///
55
/// NOTE: If the result is less than 1, it will be rounded up to 1.
6-
pub(crate) trait RoundedDivision<Rhs = Self> {
6+
pub trait RoundedDivision<Rhs = Self> {
77
type Output;
88

99
fn div_round(self, rhs: Rhs) -> Self::Output;
@@ -29,7 +29,7 @@ unsigned_rounded_division!(u8, u16, u32, u64, u128, usize);
2929
///
3030
/// This is used in AIFF.
3131
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
32-
pub(crate) struct F80 {
32+
pub struct F80 {
3333
signed: bool,
3434
// 15-bit exponent with a bias of 16383
3535
exponent: u16,

lofty/src/iff/wav/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::error::Result;
22
use crate::macros::decode_err;
33
use crate::properties::{ChannelMask, FileProperties};
4-
use crate::util::math::RoundedDivision;
54

65
use std::time::Duration;
76

7+
use aud_io::math::RoundedDivision;
88
use byteorder::{LittleEndian, ReadBytesExt};
99

1010
const PCM: u16 = 0x0001;

lofty/src/mp4/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use crate::error::{LoftyError, Result};
55
use crate::macros::{decode_err, err, try_vec};
66
use crate::properties::FileProperties;
77
use crate::util::alloc::VecFallibleCapacity;
8-
use crate::util::math::RoundedDivision;
98

109
use std::io::{Cursor, Read, Seek, SeekFrom};
1110
use std::time::Duration;
1211

12+
use aud_io::math::RoundedDivision;
1313
use byteorder::{BigEndian, ReadBytesExt};
1414

1515
/// An MP4 file's audio codec

lofty/src/mpeg/properties.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ use super::header::{ChannelMode, Emphasis, Header, Layer, MpegVersion, VbrHeader
22
use crate::error::Result;
33
use crate::mpeg::header::rev_search_for_frame_header;
44
use crate::properties::{ChannelMask, FileProperties};
5-
use crate::util::math::RoundedDivision;
65

76
use std::io::{Read, Seek, SeekFrom};
87
use std::time::Duration;
98

9+
use aud_io::math::RoundedDivision;
10+
1011
/// An MPEG file's audio properties
1112
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
1213
#[non_exhaustive]

lofty/src/musepack/sv4to6/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use crate::error::Result;
33
use crate::macros::decode_err;
44
use crate::musepack::constants::{MPC_DECODER_SYNTH_DELAY, MPC_FRAME_LENGTH};
55
use crate::properties::FileProperties;
6-
use crate::util::math::RoundedDivision;
76

87
use std::io::Read;
98
use std::time::Duration;
109

10+
use aud_io::math::RoundedDivision;
1111
use byteorder::{LittleEndian, ReadBytesExt};
1212

1313
/// MPC stream versions 4-6 audio properties

lofty/src/musepack/sv8/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use crate::error::Result;
44
use crate::macros::decode_err;
55
use crate::musepack::constants::FREQUENCY_TABLE;
66
use crate::properties::FileProperties;
7-
use crate::util::math::RoundedDivision;
87

98
use std::io::Read;
109
use std::time::Duration;
1110

11+
use aud_io::math::RoundedDivision;
1212
use byteorder::{BigEndian, ReadBytesExt};
1313

1414
/// MPC stream version 8 audio properties

lofty/src/ogg/opus/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use super::find_last_page;
22
use crate::error::Result;
33
use crate::macros::decode_err;
44
use crate::properties::{ChannelMask, FileProperties};
5-
use crate::util::math::RoundedDivision;
65

76
use std::io::{Read, Seek, SeekFrom};
87
use std::time::Duration;
98

9+
use aud_io::math::RoundedDivision;
1010
use byteorder::{LittleEndian, ReadBytesExt};
1111
use ogg_pager::{Packets, PageHeader};
1212

lofty/src/ogg/speex/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use crate::error::Result;
22
use crate::macros::decode_err;
33
use crate::ogg::find_last_page;
44
use crate::properties::FileProperties;
5-
use crate::util::math::RoundedDivision;
65

76
use std::io::{Read, Seek, SeekFrom};
87
use std::time::Duration;
98

9+
use aud_io::math::RoundedDivision;
1010
use byteorder::{LittleEndian, ReadBytesExt};
1111
use ogg_pager::{Packets, PageHeader};
1212

lofty/src/ogg/vorbis/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use super::find_last_page;
22
use crate::error::Result;
33
use crate::properties::FileProperties;
4-
use crate::util::math::RoundedDivision;
54

65
use std::io::{Read, Seek, SeekFrom};
76
use std::time::Duration;
87

8+
use aud_io::math::RoundedDivision;
99
use byteorder::{LittleEndian, ReadBytesExt};
1010
use ogg_pager::{Packets, PageHeader};
1111

0 commit comments

Comments
 (0)