Skip to main content

ffmpeg_next/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
10pub mod stream_io;
11pub use self::stream_io::StreamIo;
12
13#[doc(hidden)]
14pub mod common;
15
16pub enum Context {
17    Input(Input),
18    Output(Output),
19}
20
21unsafe impl Send for Context {}
22
23impl Context {
24    pub fn is_input(&self) -> bool {
25        matches!(*self, Context::Input(..))
26    }
27
28    pub fn input(self) -> Input {
29        if let Context::Input(context) = self {
30            return context;
31        }
32
33        unreachable!();
34    }
35
36    pub fn is_output(&self) -> bool {
37        matches!(*self, Context::Output(..))
38    }
39
40    pub fn output(self) -> Output {
41        if let Context::Output(context) = self {
42            return context;
43        }
44
45        unreachable!();
46    }
47}