EBML: Stub MergeTag impl

This commit is contained in:
Serial 2024-10-15 19:55:56 -04:00
parent 378595570c
commit 0dd9557447
No known key found for this signature in database
GPG key ID: DA95198DC17C4568
2 changed files with 16 additions and 6 deletions

View file

@ -136,13 +136,13 @@ matroska_mapping_tables!(
const TAG_RETAINED: bool = true;
const TAG_CONSUMED: bool = false;
pub(super) fn split_tag(mut ebml_tag: MatroskaTag) -> (MatroskaTag, Tag) {
pub(super) fn split_tag(mut matroska_tag: MatroskaTag) -> (MatroskaTag, Tag) {
let mut tag = Tag::new(TagType::Matroska);
// TODO: Pictures, can they be handled in a generic way?
// What about the uid and referral?
ebml_tag.tags.retain_mut(|t| {
matroska_tag.tags.retain_mut(|t| {
let target_type = match &t.target {
Some(t) if !t.has_uids() => t.target_type,
// We cannot use any tags bound to uids
@ -159,7 +159,7 @@ pub(super) fn split_tag(mut ebml_tag: MatroskaTag) -> (MatroskaTag, Tag) {
return TAG_RETAINED;
});
(ebml_tag, tag)
(matroska_tag, tag)
}
fn split_simple_tags(
@ -196,3 +196,7 @@ fn split_simple_tags(
return TAG_CONSUMED;
}
pub(super) fn merge_tag(tag: Tag, matroska_tag: MatroskaTag) -> MatroskaTag {
todo!()
}

View file

@ -367,8 +367,8 @@ impl SplitTag for MatroskaTag {
impl MergeTag for SplitTagRemainder {
type Merged = MatroskaTag;
fn merge_tag(self, _tag: crate::tag::Tag) -> Self::Merged {
todo!()
fn merge_tag(self, tag: crate::tag::Tag) -> Self::Merged {
generic::merge_tag(tag, self.0)
}
}
@ -385,7 +385,13 @@ impl From<MatroskaTag> for crate::tag::Tag {
}
impl From<crate::tag::Tag> for MatroskaTag {
fn from(input: crate::tag::Tag) -> Self {
fn from(mut input: crate::tag::Tag) -> Self {
if unsafe { global_options().preserve_format_specific_items } {
if let Some(companion) = input.companion_tag.take().and_then(CompanionTag::matroska) {
return SplitTagRemainder(companion).merge_tag(input);
}
}
SplitTagRemainder::default().merge_tag(input)
}
}