Skip to main content

Module ffi

Module ffi 

Source
Expand description

The hand-written FFmpeg surface falcon uses, and the loader that opens the shared libraries at run time.

Only the functions in Api are called. Structs are declared as far as the last field falcon reads, laid out as FFmpeg 7.1 declares them (libavutil 59, libavcodec 61, libavformat 61, libswscale 8, libswresample 5, libavfilter 10). The loader refuses libraries of any other major version, since a struct prefix is only right for the version it was copied from, and refuses any build whose licence is not the LGPL. The layout test checks every offset against the installed headers.

Structs§

AVChannelLayout
AVCodec
Opaque types, only ever behind pointers.
AVCodecContext
AVCodecParameters
The start of AVCodecParameters, up to framerate.
AVFilter
AVFilterContext
AVFilterGraph
AVFormatContext
The start of AVFormatContext, up to duration.
AVFrame
AVFrame up to ch_layout (FFmpeg 7.1 still has the deprecated fields key_frame, interlaced_frame, top_field_first, palette_has_changed, pkt_pos and pkt_size).
AVPacket
The start of AVPacket, up to stream_index.
AVPacketSideData
AVRational
AVStream
The start of AVStream, up to avg_frame_rate.
Api
Every FFmpeg function falcon calls, resolved from the loaded libraries. The libraries stay loaded for the life of the process.
SwrContext
SwsContext

Enums§

LoadError
Why FFmpeg could not be used.

Constants§

AVCODEC_MAJOR
AVERROR_EAGAIN
AVERROR(EAGAIN): EAGAIN is 35 on macOS and 11 on Linux and in Windows’s C runtimes.
AVERROR_EOF
AVERROR_EOF, -MKTAG('E','O','F',' ').
AVERROR_INVALIDDATA
AVERROR_INVALIDDATA, -MKTAG('I','N','D','A').
AVFILTER_MAJOR
AVFORMAT_MAJOR
AVMEDIA_TYPE_AUDIO
AVMEDIA_TYPE_VIDEO
AVSEEK_FLAG_BACKWARD
AVUTIL_MAJOR
Major versions of the libraries the structs below describe.
AV_LOG_QUIET
AV_NOPTS_VALUE
AV_PIX_FMT_RGBA
AV_PKT_DATA_DISPLAYMATRIX
AV_SAMPLE_FMT_FLT
AV_TIME_BASE
SWRESAMPLE_MAJOR
SWSCALE_MAJOR
SWS_AREA
SWS_BILINEAR

Functions§

api
The loaded FFmpeg, opened on first use.
error_text
FFmpeg’s message for an error code.
has_decoder
Whether the loaded FFmpeg has the decoder called name (FFmpeg’s short name, such as libdav1d for AV1).
license_ok
Whether a library’s licence string is one falcon may load: the LGPL, never the GPL (--enable-gpl) or a nonfree build.
search_dirs
Where the libraries are looked for, in order: $FALCON_FFMPEG_DIR, the app bundle’s Contents/Frameworks next to the executable (Linux packages: lib/falcon beside bin; Windows: the executable’s own folder, where the installer puts them, then lib in it, where the portable zip does), and the workspace’s target/ffmpeg/lib that scripts/build-ffmpeg.sh fills.