1pub mod constants;
3mod read;
4pub mod sv4to6;
5pub mod sv7;
6pub mod sv8;
7
8use crate::ape::tag::ApeTag;
9use crate::id3::v1::tag::Id3v1Tag;
10use crate::id3::v2::tag::Id3v2Tag;
11use crate::properties::FileProperties;
12
13use lofty_attr::LoftyFile;
14
15#[derive(Debug, Clone, PartialEq)]
19pub enum MpcProperties {
20 Sv8(sv8::MpcSv8Properties),
22 Sv7(sv7::MpcSv7Properties),
24 Sv4to6(sv4to6::MpcSv4to6Properties),
26}
27
28impl Default for MpcProperties {
29 fn default() -> Self {
30 Self::Sv8(sv8::MpcSv8Properties::default())
31 }
32}
33
34impl From<MpcProperties> for FileProperties {
35 fn from(input: MpcProperties) -> Self {
36 match input {
37 MpcProperties::Sv8(sv8prop) => sv8prop.into(),
38 MpcProperties::Sv7(sv7prop) => sv7prop.into(),
39 MpcProperties::Sv4to6(sv4to6prop) => sv4to6prop.into(),
40 }
41 }
42}
43
44#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
46pub enum MpcStreamVersion {
47 #[default]
49 Sv8,
50 Sv7,
52 Sv4to6,
54}
55
56#[derive(LoftyFile, Default)]
58#[lofty(read_fn = "read::read_from")]
59#[lofty(internal_write_module_do_not_use_anywhere_else)]
60pub struct MpcFile {
61 pub(crate) stream_version: MpcStreamVersion,
63 #[lofty(tag_type = "Id3v2")]
65 pub(crate) id3v2_tag: Option<Id3v2Tag>,
66 #[lofty(tag_type = "Id3v1")]
68 pub(crate) id3v1_tag: Option<Id3v1Tag>,
69 #[lofty(tag_type = "Ape")]
71 pub(crate) ape_tag: Option<ApeTag>,
72 pub(crate) properties: MpcProperties,
74}
75
76impl MpcFile {
77 pub fn stream_version(&self) -> MpcStreamVersion {
79 self.stream_version
80 }
81}