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
44#[must_use]
45pub fn api_version() -> i32 {
46    api::API::get().unwrap().version()
47}
48
49/// A simple macro to create an owned map
50///
51/// its syntax is `owned_map!({"key": value}, ... , {"key": value})`
52///
53/// # Example
54///
55/// ```
56/// use rustsynth::owned_map;
57/// let map = owned_map!({"int": &0});
58/// ```
59#[macro_export(local_inner_macros)]
60macro_rules! owned_map {
61    ($({$key:literal: $x:expr }),*) => {
62        {
63            let mut temp_map = $crate::map::Map::new().unwrap();
64            $(
65                temp_map.set($key, $x).unwrap();
66            )*
67            temp_map
68        }
69    };
70}
71
72// Dev notes
73//
74// 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
75// so things that are at the front: Core, Ownedmaps
76//
77
78pub use ffi::version as MakeVersion;