ffmpeg_the_third/codec/encoder/
mod.rs1pub mod encoder;
2pub use self::encoder::Encoder;
3
4pub mod video;
5pub use self::video::Encoder as Video;
6
7pub mod audio;
8pub use self::audio::Encoder as Audio;
9
10pub mod subtitle;
11pub use self::subtitle::Encoder as Subtitle;
12
13pub mod motion_estimation;
14pub use self::motion_estimation::MotionEstimation;
15
16#[cfg(not(feature = "ffmpeg_5_0"))]
17pub mod prediction;
18#[cfg(not(feature = "ffmpeg_5_0"))]
19pub use self::prediction::Prediction;
20
21pub mod comparison;
22pub use self::comparison::Comparison;
23
24pub mod decision;
25pub use self::decision::Decision;
26
27use std::ffi::CString;
28
29use crate::codec::Context;
30use crate::codec::Id;
31use crate::ffi::*;
32use crate::Codec;
33
34pub fn new() -> Encoder {
35 Context::new().encoder()
36}
37
38pub fn find(id: Id) -> Option<Codec> {
39 unsafe {
40 let ptr = avcodec_find_encoder(id.into());
41 Codec::from_raw(ptr)
42 }
43}
44
45pub fn find_by_name(name: &str) -> Option<Codec> {
46 unsafe {
47 let name = CString::new(name).unwrap();
48 let ptr = avcodec_find_encoder_by_name(name.as_ptr());
49 Codec::from_raw(ptr)
50 }
51}