format: refactor format handling

This commit is contained in:
lummax
2015-09-06 17:26:22 +02:00
committed by meh
parent d1e693965c
commit 87ea1bd196
7 changed files with 264 additions and 224 deletions

View File

@ -3,7 +3,7 @@ use std::ptr;
use std::ffi::CString;
use ffi::*;
use ::{Error, Codec, StreamMut, Dictionary};
use ::{Error, Codec, StreamMut, Dictionary, format};
use super::common::Context;
pub struct Output {
@ -28,6 +28,12 @@ impl Output {
}
impl Output {
pub fn format(&self) -> format::Output {
unsafe {
format::Output::wrap((*self.as_ptr()).oformat)
}
}
pub fn write_header(&mut self) -> Result<(), Error> {
unsafe {
match avformat_write_header(self.as_mut_ptr(), ptr::null_mut()) {
@ -74,7 +80,7 @@ impl Output {
pub fn set_metadata(&mut self, dictionary: Dictionary) {
unsafe {
(*self.as_mut_ptr()).metadata = dictionary.take();
(*self.as_mut_ptr()).metadata = dictionary.disown();
}
}
}