*: use latest ffmpeg-sys using bindgen

* Update bindings to newest ffmpeg version for new ffmpeg-sys, which is mostly generated by bindgen
* Bring back removed feature flags
* Fix whitespace formating
* Remove prepended enum names to enum variants
* Remove unneeded allows
This commit is contained in:
Tadas Barzdžius
2017-07-08 18:00:27 +03:00
committed by meh
parent 8cf47c7ec6
commit 5ac0527bdc
41 changed files with 208 additions and 99 deletions

View File

@ -106,7 +106,7 @@ impl<'a> Best<'a> {
pub fn best<'b>(self, kind: media::Type) -> Option<Stream<'b>> where 'a: 'b {
unsafe {
let mut decoder = ptr::null_mut();
let index = av_find_best_stream(self.context.as_ptr(),
let index = av_find_best_stream(self.context.ptr,
kind.into(), self.wanted as c_int, self.related as c_int,
&mut decoder, 0);

View File

@ -182,7 +182,7 @@ pub fn dump(ctx: &Input, index: i32, url: Option<&str>) {
let url = url.map(|u| CString::new(u).unwrap());
unsafe {
av_dump_format(ctx.as_ptr(), index,
av_dump_format(ctx.as_ptr() as *mut _, index,
url.map(|u| u.as_ptr()).unwrap_or(ptr::null()), 0);
}
}

View File

@ -106,7 +106,7 @@ pub fn dump(ctx: &Output, index: i32, url: Option<&str>) {
let url = url.map(|u| CString::new(u).unwrap());
unsafe {
av_dump_format(ctx.as_ptr(), index,
av_dump_format(ctx.as_ptr() as *mut _, index,
url.map(|u| u.as_ptr()).unwrap_or(ptr::null()), 1);
}
}

View File

@ -70,7 +70,7 @@ impl Output {
let path = CString::new(path.as_ref().as_os_str().to_str().unwrap()).unwrap();
unsafe {
codec::Id::from(av_guess_codec(self.as_ptr(), ptr::null(), path.as_ptr(), ptr::null(), kind.into()))
codec::Id::from(av_guess_codec(self.as_ptr() as *mut _, ptr::null(), path.as_ptr(), ptr::null(), kind.into()))
}
}

View File

@ -29,11 +29,11 @@ pub fn register_all() {
pub fn register(format: &Format) {
match format {
&Format::Input(ref format) => unsafe {
av_register_input_format(format.as_ptr());
av_register_input_format(format.as_ptr() as *mut _);
},
&Format::Output(ref format) => unsafe {
av_register_output_format(format.as_ptr());
av_register_output_format(format.as_ptr() as *mut _);
}
}
}
@ -69,7 +69,7 @@ pub fn open<P: AsRef<Path>>(path: &P, format: &Format) -> Result<Context, Error>
match format {
&Format::Input(ref format) => {
match avformat_open_input(&mut ps, path.as_ptr(), format.as_ptr(), ptr::null_mut()) {
match avformat_open_input(&mut ps, path.as_ptr(), format.as_ptr() as *mut _, ptr::null_mut()) {
0 => {
match avformat_find_stream_info(ps, ptr::null_mut()) {
r if r >= 0 => Ok(Context::Input(context::Input::wrap(ps))),
@ -82,7 +82,7 @@ pub fn open<P: AsRef<Path>>(path: &P, format: &Format) -> Result<Context, Error>
}
&Format::Output(ref format) => {
match avformat_alloc_output_context2(&mut ps, format.as_ptr(), ptr::null(), path.as_ptr()) {
match avformat_alloc_output_context2(&mut ps, format.as_ptr() as *mut _, ptr::null(), path.as_ptr()) {
0 => {
match avio_open(&mut (*ps).pb, path.as_ptr(), AVIO_FLAG_WRITE) {
0 => Ok(Context::Output(context::Output::wrap(ps))),
@ -105,7 +105,7 @@ pub fn open_with<P: AsRef<Path>>(path: &P, format: &Format, options: Dictionary)
match format {
&Format::Input(ref format) => {
let res = avformat_open_input(&mut ps, path.as_ptr(), format.as_ptr(), &mut opts);
let res = avformat_open_input(&mut ps, path.as_ptr(), format.as_ptr() as *mut _, &mut opts);
Dictionary::own(opts);
@ -122,7 +122,7 @@ pub fn open_with<P: AsRef<Path>>(path: &P, format: &Format, options: Dictionary)
}
&Format::Output(ref format) => {
match avformat_alloc_output_context2(&mut ps, format.as_ptr(), ptr::null(), path.as_ptr()) {
match avformat_alloc_output_context2(&mut ps, format.as_ptr() as *mut _, ptr::null(), path.as_ptr()) {
0 => {
match avio_open(&mut (*ps).pb, path.as_ptr(), AVIO_FLAG_WRITE) {
0 => Ok(Context::Output(context::Output::wrap(ps))),