libav/tests.lisp
The platform's own path must be there, since decoding to a GPU surface is the reason this binding exists. Which other types FFmpeg was built with is not this system's business.
The offsets are only trustworthy if the library reads back what Lisp wrote through them. Describe a picture through the groveled slots, then let av_frame_get_buffer act on that description: a 1920-wide NV12 frame has to come back with two planes and a stride of at least its width.
NV12 interleaves chroma, so there is no third plane to find.
The count is the claim: a decode loop that forgets to flush the codec at end of file loses the pictures still buffered inside it, and a loop that mishandles EAGAIN stops early. Ten frames in, ten frames out.
Exhausted stays exhausted.
And rewinding makes it whole again.
Software decoding, so the picture is in ordinary memory and its planes are real.
swscale both converts and resizes, so a caller can ask for the size its surface wants rather than the size the file happens to be.
A test pattern is not one flat colour; a conversion that silently produced an empty image would be.
No width, height, or format: av_frame_get_buffer has nothing to size.
The test pattern has no sound; asking is not an error, it is a NIL.
A one-second 440 Hz sine, made by ffmpeg beside the test pattern.
About a second of it, and audibly a tone rather than silence or a decoder handing back garbage.
And again from the top.
(&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…
Logical conjunction of tests and raw truth values.
Test whether two compatible scalars are equal.
Logical negation of one test or raw truth value.
()Return the hardware device types this FFmpeg was built with, as keywords. The list is whatever the library reports, so a type this system does not name in its HARDWARE-DEVICE-TYPE enumeration still appears, keyed by FFmpeg's own name for it.
(format)((variable) &body body)An explicitly owned AVFrame.
(frame)(frame)FRAME's pixel format as a keyword, or its raw integer when unrecognised. A hardware format -- :VIDEOTOOLBOX, :VAAPI, :VULKAN -- means the picture never touched the CPU and FRAME's third plane holds a platform surface.
(frame)(frame &key (alignment 0))Allocate buffers for FRAME's current width, height, and pixel format. An ALIGNMENT of zero lets FFmpeg choose the alignment its own SIMD paths want, which is what a decoder would do.
Test whether one compatible scalar is at least another.
(frame plane)(frame plane)(frame)(frame)(frame)((variable pathname) &body body)An open video file and its decoder.
(video)(video)Decode until VIDEO's frame holds the next picture. Return the frame or NIL. NIL means the file is exhausted; VIDEO's frame is left holding the last picture that was decoded.
(video)(video width height &key array (alpha 255))Return VIDEO's current picture as a HEIGHT by WIDTH array of RGBA words. Each word is red in its low byte through ALPHA in its high byte, which is the packing luvcraft's block atlas uses. ARRAY is filled and returned when given, so a player can convert into the same array every frame. ALPHA is written rather than…
Extract the unsigned bit field (BYTE SIZE POSITION) of one unsigned scalar.
Test whether one compatible scalar is greater than another.
(condition)(pathname)Open PATHNAME's best audio stream and start a decoder for it. Returns an AUDIO-TRACK, or NIL when the file has no sound. The caller owns it and must CLOSE-AUDIO it.
Test whether one compatible scalar is less than another.
(track)Decode until TRACK's frame holds the next run of samples, or NIL at the end of the file.
(track &optional buffer)Return TRACK's current frame folded to mono single-floats, and how many. BUFFER is reused when it is large enough; otherwise a fresh one is made. The count is the number of samples written, which is what matters, since the buffer may be longer. Every sample format a decoder hands out is read here directly -- planar…
Test whether one compatible scalar is at most another.
The maximum of compatible quantities.
The componentwise absolute value of a raw value.
(track)(track)
load-libavsignalslibav-version-mismatchitself when the headers this system groveled and the libraries it dlopens come from different builds, so reaching a version string at all is the claim.