|
1 | 1 | use crate::ebml::element_reader::{ElementIdent, ElementReader, ElementReaderYield}; |
2 | 2 | use crate::ebml::properties::EbmlProperties; |
3 | 3 | use crate::error::Result; |
| 4 | +use crate::macros::decode_err; |
4 | 5 | use crate::probe::ParseOptions; |
5 | 6 |
|
6 | 7 | use std::io::{Read, Seek}; |
7 | 8 |
|
8 | 9 | pub(super) fn read_from<R>( |
9 | 10 | element_reader: &mut ElementReader<R>, |
10 | | - _parse_options: ParseOptions, |
11 | | - _properties: &mut EbmlProperties, |
| 11 | + parse_options: ParseOptions, |
| 12 | + properties: &mut EbmlProperties, |
12 | 13 | ) -> Result<()> |
13 | 14 | where |
14 | 15 | R: Read + Seek, |
|
29 | 30 | }, |
30 | 31 | ElementReaderYield::Child((child, size)) => { |
31 | 32 | match child.ident { |
32 | | - ElementIdent::TimecodeScale => todo!("Support segment.Info.TimecodeScale"), |
| 33 | + ElementIdent::TimecodeScale => { |
| 34 | + properties.segment_info.timecode_scale = |
| 35 | + element_reader.read_unsigned_int(size)?; |
| 36 | + |
| 37 | + if properties.segment_info.timecode_scale == 0 { |
| 38 | + log::warn!("Segment.Info.TimecodeScale is 0, which is invalid"); |
| 39 | + if parse_options.parsing_mode == crate::probe::ParsingMode::Strict { |
| 40 | + decode_err!(@BAIL Ebml, "Segment.Info.TimecodeScale must be nonzero"); |
| 41 | + } |
| 42 | + } |
| 43 | + }, |
33 | 44 | ElementIdent::MuxingApp => todo!("Support segment.Info.MuxingApp"), |
34 | 45 | ElementIdent::WritingApp => todo!("Support segment.Info.WritingApp"), |
35 | 46 | _ => { |
|
0 commit comments