Package limn.video.ffmpeg
This is the only package in Limn with a native payload, and it is a module of its own so that
it stays the only one. limn-toolkit depends on nothing and carries no native, so its
pure-Java decoders cost an application that never plays an MP4 no codec on its classpath, and
no FFmpeg at all.
The library is not in this repository and Gradle does not build it. It is the
limn-ffmpeg-natives artifact, versioned with FFmpeg (ADR 037): this module brings its JNI shim
along, and an application adds the natives-<os>-<arch> classifier for its platform. A
build that added none has no library, which is an ordinary case rather than a broken one.
Everything here is written so that absence is
ordinary: FfmpegVideoDecoder.supports(java.nio.file.Path) answers false,
FfmpegLibrary.isAvailable() answers false and never throws,
and any decoder installed behind this one is reached exactly as if this one were not there.
Two entry points, for the two shapes a caller wants:
FfmpegVideoDecoderis the SPI implementation: install it andVideos.openreturns pictures. Video only, because that is what the facade's signature carries.FfmpegMediais the container; it opens a file once and hands out both tracks, as the two types the toolkit already publishes, for an application that wants the soundtrack as well.
The licence is LGPL-2.1-or-later and the FFmpeg libraries are linked dynamically, which is
what keeps it so. Nothing here may be built with --enable-gpl, and a test reads the
linked library's own configure line to make sure nothing has been.
-
ClassDescriptionWhat every failure inside the FFmpeg decoder arrives as, including every failure that started in C.Finds and loads the native library the FFmpeg decoder needs, and answers whether it is there.An open container, and the tracks inside it: one picture stream, and whichever of its soundtracks is playing.One of a container's audio tracks, as the container describes it: read once at open, from the file's own stream headers, without opening a decoder for it.One audio track of a written clip.How a written clip's pictures are coded.Whether to decode on a platform accelerator, and therefore what shape this container's pictures have.One of a container's subtitle tracks, as the container describes it: read once at open, from the file's own stream headers, without opening a decoder for it.Decodes H.264, HEVC, VP9 and VP8 video and AAC, Opus and Vorbis audio out of MP4 and Matroska/WebM, through a trimmed FFmpeg behind a hand-written native shim.The cues of a container's selected subtitle track, asked for by position: what is on screen at this moment.One subtitle cue: its text, and the interval it is on screen for.