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());
|
let mut cursor = Cursor::new(Vec::new());
|
||||||
|
|
||||||
encode_webm_element(WebmElement::EbmlHead, &mut cursor).unwrap();
|
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();
|
stdout().write_all(&cursor.get_ref()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
10
src/webm.rs
10
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<()> {
|
pub fn encode_webm_element<T: Write + Seek>(element: WebmElement, output: &mut T) -> IoResult<()> {
|
||||||
match element {
|
match element {
|
||||||
WebmElement::EbmlHead => {
|
WebmElement::EbmlHead => encode_element(EBML_HEAD_ID, output, |output| {
|
||||||
encode_element(EBML_HEAD_ID, output, |output| {
|
|
||||||
encode_string(DOC_TYPE_ID, "webm", 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))
|
_ => Err(IoError::new(ErrorKind::InvalidInput, WriteError::OutOfRange))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue