Skip to content

Commit 81b4d5b

Browse files
committed
EBML: Retain companion tag
1 parent 2d5bf8a commit 81b4d5b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lofty/src/ebml/tag/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ pub use tag::*;
1313
pub use tag_name::*;
1414
pub use target::*;
1515

16-
use crate::config::WriteOptions;
16+
use crate::config::{global_options, WriteOptions};
1717
use crate::error::LoftyError;
1818
use crate::io::{FileLike, Length, Truncate};
1919
use crate::picture::Picture;
20+
use crate::tag::companion_tag::CompanionTag;
2021
use crate::tag::{Accessor, MergeTag, SplitTag, TagExt, TagType};
2122

2223
use std::borrow::Cow;
@@ -373,7 +374,13 @@ impl MergeTag for SplitTagRemainder {
373374

374375
impl From<MatroskaTag> for crate::tag::Tag {
375376
fn from(input: MatroskaTag) -> Self {
376-
input.split_tag().1
377+
let (remainder, mut tag) = input.split_tag();
378+
379+
if unsafe { global_options().preserve_format_specific_items } && remainder.0.len() > 0 {
380+
tag.companion_tag = Some(CompanionTag::Matroska(remainder.0));
381+
}
382+
383+
tag
377384
}
378385
}
379386

0 commit comments

Comments
 (0)