ffmpeg_rs/format/context/
mod.rs

1pub mod destructor;
2pub use self::destructor::Destructor;
3
4pub mod input;
5pub use self::input::Input;
6
7pub mod output;
8pub use self::output::Output;
9
10#[doc(hidden)]
11pub mod common;
12
13pub enum Context {
14    Input(Input),
15    Output(Output),
16}
17
18unsafe impl Send for Context {}
19
20impl Context {
21    pub fn is_input(&self) -> bool {
22        matches!(*self, Context::Input(..))
23    }
24
25    pub fn input(self) -> Input {
26        if let Context::Input(context) = self {
27            return context;
28        }
29
30        unreachable!();
31    }
32
33    pub fn is_output(&self) -> bool {
34        matches!(*self, Context::Output(..))
35    }
36
37    pub fn output(self) -> Output {
38        if let Context::Output(context) = self {
39            return context;
40        }
41
42        unreachable!();
43    }
44}