edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! What a library row is and what it says about its file. |
| 2 | |
| 3 | use crate::*; |
| 4 | |
| 5 | /// What is left on the clipboard after the library row at `removed` was taken |
| 6 | /// out. A copied clip names its file by *index* into the source list |
| 7 | /// (`engine::Clip::source`) and a removal renumbers that list |
| 8 | /// (`engine::Project::remove_source`), so a clipboard kept as it was would paste |
| 9 | /// **a different file** -- the next one along -- over the range it was copied |
| 10 | /// from. |
| 11 | /// |
| 12 | /// An entry whose own file is gone drops out of the clipboard rather than |
| 13 | /// pasting some other take down in its place; a set with even one such |
| 14 | /// member is trimmed, not emptied whole, the way a lane keeps every clip a |
| 15 | /// removal did not touch. Every index past `removed` moves down by one, |
| 16 | /// exactly as the lanes' clips do. |
| 17 | pub |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | /// One library row: a file and one of its audio streams. Plain data, planned |
| 35 | /// before anything is drawn -- which rows exist at all is the branchy part. |
| 36 | |
| 37 | pub |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | /// Every row the library shows: one per source entry, plus one for each further |
| 55 | /// audio stream those files have that no clip plays yet -- a remux with a track |
| 56 | /// per language lists them all, the ones this engine cannot use greyed out |
| 57 | /// rather than hidden. Streams a file has not been probed for yet simply are |
| 58 | /// not there; the row for what *is* on the timeline is always there. |
| 59 | /// |
| 60 | /// `timeline_audio` is the rate and layout of source 0's stream, which every |
| 61 | /// other source must match: one output device and one copied AAC track for the |
| 62 | /// whole timeline (`PlaybackSession::place_stream_at`). `None` while unknown, |
| 63 | /// and then nothing is greyed for it -- the engine still refuses. |
| 64 | pub |
| 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 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | /// Two files whose rows read the same word ("2026-09-09 18-05-50" twice, user |
| 131 | /// 2026-09-10 -- two screen recordings) are told apart on the metadata line |
| 132 | /// rather than left as a pair of identical rows: the folder they came out of |
| 133 | /// when that differs, and a `#n` in arrival order when even the folder is |
| 134 | /// shared. Compared on the stem, because the stem is what the row draws. |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | /// The row's second line: what the stream is and then either how long it is or |
| 177 | /// why it cannot be used, with the separator only where both halves exist (a |
| 178 | /// single-stream file says nothing about its stream). |
| 179 | pub |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | /// How a source's decoder reads: the codec and which seat has it, or the seat |
| 188 | /// alone for a still, which has no coded stream to name. The one place either |
| 189 | /// answer is spelled, so a row, a transport line and a card cannot disagree. |
| 190 | pub |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | /// What the one-shot probe said about a file: the seat it will open on, or -- |
| 198 | /// when the decoder itself refused -- the refusal, in the decoder's own words. |
| 199 | /// |
| 200 | /// Three answers, not two, because "asked" and "refused" are not the same |
| 201 | /// answer. Both used to be a missing entry, and a missing entry drew an empty |
| 202 | /// second line -- the same line a song draws -- so a file this machine cannot |
| 203 | /// decode was indistinguishable from one that needs no word at all. |
| 204 | |
| 205 | pub |
| 206 | |
| 207 | |
| 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 | /// How a row names its file: the file alone when it has one audio stream or |
| 241 | /// none, and the file plus which stream this row is when it has several -- |
| 242 | /// counted from 1, the way a player numbers tracks. |
| 243 | pub |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | /// What a stream is, for the row's second line: the language if the file says |
| 251 | /// one, then rate and layout. A field the header does not give is left out |
| 252 | /// rather than shown as a zero -- a stream we cannot parse says nothing about |
| 253 | /// itself, and saying "0 Hz" would be saying something. |
| 254 | pub |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | /// How big a file is, for a person: the largest unit that keeps the figure to |
| 267 | /// one decimal (`1.2 GB`, `840 MB`), bytes below a kilobyte. |
| 268 | pub |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | /// A picture's height as a person names it: `1080p`, and `4K` for the 2160 |
| 282 | /// line, which is the one name people use for it. |
| 283 | pub |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | /// One stream's rate in the unit its size asks for: bits a second below a |
| 291 | /// kilobit, kilobits below a megabit, megabits above. One track's own rate, so |
| 292 | /// there is no shared unit to keep across a line of them. |
| 293 | pub |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | /// A picture track as the properties plate says it: codec, size, rate, depth |
| 302 | /// and its own bitrate, each left out where the file does not state it. |
| 303 | pub |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | /// A sound track as the properties plate says it: codec, rate, layout, depth |
| 321 | /// and its own bitrate. The codec is `"unknown"` only where the header will not |
| 322 | /// name it, which says nothing and is left out. |
| 323 | pub |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | /// What the properties plate says about a file, top to bottom: the file and its |
| 342 | /// path, its container and size, then one line per picture and sound track. |
| 343 | /// Rows the probe has not answered for are simply not there -- the plate fills |
| 344 | /// in as the header reads, and never says "unknown". |
| 345 | pub |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | /// The plate's Copy button: the full path on the clipboard, and a toast that |
| 384 | /// says so. Shared by both properties plates so the two cannot word it apart. |
| 385 | pub |
| 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | |
| 416 | |
| 417 | |
| 418 | |
| 419 | |
| 420 | |
| 421 | |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | |
| 430 | |
| 431 | |
| 432 | /// A rate in the line's unit as a person reads it: one decimal above 1 of it, |
| 433 | /// two below -- a 128 kbps song rounded to one decimal is "0.1", which reads as |
| 434 | /// a guess where "0.13" reads as a measurement. |
| 435 | /// |
| 436 | /// Never `0.00`: [`bits_label`] only asks for this in a unit where the number |
| 437 | /// is at least 0.001 of it, so two decimals always reach it. Every rate that |
| 438 | /// gets here is one the container really stated (the probe leaves out what it |
| 439 | /// does not state, it never zeroes it), and a "0.00 sound" would be this card |
| 440 | /// saying a track that plays is silent. |
| 441 | pub |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | /// A language tag as a person reads it. Everything a file writes is passed |
| 450 | /// through untouched bar the one tag that is not a language: "und" is what a |
| 451 | /// muxer writes when nobody said, and a row showing it verbatim names a |
| 452 | /// language nobody speaks. |
| 453 | pub |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | pub |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | /// Why a stream cannot go on this timeline, or `None` if it can. Both answers |
| 470 | /// are shown: a stream nothing can be done with is listed greyed with the |
| 471 | /// reason, never dropped from the list -- a file has the tracks it has, and a |
| 472 | /// picker that hides them is a picker that lies. |
| 473 | pub |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | /// How wide the equalizer card is drawn in a window this wide: all of it bar a |
| 497 | /// margin, up to [`EQ_W_MAX`]. The card is a graph, and a graph of twenty |
| 498 | /// thousand hertz on 320 px spends four pixels on the octave below middle C -- |
| 499 | /// so it takes the room a big window has and stays inside a small one. Floored |
| 500 | /// at the other cards' width, which is the last size the rows still read at. |
| 501 | pub |
| 502 | |
| 503 | |
| 504 | |
| 505 | |
| 506 | |
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | |
| 512 | |
| 513 | /// How wide a non-EQ param card is drawn: its usual fixed width, or (when |
| 514 | /// maximized) all of the window bar the same margin the EQ card gives |
| 515 | /// itself -- never narrower than its own floor, so a small window's |
| 516 | /// maximize is a no-op rather than a shrink. |
| 517 | pub |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | /// What the media list is given of the window. A share of it, so a narrow |
| 526 | /// window gives the panel less rather than giving the picture nothing, floored |
| 527 | /// where a name stops being readable and capped at a third of the window -- |
| 528 | /// the picture is what the program is for and keeps the majority at every size. |
| 529 | pub |
| 530 | |
| 531 | |
| 532 | |
| 533 | |
| 534 | |
| 535 | /// What the window is called: the program, and what is open in it. The name is |
| 536 | /// what the header shows, so an empty window says the program alone rather than |
| 537 | /// "no file open — edith". |
| 538 | pub |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | /// What the window is called once a project is in play: the same name the |
| 547 | /// header bar shows (`ui::menubar::bar`), so the title and the bar never |
| 548 | /// disagree. A project started or saved answers with its own name; an unsaved |
| 549 | /// one is "Untitled"; with no project at all the window keeps `name`, which is |
| 550 | /// the media's. |
| 551 | pub |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | /// The tint a clip from source `n` wears. Cycled rather than extended: past the |
| 562 | /// palette two sources share a colour, which is a smaller lie than a fifth tint |
| 563 | /// bright enough to leave the family. |
| 564 | pub |
| 565 | |
| 566 | |
| 567 | |
| 568 | /// The tint of a *file*, which is what a library row is named by: the first |
| 569 | /// source entry naming it, since two audio streams of one file are two sources |
| 570 | /// and one colour. |
| 571 | /// |
| 572 | /// `None` for a path no source names -- a standalone `.srt` is on nobody's |
| 573 | /// timeline, and painting it with the first file's colour would say it came out |
| 574 | /// of that file. No swatch says what is true: it belongs to itself. |
| 575 | pub |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | |
| 584 | |
| 585 | |
| 586 | |
| 587 | |
| 588 | |
| 589 | |
| 590 |