Drop unknown elements when building header

This commit is contained in:
Tangent 128 2018-04-09 22:52:01 -04:00
parent bf0f727b03
commit 4970603236
2 changed files with 4 additions and 1 deletions

View File

@ -125,6 +125,7 @@ impl<S: EbmlEventSource> Stream for WebmChunker<S>
},
Ok(Async::Ready(Some(WebmElement::Info))) => {},
Ok(Async::Ready(Some(WebmElement::Void))) => {},
Ok(Async::Ready(Some(WebmElement::Unknown(_)))) => {},
Ok(Async::Ready(Some(element))) => {
match encode_webm_element(element, buffer) {
Ok(_) => {},

View File

@ -123,7 +123,9 @@ pub fn encode_webm_element<T: Write + Seek>(element: WebmElement, output: &mut T
WebmElement::Cluster => encode_tag_header(CLUSTER_ID, Varint::Unknown, output),
WebmElement::Timecode(time) => encode_integer(TIMECODE_ID, time, output),
WebmElement::SimpleBlock(block) => encode_simple_block(block, output),
_ => Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange))
WebmElement::Void => Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange)),
WebmElement::Info => Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange)),
WebmElement::Unknown(_) => Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange))
}
}