Skip to main content

ffmpeg_next/codec/
mod.rs

1pub mod flag;
2pub use self::flag::Flags;
3
4pub mod id;
5pub use self::id::Id;
6
7pub mod packet;
8
9pub mod subtitle;
10
11#[cfg(not(feature = "ffmpeg_5_0"))]
12pub mod picture;
13
14pub mod discard;
15
16pub mod context;
17pub use self::context::Context;
18
19pub mod capabilities;
20pub use self::capabilities::Capabilities;
21
22pub mod codec;
23
24pub mod parameters;
25pub use self::parameters::Parameters;
26
27pub mod video;
28pub use self::video::Video;
29
30pub mod audio;
31pub use self::audio::Audio;
32
33pub mod audio_service;
34pub mod field_order;
35
36pub mod compliance;
37pub use self::compliance::Compliance;
38
39pub mod debug;
40pub use self::debug::Debug;
41
42pub mod profile;
43pub use self::profile::Profile;
44
45pub mod threading;
46
47pub mod decoder;
48pub mod encoder;
49pub mod traits;
50
51use std::ffi::CStr;
52use std::str::from_utf8_unchecked;
53
54use crate::ffi::*;
55
56/// Query a codec's supported configuration list via `avcodec_get_supported_config`.
57#[cfg(feature = "ffmpeg_9_0")]
58pub(crate) unsafe fn supported_config<T>(codec: *const AVCodec, config: AVCodecConfig) -> *const T {
59    unsafe {
60        let mut out: *const T = std::ptr::null();
61        avcodec_get_supported_config(
62            std::ptr::null(),
63            codec,
64            config,
65            0,
66            (&mut out as *mut *const T).cast(),
67            std::ptr::null_mut(),
68        );
69        out
70    }
71}
72
73pub fn version() -> u32 {
74    unsafe { avcodec_version() }
75}
76
77pub fn configuration() -> &'static str {
78    unsafe { from_utf8_unchecked(CStr::from_ptr(avcodec_configuration()).to_bytes()) }
79}
80
81pub fn license() -> &'static str {
82    unsafe { from_utf8_unchecked(CStr::from_ptr(avcodec_license()).to_bytes()) }
83}