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