mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-13 14:12:31 +00:00
Misc: Remove mp4_ilst
feature
This commit is contained in:
parent
4e87434cf2
commit
2fc30f3b5a
8 changed files with 15 additions and 43 deletions
|
@ -30,8 +30,7 @@ once_cell = "1.16.0"
|
|||
paste = "1.0.11"
|
||||
|
||||
[features]
|
||||
default = ["mp4_ilst", "ape", "id3v1", "id3v2", "aiff_text_chunks", "riff_info_list"]
|
||||
mp4_ilst = []
|
||||
default = ["ape", "id3v1", "id3v2", "aiff_text_chunks", "riff_info_list"]
|
||||
ape = []
|
||||
id3v1 = []
|
||||
id3v2 = ["flate2"]
|
||||
|
|
|
@ -836,7 +836,6 @@ impl FileType {
|
|||
FileType::Opus | FileType::FLAC | FileType::Vorbis | FileType::Speex => {
|
||||
tag_type == TagType::VorbisComments
|
||||
},
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
FileType::MP4 => tag_type == TagType::MP4ilst,
|
||||
#[cfg(feature = "riff_info_list")]
|
||||
FileType::WAV => tag_type == TagType::RIFFInfo,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/// All possible genres for ID3v1
|
||||
#[cfg(any(feature = "id3v1", feature = "mp4_ilst"))]
|
||||
#[cfg(any(feature = "id3v1"))]
|
||||
pub const GENRES: [&str; 192] = [
|
||||
"Blues",
|
||||
"Classic rock",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//!
|
||||
//! The only supported tag format is [`Ilst`].
|
||||
mod atom_info;
|
||||
pub(crate) mod ilst;
|
||||
mod moov;
|
||||
mod properties;
|
||||
mod read;
|
||||
|
@ -12,24 +13,17 @@ use lofty_attr::LoftyFile;
|
|||
|
||||
// Exports
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "mp4_ilst")] {
|
||||
pub(crate) mod ilst;
|
||||
|
||||
pub use atom_info::AtomIdent;
|
||||
pub use ilst::atom::{Atom, AtomData, AdvisoryRating};
|
||||
pub use ilst::Ilst;
|
||||
|
||||
/// This module contains the codes for all of the [Well-known data types]
|
||||
///
|
||||
/// [Well-known data types]: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW34
|
||||
pub mod constants {
|
||||
pub use super::ilst::constants::*;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use crate::mp4::properties::{AudioObjectType, Mp4Codec, Mp4Properties};
|
||||
pub use atom_info::AtomIdent;
|
||||
pub use ilst::atom::{AdvisoryRating, Atom, AtomData};
|
||||
pub use ilst::Ilst;
|
||||
|
||||
pub(crate) use properties::SAMPLE_RATES;
|
||||
|
||||
|
@ -39,7 +33,6 @@ pub(crate) use properties::SAMPLE_RATES;
|
|||
pub struct Mp4File {
|
||||
/// The file format from ftyp's "major brand" (Ex. "M4A ")
|
||||
pub(crate) ftyp: String,
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
#[lofty(tag_type = "MP4ilst")]
|
||||
/// The parsed `ilst` (metadata) atom, if it exists
|
||||
pub(crate) ilst_tag: Option<Ilst>,
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
use super::atom_info::{AtomIdent, AtomInfo};
|
||||
use super::read::{nested_atom, skip_unneeded};
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
use super::{
|
||||
ilst::{read::parse_ilst, Ilst},
|
||||
read::{meta_is_full, AtomReader},
|
||||
};
|
||||
use super::ilst::read::parse_ilst;
|
||||
use super::ilst::Ilst;
|
||||
use super::read::{meta_is_full, nested_atom, skip_unneeded, AtomReader};
|
||||
use crate::error::Result;
|
||||
use crate::macros::decode_err;
|
||||
|
||||
|
@ -13,7 +10,6 @@ use std::io::{Read, Seek};
|
|||
pub(crate) struct Moov {
|
||||
// Represents the trak.mdia atom
|
||||
pub(crate) traks: Vec<AtomInfo>,
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
// Represents a parsed moov.udta.meta.ilst
|
||||
pub(crate) meta: Option<Ilst>,
|
||||
}
|
||||
|
@ -42,7 +38,6 @@ impl Moov {
|
|||
R: Read + Seek,
|
||||
{
|
||||
let mut traks = Vec::new();
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
let mut meta = None;
|
||||
|
||||
while let Ok(atom) = reader.next() {
|
||||
|
@ -54,7 +49,6 @@ impl Moov {
|
|||
traks.push(mdia);
|
||||
}
|
||||
},
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
b"udta" => {
|
||||
meta = meta_from_udta(reader, atom.len - 8)?;
|
||||
},
|
||||
|
@ -67,15 +61,10 @@ impl Moov {
|
|||
skip_unneeded(reader, atom.extended, atom.len)?
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
traks,
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
meta,
|
||||
})
|
||||
Ok(Self { traks, meta })
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
fn meta_from_udta<R>(reader: &mut AtomReader<R>, len: u64) -> Result<Option<Ilst>>
|
||||
where
|
||||
R: Read + Seek,
|
||||
|
|
|
@ -163,7 +163,6 @@ where
|
|||
|
||||
Ok(Mp4File {
|
||||
ftyp,
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
ilst_tag: moov.meta,
|
||||
properties: if parse_options.read_properties {
|
||||
super::properties::read_properties(&mut reader, &moov.traks, file_length)?
|
||||
|
@ -220,7 +219,6 @@ where
|
|||
Ok(ret)
|
||||
}
|
||||
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
// Creates a tree of nested atoms
|
||||
pub(super) fn atom_tree<R>(
|
||||
reader: &mut R,
|
||||
|
@ -257,7 +255,6 @@ where
|
|||
Ok((found_idx, buf))
|
||||
}
|
||||
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
pub(super) fn meta_is_full<R>(reader: &mut R) -> Result<bool>
|
||||
where
|
||||
R: Read + Seek,
|
||||
|
|
|
@ -204,7 +204,6 @@ gen_map!(
|
|||
);
|
||||
|
||||
gen_map!(
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
ILST_MAP;
|
||||
|
||||
"\u{a9}alb" => AlbumTitle,
|
||||
|
@ -426,7 +425,6 @@ gen_item_keys!(
|
|||
#[cfg(feature = "id3v2")]
|
||||
[TagType::ID3v2, ID3V2_MAP],
|
||||
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
[TagType::MP4ilst, ILST_MAP],
|
||||
|
||||
#[cfg(feature = "riff_info_list")]
|
||||
|
|
|
@ -8,7 +8,6 @@ use crate::{aac, ape, flac, iff, mpeg, wavpack};
|
|||
use crate::id3::v1::tag::Id3v1TagRef;
|
||||
#[cfg(feature = "id3v2")]
|
||||
use crate::id3::v2::{self, tag::Id3v2TagRef, ID3v2TagFlags};
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
use crate::mp4::Ilst;
|
||||
use crate::ogg::tag::{create_vorbis_comments_ref, VorbisCommentsRef};
|
||||
#[cfg(feature = "ape")]
|
||||
|
@ -32,7 +31,6 @@ pub(crate) fn write_tag(tag: &Tag, file: &mut File, file_type: FileType) -> Resu
|
|||
crate::ogg::write::write_to(file, tag, file_type)
|
||||
},
|
||||
FileType::MPEG => mpeg::write::write_to(file, tag),
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
FileType::MP4 => {
|
||||
crate::mp4::ilst::write::write_to(file, &mut Into::<Ilst>::into(tag.clone()).as_ref())
|
||||
},
|
||||
|
@ -59,7 +57,6 @@ pub(crate) fn dump_tag<W: Write>(tag: &Tag, writer: &mut W) -> Result<()> {
|
|||
frames: v2::tag::tag_frames(tag),
|
||||
}
|
||||
.dump_to(writer),
|
||||
#[cfg(feature = "mp4_ilst")]
|
||||
TagType::MP4ilst => Into::<Ilst>::into(tag.clone()).as_ref().dump_to(writer),
|
||||
TagType::VorbisComments => {
|
||||
let (vendor, items, pictures) = create_vorbis_comments_ref(tag);
|
||||
|
|
Loading…
Reference in a new issue