Skip to content

Commit daee8d8

Browse files
committed
remove autogen tests for smaller gen ffi file
1 parent 4cc27d5 commit daee8d8

File tree

13 files changed

+131
-30
lines changed

13 files changed

+131
-30
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ffmpeg-dev"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
authors = ["colbyn <hello@colbyn.com>"]
55
edition = "2018"
66
keywords = ["video", "ffmpeg"]

build.rs

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -332,36 +332,68 @@ fn build() {
332332
skip_codegen = false;
333333
}
334334
// CONFIG
335-
let codegen = bindgen::Builder::default();
336-
let codegen = codegen.clang_arg(format!("-I{}", source_path.to_str().expect("PathBuf to str")));
337-
let mut missing = Vec::new();
338-
let codegen = ffmpeg_headers
339-
.iter()
340-
.fold(codegen, |codegen: bindgen::Builder, path: &&str| -> bindgen::Builder {
341-
let path: &str = path.clone();
342-
let path: PathBuf = source_path.join(path);
343-
let path: &str = path.to_str().expect("PathBuf to str");
344-
if !PathBuf::from(path).exists() {
345-
missing.push(String::from(path));
346-
codegen
347-
} else {
348-
codegen.header(path)
349-
}
350-
});
351-
if !missing.is_empty() {
352-
panic!("missing headers: {:#?}", missing);
335+
if !skip_codegen {
336+
let codegen = bindgen::Builder::default();
337+
let codegen = codegen.clang_arg(format!("-I{}", source_path.to_str().expect("PathBuf to str")));
338+
let mut missing = Vec::new();
339+
let codegen = ffmpeg_headers
340+
.iter()
341+
.fold(codegen, |codegen: bindgen::Builder, path: &&str| -> bindgen::Builder {
342+
let path: &str = path.clone();
343+
let path: PathBuf = source_path.join(path);
344+
let path: &str = path.to_str().expect("PathBuf to str");
345+
if !PathBuf::from(path).exists() {
346+
missing.push(String::from(path));
347+
codegen
348+
} else {
349+
codegen.header(path)
350+
}
351+
});
352+
if !missing.is_empty() {
353+
panic!("missing headers: {:#?}", missing);
354+
}
355+
// RUN
356+
codegen
357+
.parse_callbacks(Box::new(ignored_macros.clone()))
358+
.layout_tests(false)
359+
.rustfmt_bindings(true)
360+
.detect_include_paths(true)
361+
.generate_comments(true)
362+
.generate()
363+
.expect("Unable to generate bindings")
364+
.write_to_file(out_path.join(gen_file_name))
365+
.expect("Couldn't write bindings!");
353366
}
354-
// RUN
355-
codegen
356-
.parse_callbacks(Box::new(ignored_macros.clone()))
357-
.rustfmt_bindings(true)
358-
.detect_include_paths(true)
359-
.generate_comments(true)
360-
.generate()
361-
.expect("Unable to generate bindings")
362-
.write_to_file(out_path.join(gen_file_name))
363-
.expect("Couldn't write bindings!");
364367
}
368+
// DEV - TMP
369+
// {
370+
// let codegen = |file_name: &str, headers: &[&str]| {
371+
// let codegen = bindgen::Builder::default();
372+
// let codegen = headers
373+
// .iter()
374+
// .fold(codegen, |codegen: bindgen::Builder, path: &&str| -> bindgen::Builder {
375+
// let path: &str = path.clone();
376+
// let path: PathBuf = source_path.join(path);
377+
// let path: &str = path.to_str().expect("PathBuf to str");
378+
// assert!(PathBuf::from(path).exists());
379+
// codegen.header(path)
380+
// });
381+
// codegen
382+
// .layout_tests(false)
383+
// .generate_comments(true)
384+
// .generate()
385+
// .expect("Unable to generate bindings")
386+
// .write_to_file(out_path.join(file_name))
387+
// .expect("Couldn't write bindings!");
388+
// };
389+
// codegen("bindings_avcodec.rs", &["libavcodec/avcodec.h"]);
390+
// codegen("bindings_avdevice.rs", &["libavdevice/avdevice.h"]);
391+
// codegen("bindings_avfilter.rs", &["libavfilter/avfilter.h"]);
392+
// codegen("bindings_avformat.rs", &["libavformat/avformat.h"]);
393+
// codegen("bindings_avresample.rs", &["libavresample/avresample.h"]);
394+
// codegen("bindings_avutil.rs", &["libavutil/avutil.h"]);
395+
// codegen("bindings_swresample.rs", &["libswresample/swresample.h"]);
396+
// }
365397
}
366398

367399
///////////////////////////////////////////////////////////////////////////////

src/api.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![allow(unused)]
2+
#![allow(non_snake_case)]
3+
#![allow(non_upper_case_globals)]
4+
#![allow(non_camel_case_types)]
5+
#![allow(improper_ctypes)]
6+
#![allow(safe_packed_borrows)]
7+
//! Experimental, alternative FFI bindings.
8+
//!
9+
//! Experimenting with semi manual API bindings here, since it seems as though
10+
//! `ffmpeg_dev::sys` is too big for RLS. Or rather, because RLS sometimes
11+
//! really, really, really sucks.
12+
//!
13+
//! Notes:
14+
//! * **Be advised, exported API yet not stable. Prefer directly using symbols from the `ffmpeg_dev::sys` module over this one.**
15+
//! * Also note that this will be be incomplete.
16+
17+
// pub mod avcodec;
18+
// pub mod avdevice;
19+
// pub mod avfilter;
20+
// pub mod avformat;
21+
// pub mod avutil;
22+
// pub mod avresample;
23+
// pub mod swresample;
24+
// pub mod swscale;
25+

src/api/avcodec.rs

Whitespace-only changes.

src/api/avdevice.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![allow(unused)]
2+
#![allow(non_snake_case)]
3+
#![allow(non_upper_case_globals)]
4+
#![allow(non_camel_case_types)]
5+
#![allow(improper_ctypes)]
6+
#![allow(safe_packed_borrows)]

src/api/avfilter.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![allow(unused)]
2+
#![allow(non_snake_case)]
3+
#![allow(non_upper_case_globals)]
4+
#![allow(non_camel_case_types)]
5+
#![allow(improper_ctypes)]
6+
#![allow(safe_packed_borrows)]

src/api/avformat.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![allow(unused)]
2+
#![allow(non_snake_case)]
3+
#![allow(non_upper_case_globals)]
4+
#![allow(non_camel_case_types)]
5+
#![allow(improper_ctypes)]
6+
#![allow(safe_packed_borrows)]

src/api/avresample.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![allow(unused)]
2+
#![allow(non_snake_case)]
3+
#![allow(non_upper_case_globals)]
4+
#![allow(non_camel_case_types)]
5+
#![allow(improper_ctypes)]
6+
#![allow(safe_packed_borrows)]

src/api/avutil.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![allow(unused)]
2+
#![allow(non_snake_case)]
3+
#![allow(non_upper_case_globals)]
4+
#![allow(non_camel_case_types)]
5+
#![allow(improper_ctypes)]
6+
#![allow(safe_packed_borrows)]

src/api/swresample.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![allow(unused)]
2+
#![allow(non_snake_case)]
3+
#![allow(non_upper_case_globals)]
4+
#![allow(non_camel_case_types)]
5+
#![allow(improper_ctypes)]
6+
#![allow(safe_packed_borrows)]

0 commit comments

Comments
 (0)