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 AVCodec(());
33pub struct SwsContext(());
34pub struct SwrContext(());
35pub struct AVBufferRef(());
36pub struct AVIOContext(());
37pub struct AVOutputFormat(());
38
39pub struct AVInputFormat {
40    pub name: *const c_char,
41    pub long_name: *const c_char,
42}
43
44// ── Structs with field-level access ───────────────────────────────────────────
45
46#[derive(Copy, Clone)]
47#[repr(C)]
48pub union AVChannelLayout__bindgen_ty_1 {
49    pub mask: u64,
50}
51
52impl Default for AVChannelLayout__bindgen_ty_1 {
53    fn default() -> Self {
54        Self { mask: 0 }
55    }
56}
57
58#[derive(Copy, Clone)]
59pub struct AVChannelLayout {
60    pub order: AVChannelOrder,
61    pub nb_channels: c_int,
62    pub u: AVChannelLayout__bindgen_ty_1,
63}
64
65impl Default for AVChannelLayout {
66    fn default() -> Self {
67        Self {
68            order: 0,
69            nb_channels: 0,
70            u: AVChannelLayout__bindgen_ty_1::default(),
71        }
72    }
73}
74
75#[derive(Copy, Clone)]
76pub struct AVRational {
77    pub num: c_int,
78    pub den: c_int,
79}
80
81pub struct AVDictionaryEntry {
82    pub key: *mut c_char,
83    pub value: *mut c_char,
84}
85
86pub struct AVChapter {
87    pub id: i64,
88    pub time_base: AVRational,
89    pub start: i64,
90    pub end: i64,
91    pub metadata: *mut AVDictionary,
92}
93
94pub struct AVCodecParameters {
95    pub codec_type: AVMediaType,
96    pub codec_id: AVCodecID,
97    pub codec_tag: c_uint,
98    pub format: c_int,
99    pub bit_rate: i64,
100    pub width: c_int,
101    pub height: c_int,
102    pub sample_rate: c_int,
103    pub ch_layout: AVChannelLayout,
104    pub sample_fmt: AVSampleFormat,
105    pub color_space: AVColorSpace,
106    pub color_range: AVColorRange,
107    pub color_primaries: AVColorPrimaries,
108}
109
110pub struct AVStream {
111    pub codecpar: *mut AVCodecParameters,
112    pub nb_frames: i64,
113    pub duration: i64,
114    pub time_base: AVRational,
115    pub avg_frame_rate: AVRational,
116    pub r_frame_rate: AVRational,
117    pub start_time: i64,
118    pub metadata: *mut AVDictionary,
119}
120
121pub struct AVFormatContext {
122    pub nb_streams: c_uint,
123    pub streams: *mut *mut AVStream,
124    pub duration: i64,
125    pub metadata: *mut AVDictionary,
126    pub nb_chapters: c_uint,
127    pub chapters: *mut *mut AVChapter,
128    pub iformat: *mut AVInputFormat,
129    pub bit_rate: i64,
130    pub pb: *mut AVIOContext,
131}
132
133pub struct AVFrame {
134    pub data: [*mut u8; 8],
135    pub linesize: [c_int; 8],
136    pub width: c_int,
137    pub height: c_int,
138    pub nb_samples: c_int,
139    pub format: c_int,
140    pub key_frame: c_int,
141    pub pict_type: AVPictureType,
142    pub pts: i64,
143    pub pkt_dts: i64,
144    pub sample_rate: c_int,
145    pub ch_layout: AVChannelLayout,
146    pub duration: i64,
147    pub time_base: AVRational,
148    pub hw_frames_ctx: *mut AVBufferRef,
149}
150
151pub struct AVPacket {
152    pub pts: i64,
153    pub dts: i64,
154    pub data: *mut u8,
155    pub size: c_int,
156    pub stream_index: c_int,
157    pub flags: c_int,
158    pub duration: i64,
159}
160
161pub struct AVCodecContext {
162    pub codec_id: AVCodecID,
163    pub bit_rate: i64,
164    pub width: c_int,
165    pub height: c_int,
166    pub pix_fmt: AVPixelFormat,
167    pub sample_rate: c_int,
168    pub ch_layout: AVChannelLayout,
169    pub sample_fmt: AVSampleFormat,
170    pub time_base: AVRational,
171    pub framerate: AVRational,
172    pub gop_size: c_int,
173    pub max_b_frames: c_int,
174    pub qmin: c_int,
175    pub qmax: c_int,
176    pub thread_count: c_int,
177    pub hw_device_ctx: *mut AVBufferRef,
178    pub hw_frames_ctx: *mut AVBufferRef,
179    pub priv_data: *mut c_void,
180}
181
182// ── Constants ─────────────────────────────────────────────────────────────────
183
184pub const AV_DICT_IGNORE_SUFFIX: u32 = 2;
185pub const AV_NUM_DATA_POINTERS: usize = 8;
186
187pub const AVMediaType_AVMEDIA_TYPE_VIDEO: AVMediaType = 0;
188pub const AVMediaType_AVMEDIA_TYPE_AUDIO: AVMediaType = 1;
189
190pub const AVChannelOrder_AV_CHANNEL_ORDER_UNSPEC: AVChannelOrder = 0;
191pub const AVChannelOrder_AV_CHANNEL_ORDER_NATIVE: AVChannelOrder = 1;
192
193// AVCodecID — video
194pub const AVCodecID_AV_CODEC_ID_NONE: AVCodecID = 0;
195pub const AVCodecID_AV_CODEC_ID_MPEG2VIDEO: AVCodecID = 2;
196pub const AVCodecID_AV_CODEC_ID_MJPEG: AVCodecID = 7;
197pub const AVCodecID_AV_CODEC_ID_MPEG4: AVCodecID = 13;
198pub const AVCodecID_AV_CODEC_ID_H264: AVCodecID = 27;
199pub const AVCodecID_AV_CODEC_ID_THEORA: AVCodecID = 30;
200pub const AVCodecID_AV_CODEC_ID_VP8: AVCodecID = 139;
201pub const AVCodecID_AV_CODEC_ID_PRORES: AVCodecID = 147;
202pub const AVCodecID_AV_CODEC_ID_VP9: AVCodecID = 167;
203pub const AVCodecID_AV_CODEC_ID_HEVC: AVCodecID = 173;
204pub const AVCodecID_AV_CODEC_ID_AV1: AVCodecID = 226;
205pub const AVCodecID_AV_CODEC_ID_DNXHD: AVCodecID = 99;
206
207// AVCodecID — audio
208pub const AVCodecID_AV_CODEC_ID_PCM_S16LE: AVCodecID = 65536;
209pub const AVCodecID_AV_CODEC_ID_PCM_S16BE: AVCodecID = 65537;
210pub const AVCodecID_AV_CODEC_ID_PCM_U8: AVCodecID = 65542;
211pub const AVCodecID_AV_CODEC_ID_PCM_S24LE: AVCodecID = 65544;
212pub const AVCodecID_AV_CODEC_ID_PCM_S24BE: AVCodecID = 65545;
213pub const AVCodecID_AV_CODEC_ID_PCM_S32LE: AVCodecID = 65556;
214pub const AVCodecID_AV_CODEC_ID_PCM_S32BE: AVCodecID = 65557;
215pub const AVCodecID_AV_CODEC_ID_PCM_F32LE: AVCodecID = 65558;
216pub const AVCodecID_AV_CODEC_ID_PCM_F32BE: AVCodecID = 65559;
217pub const AVCodecID_AV_CODEC_ID_PCM_F64LE: AVCodecID = 65560;
218pub const AVCodecID_AV_CODEC_ID_PCM_F64BE: AVCodecID = 65561;
219pub const AVCodecID_AV_CODEC_ID_MP3: AVCodecID = 86017;
220pub const AVCodecID_AV_CODEC_ID_AAC: AVCodecID = 86018;
221pub const AVCodecID_AV_CODEC_ID_AC3: AVCodecID = 86019;
222pub const AVCodecID_AV_CODEC_ID_DTS: AVCodecID = 86020;
223pub const AVCodecID_AV_CODEC_ID_VORBIS: AVCodecID = 86021;
224pub const AVCodecID_AV_CODEC_ID_FLAC: AVCodecID = 86028;
225pub const AVCodecID_AV_CODEC_ID_ALAC: AVCodecID = 86032;
226pub const AVCodecID_AV_CODEC_ID_WMAV2: AVCodecID = 86047;
227pub const AVCodecID_AV_CODEC_ID_EAC3: AVCodecID = 86056;
228pub const AVCodecID_AV_CODEC_ID_OPUS: AVCodecID = 86076;
229
230// AVPixelFormat
231pub const AVPixelFormat_AV_PIX_FMT_NONE: AVPixelFormat = -1;
232pub const AVPixelFormat_AV_PIX_FMT_YUV420P: AVPixelFormat = 0;
233pub const AVPixelFormat_AV_PIX_FMT_RGB24: AVPixelFormat = 2;
234pub const AVPixelFormat_AV_PIX_FMT_BGR24: AVPixelFormat = 3;
235pub const AVPixelFormat_AV_PIX_FMT_YUV422P: AVPixelFormat = 4;
236pub const AVPixelFormat_AV_PIX_FMT_YUV444P: AVPixelFormat = 5;
237pub const AVPixelFormat_AV_PIX_FMT_GRAY8: AVPixelFormat = 8;
238pub const AVPixelFormat_AV_PIX_FMT_PAL8: AVPixelFormat = 77;
239pub const AVPixelFormat_AV_PIX_FMT_NV12: AVPixelFormat = 23;
240pub const AVPixelFormat_AV_PIX_FMT_NV21: AVPixelFormat = 24;
241pub const AVPixelFormat_AV_PIX_FMT_RGBA: AVPixelFormat = 26;
242pub const AVPixelFormat_AV_PIX_FMT_BGRA: AVPixelFormat = 28;
243pub const AVPixelFormat_AV_PIX_FMT_VAAPI: AVPixelFormat = 51;
244pub const AVPixelFormat_AV_PIX_FMT_DXVA2_VLD: AVPixelFormat = 53;
245pub const AVPixelFormat_AV_PIX_FMT_YUV420P10LE: AVPixelFormat = 66;
246pub const AVPixelFormat_AV_PIX_FMT_VDPAU: AVPixelFormat = 101;
247pub const AVPixelFormat_AV_PIX_FMT_CUDA: AVPixelFormat = 119;
248pub const AVPixelFormat_AV_PIX_FMT_QSV: AVPixelFormat = 123;
249pub const AVPixelFormat_AV_PIX_FMT_VIDEOTOOLBOX: AVPixelFormat = 135;
250pub const AVPixelFormat_AV_PIX_FMT_MEDIACODEC: AVPixelFormat = 165;
251pub const AVPixelFormat_AV_PIX_FMT_P010LE: AVPixelFormat = 161;
252pub const AVPixelFormat_AV_PIX_FMT_D3D11: AVPixelFormat = 174;
253pub const AVPixelFormat_AV_PIX_FMT_OPENCL: AVPixelFormat = 180;
254pub const AVPixelFormat_AV_PIX_FMT_VULKAN: AVPixelFormat = 193;
255
256// AVSampleFormat
257pub const AVSampleFormat_AV_SAMPLE_FMT_NONE: AVSampleFormat = -1;
258pub const AVSampleFormat_AV_SAMPLE_FMT_U8: AVSampleFormat = 0;
259pub const AVSampleFormat_AV_SAMPLE_FMT_S16: AVSampleFormat = 1;
260pub const AVSampleFormat_AV_SAMPLE_FMT_S32: AVSampleFormat = 2;
261pub const AVSampleFormat_AV_SAMPLE_FMT_FLT: AVSampleFormat = 3;
262pub const AVSampleFormat_AV_SAMPLE_FMT_DBL: AVSampleFormat = 4;
263pub const AVSampleFormat_AV_SAMPLE_FMT_U8P: AVSampleFormat = 5;
264pub const AVSampleFormat_AV_SAMPLE_FMT_S16P: AVSampleFormat = 6;
265pub const AVSampleFormat_AV_SAMPLE_FMT_S32P: AVSampleFormat = 7;
266pub const AVSampleFormat_AV_SAMPLE_FMT_FLTP: AVSampleFormat = 8;
267pub const AVSampleFormat_AV_SAMPLE_FMT_DBLP: AVSampleFormat = 9;
268pub const AVSampleFormat_AV_SAMPLE_FMT_S64: AVSampleFormat = 10;
269pub const AVSampleFormat_AV_SAMPLE_FMT_S64P: AVSampleFormat = 11;
270
271// AVColorPrimaries
272pub const AVColorPrimaries_AVCOL_PRI_BT709: AVColorPrimaries = 1;
273pub const AVColorPrimaries_AVCOL_PRI_UNSPECIFIED: AVColorPrimaries = 2;
274pub const AVColorPrimaries_AVCOL_PRI_BT470BG: AVColorPrimaries = 5;
275pub const AVColorPrimaries_AVCOL_PRI_SMPTE170M: AVColorPrimaries = 6;
276pub const AVColorPrimaries_AVCOL_PRI_BT2020: AVColorPrimaries = 9;
277
278// AVColorRange
279pub const AVColorRange_AVCOL_RANGE_UNSPECIFIED: AVColorRange = 0;
280pub const AVColorRange_AVCOL_RANGE_MPEG: AVColorRange = 1;
281pub const AVColorRange_AVCOL_RANGE_JPEG: AVColorRange = 2;
282
283// AVColorSpace
284pub const AVColorSpace_AVCOL_SPC_RGB: AVColorSpace = 0;
285pub const AVColorSpace_AVCOL_SPC_BT709: AVColorSpace = 1;
286pub const AVColorSpace_AVCOL_SPC_UNSPECIFIED: AVColorSpace = 2;
287pub const AVColorSpace_AVCOL_SPC_BT470BG: AVColorSpace = 5;
288pub const AVColorSpace_AVCOL_SPC_SMPTE170M: AVColorSpace = 6;
289pub const AVColorSpace_AVCOL_SPC_BT2020_NCL: AVColorSpace = 9;
290pub const AVColorSpace_AVCOL_SPC_BT2020_CL: AVColorSpace = 10;
291
292// AVHWDeviceType
293pub const AVHWDeviceType_AV_HWDEVICE_TYPE_CUDA: AVHWDeviceType = 2;
294pub const AVHWDeviceType_AV_HWDEVICE_TYPE_VAAPI: AVHWDeviceType = 4;
295pub const AVHWDeviceType_AV_HWDEVICE_TYPE_QSV: AVHWDeviceType = 5;
296pub const AVHWDeviceType_AV_HWDEVICE_TYPE_VIDEOTOOLBOX: AVHWDeviceType = 7;
297pub const AVHWDeviceType_AV_HWDEVICE_TYPE_D3D11VA: AVHWDeviceType = 8;
298
299// ── Raw FFmpeg functions (bindgen-generated counterparts) ─────────────────────
300//
301// These mirror what bindgen would emit from the real FFmpeg headers.
302// All bodies are stubs; the code is compiled but never executed on docs.rs.
303
304// SAFETY: docs.rs stubs — never called at runtime.
305pub unsafe fn av_strerror(_errnum: c_int, _errbuf: *mut c_char, _errbuf_size: usize) -> c_int {
306    0
307}
308
309pub unsafe fn av_dict_get(
310    _m: *const AVDictionary,
311    _key: *const c_char,
312    _prev: *const AVDictionaryEntry,
313    _flags: c_int,
314) -> *mut AVDictionaryEntry {
315    std::ptr::null_mut()
316}
317
318pub unsafe fn avcodec_get_name(_id: AVCodecID) -> *const c_char {
319    std::ptr::null()
320}
321
322pub unsafe fn av_frame_alloc() -> *mut AVFrame {
323    std::ptr::null_mut()
324}
325
326pub unsafe fn av_frame_free(_frame: *mut *mut AVFrame) {}
327
328pub unsafe fn av_frame_get_buffer(_frame: *mut AVFrame, _align: c_int) -> c_int {
329    0
330}
331
332pub unsafe fn av_frame_move_ref(_dst: *mut AVFrame, _src: *mut AVFrame) {}
333
334pub unsafe fn av_frame_unref(_frame: *mut AVFrame) {}
335
336pub unsafe fn av_packet_alloc() -> *mut AVPacket {
337    std::ptr::null_mut()
338}
339
340pub unsafe fn av_packet_free(_pkt: *mut *mut AVPacket) {}
341
342pub unsafe fn av_packet_unref(_pkt: *mut AVPacket) {}
343
344pub unsafe fn av_buffer_ref(_buf: *mut AVBufferRef) -> *mut AVBufferRef {
345    std::ptr::null_mut()
346}
347
348pub unsafe fn av_buffer_unref(_buf: *mut *mut AVBufferRef) {}
349
350pub unsafe fn av_hwdevice_ctx_create(
351    _device_ctx: *mut *mut AVBufferRef,
352    _type_: AVHWDeviceType,
353    _device: *const c_char,
354    _opts: *mut AVDictionary,
355    _flags: c_int,
356) -> c_int {
357    -1
358}
359
360pub unsafe fn av_hwframe_transfer_data(
361    _dst: *mut AVFrame,
362    _src: *const AVFrame,
363    _flags: c_int,
364) -> c_int {
365    -1
366}
367
368pub unsafe fn av_opt_set(
369    _obj: *mut c_void,
370    _name: *const c_char,
371    _val: *const c_char,
372    _search_flags: c_int,
373) -> c_int {
374    0
375}
376
377pub unsafe fn av_read_frame(_s: *mut AVFormatContext, _pkt: *mut AVPacket) -> c_int {
378    -1
379}
380
381pub unsafe fn av_write_trailer(_s: *mut AVFormatContext) -> c_int {
382    0
383}
384
385pub unsafe fn av_interleaved_write_frame(
386    _s: *mut AVFormatContext,
387    _pkt: *mut AVPacket,
388) -> c_int {
389    0
390}
391
392pub unsafe fn avcodec_receive_frame(_avctx: *mut AVCodecContext, _frame: *mut AVFrame) -> c_int {
393    -1
394}
395
396pub unsafe fn avcodec_send_packet(
397    _avctx: *mut AVCodecContext,
398    _avpkt: *const AVPacket,
399) -> c_int {
400    -1
401}
402
403pub unsafe fn avformat_alloc_output_context2(
404    _ctx: *mut *mut AVFormatContext,
405    _oformat: *mut AVOutputFormat,
406    _format_name: *const c_char,
407    _filename: *const c_char,
408) -> c_int {
409    -1
410}
411
412pub unsafe fn avformat_free_context(_s: *mut AVFormatContext) {}
413
414pub unsafe fn avformat_new_stream(
415    _s: *mut AVFormatContext,
416    _c: *const AVCodec,
417) -> *mut AVStream {
418    std::ptr::null_mut()
419}
420
421pub unsafe fn avformat_write_header(
422    _s: *mut AVFormatContext,
423    _options: *mut *mut AVDictionary,
424) -> c_int {
425    -1
426}
427
428pub unsafe fn swr_alloc_set_opts2(
429    _ps: *mut *mut SwrContext,
430    _out_ch_layout: *const AVChannelLayout,
431    _out_sample_fmt: AVSampleFormat,
432    _out_sample_rate: c_int,
433    _in_ch_layout: *const AVChannelLayout,
434    _in_sample_fmt: AVSampleFormat,
435    _in_sample_rate: c_int,
436    _log_offset: c_int,
437    _log_ctx: *mut c_void,
438) -> c_int {
439    -1
440}
441
442pub unsafe fn swr_convert(
443    _s: *mut SwrContext,
444    _out: *mut *mut u8,
445    _out_count: c_int,
446    _in_: *const *const u8,
447    _in_count: c_int,
448) -> c_int {
449    -1
450}
451
452pub unsafe fn swr_free(_s: *mut *mut SwrContext) {}
453
454pub unsafe fn swr_get_out_samples(_s: *mut SwrContext, _in_samples: c_int) -> c_int {
455    0
456}
457
458pub unsafe fn swr_init(_s: *mut SwrContext) -> c_int {
459    -1
460}
461
462pub unsafe fn av_channel_layout_default(_ch_layout: *mut AVChannelLayout, _nb_channels: c_int) {}
463
464pub unsafe fn av_channel_layout_uninit(_ch_layout: *mut AVChannelLayout) {}
465
466// ── Wrapper module stubs ──────────────────────────────────────────────────────
467//
468// These mirror the safe wrapper modules in avformat.rs, avcodec.rs,
469// swresample.rs, and swscale.rs.  Signatures must exactly match those files.
470
471// ── libavfilter opaque types ──────────────────────────────────────────────────
472
473pub struct AVFilterGraph(());
474pub struct AVFilterContext(());
475pub struct AVFilter(());
476
477// ── libavfilter constants ─────────────────────────────────────────────────────
478
479/// Flag for `av_buffersrc_add_frame_flags`: keep a reference to the frame.
480pub const AV_BUFFERSRC_FLAG_KEEP_REF: c_int = 8;
481
482// ── libavfilter functions ─────────────────────────────────────────────────────
483
484// SAFETY: docs.rs stubs — never called at runtime.
485
486pub unsafe fn avfilter_graph_alloc() -> *mut AVFilterGraph {
487    ptr::null_mut()
488}
489
490pub unsafe fn avfilter_graph_free(_graph: *mut *mut AVFilterGraph) {}
491
492pub unsafe fn avfilter_get_by_name(_name: *const c_char) -> *const AVFilter {
493    ptr::null()
494}
495
496pub unsafe fn avfilter_graph_create_filter(
497    _filt_ctx: *mut *mut AVFilterContext,
498    _filt: *const AVFilter,
499    _name: *const c_char,
500    _args: *const c_char,
501    _opaque: *mut c_void,
502    _graph_ctx: *mut AVFilterGraph,
503) -> c_int {
504    0
505}
506
507pub unsafe fn avfilter_link(
508    _src: *mut AVFilterContext,
509    _srcpad: c_uint,
510    _dst: *mut AVFilterContext,
511    _dstpad: c_uint,
512) -> c_int {
513    0
514}
515
516pub unsafe fn avfilter_graph_config(
517    _graphctx: *mut AVFilterGraph,
518    _log_ctx: *mut c_void,
519) -> c_int {
520    0
521}
522
523pub unsafe fn avfilter_graph_set_auto_convert(_graph: *mut AVFilterGraph, _flags: c_uint) {}
524
525pub unsafe fn av_buffersrc_add_frame_flags(
526    _ctx: *mut AVFilterContext,
527    _frame: *mut AVFrame,
528    _flags: c_int,
529) -> c_int {
530    0
531}
532
533pub unsafe fn av_buffersink_get_frame(
534    _ctx: *mut AVFilterContext,
535    _frame: *mut AVFrame,
536) -> c_int {
537    // Return EAGAIN to signal no frame available
538    -11
539}
540
541/// Stub `avformat` wrapper module.
542pub mod avformat {
543    use std::os::raw::c_int;
544    use std::path::Path;
545
546    use super::{AVFormatContext, AVIOContext, AVPacket};
547
548    pub unsafe fn open_input(_path: &Path) -> Result<*mut AVFormatContext, c_int> {
549        Err(-1)
550    }
551
552    pub unsafe fn close_input(_ctx: *mut *mut AVFormatContext) {}
553
554    pub unsafe fn find_stream_info(_ctx: *mut AVFormatContext) -> Result<(), c_int> {
555        Err(-1)
556    }
557
558    pub unsafe fn seek_frame(
559        _ctx: *mut AVFormatContext,
560        _stream_index: c_int,
561        _timestamp: i64,
562        _flags: c_int,
563    ) -> Result<(), c_int> {
564        Err(-1)
565    }
566
567    pub unsafe fn seek_file(
568        _ctx: *mut AVFormatContext,
569        _stream_index: c_int,
570        _min_ts: i64,
571        _ts: i64,
572        _max_ts: i64,
573        _flags: c_int,
574    ) -> Result<(), c_int> {
575        Err(-1)
576    }
577
578    pub unsafe fn read_frame(
579        _ctx: *mut AVFormatContext,
580        _pkt: *mut AVPacket,
581    ) -> Result<(), c_int> {
582        Err(-1)
583    }
584
585    pub unsafe fn write_frame(
586        _ctx: *mut AVFormatContext,
587        _pkt: *mut AVPacket,
588    ) -> Result<(), c_int> {
589        Err(-1)
590    }
591
592    pub unsafe fn open_output(_path: &Path, _flags: c_int) -> Result<*mut AVIOContext, c_int> {
593        Err(-1)
594    }
595
596    pub unsafe fn close_output(_pb: *mut *mut AVIOContext) {}
597
598    pub mod avio_flags {
599        use std::os::raw::c_int;
600        pub const READ: c_int = 1;
601        pub const WRITE: c_int = 2;
602        pub const READ_WRITE: c_int = 3;
603    }
604
605    pub mod seek_flags {
606        pub const BACKWARD: i32 = 1;
607        pub const BYTE: i32 = 2;
608        pub const ANY: i32 = 4;
609        pub const FRAME: i32 = 8;
610    }
611}
612
613/// Stub `avcodec` wrapper module.
614pub mod avcodec {
615    use std::os::raw::c_int;
616
617    use super::{AVCodec, AVCodecContext, AVCodecID, AVCodecParameters, AVDictionary, AVFrame, AVPacket};
618
619    pub unsafe fn find_decoder(_codec_id: AVCodecID) -> Option<*const AVCodec> {
620        None
621    }
622
623    pub unsafe fn find_decoder_by_name(_name: *const i8) -> Option<*const AVCodec> {
624        None
625    }
626
627    pub unsafe fn find_encoder(_codec_id: AVCodecID) -> Option<*const AVCodec> {
628        None
629    }
630
631    pub unsafe fn find_encoder_by_name(_name: *const i8) -> Option<*const AVCodec> {
632        None
633    }
634
635    pub unsafe fn alloc_context3(_codec: *const AVCodec) -> Result<*mut AVCodecContext, c_int> {
636        Err(-1)
637    }
638
639    pub unsafe fn free_context(_ctx: *mut *mut AVCodecContext) {}
640
641    pub unsafe fn parameters_to_context(
642        _codec_ctx: *mut AVCodecContext,
643        _par: *const AVCodecParameters,
644    ) -> Result<(), c_int> {
645        Err(-1)
646    }
647
648    pub unsafe fn open2(
649        _avctx: *mut AVCodecContext,
650        _codec: *const AVCodec,
651        _options: *mut *mut AVDictionary,
652    ) -> Result<(), c_int> {
653        Err(-1)
654    }
655
656    pub unsafe fn send_packet(
657        _ctx: *mut AVCodecContext,
658        _pkt: *const AVPacket,
659    ) -> Result<(), c_int> {
660        Err(-1)
661    }
662
663    pub unsafe fn receive_frame(
664        _ctx: *mut AVCodecContext,
665        _frame: *mut AVFrame,
666    ) -> Result<(), c_int> {
667        Err(-1)
668    }
669
670    pub unsafe fn send_frame(
671        _ctx: *mut AVCodecContext,
672        _frame: *const AVFrame,
673    ) -> Result<(), c_int> {
674        Err(-1)
675    }
676
677    pub unsafe fn receive_packet(
678        _ctx: *mut AVCodecContext,
679        _pkt: *mut AVPacket,
680    ) -> Result<(), c_int> {
681        Err(-1)
682    }
683
684    pub unsafe fn flush_buffers(_ctx: *mut AVCodecContext) {}
685}
686
687/// Stub `swresample` wrapper module.
688pub mod swresample {
689    use std::os::raw::c_int;
690
691    use super::{AVChannelLayout, AVSampleFormat, SwrContext};
692
693    pub unsafe fn alloc() -> Result<*mut SwrContext, c_int> {
694        Err(-1)
695    }
696
697    pub unsafe fn alloc_set_opts2(
698        _out_ch_layout: *const AVChannelLayout,
699        _out_sample_fmt: AVSampleFormat,
700        _out_sample_rate: c_int,
701        _in_ch_layout: *const AVChannelLayout,
702        _in_sample_fmt: AVSampleFormat,
703        _in_sample_rate: c_int,
704    ) -> Result<*mut SwrContext, c_int> {
705        Err(-1)
706    }
707
708    pub unsafe fn init(_ctx: *mut SwrContext) -> Result<(), c_int> {
709        Err(-1)
710    }
711
712    pub unsafe fn is_initialized(_ctx: *const SwrContext) -> bool {
713        false
714    }
715
716    pub unsafe fn free(_ctx: *mut *mut SwrContext) {}
717
718    pub unsafe fn convert(
719        _s: *mut SwrContext,
720        _out: *mut *mut u8,
721        _out_count: c_int,
722        _in_: *const *const u8,
723        _in_count: c_int,
724    ) -> Result<c_int, c_int> {
725        Err(-1)
726    }
727
728    pub unsafe fn get_delay(_ctx: *mut SwrContext, _base: i64) -> i64 {
729        0
730    }
731
732    pub fn estimate_output_samples(
733        _out_sample_rate: i32,
734        _in_sample_rate: i32,
735        _in_samples: i32,
736    ) -> i32 {
737        0
738    }
739
740    pub mod channel_layout {
741        use super::super::AVChannelLayout;
742
743        pub unsafe fn set_default(_ch_layout: *mut AVChannelLayout, _nb_channels: i32) {}
744        pub unsafe fn uninit(_ch_layout: *mut AVChannelLayout) {}
745        pub unsafe fn copy(
746            _dst: *mut AVChannelLayout,
747            _src: *const AVChannelLayout,
748        ) -> Result<(), i32> {
749            Err(-1)
750        }
751        pub unsafe fn is_equal(
752            _chl: *const AVChannelLayout,
753            _chl1: *const AVChannelLayout,
754        ) -> bool {
755            false
756        }
757        pub fn mono() -> AVChannelLayout {
758            AVChannelLayout::default()
759        }
760        pub fn stereo() -> AVChannelLayout {
761            AVChannelLayout::default()
762        }
763        pub fn with_channels(_nb_channels: i32) -> AVChannelLayout {
764            AVChannelLayout::default()
765        }
766        pub fn is_valid(ch_layout: &AVChannelLayout) -> bool {
767            ch_layout.nb_channels > 0
768        }
769        pub fn nb_channels(ch_layout: &AVChannelLayout) -> i32 {
770            ch_layout.nb_channels
771        }
772        pub fn is_native_order(_ch_layout: &AVChannelLayout) -> bool {
773            false
774        }
775    }
776
777    pub mod sample_format {
778        use super::super::{
779            AVSampleFormat, AVSampleFormat_AV_SAMPLE_FMT_NONE, AVSampleFormat_AV_SAMPLE_FMT_U8,
780            AVSampleFormat_AV_SAMPLE_FMT_S16, AVSampleFormat_AV_SAMPLE_FMT_S32,
781            AVSampleFormat_AV_SAMPLE_FMT_FLT, AVSampleFormat_AV_SAMPLE_FMT_DBL,
782            AVSampleFormat_AV_SAMPLE_FMT_U8P, AVSampleFormat_AV_SAMPLE_FMT_S16P,
783            AVSampleFormat_AV_SAMPLE_FMT_S32P, AVSampleFormat_AV_SAMPLE_FMT_FLTP,
784            AVSampleFormat_AV_SAMPLE_FMT_DBLP, AVSampleFormat_AV_SAMPLE_FMT_S64,
785            AVSampleFormat_AV_SAMPLE_FMT_S64P,
786        };
787
788        pub const NONE: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_NONE;
789        pub const U8: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_U8;
790        pub const S16: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S16;
791        pub const S32: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S32;
792        pub const FLT: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_FLT;
793        pub const DBL: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_DBL;
794        pub const U8P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_U8P;
795        pub const S16P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S16P;
796        pub const S32P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S32P;
797        pub const FLTP: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_FLTP;
798        pub const DBLP: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_DBLP;
799        pub const S64: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S64;
800        pub const S64P: AVSampleFormat = AVSampleFormat_AV_SAMPLE_FMT_S64P;
801
802        pub fn bytes_per_sample(_sample_fmt: AVSampleFormat) -> i32 {
803            0
804        }
805        pub fn is_planar(_sample_fmt: AVSampleFormat) -> bool {
806            false
807        }
808    }
809}
810
811/// Stub `swscale` wrapper module.
812pub mod swscale {
813    use std::os::raw::c_int;
814
815    use super::{AVPixelFormat, SwsContext};
816
817    pub unsafe fn get_context(
818        _src_w: c_int,
819        _src_h: c_int,
820        _src_fmt: AVPixelFormat,
821        _dst_w: c_int,
822        _dst_h: c_int,
823        _dst_fmt: AVPixelFormat,
824        _flags: c_int,
825    ) -> Result<*mut SwsContext, c_int> {
826        Err(-1)
827    }
828
829    pub unsafe fn free_context(_ctx: *mut SwsContext) {}
830
831    pub unsafe fn scale(
832        _ctx: *mut SwsContext,
833        _src: *const *const u8,
834        _src_stride: *const c_int,
835        _src_slice_y: c_int,
836        _src_slice_h: c_int,
837        _dst: *const *mut u8,
838        _dst_stride: *const c_int,
839    ) -> Result<c_int, c_int> {
840        Err(-1)
841    }
842
843    pub unsafe fn is_supported_input(_pix_fmt: AVPixelFormat) -> bool {
844        false
845    }
846
847    pub unsafe fn is_supported_output(_pix_fmt: AVPixelFormat) -> bool {
848        false
849    }
850
851    pub unsafe fn is_supported_endianness_conversion(_pix_fmt: AVPixelFormat) -> bool {
852        false
853    }
854
855    pub mod scale_flags {
856        pub const FAST_BILINEAR: i32 = 1;
857        pub const BILINEAR: i32 = 2;
858        pub const BICUBIC: i32 = 4;
859        pub const X: i32 = 8;
860        pub const POINT: i32 = 16;
861        pub const AREA: i32 = 32;
862        pub const BICUBLIN: i32 = 64;
863        pub const GAUSS: i32 = 128;
864        pub const SINC: i32 = 256;
865        pub const LANCZOS: i32 = 512;
866        pub const SPLINE: i32 = 1024;
867    }
868}