Skip to main content

Crate falcon_video

Crate falcon_video 

Source
Expand description

Video for falcon’s viewer. Files play through the operating system’s own media framework, AVFoundation on macOS (H.264, HEVC, ProRes, … in mp4, mov and m4v). Whatever it refuses (Matroska, WebM, AVI, WMV, FLV, Ogg, MPEG-TS, …) falls back to FFmpeg through falcon-ffmpeg, which loads an LGPL FFmpeg at run time when one is present, as Eagle falls back from Chromium’s player to its bundled one. One Video drives the same viewer either way.

A Video on the system player also moves to FFmpeg, once, when the system player fails after opening, or when it has drawn no picture within 1.5 s of opening: Eagle gives its <video> element the same time. The system player draws a poster picture while paused, so a paused clip counts as drawn. A slow disk gets one switch: FFmpeg is not left again, and if it can’t open the file the system player stays and keeps its time.

  • probe reads a file’s duration, display size and audio track.
  • frame_at decodes the frame at a time, on any thread.
  • Grabber decodes small pictures of one file again and again, for previews such as the seek bar’s hover thumbnail.
  • Video plays a file with sound and hands out each new frame as RGBA pixels for the caller to upload as a texture. It lives on the main thread, as AVFoundation’s player requires.
  • Prepared readies a small Video off the main thread, for the grid’s hover previews: its frames fit a given side, and nothing about opening or dropping it waits on the file.

All Objective-C interop sits in the private mac module; this file and pixels are plain Rust.

Structs§

Error
Why a file could not be opened, probed or decoded.
Frame
A decoded picture: width * height RGBA pixels, rows top to bottom, fully opaque.
Grabber
Decodes small pictures of one file quickly, for previews such as the seek bar’s hover thumbnail, with pictures no larger than max_side on their long side.
Info
What probe learns about a file.
Prepared
A preview read and ready to play, as [Video::start] of what any thread prepared: everything that waits on the file (AVFoundation reading its header, FFmpeg probing its streams) has been done by then.
Video
A playing video, through whichever back end can play it. AVFoundation is tried first; a file it refuses on opening, fails on later, or draws no picture of within 1.5 s is played by FFmpeg when present, keeping the player’s settings and place.

Enums§

Backend
Which decoder plays a file.

Constants§

RATES
Playback speeds, slowest first: the steps the speed keys move through.

Functions§

ffmpeg_available
Whether the FFmpeg fallback can be used.
ffmpeg_status
The FFmpeg fallback’s version and where it was loaded from, or why it can’t be used.
frame_at
The picture at secs, turned the way the track asks. Safe to call from any thread.
needs_ffmpeg
Whether files with extension ext need the FFmpeg fallback: formats macOS can’t play, such as Matroska, WebM, AVI, WMV and FLV.
probe
Reads what the viewer needs before playing. Fails for files with no video track the system or FFmpeg can play.
quarter_turns
Clockwise quarter turns (0 to 3) for a track’s affine transform [a b c d]: an iPhone portrait clip carries [0 1 -1 0], one turn.
step_rate
The next speed up (or down) from rate; the ends stay put. A rate not in RATES moves to the nearest step in that direction.

Type Aliases§

Result