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};
14
15// ── Type aliases ──────────────────────────────────────────────────────────────
16
17pub type AVCodecID = c_uint;
18pub type AVPixelFormat = c_int;
19pub type AVSampleFormat = c_int;
20pub type AVMediaType = c_int;
21pub type AVColorPrimaries = c_uint;
22pub type AVColorRange = c_uint;
23pub type AVColorSpace = c_uint;
24pub type AVHWDeviceType = c_int;
25pub type AVChannelOrder = c_uint;
26pub type AVPictureType = c_int;
27
28// ── Opaque types (only ever used behind raw pointers) ─────────────────────────
29
30pub struct AVDictionary(());
31pub struct AVCodec(());
32pub struct SwsContext(());
33pub struct SwrContext(());
34pub struct AVBufferRef(());
35pub struct AVIOContext(());
36pub struct AVOutputFormat(());
37
38pub struct AVInputFormat {
39    pub name: *const c_char,
40    pub long_name: *const c_char,
41}
42
43// ── Structs with field-level access ───────────────────────────────────────────
44
45#[repr(C)]
46pub union AVChannelLayout__bindgen_ty_1 {
47    pub mask: u64,
48}
49
50pub struct AVChannelLayout {
51    pub order: AVChannelOrder,
52    pub nb_channels: c_int,
53    pub u: AVChannelLayout__bindgen_ty_1,
54}
55
56pub struct AVRational {
57    pub num: c_int,
58    pub den: c_int,
59}
60
61pub struct AVDictionaryEntry {
62    pub key: *mut c_char,
63    pub value: *mut c_char,
64}
65
66pub struct AVChapter {
67    pub id: i64,
68    pub time_base: AVRational,
69    pub start: i64,
70    pub end: i64,
71    pub metadata: *mut AVDictionary,
72}
73
74pub struct AVCodecParameters {
75    pub codec_type: AVMediaType,
76    pub codec_id: AVCodecID,
77    pub codec_tag: c_uint,
78    pub format: c_int,
79    pub bit_rate: i64,
80    pub width: c_int,
81    pub height: c_int,
82    pub sample_rate: c_int,
83    pub ch_layout: AVChannelLayout,
84    pub sample_fmt: AVSampleFormat,
85    pub color_space: AVColorSpace,
86    pub color_range: AVColorRange,
87    pub color_primaries: AVColorPrimaries,
88}
89
90pub struct AVStream {
91    pub codecpar: *mut AVCodecParameters,
92    pub nb_frames: i64,
93    pub duration: i64,
94    pub time_base: AVRational,
95    pub avg_frame_rate: AVRational,
96    pub r_frame_rate: AVRational,
97    pub start_time: i64,
98}
99
100pub struct AVFormatContext {
101    pub nb_streams: c_uint,
102    pub streams: *mut *mut AVStream,
103    pub duration: i64,
104    pub metadata: *mut AVDictionary,
105    pub nb_chapters: c_uint,
106    pub chapters: *mut *mut AVChapter,
107    pub iformat: *mut AVInputFormat,
108    pub bit_rate: i64,
109    pub pb: *mut AVIOContext,
110}
111
112pub struct AVFrame {
113    pub data: [*mut u8; 8],
114    pub linesize: [c_int; 8],
115    pub width: c_int,
116    pub height: c_int,
117    pub nb_samples: c_int,
118    pub format: c_int,
119    pub key_frame: c_int,
120    pub pict_type: AVPictureType,
121    pub pts: i64,
122    pub pkt_dts: i64,
123    pub sample_rate: c_int,
124    pub ch_layout: AVChannelLayout,
125    pub duration: i64,
126    pub time_base: AVRational,
127    pub hw_frames_ctx: *mut AVBufferRef,
128}
129
130pub struct AVPacket {
131    pub pts: i64,
132    pub dts: i64,
133    pub data: *mut u8,
134    pub size: c_int,
135    pub stream_index: c_int,
136    pub flags: c_int,
137    pub duration: i64,
138}
139
140pub struct AVCodecContext {
141    pub codec_id: AVCodecID,
142    pub bit_rate: i64,
143    pub width: c_int,
144    pub height: c_int,
145    pub pix_fmt: AVPixelFormat,
146    pub sample_rate: c_int,
147    pub ch_layout: AVChannelLayout,
148    pub sample_fmt: AVSampleFormat,
149    pub time_base: AVRational,
150    pub framerate: AVRational,
151    pub gop_size: c_int,
152    pub max_b_frames: c_int,
153    pub qmin: c_int,
154    pub qmax: c_int,
155    pub thread_count: c_int,
156    pub hw_device_ctx: *mut AVBufferRef,
157    pub hw_frames_ctx: *mut AVBufferRef,
158    pub priv_data: *mut c_void,
159}
160
161// ── Constants ─────────────────────────────────────────────────────────────────
162
163pub const AV_DICT_IGNORE_SUFFIX: u32 = 2;
164pub const AV_NUM_DATA_POINTERS: usize = 8;
165
166pub const AVMediaType_AVMEDIA_TYPE_VIDEO: AVMediaType = 0;
167pub const AVMediaType_AVMEDIA_TYPE_AUDIO: AVMediaType = 1;
168
169pub const AVChannelOrder_AV_CHANNEL_ORDER_UNSPEC: AVChannelOrder = 0;
170pub const AVChannelOrder_AV_CHANNEL_ORDER_NATIVE: AVChannelOrder = 1;
171
172// AVCodecID — video
173pub const AVCodecID_AV_CODEC_ID_NONE: AVCodecID = 0;
174pub const AVCodecID_AV_CODEC_ID_MPEG2VIDEO: AVCodecID = 2;
175pub const AVCodecID_AV_CODEC_ID_MJPEG: AVCodecID = 7;
176pub const AVCodecID_AV_CODEC_ID_MPEG4: AVCodecID = 13;
177pub const AVCodecID_AV_CODEC_ID_H264: AVCodecID = 27;
178pub const AVCodecID_AV_CODEC_ID_THEORA: AVCodecID = 30;
179pub const AVCodecID_AV_CODEC_ID_VP8: AVCodecID = 139;
180pub const AVCodecID_AV_CODEC_ID_PRORES: AVCodecID = 147;
181pub const AVCodecID_AV_CODEC_ID_VP9: AVCodecID = 167;
182pub const AVCodecID_AV_CODEC_ID_HEVC: AVCodecID = 173;
183pub const AVCodecID_AV_CODEC_ID_AV1: AVCodecID = 226;
184pub const AVCodecID_AV_CODEC_ID_DNXHD: AVCodecID = 99;
185
186// AVCodecID — audio
187pub const AVCodecID_AV_CODEC_ID_PCM_S16LE: AVCodecID = 65536;
188pub const AVCodecID_AV_CODEC_ID_PCM_S16BE: AVCodecID = 65537;
189pub const AVCodecID_AV_CODEC_ID_PCM_U8: AVCodecID = 65542;
190pub const AVCodecID_AV_CODEC_ID_PCM_S24LE: AVCodecID = 65544;
191pub const AVCodecID_AV_CODEC_ID_PCM_S24BE: AVCodecID = 65545;
192pub const AVCodecID_AV_CODEC_ID_PCM_S32LE: AVCodecID = 65556;
193pub const AVCodecID_AV_CODEC_ID_PCM_S32BE: AVCodecID = 65557;
194pub const AVCodecID_AV_CODEC_ID_PCM_F32LE: AVCodecID = 65558;
195pub const AVCodecID_AV_CODEC_ID_PCM_F32BE: AVCodecID = 65559;
196pub const AVCodecID_AV_CODEC_ID_PCM_F64LE: AVCodecID = 65560;
197pub const AVCodecID_AV_CODEC_ID_PCM_F64BE: AVCodecID = 65561;
198pub const AVCodecID_AV_CODEC_ID_MP3: AVCodecID = 86017;
199pub const AVCodecID_AV_CODEC_ID_AAC: AVCodecID = 86018;
200pub const AVCodecID_AV_CODEC_ID_AC3: AVCodecID = 86019;
201pub const AVCodecID_AV_CODEC_ID_DTS: AVCodecID = 86020;
202pub const AVCodecID_AV_CODEC_ID_VORBIS: AVCodecID = 86021;
203pub const AVCodecID_AV_CODEC_ID_FLAC: AVCodecID = 86028;
204pub const AVCodecID_AV_CODEC_ID_ALAC: AVCodecID = 86032;
205pub const AVCodecID_AV_CODEC_ID_WMAV2: AVCodecID = 86047;
206pub const AVCodecID_AV_CODEC_ID_EAC3: AVCodecID = 86056;
207pub const AVCodecID_AV_CODEC_ID_OPUS: AVCodecID = 86076;
208
209// AVPixelFormat
210pub const AVPixelFormat_AV_PIX_FMT_NONE: AVPixelFormat = -1;
211pub const AVPixelFormat_AV_PIX_FMT_YUV420P: AVPixelFormat = 0;
212pub const AVPixelFormat_AV_PIX_FMT_RGB24: AVPixelFormat = 2;
213pub const AVPixelFormat_AV_PIX_FMT_BGR24: AVPixelFormat = 3;
214pub const AVPixelFormat_AV_PIX_FMT_YUV422P: AVPixelFormat = 4;
215pub const AVPixelFormat_AV_PIX_FMT_YUV444P: AVPixelFormat = 5;
216pub const AVPixelFormat_AV_PIX_FMT_GRAY8: AVPixelFormat = 8;
217pub const AVPixelFormat_AV_PIX_FMT_PAL8: AVPixelFormat = 77;
218pub const AVPixelFormat_AV_PIX_FMT_NV12: AVPixelFormat = 23;
219pub const AVPixelFormat_AV_PIX_FMT_NV21: AVPixelFormat = 24;
220pub const AVPixelFormat_AV_PIX_FMT_RGBA: AVPixelFormat = 26;
221pub const AVPixelFormat_AV_PIX_FMT_BGRA: AVPixelFormat = 28;
222pub const AVPixelFormat_AV_PIX_FMT_VAAPI: AVPixelFormat = 51;
223pub const AVPixelFormat_AV_PIX_FMT_DXVA2_VLD: AVPixelFormat = 53;
224pub const AVPixelFormat_AV_PIX_FMT_YUV420P10LE: AVPixelFormat = 66;
225pub const AVPixelFormat_AV_PIX_FMT_VDPAU: AVPixelFormat = 101;
226pub const AVPixelFormat_AV_PIX_FMT_CUDA: AVPixelFormat = 119;
227pub const AVPixelFormat_AV_PIX_FMT_QSV: AVPixelFormat = 123;
228pub const AVPixelFormat_AV_PIX_FMT_VIDEOTOOLBOX: AVPixelFormat = 135;
229pub const AVPixelFormat_AV_PIX_FMT_MEDIACODEC: AVPixelFormat = 165;
230pub const AVPixelFormat_AV_PIX_FMT_P010LE: AVPixelFormat = 161;
231pub const AVPixelFormat_AV_PIX_FMT_D3D11: AVPixelFormat = 174;
232pub const AVPixelFormat_AV_PIX_FMT_OPENCL: AVPixelFormat = 180;
233pub const AVPixelFormat_AV_PIX_FMT_VULKAN: AVPixelFormat = 193;
234
235// AVSampleFormat
236pub const AVSampleFormat_AV_SAMPLE_FMT_U8: AVSampleFormat = 0;
237pub const AVSampleFormat_AV_SAMPLE_FMT_S16: AVSampleFormat = 1;
238pub const AVSampleFormat_AV_SAMPLE_FMT_S32: AVSampleFormat = 2;
239pub const AVSampleFormat_AV_SAMPLE_FMT_FLT: AVSampleFormat = 3;
240pub const AVSampleFormat_AV_SAMPLE_FMT_DBL: AVSampleFormat = 4;
241pub const AVSampleFormat_AV_SAMPLE_FMT_U8P: AVSampleFormat = 5;
242pub const AVSampleFormat_AV_SAMPLE_FMT_S16P: AVSampleFormat = 6;
243pub const AVSampleFormat_AV_SAMPLE_FMT_S32P: AVSampleFormat = 7;
244pub const AVSampleFormat_AV_SAMPLE_FMT_FLTP: AVSampleFormat = 8;
245pub const AVSampleFormat_AV_SAMPLE_FMT_DBLP: AVSampleFormat = 9;
246
247// AVColorPrimaries
248pub const AVColorPrimaries_AVCOL_PRI_BT709: AVColorPrimaries = 1;
249pub const AVColorPrimaries_AVCOL_PRI_UNSPECIFIED: AVColorPrimaries = 2;
250pub const AVColorPrimaries_AVCOL_PRI_BT470BG: AVColorPrimaries = 5;
251pub const AVColorPrimaries_AVCOL_PRI_SMPTE170M: AVColorPrimaries = 6;
252pub const AVColorPrimaries_AVCOL_PRI_BT2020: AVColorPrimaries = 9;
253
254// AVColorRange
255pub const AVColorRange_AVCOL_RANGE_UNSPECIFIED: AVColorRange = 0;
256pub const AVColorRange_AVCOL_RANGE_MPEG: AVColorRange = 1;
257pub const AVColorRange_AVCOL_RANGE_JPEG: AVColorRange = 2;
258
259// AVColorSpace
260pub const AVColorSpace_AVCOL_SPC_RGB: AVColorSpace = 0;
261pub const AVColorSpace_AVCOL_SPC_BT709: AVColorSpace = 1;
262pub const AVColorSpace_AVCOL_SPC_UNSPECIFIED: AVColorSpace = 2;
263pub const AVColorSpace_AVCOL_SPC_BT470BG: AVColorSpace = 5;
264pub const AVColorSpace_AVCOL_SPC_SMPTE170M: AVColorSpace = 6;
265pub const AVColorSpace_AVCOL_SPC_BT2020_NCL: AVColorSpace = 9;
266pub const AVColorSpace_AVCOL_SPC_BT2020_CL: AVColorSpace = 10;
267
268// AVHWDeviceType
269pub const AVHWDeviceType_AV_HWDEVICE_TYPE_CUDA: AVHWDeviceType = 2;
270pub const AVHWDeviceType_AV_HWDEVICE_TYPE_VAAPI: AVHWDeviceType = 4;
271pub const AVHWDeviceType_AV_HWDEVICE_TYPE_QSV: AVHWDeviceType = 5;
272pub const AVHWDeviceType_AV_HWDEVICE_TYPE_VIDEOTOOLBOX: AVHWDeviceType = 7;
273pub const AVHWDeviceType_AV_HWDEVICE_TYPE_D3D11VA: AVHWDeviceType = 8;
274
275// ── Raw FFmpeg functions (bindgen-generated counterparts) ─────────────────────
276//
277// These mirror what bindgen would emit from the real FFmpeg headers.
278// All bodies are stubs; the code is compiled but never executed on docs.rs.
279
280// SAFETY: docs.rs stubs — never called at runtime.
281pub unsafe fn av_strerror(_errnum: c_int, _errbuf: *mut c_char, _errbuf_size: usize) -> c_int {
282    0
283}
284
285pub unsafe fn av_dict_get(
286    _m: *const AVDictionary,
287    _key: *const c_char,
288    _prev: *const AVDictionaryEntry,
289    _flags: c_int,
290) -> *mut AVDictionaryEntry {
291    std::ptr::null_mut()
292}
293
294pub unsafe fn avcodec_get_name(_id: AVCodecID) -> *const c_char {
295    std::ptr::null()
296}
297
298pub unsafe fn av_frame_alloc() -> *mut AVFrame {
299    std::ptr::null_mut()
300}
301
302pub unsafe fn av_frame_free(_frame: *mut *mut AVFrame) {}
303
304pub unsafe fn av_frame_get_buffer(_frame: *mut AVFrame, _align: c_int) -> c_int {
305    0
306}
307
308pub unsafe fn av_frame_move_ref(_dst: *mut AVFrame, _src: *mut AVFrame) {}
309
310pub unsafe fn av_frame_unref(_frame: *mut AVFrame) {}
311
312pub unsafe fn av_packet_alloc() -> *mut AVPacket {
313    std::ptr::null_mut()
314}
315
316pub unsafe fn av_packet_free(_pkt: *mut *mut AVPacket) {}
317
318pub unsafe fn av_packet_unref(_pkt: *mut AVPacket) {}
319
320pub unsafe fn av_buffer_ref(_buf: *mut AVBufferRef) -> *mut AVBufferRef {
321    std::ptr::null_mut()
322}
323
324pub unsafe fn av_buffer_unref(_buf: *mut *mut AVBufferRef) {}
325
326pub unsafe fn av_hwdevice_ctx_create(
327    _device_ctx: *mut *mut AVBufferRef,
328    _type_: AVHWDeviceType,
329    _device: *const c_char,
330    _opts: *mut AVDictionary,
331    _flags: c_int,
332) -> c_int {
333    -1
334}
335
336pub unsafe fn av_hwframe_transfer_data(
337    _dst: *mut AVFrame,
338    _src: *const AVFrame,
339    _flags: c_int,
340) -> c_int {
341    -1
342}
343
344pub unsafe fn av_opt_set(
345    _obj: *mut c_void,
346    _name: *const c_char,
347    _val: *const c_char,
348    _search_flags: c_int,
349) -> c_int {
350    0
351}
352
353pub unsafe fn av_read_frame(_s: *mut AVFormatContext, _pkt: *mut AVPacket) -> c_int {
354    -1
355}
356
357pub unsafe fn av_write_trailer(_s: *mut AVFormatContext) -> c_int {
358    0
359}
360
361pub unsafe fn av_interleaved_write_frame(
362    _s: *mut AVFormatContext,
363    _pkt: *mut AVPacket,
364) -> c_int {
365    0
366}
367
368pub unsafe fn avcodec_receive_frame(_avctx: *mut AVCodecContext, _frame: *mut AVFrame) -> c_int {
369    -1
370}
371
372pub unsafe fn avcodec_send_packet(
373    _avctx: *mut AVCodecContext,
374    _avpkt: *const AVPacket,
375) -> c_int {
376    -1
377}
378
379pub unsafe fn avformat_alloc_output_context2(
380    _ctx: *mut *mut AVFormatContext,
381    _oformat: *mut AVOutputFormat,
382    _format_name: *const c_char,
383    _filename: *const c_char,
384) -> c_int {
385    -1
386}
387
388pub unsafe fn avformat_free_context(_s: *mut AVFormatContext) {}
389
390pub unsafe fn avformat_new_stream(
391    _s: *mut AVFormatContext,
392    _c: *const AVCodec,
393) -> *mut AVStream {
394    std::ptr::null_mut()
395}
396
397pub unsafe fn avformat_write_header(
398    _s: *mut AVFormatContext,
399    _options: *mut *mut AVDictionary,
400) -> c_int {
401    -1
402}
403
404pub unsafe fn swr_alloc_set_opts2(
405    _ps: *mut *mut SwrContext,
406    _out_ch_layout: *const AVChannelLayout,
407    _out_sample_fmt: AVSampleFormat,
408    _out_sample_rate: c_int,
409    _in_ch_layout: *const AVChannelLayout,
410    _in_sample_fmt: AVSampleFormat,
411    _in_sample_rate: c_int,
412    _log_offset: c_int,
413    _log_ctx: *mut c_void,
414) -> c_int {
415    -1
416}
417
418pub unsafe fn swr_convert(
419    _s: *mut SwrContext,
420    _out: *mut *mut u8,
421    _out_count: c_int,
422    _in_: *const *const u8,
423    _in_count: c_int,
424) -> c_int {
425    -1
426}
427
428pub unsafe fn swr_free(_s: *mut *mut SwrContext) {}
429
430pub unsafe fn swr_get_out_samples(_s: *mut SwrContext, _in_samples: c_int) -> c_int {
431    0
432}
433
434pub unsafe fn swr_init(_s: *mut SwrContext) -> c_int {
435    -1
436}
437
438pub unsafe fn av_channel_layout_default(_ch_layout: *mut AVChannelLayout, _nb_channels: c_int) {}
439
440pub unsafe fn av_channel_layout_uninit(_ch_layout: *mut AVChannelLayout) {}
441
442// ── Wrapper module stubs ──────────────────────────────────────────────────────
443//
444// These mirror the safe wrapper modules in avformat.rs, avcodec.rs,
445// swresample.rs, and swscale.rs.  Signatures must exactly match those files.
446
447/// Stub `avformat` wrapper module.
448pub mod avformat {
449    use std::os::raw::c_int;
450    use std::path::Path;
451
452    use super::{AVFormatContext, AVIOContext, AVPacket};
453
454    pub unsafe fn open_input(_path: &Path) -> Result<*mut AVFormatContext, c_int> {
455        Err(-1)
456    }
457
458    pub unsafe fn close_input(_ctx: *mut *mut AVFormatContext) {}
459
460    pub unsafe fn find_stream_info(_ctx: *mut AVFormatContext) -> Result<(), c_int> {
461        Err(-1)
462    }
463
464    pub unsafe fn seek_frame(
465        _ctx: *mut AVFormatContext,
466        _stream_index: c_int,
467        _timestamp: i64,
468        _flags: c_int,
469    ) -> Result<(), c_int> {
470        Err(-1)
471    }
472
473    pub unsafe fn seek_file(
474        _ctx: *mut AVFormatContext,
475        _stream_index: c_int,
476        _min_ts: i64,
477        _ts: i64,
478        _max_ts: i64,
479        _flags: c_int,
480    ) -> Result<(), c_int> {
481        Err(-1)
482    }
483
484    pub unsafe fn read_frame(
485        _ctx: *mut AVFormatContext,
486        _pkt: *mut AVPacket,
487    ) -> Result<(), c_int> {
488        Err(-1)
489    }
490
491    pub unsafe fn write_frame(
492        _ctx: *mut AVFormatContext,
493        _pkt: *mut AVPacket,
494    ) -> Result<(), c_int> {
495        Err(-1)
496    }
497
498    pub unsafe fn open_output(_path: &Path, _flags: c_int) -> Result<*mut AVIOContext, c_int> {
499        Err(-1)
500    }
501
502    pub unsafe fn close_output(_pb: *mut *mut AVIOContext) {}
503}
504
505/// Stub `avcodec` wrapper module.
506pub mod avcodec {
507    use std::os::raw::c_int;
508
509    use super::{AVCodec, AVCodecContext, AVCodecID, AVCodecParameters, AVDictionary, AVFrame, AVPacket};
510
511    pub unsafe fn find_decoder(_codec_id: AVCodecID) -> Option<*const AVCodec> {
512        None
513    }
514
515    pub unsafe fn find_decoder_by_name(_name: *const i8) -> Option<*const AVCodec> {
516        None
517    }
518
519    pub unsafe fn find_encoder(_codec_id: AVCodecID) -> Option<*const AVCodec> {
520        None
521    }
522
523    pub unsafe fn find_encoder_by_name(_name: *const i8) -> Option<*const AVCodec> {
524        None
525    }
526
527    pub unsafe fn alloc_context3(_codec: *const AVCodec) -> Result<*mut AVCodecContext, c_int> {
528        Err(-1)
529    }
530
531    pub unsafe fn free_context(_ctx: *mut *mut AVCodecContext) {}
532
533    pub unsafe fn parameters_to_context(
534        _codec_ctx: *mut AVCodecContext,
535        _par: *const AVCodecParameters,
536    ) -> Result<(), c_int> {
537        Err(-1)
538    }
539
540    pub unsafe fn open2(
541        _avctx: *mut AVCodecContext,
542        _codec: *const AVCodec,
543        _options: *mut *mut AVDictionary,
544    ) -> Result<(), c_int> {
545        Err(-1)
546    }
547
548    pub unsafe fn send_packet(
549        _ctx: *mut AVCodecContext,
550        _pkt: *const AVPacket,
551    ) -> Result<(), c_int> {
552        Err(-1)
553    }
554
555    pub unsafe fn receive_frame(
556        _ctx: *mut AVCodecContext,
557        _frame: *mut AVFrame,
558    ) -> Result<(), c_int> {
559        Err(-1)
560    }
561
562    pub unsafe fn send_frame(
563        _ctx: *mut AVCodecContext,
564        _frame: *const AVFrame,
565    ) -> Result<(), c_int> {
566        Err(-1)
567    }
568
569    pub unsafe fn receive_packet(
570        _ctx: *mut AVCodecContext,
571        _pkt: *mut AVPacket,
572    ) -> Result<(), c_int> {
573        Err(-1)
574    }
575
576    pub unsafe fn flush_buffers(_ctx: *mut AVCodecContext) {}
577}
578
579/// Stub `swresample` wrapper module.
580pub mod swresample {
581    use std::os::raw::c_int;
582
583    use super::{AVChannelLayout, AVSampleFormat, SwrContext};
584
585    pub unsafe fn alloc() -> Result<*mut SwrContext, c_int> {
586        Err(-1)
587    }
588
589    pub unsafe fn alloc_set_opts2(
590        _out_ch_layout: *const AVChannelLayout,
591        _out_sample_fmt: AVSampleFormat,
592        _out_sample_rate: c_int,
593        _in_ch_layout: *const AVChannelLayout,
594        _in_sample_fmt: AVSampleFormat,
595        _in_sample_rate: c_int,
596    ) -> Result<*mut SwrContext, c_int> {
597        Err(-1)
598    }
599
600    pub unsafe fn init(_ctx: *mut SwrContext) -> Result<(), c_int> {
601        Err(-1)
602    }
603
604    pub unsafe fn is_initialized(_ctx: *const SwrContext) -> bool {
605        false
606    }
607
608    pub unsafe fn free(_ctx: *mut *mut SwrContext) {}
609
610    pub unsafe fn convert(
611        _s: *mut SwrContext,
612        _out: *mut *mut u8,
613        _out_count: c_int,
614        _in_: *const *const u8,
615        _in_count: c_int,
616    ) -> Result<c_int, c_int> {
617        Err(-1)
618    }
619
620    pub unsafe fn get_delay(_ctx: *mut SwrContext, _base: i64) -> i64 {
621        0
622    }
623
624    pub fn estimate_output_samples(
625        _out_sample_rate: i32,
626        _in_sample_rate: i32,
627        _in_samples: i32,
628    ) -> i32 {
629        0
630    }
631}
632
633/// Stub `swscale` wrapper module.
634pub mod swscale {
635    use std::os::raw::c_int;
636
637    use super::{AVPixelFormat, SwsContext};
638
639    pub unsafe fn get_context(
640        _src_w: c_int,
641        _src_h: c_int,
642        _src_fmt: AVPixelFormat,
643        _dst_w: c_int,
644        _dst_h: c_int,
645        _dst_fmt: AVPixelFormat,
646        _flags: c_int,
647    ) -> Result<*mut SwsContext, c_int> {
648        Err(-1)
649    }
650
651    pub unsafe fn free_context(_ctx: *mut SwsContext) {}
652
653    pub unsafe fn scale(
654        _ctx: *mut SwsContext,
655        _src: *const *const u8,
656        _src_stride: *const c_int,
657        _src_slice_y: c_int,
658        _src_slice_h: c_int,
659        _dst: *const *mut u8,
660        _dst_stride: *const c_int,
661    ) -> Result<c_int, c_int> {
662        Err(-1)
663    }
664
665    pub unsafe fn is_supported_input(_pix_fmt: AVPixelFormat) -> bool {
666        false
667    }
668
669    pub unsafe fn is_supported_output(_pix_fmt: AVPixelFormat) -> bool {
670        false
671    }
672
673    pub unsafe fn is_supported_endianness_conversion(_pix_fmt: AVPixelFormat) -> bool {
674        false
675    }
676}