aboutsummaryrefslogtreecommitdiff
path: root/remuxer/src/import/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'remuxer/src/import/mod.rs')
-rw-r--r--remuxer/src/import/mod.rs56
1 files changed, 38 insertions, 18 deletions
diff --git a/remuxer/src/import/mod.rs b/remuxer/src/import/mod.rs
index f9f655a..8c89b4d 100644
--- a/remuxer/src/import/mod.rs
+++ b/remuxer/src/import/mod.rs
@@ -19,6 +19,7 @@ use std::path::PathBuf;
pub struct MatroskaMetadata {
pub title: Option<String>,
pub description: Option<String>,
+ pub tagline: Option<String>,
pub tracks: Vec<SourceTrack>,
pub track_sources: Vec<LocalTrack>,
pub image: Option<(String, Vec<u8>)>,
@@ -87,24 +88,43 @@ fn import_read_segment(segment: &mut Unflatten) -> Result<MatroskaMetadata> {
}
}
MatroskaTag::Tags(_) => {
- // let mut children = children.unwrap();
- // while let Some(Ok(Unflat {
- // children, item, ..
- // })) = children.n()
- // {
- // match item {
- // MatroskaTag::Tag(_) => {
- // let mut children = children.unwrap();
- // while let Some(Ok(Unflat {
- // children, item, ..
- // })) = children.n() {
-
- // }
-
- // },
- // _ => debug!("(rst) tag ignored: {item:?}"),
- // }
- // }
+ let mut children = children.unwrap();
+ while let Some(Ok(Unflat { children, item, .. })) = children.n() {
+ match item {
+ MatroskaTag::Tag(_) => {
+ let mut children = children.unwrap();
+ while let Some(Ok(Unflat { children, item, .. })) = children.n() {
+ match item {
+ MatroskaTag::SimpleTag(_) => {
+ let (mut key, mut value) = (None, None);
+ let mut children = children.unwrap();
+ while let Some(Ok(Unflat {
+ children: _, item, ..
+ })) = children.n()
+ {
+ match item {
+ MatroskaTag::TagName(k) => key = Some(k),
+ MatroskaTag::TagString(v) => value = Some(v),
+ _ => debug!("(rstts) tag ignored: {item:?}"),
+ }
+ }
+ match (key, value) {
+ (Some(key), Some(value)) => match key.as_str() {
+ "DESCRIPTION" => m.description = Some(value),
+ "COMMENT" => m.tagline = Some(value),
+ _ => debug!("simple tag ignored: {key:?}"),
+ },
+ (None, None) => (),
+ _ => warn!("simple tag with only one of name/string"),
+ }
+ }
+ _ => debug!("(rstt) tag ignored: {item:?}"),
+ }
+ }
+ }
+ _ => debug!("(rst) tag ignored: {item:?}"),
+ }
+ }
}
MatroskaTag::Cues(_) => {}
MatroskaTag::Chapters(_) => {}