mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
filter/graph: add dump() method
This commit is contained in:
+14
-1
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user