Skip to content

Commit 22c266d

Browse files
committed
Refactor Node and Value Implementations; Enhance Plugin API
- Updated the `Node` struct to remove unnecessary lifetime parameters and associated implementations. - Refactored the `Value` and `ValueNotArray` traits to simplify their implementations for `Node`. - Introduced new methods in the `Node` struct for frame caching and retrieval. - Enhanced the `Plugin` API with new methods for configuration and function registration. - Added tests for the `ScriptAPI` to verify API version compatibility. - Updated the `Environment` methods to use `i32` for indices instead of `usize`. - Improved error handling and string conversions in plugin methods.
1 parent e4deaac commit 22c266d

28 files changed

Lines changed: 1230 additions & 586 deletions

File tree

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "rustsynth-sys/vapoursynth"]
22
path = rustsynth-sys/vapoursynth
3-
url = https://github.com/AmusementClub/vapoursynth-classic.git
3+
url = https://github.com/vapoursynth/vapoursynth.git

Cargo.lock

Lines changed: 124 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[workspace]
2+
resolver = "2"
23
members = ["rustsynth", "rustsynth-sys", "rustsynth-derive"]

rustsynth-derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repository = "https://github.com/animafps/rustsynth"
1313
proc-macro = true
1414

1515
[dependencies]
16-
syn = "1.0"
16+
syn = { version = "2.0", features = ["full"] }
1717
quote = "1.0"
1818
proc-macro2 = "1.0"
1919
rustsynth = { version = "=0.4.0", path = "../rustsynth" }

rustsynth-derive/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ fn impl_map_macro(ast: &syn::DeriveInput) -> TokenStream {
4747
/// # Example
4848
///
4949
/// ```
50+
/// use rustsynth_derive::init_plugins;
51+
/// use rustsynth::{core::{CoreRef,CoreCreationFlags},plugin::Plugin};
52+
///
53+
/// let mycore = CoreRef::new(CoreCreationFlags::NONE);
5054
/// init_plugins!();
5155
///
5256
/// let clip = Plugins::ffms2::Source(&mycore, "./demo.mp4".to_owned()).get_node("clip").unwrap();
@@ -57,7 +61,7 @@ pub fn init_plugins(_input: TokenStream) -> TokenStream {
5761
let plugins = core.plugins();
5862
let token_vec: Vec<proc_macro2::TokenStream> = plugins
5963
.map(|x| {
60-
let namespace = Ident::new(x.namespace().unwrap(), Span::call_site());
64+
let namespace = Ident::new(&x.namespace().unwrap(), Span::call_site());
6165
let func_vec: Vec<proc_macro2::TokenStream> = x
6266
.functions()
6367
.map(|y| {
@@ -120,7 +124,7 @@ fn parse_arguments(input: &Vec<Vec<&str>>) -> Vec<proc_macro2::TokenStream> {
120124
match x[1] {
121125
"vnode" => {
122126
quote! {
123-
#x0: rustsynth::node::Node<'core>
127+
#x0: rustsynth::node::Node
124128
}
125129
}
126130
"int" => {
@@ -146,4 +150,4 @@ fn parse_arguments(input: &Vec<Vec<&str>>) -> Vec<proc_macro2::TokenStream> {
146150
}
147151
})
148152
.collect()
149-
}
153+
}

rustsynth-sys/build.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ fn main() {
5151
// https://github.com/rust-lang/rust-bindgen/issues/550
5252
.blocklist_type("max_align_t")
5353
.blocklist_function("_.*")
54+
// Block duplicate floating-point classification constants
55+
.blocklist_item("FP_NAN")
56+
.blocklist_item("FP_INFINITE")
57+
.blocklist_item("FP_ZERO")
58+
.blocklist_item("FP_SUBNORMAL")
59+
.blocklist_item("FP_NORMAL")
60+
// Block long double math functions that use u128 (not FFI-safe)
61+
.blocklist_function("nexttoward.*")
62+
.blocklist_function(".*l$") // Functions ending in 'l' (long double variants)
63+
.blocklist_type(".*128.*") // Any types containing 128
5464
// Tell cargo to invalidate the built crate whenever any of the
5565
// included header files changed.
5666
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
@@ -77,7 +87,7 @@ fn main() {
7787
.bitfield_enum("VSCoreCreationFlags")
7888
.bitfield_enum("VSPluginConfigFlags")
7989
.prepend_enum_name(false)
80-
.derive_eq(true)
90+
.derive_eq(false)
8191
.size_t_is_usize(true)
8292
// Finish the builder and generate the bindings.
8393
.generate()

rustsynth-sys/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
1212

1313
macro_rules! version {
1414
($major:expr, $minor:expr) => {
15-
(($major) << 16) | ($minor)
15+
(($major) << 16) | ($minor)
1616
};
1717
}
1818

19-
pub const VAPOURSYNTH_API_VERSION: u32 = version!(VAPOURSYNTH_API_MAJOR, VAPOURSYNTH_API_MINOR);
20-
pub const VSSCRIPT_API_VERSION: u32 = version!(VSSCRIPT_API_MAJOR, VSSCRIPT_API_MINOR);
19+
pub const VAPOURSYNTH_API_VERSION: i32 = version!(VAPOURSYNTH_API_MAJOR as i32, VAPOURSYNTH_API_MINOR as i32);
20+
pub const VSSCRIPT_API_VERSION: i32 = version!(VSSCRIPT_API_MAJOR as i32, VSSCRIPT_API_MINOR as i32);

rustsynth-sys/vapoursynth

Submodule vapoursynth updated 107 files

rustsynth-sys/wrapper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
#include "vapoursynth/include/VapourSynth4.h"
2+
#include "vapoursynth/include/VSHelper4.h"
13
#include "vapoursynth/include/VSScript4.h"
24
#include "vapoursynth/include/VSConstants4.h"

rustsynth/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ rustsynth-sys = { version = "=0.4.0", path = "../rustsynth-sys" }
1414
thiserror = "1.0"
1515
bitflags = "1.3"
1616
half = { version = "2.0", optional = true }
17+
futures = "0.3.31"
1718

1819
[features]
1920
# Enable the half::f16 type to be used for frame pixel data.

0 commit comments

Comments
 (0)