Skip to main content

ff_sys/
constants.rs

1//! Global FFmpeg constants.
2
3/// Invalid PTS value (no presentation timestamp).
4///
5/// This constant indicates that a frame or packet does not have a valid
6/// presentation timestamp.
7pub const AV_NOPTS_VALUE: i64 = i64::MIN;
8
9/// `AVFMT_TS_DISCONT` — `AVInputFormat` flag indicating discontinuous timestamps.
10///
11/// Set for live/streaming formats such as HLS (live playlists), RTMP, RTSP,
12/// MPEG-TS (UDP/SRT), and similar sources. Used to detect live streams after
13/// `avformat_find_stream_info` has been called.
14pub const AVFMT_TS_DISCONT: i32 = 0x0200;
15
16/// `AVFMT_NOFILE` — `AVOutputFormat` flag indicating the muxer manages its own
17/// I/O and has no `AVIOContext` (`pb`) opened by the caller.
18///
19/// Set for muxers such as `image2` (image sequences), `hls`, `dash`, and similar
20/// segment/directory formats. When set, the caller must not `avio_open` a `pb`,
21/// and the owned [`OutputFormatContext`](crate::OutputFormatContext) must not
22/// close one on drop.
23pub const AVFMT_NOFILE: i32 = 0x0001;
24
25/// `AVFMT_FLAG_CUSTOM_IO`: the caller supplied the context's `pb`, so libavformat
26/// must not `avio_close()` it.
27///
28/// Hand-defined because bindgen's `AV_.*` variable allowlist does not match
29/// `AVFMT_`, the same reason [`AVFMT_NOFILE`] is defined here. The value is from
30/// `libavformat/avformat.h`.
31pub const AVFMT_FLAG_CUSTOM_IO: i32 = 0x0080;
32
33/// `AV_BUFFERSRC_FLAG_KEEP_REF` normalized to `i32` for cross-platform use.
34///
35/// bindgen generates `AV_BUFFERSRC_FLAG_KEEP_REF` as `u32` on Linux/macOS
36/// (pkg-config / Homebrew) but as `i32` on Windows (VCPKG). Use this constant
37/// instead of the raw bindgen symbol when calling `av_buffersrc_add_frame_flags`.
38///
39/// The cfg flag `ffmpeg_buffersrc_flag_u32` is emitted by the build script on
40/// platforms where the bindgen type is `u32` (Linux, macOS).
41#[cfg(ffmpeg_buffersrc_flag_u32)]
42pub const BUFFERSRC_FLAG_KEEP_REF: i32 = crate::AV_BUFFERSRC_FLAG_KEEP_REF as i32;
43#[cfg(not(ffmpeg_buffersrc_flag_u32))]
44pub const BUFFERSRC_FLAG_KEEP_REF: i32 = crate::AV_BUFFERSRC_FLAG_KEEP_REF;