filter/graph: add dump() method

This commit is contained in:
lummax 2015-09-09 19:19:45 +02:00 committed by meh
parent 91134301a5
commit 056293a244

View File

@ -1,5 +1,6 @@
use std::ptr;
use std::ffi::CString;
use std::ffi::{CString, CStr};
use std::str::from_utf8_unchecked;
use ffi::*;
use libc::c_int;
@ -76,6 +77,18 @@ impl Graph {
}
}
pub fn dump(&self) -> String {
unsafe {
let ptr = avfilter_graph_dump(self.as_ptr(), ptr::null());
let cstr = from_utf8_unchecked(CStr::from_ptr((ptr)).to_bytes());
let string = cstr.to_owned();
av_free(ptr as *mut _);
string
}
}
pub fn input(&mut self, name: &str, pad: usize) -> Result<Parser, Error> {
Parser::new(self).input(name, pad)
}