Skip to main content

ff_sys/
docsrs_stubs.rs

1// Shape-compatible stubs used by docs.rs builds (DOCS_RS=1).
2//
3// These definitions mirror the real bindgen-generated FFmpeg bindings in type
4// and name, but contain no actual FFmpeg code.  All functions are no-op stubs
5// that never run; they exist only to make the dependent crates compile so that
6// rustdoc can render their public APIs.
7//
8// Maintenance note: add entries here whenever a new ff_sys symbol is referenced
9// in ff-probe, ff-decode, or ff-encode.  The values of integer constants are
10// taken from the FFmpeg 7.x headers for reference accuracy, but correctness at
11// runtime is irrelevant — docs.rs never executes this code.
12
13use std::os::raw::{c_char, c_int, c_uint, c_void};
14use std::ptr;
15
16// ── Type aliases ──────────────────────────────────────────────────────────────
17
18pub type AVCodecID = c_uint;
19pub type AVPixelFormat = c_int;
20pub type AVSampleFormat = c_int;
21pub type AVMediaType = c_int;
22pub type AVColorPrimaries = c_uint;
23pub type AVColorRange = c_uint;
24pub type AVColorSpace = c_uint;
25pub type AVHWDeviceType = c_int;
26pub type AVChannelOrder = c_uint;
27pub type AVPictureType = c_int;
28
29// ── Opaque types (only ever used behind raw pointers) ─────────────────────────
30
31pub struct AVDictionary(());
32pub struct SwsContext(());
33pub struct SwrContext(());
34pub struct AVBufferRef(());
35pub struct AVIOContext(());
36pub struct AVOutputFormat(());
37pub struct AVAudioFifo(());
38
39pub struct AVInputFormat {
40    pub name: *const c_char,
41    pub long_name: *const c_char,
42    pub flags: c_int,
43}
44
45// ── Structs with field-level access ───────────────────────────────────────────
46
47#[derive(Copy, Clone)]
48#[repr(C)]
49pub union AVChannelLayout__bindgen_ty_1 {
50    pub mask: u64,
51}
52
53impl Default for AVChannelLayout__bindgen_ty_1 {
54    fn default() -> Self {
55        Self { mask: 0 }
56    }
57}
58
59#[derive(Copy, Clone)]
60pub struct AVChannelLayout {
61    pub order: AVChannelOrder,
62    pub nb_channels: c_int,
63    pub u: AVChannelLayout__bindgen_ty_1,
64}
65
66impl Default for AVChannelLayout {
67    fn default() -> Self {
68        Self {
69            order: 0,
70            nb_channels: 0,
71            u: AVChannelLayout__bindgen_ty_1::default(),
72        }
73    }
74}
75
76#[derive(Copy, Clone)]
77pub struct AVRational {
78    pub num: c_int,
79    pub den: c_int,
80}
81
82pub struct AVDictionaryEntry {
83    pub key: *mut c_char,
84    pub value: *mut c_char,
85}
86
87pub struct AVChapter {
88    pub id: i64,
89    pub time_base: AVRational,
90    pub start: i64,
91    pub end: i64,
92    pub metadata: *mut AVDictionary,
93}
94
95pub struct AVCodecParameters {
96    pub codec_type: AVMediaType,
97    pub codec_id: AVCodecID,
98    pub codec_tag: c_uint,
99    pub extradata: *mut u8,
100    pub extradata_size: c_int,
101    pub format: c_int,
102    pub bit_rate: i64,
103    pub width: c_int,
104    pub height: c_int,
105    pub sample_rate: c_int,
106    pub ch_layout: AVChannelLayout,
107    pub sample_fmt: AVSampleFormat,
108    pub color_space: AVColorSpace,
109    pub color_range: AVColorRange,
110    pub color_primaries: AVColorPrimaries,
111}
112
113pub struct AVStream {
114    pub codecpar: *mut AVCodecParameters,
115    pub nb_frames: i64,
116    pub duration: i64,
117    pub time_base: AVRational,
118    pub avg_frame_rate: AVRational,
119    pub r_frame_rate: AVRational,
120    pub start_time: i64,
121    pub disposition: c_int,
122    pub metadata: *mut AVDictionary,
123}
124
125pub struct AVFormatContext {
126    pub nb_streams: c_uint,
127    pub streams: *mut *mut AVStream,
128    pub duration: i64,
129    pub metadata: *mut AVDictionary,
130    pub nb_chapters: c_uint,
131    pub chapters: *mut *mut AVChapter,
132    pub iformat: *mut AVInputFormat,
133    pub bit_rate: i64,
134    pub pb: *mut AVIOContext,
135    pub priv_data: *mut c_void,
136}
137
138pub struct AVFrame {
139    pub data: [*mut u8; 8],
140    pub linesize: [c_int; 8],
141    pub width: c_int,
142    pub height: c_int,
143    pub nb_samples: c_int,
144    pub format: c_int,
145    pub key_frame: c_int,
146    pub pict_type: AVPictureType,
147    pub pts: i64,
148    pub pkt_dts: i64,
149    pub sample_rate: c_int,
150    pub ch_layout: AVChannelLayout,
151    pub duration: i64,
152    pub time_base: AVRational,
153    pub hw_frames_ctx: *mut AVBufferRef,
154}
155
156pub struct AVPacket {
157    pub pts: i64,
158    pub dts: i64,
159    pub data: *mut u8,
160    pub size: c_int,
161    pub stream_index: c_int,
162    pub flags: c_int,
163    pub duration: i64,
164}
165
166pub type AVColorTransferCharacteristic = c_uint;
167
168pub struct AVCodecContext {
169    pub codec_id: AVCodecID,
170    pub bit_rate: i64,
171    pub width: c_int,
172    pub height: c_int,
173    pub pix_fmt: AVPixelFormat,
174    pub sample_rate: c_int,
175    pub ch_layout: AVChannelLayout,
176    pub sample_fmt: AVSampleFormat,
177    pub time_base: AVRational,
178    pub framerate: AVRational,
179    pub gop_size: c_int,
180    pub max_b_frames: c_int,
181    pub qmin: c_int,
182    pub qmax: c_int,
183    pub thread_count: c_int,
184    pub hw_device_ctx: *mut AVBufferRef,
185    pub hw_frames_ctx: *mut AVBufferRef,
186    pub priv_data: *mut c_void,
187    pub color_primaries: AVColorPrimaries,
188    pub color_trc: AVColorTransferCharacteristic,
189    pub colorspace: AVColorSpace,
190    // Fields added for v0.7.0 feature coverage
191    pub frame_size: c_int,
192    pub color_range: AVColorRange,
193    pub refs: c_int,
194    pub rc_max_rate: i64,
195    pub rc_buffer_size: c_int,
196    pub flags: c_int,
197    pub stats_out: *mut c_char,
198    pub stats_in: *mut c_char,
199}
200
201pub struct AVCodec {
202    pub sample_fmts: *const AVSampleFormat,
203    pub capabilities: c_int,
204}
205
206// ── Constants ─────────────────────────────────────────────────────────────────
207
208pub const AV_DICT_IGNORE_SUFFIX: u32 = 2;
209pub const AV_NUM_DATA_POINTERS: usize = 8;
210pub const AV_TIME_BASE: u32 = 1_000_000;
211
212pub const AVMediaType_AVMEDIA_TYPE_VIDEO: AVMediaType = 0;
213pub const AVMediaType_AVMEDIA_TYPE_AUDIO: AVMediaType = 1;
214pub const AVMediaType_AVMEDIA_TYPE_SUBTITLE: AVMediaType = 3;
215pub const AVMediaType_AVMEDIA_TYPE_ATTACHMENT: AVMediaType = 4;
216
217pub const AV_DISPOSITION_FORCED: u32 = 0x0040;
218pub const AV_DISPOSITION_ATTACHED_PIC: u32 = 0x0400;
219pub const AV_INPUT_BUFFER_PADDING_SIZE: u32 = 64;
220
221pub const AVChannelOrder_AV_CHANNEL_ORDER_UNSPEC: AVChannelOrder = 0;
222pub const AVChannelOrder_AV_CHANNEL_ORDER_NATIVE: AVChannelOrder = 1;
223
224// AVCodecID — video
225pub const AVCodecID_AV_CODEC_ID_NONE: AVCodecID = 0;
226pub const AVCodecID_AV_CODEC_ID_MPEG2VIDEO: AVCodecID = 2;
227pub const AVCodecID_AV_CODEC_ID_MJPEG: AVCodecID = 7;
228pub const AVCodecID_AV_CODEC_ID_MPEG4: AVCodecID = 13;
229pub const AVCodecID_AV_CODEC_ID_H264: AVCodecID = 27;
230pub const AVCodecID_AV_CODEC_ID_THEORA: AVCodecID = 30;
231pub const AVCodecID_AV_CODEC_ID_VP8: AVCodecID = 139;
232pub const AVCodecID_AV_CODEC_ID_PRORES: AVCodecID = 147;
233pub const AVCodecID_AV_CODEC_ID_VP9: AVCodecID = 167;
234pub const AVCodecID_AV_CODEC_ID_HEVC: AVCodecID = 173;
235pub const AVCodecID_AV_CODEC_ID_AV1: AVCodecID = 226;
236pub const AVCodecID_AV_CODEC_ID_DNXHD: AVCodecID = 99;
237
238// AVCodecID — image (still image)
239pub const AVCodecID_AV_CODEC_ID_PNG: AVCodecID = 61;
240pub const AVCodecID_AV_CODEC_ID_BMP: AVCodecID = 76;
241pub const AVCodecID_AV_CODEC_ID_TIFF: AVCodecID = 90;
242pub const AVCodecID_AV_CODEC_ID_WEBP: AVCodecID = 219;
243pub const AVCodecID_AV_CODEC_ID_EXR: AVCodecID = 178;
244
245// AVCodecID — subtitle
246pub const AVCodecID_AV_CODEC_ID_DVB_SUBTITLE: AVCodecID = 94209;
247pub const AVCodecID_AV_CODEC_ID_SSA: AVCodecID = 94212;
248pub const AVCodecID_AV_CODEC_ID_HDMV_PGS_SUBTITLE: AVCodecID = 94214;
249pub const AVCodecID_AV_CODEC_ID_SRT: AVCodecID = 94216;
250pub const AVCodecID_AV_CODEC_ID_SUBRIP: AVCodecID = 94248;
251pub const AVCodecID_AV_CODEC_ID_WEBVTT: AVCodecID = 94249;
252pub const AVCodecID_AV_CODEC_ID_ASS: AVCodecID = 94253;
253
254// AVCodecID — attachment / data
255pub const AVCodecID_AV_CODEC_ID_BIN_DATA: AVCodecID = 98314;
256
257// AVCodecID — audio
258pub const AVCodecID_AV_CODEC_ID_PCM_S16LE: AVCodecID = 65536;
259pub const AVCodecID_AV_CODEC_ID_PCM_S16BE: AVCodecID = 65537;
260pub const AVCodecID_AV_CODEC_ID_PCM_U8: AVCodecID = 65542;
261pub const AVCodecID_AV_CODEC_ID_PCM_S24LE: AVCodecID = 65544;
262pub const AVCodecID_AV_CODEC_ID_PCM_S24BE: AVCodecID = 65545;
263pub const AVCodecID_AV_CODEC_ID_PCM_S32LE: AVCodecID = 65556;
264pub const AVCodecID_AV_CODEC_ID_PCM_S32BE: AVCodecID = 65557;
265pub const AVCodecID_AV_CODEC_ID_PCM_F32LE: AVCodecID = 65558;
266pub const AVCodecID_AV_CODEC_ID_PCM_F32BE: AVCodecID = 65559;
267pub const AVCodecID_AV_CODEC_ID_PCM_F64LE: AVCodecID = 65560;
268pub const AVCodecID_AV_CODEC_ID_PCM_F64BE: AVCodecID = 65561;
269pub const AVCodecID_AV_CODEC_ID_MP3: AVCodecID = 86017;
270pub const AVCodecID_AV_CODEC_ID_AAC: AVCodecID = 86018;
271pub const AVCodecID_AV_CODEC_ID_AC3: AVCodecID = 86019;
272pub const AVCodecID_AV_CODEC_ID_DTS: AVCodecID = 86020;
273pub const AVCodecID_AV_CODEC_ID_VORBIS: AVCodecID = 86021;
274pub const AVCodecID_AV_CODEC_ID_FLAC: AVCodecID = 86028;
275pub const AVCodecID_AV_CODEC_ID_ALAC: AVCodecID = 86032;
276pub const AVCodecID_AV_CODEC_ID_WMAV2: AVCodecID = 86047;
277pub const AVCodecID_AV_CODEC_ID_EAC3: AVCodecID = 86056;
278pub const AVCodecID_AV_CODEC_ID_OPUS: AVCodecID = 86076;
279
280// AVPixelFormat
281pub const AVPixelFormat_AV_PIX_FMT_NONE: AVPixelFormat = -1;
282pub const AVPixelFormat_AV_PIX_FMT_YUV420P: AVPixelFormat = 0;
283pub const AVPixelFormat_AV_PIX_FMT_RGB24: AVPixelFormat = 2;
284pub const AVPixelFormat_AV_PIX_FMT_BGR24: AVPixelFormat = 3;
285pub const AVPixelFormat_AV_PIX_FMT_YUV422P: AVPixelFormat = 4;
286pub const AVPixelFormat_AV_PIX_FMT_YUV444P: AVPixelFormat = 5;
287pub const AVPixelFormat_AV_PIX_FMT_GRAY8: AVPixelFormat = 8;
288pub const AVPixelFormat_AV_PIX_FMT_PAL8: AVPixelFormat = 77;
289pub const AVPixelFormat_AV_PIX_FMT_NV12: AVPixelFormat = 23;
290pub const AVPixelFormat_AV_PIX_FMT_NV21: AVPixelFormat = 24;
291pub const AVPixelFormat_AV_PIX_FMT_RGBA: AVPixelFormat = 26;
292pub const AVPixelFormat_AV_PIX_FMT_BGRA: AVPixelFormat = 28;
293pub const AVPixelFormat_AV_PIX_FMT_YUVJ420P: AVPixelFormat = 12;
294pub const AVPixelFormat_AV_PIX_FMT_YUVJ422P: AVPixelFormat = 13;
295pub const AVPixelFormat_AV_PIX_FMT_YUVJ444P: AVPixelFormat = 14;
296pub const AVPixelFormat_AV_PIX_FMT_VAAPI: AVPixelFormat = 51;
297pub const AVPixelFormat_AV_PIX_FMT_DXVA2_VLD: AVPixelFormat = 53;
298pub const AV_OPT_SEARCH_CHILDREN: u32 = 1;
299pub const AVPixelFormat_AV_PIX_FMT_YUV420P10LE: AVPixelFormat = 66;
300pub const AVPixelFormat_AV_PIX_FMT_YUV422P10LE: AVPixelFormat = 64;
301pub const AVPixelFormat_AV_PIX_FMT_YUV444P10LE: AVPixelFormat = 68;
302pub const AVPixelFormat_AV_PIX_FMT_YUVA444P10LE: AVPixelFormat = 91;
303pub const AVPixelFormat_AV_PIX_FMT_VDPAU: AVPixelFormat = 101;
304pub const AVPixelFormat_AV_PIX_FMT_CUDA: AVPixelFormat = 119;
305pub const AVPixelFormat_AV_PIX_FMT_QSV: AVPixelFormat = 123;
306pub const AVPixelFormat_AV_PIX_FMT_VIDEOTOOLBOX: AVPixelFormat = 135;
307pub const AVPixelFormat_AV_PIX_FMT_MEDIACODEC: AVPixelFormat = 165;
308pub const AVPixelFormat_AV_PIX_FMT_P010LE: AVPixelFormat = 161;
309pub const AVPixelFormat_AV_PIX_FMT_GBRPF32LE: AVPixelFormat = 175;
310pub const AVPixelFormat_AV_PIX_FMT_D3D11: AVPixelFormat = 174;
311pub const AVPixelFormat_AV_PIX_FMT_OPENCL: AVPixelFormat = 180;
312pub const AVPixelFormat_AV_PIX_FMT_VULKAN: AVPixelFormat = 193;
313
314// AVSampleFormat
315pub const AVSampleFormat_AV_SAMPLE_FMT_NONE: AVSampleFormat = -1;
316pub const AVSampleFormat_AV_SAMPLE_FMT_U8: AVSampleFormat = 0;
317pub const AVSampleFormat_AV_SAMPLE_FMT_S16: AVSampleFormat = 1;
318pub const AVSampleFormat_AV_SAMPLE_FMT_S32: AVSampleFormat = 2;
319pub const AVSampleFormat_AV_SAMPLE_FMT_FLT: AVSampleFormat = 3;
320pub const AVSampleFormat_AV_SAMPLE_FMT_DBL: AVSampleFormat = 4;
321pub const AVSampleFormat_AV_SAMPLE_FMT_U8P: AVSampleFormat = 5;
322pub const AVSampleFormat_AV_SAMPLE_FMT_S16P: AVSampleFormat = 6;
323pub const AVSampleFormat_AV_SAMPLE_FMT_S32P: AVSampleFormat = 7;
324pub const AVSampleFormat_AV_SAMPLE_FMT_FLTP: AVSampleFormat = 8;
325pub const AVSampleFormat_AV_SAMPLE_FMT_DBLP: AVSampleFormat = 9;
326pub const AVSampleFormat_AV_SAMPLE_FMT_S64: AVSampleFormat = 10;
327pub const AVSampleFormat_AV_SAMPLE_FMT_S64P: AVSampleFormat = 11;
328
329// AVColorPrimaries
330pub const AVColorPrimaries_AVCOL_PRI_BT709: AVColorPrimaries = 1;
331pub const AVColorPrimaries_AVCOL_PRI_UNSPECIFIED: AVColorPrimaries = 2;
332pub const AVColorPrimaries_AVCOL_PRI_BT470BG: AVColorPrimaries = 5;
333pub const AVColorPrimaries_AVCOL_PRI_SMPTE170M: AVColorPrimaries = 6;
334pub const AVColorPrimaries_AVCOL_PRI_BT2020: AVColorPrimaries = 9;
335
336// AVColorRange
337pub const AVColorRange_AVCOL_RANGE_UNSPECIFIED: AVColorRange = 0;
338pub const AVColorRange_AVCOL_RANGE_MPEG: AVColorRange = 1;
339pub const AVColorRange_AVCOL_RANGE_JPEG: AVColorRange = 2;
340
341// AVColorSpace
342pub const AVColorSpace_AVCOL_SPC_RGB: AVColorSpace = 0;
343pub const AVColorSpace_AVCOL_SPC_BT709: AVColorSpace = 1;
344pub const AVColorSpace_AVCOL_SPC_UNSPECIFIED: AVColorSpace = 2;
345pub const AVColorSpace_AVCOL_SPC_BT470BG: AVColorSpace = 5;
346pub const AVColorSpace_AVCOL_SPC_SMPTE170M: AVColorSpace = 6;
347pub const AVColorSpace_AVCOL_SPC_BT2020_NCL: AVColorSpace = 9;
348pub const AVColorSpace_AVCOL_SPC_BT2020_CL: AVColorSpace = 10;
349
350// AVColorTransferCharacteristic
351pub const AVColorTransferCharacteristic_AVCOL_TRC_BT709: AVColorTransferCharacteristic = 1;
352pub const AVColorTransferCharacteristic_AVCOL_TRC_UNSPECIFIED: AVColorTransferCharacteristic = 2;
353pub const AVColorTransferCharacteristic_AVCOL_TRC_LINEAR: AVColorTransferCharacteristic = 8;
354pub const AVColorTransferCharacteristic_AVCOL_TRC_BT2020_10: AVColorTransferCharacteristic = 14;
355pub const AVColorTransferCharacteristic_AVCOL_TRC_BT2020_12: AVColorTransferCharacteristic = 15;
356pub const AVColorTransferCharacteristic_AVCOL_TRC_SMPTEST2084: AVColorTransferCharacteristic = 16;
357pub const AVColorTransferCharacteristic_AVCOL_TRC_ARIB_STD_B67: AVColorTransferCharacteristic = 18;
358
359// AVPacketSideDataType
360pub type AVPacketSideDataType = c_uint;
361pub const AVPacketSideDataType_AV_PKT_DATA_MASTERING_DISPLAY_METADATA: AVPacketSideDataType = 20;
362pub const AVPacketSideDataType_AV_PKT_DATA_CONTENT_LIGHT_LEVEL: AVPacketSideDataType = 22;
363
364// AVHWDeviceType
365pub const AVHWDeviceType_AV_HWDEVICE_TYPE_CUDA: AVHWDeviceType = 2;
366pub const AVHWDeviceType_AV_HWDEVICE_TYPE_VAAPI: AVHWDeviceType = 4;
367pub const AVHWDeviceType_AV_HWDEVICE_TYPE_QSV: AVHWDeviceType = 5;
368pub const AVHWDeviceType_AV_HWDEVICE_TYPE_VIDEOTOOLBOX: AVHWDeviceType = 7;
369pub const AVHWDeviceType_AV_HWDEVICE_TYPE_D3D11VA: AVHWDeviceType = 8;
370
371// AVPictureType constants
372pub const AVPictureType_AV_PICTURE_TYPE_NONE: AVPictureType = 0;
373pub const AVPictureType_AV_PICTURE_TYPE_I: AVPictureType = 1;
374
375// ── Raw FFmpeg functions (bindgen-generated counterparts) ─────────────────────
376//
377// These mirror what bindgen would emit from the real FFmpeg headers.
378// All bodies are stubs; the code is compiled but never executed on docs.rs.
379
380// SAFETY: docs.rs stubs — never called at runtime.
381pub unsafe fn av_strerror(_errnum: c_int, _errbuf: *mut c_char, _errbuf_size: usize) -> c_int {
382    0
383}
384
385pub unsafe fn av_dict_get(
386    _m: *const AVDictionary,
387    _key: *const c_char,
388    _prev: *const AVDictionaryEntry,
389    _flags: c_int,
390) -> *mut AVDictionaryEntry {
391    std::ptr::null_mut()
392}
393
394pub unsafe fn av_dict_set(
395    _pm: *mut *mut AVDictionary,
396    _key: *const c_char,
397    _value: *const c_char,
398    _flags: c_int,
399) -> c_int {
400    0
401}
402
403pub unsafe fn av_dict_free(_m: *mut *mut AVDictionary) {}
404
405pub unsafe fn av_find_input_format(_short_name: *const c_char) -> *const AVInputFormat {
406    std::ptr::null()
407}
408
409pub unsafe fn avcodec_get_name(_id: AVCodecID) -> *const c_char {
410    std::ptr::null()
411}
412
413pub unsafe fn av_frame_alloc() -> *mut AVFrame {
414    std::ptr::null_mut()
415}
416
417pub unsafe fn av_frame_free(_frame: *mut *mut AVFrame) {}
418
419pub unsafe fn av_frame_get_buffer(_frame: *mut AVFrame, _align: c_int) -> c_int {
420    0
421}
422
423pub unsafe fn av_frame_move_ref(_dst: *mut AVFrame, _src: *mut AVFrame) {}
424
425pub unsafe fn av_frame_unref(_frame: *mut AVFrame) {}
426
427pub unsafe fn av_packet_alloc() -> *mut AVPacket {
428    std::ptr::null_mut()
429}
430
431pub unsafe fn av_packet_free(_pkt: *mut *mut AVPacket) {}
432
433pub unsafe fn av_packet_unref(_pkt: *mut AVPacket) {}
434
435pub unsafe fn av_packet_new_side_data(
436    _pkt: *mut AVPacket,
437    _type_: AVPacketSideDataType,
438    _size: usize,
439) -> *mut u8 {
440    std::ptr::null_mut()
441}
442
443pub unsafe fn av_buffer_ref(_buf: *mut AVBufferRef) -> *mut AVBufferRef {
444    std::ptr::null_mut()
445}
446
447pub unsafe fn av_buffer_unref(_buf: *mut *mut AVBufferRef) {}
448
449pub unsafe fn av_hwdevice_ctx_create(
450    _device_ctx: *mut *mut AVBufferRef,
451    _type_: AVHWDeviceType,
452    _device: *const c_char,
453    _opts: *mut AVDictionary,
454    _flags: c_int,
455) -> c_int {
456    -1
457}
458
459pub unsafe fn av_hwframe_transfer_data(
460    _dst: *mut AVFrame,
461    _src: *const AVFrame,
462    _flags: c_int,
463) -> c_int {
464    -1
465}
466
467pub unsafe fn av_opt_set(
468    _obj: *mut c_void,
469    _name: *const c_char,
470    _val: *const c_char,
471    _search_flags: c_int,
472) -> c_int {
473    0
474}
475
476pub unsafe fn av_read_frame(_s: *mut AVFormatContext, _pkt: *mut AVPacket) -> c_int {
477    -1
478}
479
480pub unsafe fn av_write_trailer(_s: *mut AVFormatContext) -> c_int {
481    0
482}
483
484pub unsafe fn av_interleaved_write_frame(
485    _s: *mut AVFormatContext,
486    _pkt: *mut AVPacket,
487) -> c_int {
488    0
489}
490
491pub unsafe fn avcodec_receive_frame(_avctx: *mut AVCodecContext, _frame: *mut AVFrame) -> c_int {
492    -1
493}
494
495pub unsafe fn avcodec_send_packet(
496    _avctx: *mut AVCodecContext,
497    _avpkt: *const AVPacket,
498) -> c_int {
499    -1
500}
501
502pub unsafe fn avformat_alloc_output_context2(
503    _ctx: *mut *mut AVFormatContext,
504    _oformat: *mut AVOutputFormat,
505    _format_name: *const c_char,
506    _filename: *const c_char,
507) -> c_int {
508    -1
509}
510
511pub unsafe fn avformat_free_context(_s: *mut AVFormatContext) {}
512
513pub unsafe fn avformat_new_stream(
514    _s: *mut AVFormatContext,
515    _c: *const AVCodec,
516) -> *mut AVStream {
517    std::ptr::null_mut()
518}
519
520pub unsafe fn avformat_write_header(
521    _s: *mut AVFormatContext,
522    _options: *mut *mut AVDictionary,
523) -> c_int {
524    -1
525}
526
527pub unsafe fn swr_alloc_set_opts2(
528    _ps: *mut *mut SwrContext,
529    _out_ch_layout: *const AVChannelLayout,
530    _out_sample_fmt: AVSampleFormat,
531    _out_sample_rate: c_int,
532    _in_ch_layout: *const AVChannelLayout,
533    _in_sample_fmt: AVSampleFormat,
534    _in_sample_rate: c_int,
535    _log_offset: c_int,
536    _log_ctx: *mut c_void,
537) -> c_int {
538    -1
539}
540
541pub unsafe fn swr_convert(
542    _s: *mut SwrContext,
543    _out: *mut *mut u8,
544    _out_count: c_int,
545    _in_: *const *const u8,
546    _in_count: c_int,
547) -> c_int {
548    -1
549}
550
551pub unsafe fn swr_free(_s: *mut *mut SwrContext) {}
552
553pub unsafe fn swr_get_out_samples(_s: *mut SwrContext, _in_samples: c_int) -> c_int {
554    0
555}
556
557pub unsafe fn swr_init(_s: *mut SwrContext) -> c_int {
558    -1
559}
560
561pub unsafe fn av_channel_layout_default(_ch_layout: *mut AVChannelLayout, _nb_channels: c_int) {}
562
563pub unsafe fn av_channel_layout_uninit(_ch_layout: *mut AVChannelLayout) {}
564
565pub unsafe fn av_rescale_q(_a: i64, _bq: AVRational, _cq: AVRational) -> i64 {
566    0
567}
568
569pub unsafe fn av_mallocz(_size: usize) -> *mut c_void {
570    std::ptr::null_mut()
571}
572
573pub unsafe fn av_malloc(_size: usize) -> *mut c_void {
574    std::ptr::null_mut()
575}
576
577pub unsafe fn av_free(_ptr: *mut c_void) {}
578
579pub unsafe fn av_new_packet(_pkt: *mut AVPacket, _size: c_int) -> c_int {
580    -1
581}
582
583pub unsafe fn avcodec_parameters_copy(
584    _dst: *mut AVCodecParameters,
585    _src: *const AVCodecParameters,
586) -> c_int {
587    0
588}
589
590pub unsafe fn av_packet_rescale_ts(
591    _pkt: *mut AVPacket,
592    _tb_src: AVRational,
593    _tb_dst: AVRational,
594) {
595}
596
597// ── Wrapper module stubs ──────────────────────────────────────────────────────
598//
599// These mirror the safe wrapper modules in avformat.rs, avcodec.rs,
600// swresample.rs, and swscale.rs.  Signatures must exactly match those files.
601
602// ── libavfilter opaque types ──────────────────────────────────────────────────
603
604pub struct AVFilterGraph(());
605pub struct AVFilter(());
606
607pub struct AVFilterContext {
608    pub hw_device_ctx: *mut AVBufferRef,
609}
610
611// ── libavfilter constants ─────────────────────────────────────────────────────
612
613/// Flag for `av_buffersrc_add_frame_flags`: keep a reference to the frame.
614pub const AV_BUFFERSRC_FLAG_KEEP_REF: c_int = 8;
615
616// ── libavfilter functions ─────────────────────────────────────────────────────
617
618// SAFETY: docs.rs stubs — never called at runtime.
619
620pub unsafe fn avfilter_graph_alloc() -> *mut AVFilterGraph {
621    ptr::null_mut()
622}
623
624pub unsafe fn avfilter_graph_free(_graph: *mut *mut AVFilterGraph) {}
625
626pub unsafe fn avfilter_get_by_name(_name: *const c_char) -> *const AVFilter {
627    ptr::null()
628}
629
630pub unsafe fn avfilter_graph_create_filter(
631    _filt_ctx: *mut *mut AVFilterContext,
632    _filt: *const AVFilter,
633    _name: *const c_char,
634    _args: *const c_char,
635    _opaque: *mut c_void,
636    _graph_ctx: *mut AVFilterGraph,
637) -> c_int {
638    0
639}
640
641pub unsafe fn avfilter_link(
642    _src: *mut AVFilterContext,
643    _srcpad: c_uint,
644    _dst: *mut AVFilterContext,
645    _dstpad: c_uint,
646) -> c_int {
647    0
648}
649
650pub unsafe fn avfilter_graph_config(
651    _graphctx: *mut AVFilterGraph,
652    _log_ctx: *mut c_void,
653) -> c_int {
654    0
655}
656
657pub unsafe fn avfilter_graph_set_auto_convert(_graph: *mut AVFilterGraph, _flags: c_uint) {}
658
659pub unsafe fn av_buffersrc_add_frame_flags(
660    _ctx: *mut AVFilterContext,
661    _frame: *mut AVFrame,
662    _flags: c_int,
663) -> c_int {
664    0
665}
666
667pub unsafe fn av_buffersink_get_frame(
668    _ctx: *mut AVFilterContext,
669    _frame: *mut AVFrame,
670) -> c_int {
671    // Return EAGAIN to signal no frame available
672    -11
673}
674
675/// Stub `avformat` wrapper module.
676pub mod avformat {
677    use std::os::raw::c_int;
678    use std::path::Path;
679
680    use super::{AVFormatContext, AVIOContext, AVPacket};
681
682    pub fn srt_available() -> bool {
683        false
684    }
685
686    pub unsafe fn open_input(_path: &Path) -> Result<*mut AVFormatContext, c_int> {
687        Err(-1)
688    }
689
690    pub unsafe fn open_input_url(
691        _url: &str,
692        _connect_timeout: std::time::Duration,
693        _read_timeout: std::time::Duration,
694    ) -> Result<*mut AVFormatContext, c_int> {
695        Err(-1)
696    }
697
698    pub unsafe fn open_input_image_sequence(
699        _path: &Path,
700        _framerate: u32,
701    ) -> Result<*mut AVFormatContext, c_int> {
702        Err(-1)
703    }
704
705    pub unsafe fn close_input(_ctx: *mut *mut AVFormatContext) {}
706
707    pub unsafe fn find_stream_info(_ctx: *mut AVFormatContext) -> Result<(), c_int> {
708        Err(-1)
709    }
710
711    pub unsafe fn seek_frame(
712        _ctx: *mut AVFormatContext,
713        _stream_index: c_int,
714        _timestamp: i64,
715        _flags: c_int,
716    ) -> Result<(), c_int> {
717        Err(-1)
718    }
719
720    pub unsafe fn seek_file(
721        _ctx: *mut AVFormatContext,
722        _stream_index: c_int,
723        _min_ts: i64,
724        _ts: i64,
725        _max_ts: i64,
726        _flags: c_int,
727    ) -> Result<(), c_int> {
728        Err(-1)
729    }
730
731    pub unsafe fn read_frame(
732        _ctx: *mut AVFormatContext,
733        _pkt: *mut AVPacket,
734    ) -> Result<(), c_int> {
735        Err(-1)
736    }
737
738    pub unsafe fn write_frame(
739        _ctx: *mut AVFormatContext,
740        _pkt: *mut AVPacket,
741    ) -> Result<(), c_int> {
742        Err(-1)
743    }
744
745    pub unsafe fn open_output(_path: &Path, _flags: c_int) -> Result<*mut AVIOContext, c_int> {
746        Err(-1)
747    }
748
749    pub unsafe fn close_output(_pb: *mut *mut AVIOContext) {}
750
751    pub mod avio_flags {
752        use std::os::raw::c_int;
753        pub const READ: c_int = 1;
754        pub const WRITE: c_int = 2;
755        pub const READ_WRITE: c_int = 3;
756    }
757
758    pub mod seek_flags {
759        pub const BACKWARD: i32 = 1;
760        pub const BYTE: i32 = 2;
761        pub const ANY: i32 = 4;
762        pub const FRAME: i32 = 8;
763    }
764}
765
766/// Stub `avcodec` wrapper module.
767pub mod avcodec {
768    use std::os::raw::c_int;
769
770    use super::{AVCodec, AVCodecContext, AVCodecID, AVCodecParameters, AVDictionary, AVFrame, AVPacket};
771
772    pub unsafe fn find_decoder(_codec_id: AVCodecID) -> Option<*const AVCodec> {
773        None
774    }
775
776    pub unsafe fn find_decoder_by_name(_name: *const i8) -> Option<*const AVCodec> {
777        None
778    }
779
780    pub unsafe fn find_encoder(_codec_id: AVCodecID) -> Option<*const AVCodec> {
781        None
782    }
783
784    pub unsafe fn find_encoder_by_name(_name: *const i8) -> Option<*const AVCodec> {
785        None
786    }
787
788    pub unsafe fn alloc_context3(_codec: *const AVCodec) -> Result<*mut AVCodecContext, c_int> {
789        Err(-1)
790    }
791
792    pub unsafe fn free_context(_ctx: *mut *mut AVCodecContext) {}
793
794    pub unsafe fn parameters_to_context(
795        _codec_ctx: *mut AVCodecContext,
796        _par: *const AVCodecParameters,
797    ) -> Result<(), c_int> {
798        Err(-1)
799    }
800
801    pub unsafe fn open2(
802        _avctx: *mut AVCodecContext,
803        _codec: *const AVCodec,
804        _options: *mut *mut AVDictionary,
805    ) -> Result<(), c_int> {
806        Err(-1)
807    }
808
809    pub unsafe fn send_packet(
810        _ctx: *mut AVCodecContext,
811        _pkt: *const AVPacket,
812    ) -> Result<(), c_int> {
813        Err(-1)
814    }
815
816    pub unsafe fn receive_frame(
817        _ctx: *mut AVCodecContext,
818        _frame: *mut AVFrame,
819    ) -> Result<(), c_int> {
820        Err(-1)
821    }
822
823    pub unsafe fn send_frame(
824        _ctx: *mut AVCodecContext,
825        _frame: *const AVFrame,
826    ) -> Result<(), c_int> {
827        Err(-1)
828    }
829
830    pub unsafe fn receive_packet(
831        _ctx: *mut AVCodecContext,
832        _pkt: *mut AVPacket,
833    ) -> Result<(), c_int> {
834        Err(-1)
835    }
836
837    pub unsafe fn flush_buffers(_ctx: *mut AVCodecContext) {}
838
839    pub unsafe fn parameters_from_context(
840        _par: *mut AVCodecParameters,
841        _ctx: *const AVCodecContext,
842    ) -> Result<(), c_int> {
843        Err(-1)
844    }
845
846    pub mod codec_caps {
847        pub const EXPERIMENTAL: u32 = 1 << 9;
848        pub const HARDWARE: u32 = 1 << 10;
849        pub const HYBRID: u32 = 1 << 11;
850        pub const VARIABLE_FRAME_SIZE: u32 = 1 << 16;
851        pub const AVOID_PROBING: u32 = 1 << 17;
852    }
853}
854
855/// Stub `swresample` wrapper module.
856pub mod swresample {
857    use std::os::raw::c_int;
858
859    use super::{AVChannelLayout, AVSampleFormat, SwrContext};
860
861    pub unsafe fn alloc() -> Result<*mut SwrContext, c_int> {
862        Err(-1)
863    }
864
865    pub unsafe fn alloc_set_opts2(
866        _out_ch_layout: *const AVChannelLayout,
867        _out_sample_fmt: AVSampleFormat,
868        _out_sample_rate: c_int,
869        _in_ch_layout: *const AVChannelLayout,
870        _in_sample_fmt: AVSampleFormat,
871        _in_sample_rate: c_int,
872    ) -> Result<*mut SwrContext, c_int> {
873        Err(-1)
874    }
875
876    pub unsafe fn init(_ctx: *mut SwrContext) -> Result<(), c_int> {
877        Err(-1)
878    }
879
880    pub unsafe fn is_initialized(_ctx: *const SwrContext) -> bool {
881        false
882    }
883
884    pub unsafe fn free(_ctx: *mut *mut SwrContext) {}
885
886    pub unsafe fn convert(
887        _s: *mut SwrContext,
888        _out: *mut *mut u8,
889        _out_count: c_int,
890        _in_: *const *const u8,
891        _in_count: c_int,
892    ) -> Result<c_int, c_int> {
893        Err(-1)
894    }
895
896    pub unsafe fn get_delay(_ctx: *mut SwrContext, _base: i64) -> i64 {
897        0
898    }
899
900    pub fn estimate_output_samples(
901        _out_sample_rate: i32,
902        _in_sample_rate: i32,
903        _in_samples: i32,
904    ) -> i32 {
905        0
906    }
907
908    pub mod channel_layout {
909        use super::super::AVChannelLayout;
910
911        pub unsafe fn set_default(_ch_layout: *mut AVChannelLayout, _nb_channels: i32) {}
912        pub unsafe fn uninit(_ch_layout: *mut AVChannelLayout) {}
913        pub unsafe fn copy(
914            _dst: *mut AVChannelLayout,
915            _src: *const AVChannelLayout,
916        ) -> Result<(), i32> {
917            Err(-1)
918        }
919        pub unsafe fn is_equal(
920            _chl: *const AVChannelLayout,
921            _chl1: *const AVChannelLayout,
922        ) -> bool {
923            false
924        }
925        pub fn mono() -> AVChannelLayout {
926            AVChannelLayout::default()
927        }
928        pub fn stereo() -> AVChannelLayout {
929            AVChannelLayout::default()
930        }
931        pub fn with_channels(_nb_channels: i32) -> AVChannelLayout {
932            AVChannelLayout::default()
933        }
934        pub fn is_valid(ch_layout: &AVChannelLayout) -> bool {
935            ch_layout.nb_channels > 0
936        }
937        pub fn nb_channels(ch_layout: &AVChannelLayout) -> i32 {
938            ch_layout.nb_channels
939        }
940        pub fn is_native_order(_ch_layout: &AVChannelLayout) -> bool {
941            false
942        }
943    }
944
945    pub mod audio_fifo {
946        use std::ffi::c_void;
947        use std::os::raw::c_int;
948
949        use super::super::{AVAudioFifo, AVSampleFormat};
950
951        pub unsafe fn alloc(
952            _sample_fmt: AVSampleFormat,
953            _channels: c_int,
954            _nb_samples: c_int,
955        ) -> Result<*mut AVAudioFifo, c_int> {
956            Err(-1)
957        }
958
959        pub unsafe fn free(_fifo: *mut AVAudioFifo) {}
960
961        pub unsafe fn write(
962            _fifo: *mut AVAudioFifo,
963            _data: *const *mut c_void,
964            _nb_samples: c_int,
965        ) -> Result<c_int, c_int> {
966            Err(-1)
967        }
968
969        pub unsafe fn read(
970            _fifo: *mut AVAudioFifo,
971            _data: *const *mut c_void,
972            _nb_samples: c_int,
973        ) -> Result<c_int, c_int> {
974            Err(-1)
975        }
976
977        pub unsafe fn size(_fifo: *mut AVAudioFifo) -> c_int {
978            0
979        }
980    }
981
982    pub mod sample_format {
983        use super::super::{
984            AVSampleFormat, AVSampleFormat_AV_SAMPLE_FMT_NONE, AVSampleFormat_AV_SAMPLE_FMT_U8,
985            AVSampleFormat_AV_SAMPLE_FMT_S16, AVSampleFormat_AV_SAMPLE_FMT_S32,
986            AVSampleFormat_AV_SAMPLE_FMT_FLT, AVSampleFormat_AV_SAMPLE_FMT_DBL,
987            AVSampleFormat_AV_SAMPLE_FMT_U8P, AVSampleFormat_AV_SAMPLE_FMT_S16P,
988            AVSampleFormat_AV_SAMPLE_FMT_S32P, AVSampleFormat_AV_SAMPLE_FMT_FLTP,
989            AVSampleFormat_AV_SAMPLE_FMT_DBLP, AVSampleFormat_AV_SAMPLE_FMT_S64,
990            AVSampleFormat_AV_SAMPLE_FMT_S64P,
991        };
992
993        pub const NONE: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_NONE;
994        pub const U8: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_U8;
995        pub const S16: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S16;
996        pub const S32: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S32;
997        pub const FLT: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_FLT;
998        pub const DBL: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_DBL;
999        pub const U8P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_U8P;
1000        pub const S16P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S16P;
1001        pub const S32P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S32P;
1002        pub const FLTP: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_FLTP;
1003        pub const DBLP: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_DBLP;
1004        pub const S64: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S64;
1005        pub const S64P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S64P;
1006
1007        pub fn bytes_per_sample(_sample_fmt: AVSampleFormat) -> i32 {
1008            0
1009        }
1010        pub fn is_planar(_sample_fmt: AVSampleFormat) -> bool {
1011            false
1012        }
1013    }
1014}
1015
1016/// Stub `swscale` wrapper module.
1017pub mod swscale {
1018    use std::os::raw::c_int;
1019
1020    use super::{AVPixelFormat, SwsContext};
1021
1022    pub unsafe fn get_context(
1023        _src_w: c_int,
1024        _src_h: c_int,
1025        _src_fmt: AVPixelFormat,
1026        _dst_w: c_int,
1027        _dst_h: c_int,
1028        _dst_fmt: AVPixelFormat,
1029        _flags: c_int,
1030    ) -> Result<*mut SwsContext, c_int> {
1031        Err(-1)
1032    }
1033
1034    pub unsafe fn free_context(_ctx: *mut SwsContext) {}
1035
1036    pub unsafe fn scale(
1037        _ctx: *mut SwsContext,
1038        _src: *const *const u8,
1039        _src_stride: *const c_int,
1040        _src_slice_y: c_int,
1041        _src_slice_h: c_int,
1042        _dst: *const *mut u8,
1043        _dst_stride: *const c_int,
1044    ) -> Result<c_int, c_int> {
1045        Err(-1)
1046    }
1047
1048    pub unsafe fn is_supported_input(_pix_fmt: AVPixelFormat) -> bool {
1049        false
1050    }
1051
1052    pub unsafe fn is_supported_output(_pix_fmt: AVPixelFormat) -> bool {
1053        false
1054    }
1055
1056    pub unsafe fn is_supported_endianness_conversion(_pix_fmt: AVPixelFormat) -> bool {
1057        false
1058    }
1059
1060    pub mod scale_flags {
1061        pub const FAST_BILINEAR: i32 = 1;
1062        pub const BILINEAR: i32 = 2;
1063        pub const BICUBIC: i32 = 4;
1064        pub const X: i32 = 8;
1065        pub const POINT: i32 = 16;
1066        pub const AREA: i32 = 32;
1067        pub const BICUBLIN: i32 = 64;
1068        pub const GAUSS: i32 = 128;
1069        pub const SINC: i32 = 256;
1070        pub const LANCZOS: i32 = 512;
1071        pub const SPLINE: i32 = 1024;
1072    }
1073}