diff --git a/src/lib.rs b/src/lib.rs index 2233e8f..91d89cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,7 @@ extern crate ffmpeg_sys as sys; pub use sys as ffi; +#[macro_use] pub mod util; pub use util::error::Error; pub use util::dictionary; diff --git a/src/util/dictionary/mod.rs b/src/util/dictionary/mod.rs index 60dec26..3c0e16a 100644 --- a/src/util/dictionary/mod.rs +++ b/src/util/dictionary/mod.rs @@ -9,3 +9,17 @@ pub use self::owned::Owned; mod iter; pub use self::iter::Iter; + +#[macro_export] +macro_rules! dict { + ( $($key:expr => $value:expr),* $(,)*) => ({ + let mut dict = ::ffmpeg::Dictionary::new(); + + $( + dict.set($key, $value); + )* + + dict + } + ); +} diff --git a/src/util/mod.rs b/src/util/mod.rs index db3b92c..252f51f 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -1,3 +1,4 @@ +#[macro_use] pub mod dictionary; pub mod error; pub mod rational;