libav/abi.lisp
The compile-time half of the version agreement. load-libav compares these
against what the loaded shared libraries report at run time; see ffi.lisp.
AV-FRAME below spells its two arrays as 8 elements because :COUNT wants a literal. This constant is what lets FFI.LISP assert that the header still agrees with that 8 rather than trusting it.
The two sentinels a decode loop is built around: EOF ends the stream, and
EAGAIN means the codec wants the other half of the send/receive pair.
AVERROR is a macro over an expression rather than a name, and constant can
only ask about names -- it guards every one it emits with #ifdef -- so take
errno's value and negate it in Lisp, which is all AVERROR does here.
swscale's scaler choice. Bilinear is what a video player would use to fit a picture to a surface that is not its native size. These are members of `enum SwsFlags' rather than definitions, so CENUM again.
Seeking lands on a keyframe, and BACKWARD picks the one at or before the timestamp rather than after it -- which is what "start over" means.
The AV_PIX_FMT_* and AV_HWDEVICE_type_* names are enum members, not
preprocessor definitions, so constant cannot see them at all: it would
silently emit nothing and leave the variable unbound. CENUM reads the
enumeration itself.
Only the formats luv expects to meet are listed. The software ones are what a decoder hands back on the CPU path; the three hardware ones are opaque frames whose `data[3]' carries a platform surface -- a CVPixelBuffer, a VASurfaceID, or an AVVkFrame -- which is the whole reason to decode through FFmpeg rather than around it.
Only the count is read. The order and mask are what a resampler needs to place channels; luv downmixes to a point source and never asks.
Only the fields luv reads or writes. Groveling a subset is safe precisely because every offset is computed rather than accumulated: leaving a field out cannot shift the ones that follow it.
The container side. A demuxed file is an AVFormatContext holding an array of AVStreams; each stream describes its content with AVCodecParameters, which is the serializable half a decoder is configured from.
(&optional directory)Load libavutil, libavcodec, and libavformat, and check their versions. DIRECTORY is useful for builds which have not been installed. When it is NIL, LUV_FFMPEG_LIBDIR is consulted before the platform soname search. Signals LIBAV-VERSION-MISMATCH when a loaded library disagrees with the headers this system was…
Headings, paragraphs, figures and their IDs, mentions, marks.
Layouts: binding grids, clauses, loop rows. The selectors are the roles dexp.lisp assigns.
FFmpeg's own headers, read by the C compiler rather than by hand.
AVFrame is a struct whose declaration order says nothing about its memory order -- `flags' lands between `buf' and `hw_frames_ctx', `duration' sits past the end of everything interesting -- and its layout moves across major versions. Groveling asks the same compiler and headers the library was built against, so the offsets are right by construction instead of by transcription.
The header search path comes from pkg-config, so nothing here names a store path: the Nix environment puts FFmpeg's .pc files on PKG_CONFIG_PATH and an ordinary system install works the same way.