File tree Expand file tree Collapse file tree 5 files changed +15
-10
lines changed
Expand file tree Collapse file tree 5 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ mod plugin {
1515 const NAME : & str = "Example Plugin" ;
1616 const PLUGIN_VER : i32 = MakeVersion ! ( 1 , 0 ) ;
1717 const API_VER : i32 = ffi:: VAPOURSYNTH_API_VERSION ;
18- const FLAGS : i32 = PluginConfigFlags :: NONE . bits ( ) ;
18+ const FLAGS : PluginConfigFlags = PluginConfigFlags :: NONE ;
1919
2020 #[ vapoursynth_filter( video) ]
2121 #[ derive( Clone ) ]
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ fn generate_vs_plugin(input: ItemMod) -> syn::Result<proc_macro2::TokenStream> {
115115 name. as_ptr( ) ,
116116 plugin_version,
117117 api_version,
118- flags,
118+ flags. bits ( ) as i32 ,
119119 plugin
120120 ) ;
121121 // Register all filters in this plugin
Original file line number Diff line number Diff line change @@ -119,7 +119,6 @@ fn main() {
119119 . rustified_enum ( "VSTransferCharacteristics" )
120120 . bitfield_enum ( "VSCoreCreationFlags" )
121121 . bitfield_enum ( "VSPluginConfigFlags" )
122- . translate_enum_integer_types ( true )
123122 . use_core ( )
124123 . prepend_enum_name ( false )
125124 . derive_eq ( false )
Original file line number Diff line number Diff line change @@ -44,13 +44,19 @@ bitflags! {
4444 /// Options when creating a core.
4545 pub struct CoreCreationFlags : u32 {
4646 /// No flags.
47- const NONE = 0b00000000 ;
47+ const NONE = 0 ;
4848 /// Required to use the graph inspection api functions. Increases memory usage due to the extra information stored.
49- const ENABLE_GRAPH_INSPECTION = 0b00000001 ;
49+ const ENABLE_GRAPH_INSPECTION = ffi :: VSCoreCreationFlags :: ccfEnableGraphInspection . 0 ;
5050 /// Don’t autoload any user plugins. Core plugins are always loaded.
51- const DISABLE_AUTO_LOADING = 0b00000010 ;
51+ const DISABLE_AUTO_LOADING = ffi :: VSCoreCreationFlags :: ccfDisableAutoLoading . 0 ;
5252 /// Don’t unload plugin libraries when the core is destroyed. Due to a small amount of memory leaking every load and unload (windows feature, not my fault) of a library this may help in applications with extreme amount of script reloading.
53- const DISABLE_LIBRARY_UNLOADING = 0b00000100 ;
53+ const DISABLE_LIBRARY_UNLOADING = ffi:: VSCoreCreationFlags :: ccfDisableLibraryUnloading. 0 ;
54+ }
55+ }
56+
57+ impl CoreCreationFlags {
58+ pub const fn to_ffi ( & self ) -> ffi:: VSCoreCreationFlags {
59+ ffi:: VSCoreCreationFlags ( self . bits ( ) as _ )
5460 }
5561}
5662
Original file line number Diff line number Diff line change @@ -242,17 +242,17 @@ unsafe extern "C" fn public_function(
242242pub type PublicFunction = fn ( in_map : & MapRef < ' _ > , out_map : & mut MapRef < ' _ > , core : CoreRef ) ;
243243
244244bitflags ! {
245- pub struct PluginConfigFlags : i32 {
245+ pub struct PluginConfigFlags : u32 {
246246 /// Allow functions to be added to the plugin object after the plugin loading phase. Mostly useful for Avisynth compatibility and other foreign plugin loaders.
247- const MODIFIABLE = 1 ;
247+ const MODIFIABLE = ffi :: VSPluginConfigFlags :: pcModifiable . 0 as u32 ;
248248 const NONE = 0 ;
249249 }
250250}
251251
252252impl PluginConfigFlags {
253253 #[ must_use]
254254 pub const fn as_ffi ( & self ) -> ffi:: VSPluginConfigFlags {
255- VSPluginConfigFlags ( self . bits ( ) as u32 )
255+ VSPluginConfigFlags ( self . bits ( ) as _ )
256256 }
257257}
258258
You can’t perform that action at this time.
0 commit comments