1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Long Screen as a native library: a screen recording in, one big screenshot out.
//!
//! [`run`] drives the same engine the web page runs, pass by pass and in the same order — scan, solve, render,
//! reveal, framing, preview pyramid — over a [`FrameSource`] (a video file decoded natively by `VideoSource`, or
//! RGBA frames you already have). It keeps the rows the page would keep in IndexedDB in an in-memory [`Store`],
//! formats diagnostics with the page's own zh/en catalogue, reports progress and diagnostics to an [`Observer`], and
//! honours pause and stop through a [`Control`] between steps. The [`RunResult`] holds the canvases (the print, its
//! framed presentation and any separate fragments) as tiles, and writes any of them as a PNG of any size, streamed
//! band by band.
//!
//! The command-line tool `long-screen` (feature `cli`) is a thin layer over this crate; a desktop app or a Python
//! binding can drive it the same way.
//!
//! ```no_run
//! use long_screen::{run, Control, DecodeOptions, Options, VideoSource};
//!
//! let mut source = VideoSource::open("recording.mov".as_ref(), DecodeOptions::default())?;
//! let control = Control::new(); // clone it to another thread to pause or stop the run
//! let mut on_progress = |p: &long_screen::Progress| eprintln!("{} {:.0}%", p.phase, p.fraction * 100.0);
//! let result = run(&mut source, &Options::default(), &mut on_progress, &control)?;
//! if let Some(print) = result.print() {
//! let file = std::fs::File::create("print.png")?;
//! result.write_png(&print.id, std::io::BufWriter::new(file))?;
//! }
//! for d in result.diagnostics() {
//! eprintln!("{} {}: {}", d.severity, d.code, d.message);
//! }
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! # Layers
//!
//! The crate root is the driver API. Under it sit the layers the driver, the web page's WebAssembly and the
//! benchmarks are built from. They are public so those builds can reach them, but they are implementation layers:
//! their API follows what those hosts need and may change in minor versions.
//!
//! - [`kernels`]: the reconstruction algorithms (motion, regions and layers, tracking, the pose graph, compositing,
//! reveal, framing, the preview pyramid, YUV→RGBA), with no I/O. Compiles for `wasm32-unknown-unknown`.
//! - [`engine`]: one run as a state machine over the kernels, driven step by step by a host that stores the rows.
//! Compiles for `wasm32-unknown-unknown`.
//! - `decode` (feature `decode`): native video decoding with the system decoder or a user-installed ffmpeg.
//!
//! # Features
//!
//! - `driver` (default): the driver API at the crate root ([`run`], [`Options`], [`RunResult`], the sources, the
//! in-memory [`Store`]). Implies `catalog`.
//! - `decode` (default): the `decode` module and `VideoSource` (AVFoundation on macOS, Media Foundation on Windows,
//! ffmpeg everywhere). Re-exports its options as `DecodeOptions` and `DecodeBackend`.
//! - `rayon` (default): the kernels run on rayon's thread pool. Results do not depend on the thread count.
//! - `catalog` (default): the embedded zh/en diagnostic and progress catalogue and its formatter
//! (`engine::catalog`), which reproduces the web page's messages exactly.
//! - `cli` (default): the `long-screen` command line and its argument parser. Implies `driver` and `decode`.
//!
//! With `default-features = false` only [`kernels`] and [`engine`] remain, which is what the web page's
//! WebAssembly builds.
// The threaded WebAssembly build is compiled with RUSTC_BOOTSTRAP for -Zbuild-std; wait/notify are still unstable
// there (kernels::pool).
// The crate docs above link the driver's items, which a build without the `driver` feature does not have.
pub use ;
pub use *;
// The crate README's examples, compiled by `cargo test --doc`.
;