luvcraft/video-interop.lisp
Return FFmpeg's hardware selector and configuration for device.
hardware-policy is :AUTO or :REQUIRED. Two values are returned: the selector
accepted by LIBAV:open-video and its backend-private configuration. A device
without a decode bridge returns two NIL values and therefore uses software.
Backend-owned state for adopting decoded hardware frames into DEVICE.
Every native plane owner retains this object until the HAL has completed its physical retirement. Asking to release the importer closes admission at once, but its backend state remains live until the last such owner callback runs.
Return an importer for hardware frames decoded for device, or NIL.
Build and return one complete decoded-video-picture.
frame remains borrowed from the decoder. An implementation must retain every
native plane for the lifetime of the returned picture and must release every
part of an incomplete candidate before propagating an error.
Request release of importer's backend-owned persistent state.
The request is idempotent. Native state is released only after every adopted plane owner has completed physical retirement in the HAL.
Release importer's backend-native state after its last owner retires.
Return one persistent, idempotent native-state teardown for importer.
Transfer a ready importer's persistent native state into HAL retirement.
Queue implementations call this only after their ledger
durably owns importer and both closures.
The default/non-live method can fail before transfer. Preserve a caller-owned retry in that case; once invalidated, the HAL ledger is the durable owner and :QUEUED must survive every later failure.
Record one native plane owner admitted while importer is still open.
Drop one native owner retainer, without losing a pending release request.
Retain importer and return an idempotent native-owner release callback.
The callback first runs release-native-owner. Only its successful completion
drops the importer retainer. If importer closure was already requested, the
same callback then performs (or retries) that closure. This ordering lets a
HAL retirement ledger retry any failed native teardown without prematurely
freeing the importer state which minted it.
Importer retirement is a separate ledger entry. A persistent-state failure therefore cannot make this plane callback run twice.
One atomically publishable and explicitly owned decoded picture.
Return picture's view for plane, or NIL when it has no such plane.
True when picture no longer owns a view or texture.
Destroy resource as release step name and report whether it succeeded.
Release picture's views before any of its textures. Idempotent.
Failed handles remain attached for a later release attempt. Textures are not retired at all until every view is gone, preserving the dependency order even when one view's destruction reports a failure.
Process-root picture after construction rollback could not release it.
Release picture, retaining it across an exceptional construction unwind.
Retry every picture retained by an earlier construction rollback.
Build a picture transactionally from plane-count native plane textures.
make-plane-texture is called with each zero-based plane index and returns an
owned HAL texture. This function creates the corresponding views. If either
step fails, all views built so far are destroyed before every owned texture.
Record the texture before creating its view: a view failure must still retire this newly adopted plane.
(device hardware-policy)Return FFmpeg's hardware selector and configuration for DEVICE. HARDWARE-POLICY is :AUTO or :REQUIRED. Two values are returned: the selector accepted by LIBAV:OPEN-VIDEO and its backend-private configuration. A device without a decode bridge returns two NIL values and therefore uses software.
(pathname &key (hardware :auto) hardware-configuration)Open PATHNAME, find its best video stream, and start a decoder for it. Returns a VIDEO. The caller owns it and must CLOSE-VIDEO it.
Backend-owned state for adopting decoded hardware frames into DEVICE. Every native plane owner retains this object until the HAL has completed its physical retirement. Asking to release the importer closes admission at once, but its backend state remains live until the last such owner callback runs.
(device)Return an importer for hardware frames decoded for DEVICE, or NIL.
(importer frame width height)Build and return one complete DECODED-VIDEO-PICTURE. FRAME remains borrowed from the decoder. An implementation must retain every native plane for the lifetime of the returned picture and must release every part of an incomplete candidate before propagating an error.
An explicitly owned AVFrame.
One atomically publishable and explicitly owned decoded picture.
(importer)Request release of IMPORTER's backend-owned persistent state. The request is idempotent. Native state is released only after every adopted plane owner has completed physical retirement in the HAL.
(importer)Release IMPORTER's backend-native state after its last owner retires.
Logical conjunction of tests and raw truth values.
Logical disjunction of tests and raw truth values.
(device owner teardown invalidate)Transfer OWNER's native teardown to DEVICE, then invalidate OWNER. Backend methods may transfer ownership to a durable device queue before INVALIDATE and attempt it immediately. The default has no such queue: native TEARDOWN must return successfully before INVALIDATE is called.
(importer release-native-owner)Retain IMPORTER and return an idempotent native-owner release callback. The callback first runs RELEASE-NATIVE-OWNER. Only its successful completion drops the importer retainer. If importer closure was already requested, the same callback then performs (or retries) that closure. This ordering lets a HAL retirement…
(picture plane)(name resource)(name &body body)(handle)Logically invalidate HANDLE immediately. Native teardown may be deferred until submitted work which captured HANDLE has completed.
(picture)Release PICTURE's views before any of its textures. Idempotent. Failed handles remain attached for a later release attempt. Textures are not retired at all until every view is gone, preserving the dependency order even when one view's destruction reports a failure.
Incomplete construction candidates whose logical release needs a retry.
(&body body)(device plane-count make-plane-texture)Build a picture transactionally from PLANE-COUNT native plane textures. MAKE-PLANE-TEXTURE is called with each zero-based plane index and returns an owned HAL texture. This function creates the corresponding views. If either step fails, all views built so far are destroyed before every owned texture.
Multiplication and scalar scaling.
(device descriptor)Asks the DEVICE for a handle to newly created instance of some object fulfilling the DESCRIPTOR.
Portable ownership boundary between decoded hardware frames and the HAL.
A decoder configuration and a frame importer belong to the GPU backend. The resulting picture does not: it is one complete, explicitly owned cohort of plane textures and their views. Video screens publish only complete pictures, so a failed chroma import cannot disturb the luma and chroma pair which the preceding frame is still displaying.