edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB6a8d990Tahinli15 days ago1049 commits
| 1 | //! Video engine: demux -> decode -> pixel convert. No UI dependencies. |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | pub |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | pub |
| 42 | |
| 43 | pub |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | pub |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | pub |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | pub use |
| 82 | |
| 83 | ; |
| 84 | pub use PlaybackClock; |
| 85 | pub use |
| 86 | |
| 87 | ; |
| 88 | pub use |
| 89 | |
| 90 | |
| 91 | ; |
| 92 | pub use ExportHandle; |
| 93 | pub use ; |
| 94 | pub use ; |
| 95 | pub use ; |
| 96 | |
| 97 | /// Whether a path names a standalone audio file -- a source with no picture, |
| 98 | /// which belongs on the audio lane and nowhere else. Extension only, lowercased: |
| 99 | /// the decoder is what really decides, but a front-end has to know which lane a |
| 100 | /// dropped file may land on *before* anything is opened, and so does |
| 101 | /// [`PlaybackSession::import`](playback::PlaybackSession::import). |
| 102 | /// |
| 103 | /// Exactly the containers the engine's audio path reads (`audio::AudioSession`), |
| 104 | /// Opus included: `.opus` is an Ogg file symphonia's probe already reads and |
| 105 | /// `ec-opus` decodes, and `.mka` is the Matroska whose sound is all it |
| 106 | /// has. A `.dts` or a bare `.ac3` is refused by the same door that refuses a |
| 107 | /// `.txt` -- there is no reader here that opens an elementary stream -- which is |
| 108 | /// the honest answer. |
| 109 | /// |
| 110 | /// The `.mpeg` and `.mpg` spellings are on the list because an MPEG audio |
| 111 | /// stream has no container to name it and the file is whatever a recorder |
| 112 | /// called it: those two are the *standard's* name -- what a voice note or a |
| 113 | /// tagged download off the web wears -- where `.mp3` is the codec's. Symphonia's |
| 114 | /// `mp3` reader is what reads them, the same reader an `.mp3` goes through, and |
| 115 | /// it skips the ID3v2 tag and any cover picture muxed into one. A `.mpeg`/`.mpg` that |
| 116 | /// is really an MPEG *program stream* with a picture in it is read by the program |
| 117 | /// stream demuxer ([`demux::is_mpegps`]) and is no audio file: those two spellings |
| 118 | /// are the one place the bytes are looked at. (MPEG's other two layers, `.mp1`/`.mp2`, are |
| 119 | /// deliberately absent: this build compiles the mp3 bundle without its `mp1`/ |
| 120 | /// `mp2` features, so a layer II stream is a codec nothing here decodes, and |
| 121 | /// admitting the spelling would be a promise the reader cannot keep.) |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | /// Whether a path names a still image -- a source with a picture and no sound |
| 154 | /// and no length of its own, which belongs on a video lane and nowhere else. |
| 155 | /// Extension only, lowercased, for [`is_audio`]'s reason: a front-end has to |
| 156 | /// know which lane a dropped file may land on before anything is opened. |
| 157 | /// |
| 158 | /// Exactly the formats `image` is built with here (see `Cargo.toml`): PNG, |
| 159 | /// JPEG and WebP. A `.gif` or a `.tif` is refused by the same door that refuses |
| 160 | /// a `.txt`, which is the honest answer until a decoder for it is compiled in. |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | /// Whether a source's file is there to read: a real file, or a generator, which has none to miss. |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | /// The largest picture this engine composes onto, either way: 7680, which is |
| 181 | /// where a per-frame buffer stops being a sane thing to allocate. |
| 182 | /// |
| 183 | /// That is 8K **UHD** (7680x4320), not 8K DCI (8192x4320). A DCI-width master |
| 184 | /// -- a ProRes 4444 XQ feature, for instance -- is 8192 wide and is refused |
| 185 | /// here by name, which it was not before the container doors asked this bound |
| 186 | /// of a file's own header rather than only of a keystroke and a `.edith` line. |
| 187 | /// The bound is deliberately not raised to 8192 to admit it: `is_resolution` |
| 188 | /// gates those two doors at 7680 too, and widening the ceiling on every path |
| 189 | /// to accommodate a container is a wider decision than a header fix should |
| 190 | /// make. A caller that needs DCI width needs the ceiling raised deliberately, |
| 191 | /// on all four doors at once. |
| 192 | pub const MAX_RESOLUTION: u32 = 7680; |
| 193 | |
| 194 | /// Whether a project resolution is a picture at all: not zero either way, and |
| 195 | /// not past [`MAX_RESOLUTION`]. Both doors ask -- the keystroke |
| 196 | /// ([`PlaybackSession::set_resolution`](playback::PlaybackSession::set_resolution)) |
| 197 | /// and the file ([`edith::load`]) -- so a hand-written `resolution` line cannot |
| 198 | /// reach an allocation a keypress could not, which is how `4294967295` used to |
| 199 | /// panic the open with a capacity overflow. |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | /// Boxed error; the engine has few failure modes and every one of them is fatal |
| 205 | /// to the session, so a message is all a caller can act on. |
| 206 | pub type Error = ; |
| 207 | pub type Result<T> = Result; |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 |