1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//! A library for reading and writing iTunes style MPEG-4 audio metadata.
//!
//! # Examples
//!
//! ## The Easy Way
//! ```no_run
//! let mut tag = mp4ameta::Tag::read_from_path("music.m4a").unwrap();
//!
//! println!("{}", tag.artist().unwrap());
//!
//! tag.set_artist("artist");
//! tag.write_to_path("music.m4a").unwrap();
//! ```
//!
//! ## The Hard Way
//! ```no_run
//! use mp4ameta::{Data, Fourcc, Tag};
//!
//! let mut tag = Tag::read_from_path("music.m4a").unwrap();
//! let artist_ident = Fourcc(*b"\xa9ART");
//!
//! let artist = tag.strings_of(&artist_ident).next().unwrap();
//! println!("{}", artist);
//!
//! tag.set_data(artist_ident, Data::Utf8("artist".to_owned()));
//! tag.write_to_path("music.m4a").unwrap();
//! ```
//!
//! ## Using Freeform Identifiers
//! ```no_run
//! use mp4ameta::{Data, FreeformIdent, Tag};
//!
//! let mut tag = Tag::read_from_path("music.m4a").unwrap();
//! let isrc_ident = FreeformIdent::new_static("com.apple.iTunes", "ISRC");
//!
//! let isrc = tag.strings_of(&isrc_ident).next().unwrap();
//! println!("{}", isrc);
//!
//! tag.set_data(isrc_ident, Data::Utf8("isrc".to_owned()));
//! tag.write_to_path("music.m4a").unwrap();
//! ```
//!
//! ## Chapters
//! There are two ways of storing chapters in mp4 files.
//! They can either be stored inside a chapter list, or a chapter track.
//! ```no_run
//! use mp4ameta::{Chapter, Tag};
//! use std::time::Duration;
//!
//! let mut tag = Tag::read_from_path("audiobook.m4b").unwrap();
//!
//! for chapter in tag.chapter_track() {
//! let mins = chapter.start.as_secs() / 60;
//! let secs = chapter.start.as_secs() % 60;
//! println!("{mins:02}:{secs:02} {}", chapter.title);
//! }
//! tag.chapter_track_mut().clear();
//!
//! tag.chapter_list_mut().extend([
//! Chapter::new(Duration::ZERO, "first chapter"),
//! Chapter::new(Duration::from_secs(3 * 60 + 42), "second chapter"),
//! Chapter::new(Duration::from_secs(7 * 60 + 13), "third chapter"),
//! ]);
//!
//! tag.write_to_path("audiobook.m4b").unwrap();
//! ```
//!
//! ## Read and Write Configurations
//! Read only the data that is relevant for your usecase.
//! And (over)write only the data that you want to edit.
//!
//! By default all data is read and written.
//! ```no_run
//! use mp4ameta::{ChplTimescale, ReadConfig, Tag, WriteConfig};
//!
//! // Only read the metadata item list, not chapters or audio information
//! let read_cfg = ReadConfig {
//! read_meta_items: true,
//! read_image_data: false,
//! ..ReadConfig::NONE
//! };
//! let mut tag = Tag::read_with_path("music.m4a", &read_cfg).unwrap();
//!
//! println!("{tag}");
//!
//! tag.clear_meta_items();
//!
//! // Only overwrite the metadata item list, leave chapters intact
//! let write_cfg = WriteConfig {
//! write_meta_items: true,
//! ..WriteConfig::NONE
//! };
//! tag.write_with_path("music.m4a", &write_cfg).unwrap();
//! ```
pub use crate;
pub use crate;
pub use crate;
pub use crate;
pub use crate*;
pub use crateMetaItem;