Extend stub WebM structure
This commit is contained in:
parent
2ecedf795d
commit
c969627510
2 changed files with 10 additions and 5 deletions
|
@ -7,6 +7,9 @@ pub fn main() {
|
|||
let mut cursor = Cursor::new(Vec::new());
|
||||
|
||||
encode_webm_element(WebmElement::EbmlHead, &mut cursor).unwrap();
|
||||
encode_webm_element(WebmElement::Segment, &mut cursor).unwrap();
|
||||
|
||||
encode_webm_element(WebmElement::Cluster, &mut cursor).unwrap();
|
||||
|
||||
stdout().write_all(&cursor.get_ref()).unwrap();
|
||||
}
|
||||
|
|
12
src/webm.rs
12
src/webm.rs
|
@ -82,11 +82,13 @@ fn decode_simple_block(bytes: &[u8]) -> Result<WebmElement, Error> {
|
|||
|
||||
pub fn encode_webm_element<T: Write + Seek>(element: WebmElement, output: &mut T) -> IoResult<()> {
|
||||
match element {
|
||||
WebmElement::EbmlHead => {
|
||||
encode_element(EBML_HEAD_ID, output, |output| {
|
||||
encode_string(DOC_TYPE_ID, "webm", output)
|
||||
})
|
||||
}
|
||||
WebmElement::EbmlHead => encode_element(EBML_HEAD_ID, output, |output| {
|
||||
encode_string(DOC_TYPE_ID, "webm", output)
|
||||
}),
|
||||
WebmElement::Segment => encode_tag_header(SEGMENT_ID, Varint::Unknown, output),
|
||||
WebmElement::SeekHead => Ok(()),
|
||||
WebmElement::Cues => Ok(()),
|
||||
WebmElement::Cluster => encode_tag_header(CLUSTER_ID, Varint::Unknown, output),
|
||||
_ => Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue