rustsynth/
lib.rs

1//! A safe wraper for [VapourSynth], written in Rust
2//!
3//! The primary goal is safety (that is, safe Rust code should not trigger undefined behavior), and secondary goals include performance and ease of use.
4//!
5//! [VapourSynth]: https://github.com/vapoursynth/vapoursynth
6#![feature(doc_cfg)]
7pub extern crate rustsynth_sys;
8pub use rustsynth_sys as ffi;
9
10#[cfg(feature = "proc-macro")]
11extern crate rustsynth_derive;
12#[doc(cfg(feature = "proc-macro"))]
13#[cfg(feature = "proc-macro")]
14pub use rustsynth_derive::*;
15
16mod api;
17pub mod core;
18pub mod filter;
19pub mod format;
20pub mod frame;
21pub mod function;
22pub mod log;
23pub mod map;
24pub mod node;
25pub mod plugin;
26#[cfg(feature = "vsscript-functions")]
27#[doc(cfg(feature = "vsscript-functions"))]
28pub mod vsscript;
29pub use api::init_api;
30
31pub mod prelude {
32    //! The VapourSynth prelude.
33    //!
34    //! Contains the types you most likely want to import anyway.
35    pub use super::{
36        core::{CoreCreationFlags, CoreRef},
37        filter::{Filter, FilterMode, RequestPattern},
38        format::{VideoFormat, VideoInfo},
39        frame::Frame,
40        node::Node,
41    };
42}
43
44pub fn api_version() -> i32 {
45    api::API::get().unwrap().version()
46}
47
48/// A simple macro to create an owned map
49///
50/// its syntax is `owned_map!({"key": value}, ... , {"key": value})`
51///
52/// # Example
53///
54/// ```
55/// use rustsynth::owned_map;
56/// let map = owned_map!({"int": &0});
57/// ```
58#[macro_export(local_inner_macros)]
59macro_rules! owned_map {
60    ($({$key:literal: $x:expr }),*) => {
61        {
62            let mut temp_map = $crate::map::OwnedMap::new();
63            $(
64                temp_map.set($key, $x).unwrap();
65            )*
66            temp_map
67        }
68    };
69}
70
71// Dev notes
72//
73// There is one API so if something is created or executed through the API then can get it once then use cached version everytime afterwards
74// so things that are at the front: Core, Ownedmaps
75//
76
77pub use ffi::version as MakeVersion;