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