format/context: add new_stream() method

This commit is contained in:
lummax 2015-08-24 22:50:48 +02:00 committed by meh
parent 471a768b8e
commit a48233cbfe

View File

@ -92,6 +92,19 @@ impl Context {
} }
} }
pub fn new_stream(&mut self, codec: &Codec) -> Option<StreamMut> {
unsafe {
let ptr = avformat_new_stream(self.as_mut_ptr(), codec.as_ptr());
if ptr.is_null() {
None
}
else {
Some(StreamMut::wrap(ptr))
}
}
}
pub fn metadata(&self) -> Dictionary { pub fn metadata(&self) -> Dictionary {
unsafe { unsafe {
Dictionary::wrap((*self.as_ptr()).metadata) Dictionary::wrap((*self.as_ptr()).metadata)