pub extern crate dasp_frame;
pub extern crate dasp_sample;
#[cfg(feature = "alac")]
pub extern crate alac;
#[cfg(feature = "caf")]
pub extern crate caf;
#[cfg(feature = "flac")]
pub extern crate claxon; #[cfg(feature = "wav")]
pub extern crate hound; #[cfg(feature = "ogg_vorbis")]
pub extern crate lewton; #[cfg(feature = "caf_alac")]
mod caf_alac;
pub mod read;
pub mod write;
pub use crate::read::{open, Reader};
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum Format {
#[cfg(feature = "flac")]
Flac,
#[cfg(feature = "ogg_vorbis")]
OggVorbis,
#[cfg(feature = "wav")]
Wav,
#[cfg(feature = "caf_alac")]
CafAlac,
}
impl Format {
pub fn from_extension(extension: &str) -> Option<Self> {
match extension {
#[cfg(feature = "flac")]
"flac" => Some(Format::Flac),
#[cfg(feature = "ogg_vorbis")]
"ogg" | "oga" => Some(Format::OggVorbis),
#[cfg(feature = "wav")]
"wav" | "wave" => Some(Format::Wav),
#[cfg(feature = "caf")]
"caf" => Some(Format::CafAlac),
_ => None,
}
}
pub fn extension(self) -> &'static str {
match self {
#[cfg(feature = "flac")]
Format::Flac => "flac",
#[cfg(feature = "wav")]
Format::Wav => "wav",
#[cfg(feature = "ogg_vorbis")]
Format::OggVorbis => "ogg",
#[cfg(feature = "caf_alac")]
Format::CafAlac => "caf",
}
}
}