Skip to content

Commit b40a63f

Browse files
committed
EBML: Finish parsing segment.Info
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
1 parent 1fa6b49 commit b40a63f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/ebml/element_reader.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,13 @@ where
373373
String::from_utf8(content).map_err(Into::into)
374374
}
375375

376-
pub(crate) fn read_utf8(&mut self) -> Result<String> {
377-
todo!()
376+
pub(crate) fn read_utf8(&mut self, element_length: u64) -> Result<String> {
377+
// https://www.rfc-editor.org/rfc/rfc8794.html#section-7.5
378+
// A UTF-8 Element MUST declare a length in octets from zero to VINTMAX
379+
380+
// Since the UTF-8 and String elements are both just turned into `String`s,
381+
// we can just reuse the `read_string` method.
382+
self.read_string(element_length)
378383
}
379384

380385
pub(crate) fn read_date(&mut self) -> Result<String> {

src/ebml/read/segment_info.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ where
4141
}
4242
}
4343
},
44-
ElementIdent::MuxingApp => todo!("Support segment.Info.MuxingApp"),
45-
ElementIdent::WritingApp => todo!("Support segment.Info.WritingApp"),
44+
ElementIdent::MuxingApp => {
45+
properties.segment_info.muxing_app = element_reader.read_utf8(size)?
46+
},
47+
ElementIdent::WritingApp => {
48+
properties.segment_info.writing_app = element_reader.read_utf8(size)?
49+
},
4650
_ => {
4751
// We do not end up using information from all of the segment
4852
// elements, so we can just skip any useless ones.

0 commit comments

Comments
 (0)