edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB978e685Tahinli3 months ago627 commits
| 1 | //! Container demux: pulls the video track out as access units the decoders take |
| 2 | //! -- Annex-B for H.264 and HEVC, the sample bytes untouched for VP9 (an mp4 VP9 |
| 3 | //! sample is a self-contained superframe already) and for AV1, whose Matroska |
| 4 | //! block is one temporal unit in the low-overhead OBU format the decoder reads. |
| 5 | //! |
| 6 | //! Two containers, one interface: mp4 through the `mp4` crate, Matroska |
| 7 | //! (`.mkv`/`.webm`) walked here as EBML. AV1 is why the second one exists -- |
| 8 | //! `mp4 0.14` has no `av01` sample entry at all, and AV1 ships in Matroska in |
| 9 | //! practice -- and HEVC rides the same walk, because that is the other codec a |
| 10 | //! `.mkv` off a disc arrives in. An AV1 *mp4* is read here too, its sample entry |
| 11 | //! picked out of the `stsd` by hand for the same reason `mux` writes it by hand: |
| 12 | //! this project exports one, and a file this cannot reopen is a file it had no |
| 13 | //! business writing. |
| 14 | |
| 15 | use OsString; |
| 16 | use File; |
| 17 | use ; |
| 18 | use ; |
| 19 | use ; |
| 20 | use UNIX_EPOCH; |
| 21 | |
| 22 | use ; |
| 23 | |
| 24 | use crate; |
| 25 | use crate; |
| 26 | |
| 27 | const START_CODE: = ; |
| 28 | |
| 29 | /// What a cancelled read fails with. A message rather than a variant because |
| 30 | /// [`crate::Error`] is a boxed error and always was; [`is_cancelled`] is what |
| 31 | /// tells this apart from a file that really would not open, so an abandoned |
| 32 | /// read is never reported to anyone as a broken file. |
| 33 | const CANCELLED: &str = "read cancelled"; |
| 34 | |
| 35 | thread_local! |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | /// Runs `read` with `flag` as this thread's cancel: setting it abandons the |
| 50 | /// walks inside at their next element, with [`CANCELLED`] rather than a verdict |
| 51 | /// about the file. Restores whatever was installed before, so a nested read is |
| 52 | /// not silently un-cancelled. |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | /// Whether the read on this thread has been abandoned; `false` where nobody |
| 64 | /// installed a flag, which is every caller that has nothing to cancel. |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | /// Whether `error` is a read that was abandoned rather than a file that could |
| 74 | /// not be read: what keeps a cancelled import off the notice bar and a |
| 75 | /// superseded audio open off stderr. |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | /// What the video track is coded with. Not a decoder choice by itself: only |
| 81 | /// H.264 has a software decoder here, which is what [`Codec::needs_plugin`] |
| 82 | /// says for the others. |
| 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 | /// The capability matrix: every [`Codec`] the decoder layer can be handed, with |
| 125 | /// the id that names it in each container -- the Matroska `CodecID` and the mp4 |
| 126 | /// `stsd` sample entry fourcc. Both dispatches read *this*, so a codec is |
| 127 | /// reachable from both containers or from neither, never from one because |
| 128 | /// somebody wrote an arm and forgot its twin (VP9 was exactly that: decoded out |
| 129 | /// of an mp4, refused out of a `.webm`, with the VA-API decoder wired all along). |
| 130 | /// |
| 131 | /// A cell that is deliberately absent is a row in [`UNSUPPORTED`] with a reason, |
| 132 | /// never a silent fall-through; `every_codec_is_reachable_from_both_containers` |
| 133 | /// holds both halves. |
| 134 | const CODEC_IDS: & = & |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | ; |
| 140 | |
| 141 | /// The written-down gaps: container ids -- a Matroska `CodecID` or a four-byte |
| 142 | /// mp4 fourcc -- this reads no picture out of, and why. Asserted to be genuinely |
| 143 | /// unreachable by the same test that asserts [`CODEC_IDS`] is reachable, so a gap |
| 144 | /// that gets closed has to be moved out of here rather than left lying as a false |
| 145 | /// claim. |
| 146 | const UNSUPPORTED: & = & |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | ; |
| 160 | |
| 161 | /// Which codec a Matroska `CodecID` names, or `None` for a track this reads no |
| 162 | /// picture out of. The mkv half of [`CODEC_IDS`]. |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | /// Which codec an mp4 `stsd` sample entry fourcc names. The mp4 half of |
| 171 | /// [`CODEC_IDS`], plus `hev1`: HEVC arrives under either fourcc and the record |
| 172 | /// the parameter sets come out of is the same `hvcC` either way. |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | /// The one refusal that is an **answer**: this file carries no picture at all |
| 184 | /// that this engine reads -- a song in a video container, an audio-only mp4 or |
| 185 | /// Matroska, a `.mka` under any name. |
| 186 | /// |
| 187 | /// A type rather than a sentence, because two callers want two different things |
| 188 | /// from it. A front-end shows its `Display`, which is the words it always was, |
| 189 | /// and refuses the import by them. [`crate::proxy`] wants to tell it from *"this |
| 190 | /// file is broken"*: a song is not a film to stand in for and saying "NO PROXY" |
| 191 | /// about one is a refusal nobody asked for, while a film that will not open is |
| 192 | /// worth a line. Neither could tell them apart by matching on prose, and prose |
| 193 | /// is the one thing in this engine that is free to be reworded. |
| 194 | /// |
| 195 | /// A file whose picture is in a codec nothing here decodes is **not** this: it |
| 196 | /// has a video track, the refusal names the codec, and that stays loud. |
| 197 | |
| 198 | ; |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 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 | /// What a file spends its bytes at, in bits per second -- the whole file, and |
| 231 | /// what each of its streams costs inside it. |
| 232 | /// |
| 233 | /// The three are one budget split three ways, so all three are measured over |
| 234 | /// **the same seconds**: the container's own duration, not each track's. That |
| 235 | /// is what makes the line read as a breakdown -- `total` can never come out |
| 236 | /// below `video + audio`, because those are disjoint byte counts over a shared |
| 237 | /// denominator, and the leftover is the container's overhead. Dividing each |
| 238 | /// track by its own length is how a file with 2 s of picture and 60 s of sound |
| 239 | /// reports a total thirty times its real byte rate, under components that add |
| 240 | /// up to a thirtieth of it. |
| 241 | /// |
| 242 | /// Every field is `None` rather than `0` wherever the container does not state |
| 243 | /// the number and nothing here derives it. A properties row a header did not |
| 244 | /// give is left out rather than shown as a zero, and a fabricated `0 kbps` is |
| 245 | /// not a missing measurement, it is a wrong one. |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | /// What `path` is coded at, from its header and its sample table alone -- |
| 264 | /// **no decoder is opened**, which is what lets a library probe run this over |
| 265 | /// every file it lists. |
| 266 | /// |
| 267 | /// The cost is one [`Demuxer::open`]: an mp4's boxes, or a Matroska segment's |
| 268 | /// element headers, both of which the caller's other per-file probes already |
| 269 | /// pay. Nothing here reads a block payload. |
| 270 | /// |
| 271 | /// Cheap is not instant, and the caller has to know which: measured over |
| 272 | /// `a local media folder`, every mp4 answered in single-digit milliseconds, and a |
| 273 | /// 12.9 GB 2160p AV1 Matroska took **seconds** cold and ~150 ms warm -- |
| 274 | /// Matroska indexes no samples, so its open walks every cluster header in the |
| 275 | /// file, and what that costs is disk, not arithmetic. Timings on that file |
| 276 | /// swing between ~150 ms and ~1.2 s run to run on the same build, so treat any |
| 277 | /// figure here as an order of magnitude and nothing finer. This belongs on |
| 278 | /// `background_executor` like every other open, never on a repaint. |
| 279 | /// |
| 280 | /// A file that will not open at all -- no video track, a codec nothing reads, |
| 281 | /// a still image, which has no playing time of its own -- comes back all |
| 282 | /// `None`. That is the answer, not an error: the cards this feeds show the |
| 283 | /// rows they have. |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 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 | |
| 384 | |
| 385 | |
| 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 | /// `bytes` over `secs`, in bits per second, or `None` where that is not a |
| 419 | /// number worth showing: nothing measured either side, or a rate that rounds to |
| 420 | /// zero. A `0` here would read as a real measurement, which is the one answer |
| 421 | /// this must never give. |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | /// How many bytes of the file an mp4 track's samples are -- its share of the |
| 429 | /// `mdat`, which over the container's seconds is its share of the byte rate. |
| 430 | /// |
| 431 | /// Not `Mp4Track::bitrate`, deliberately, though that looks like the ready-made |
| 432 | /// answer. It divides by the track's *own* duration, which is the arithmetic |
| 433 | /// [`MediaBitrate`] exists to not do; it truncates that duration to whole |
| 434 | /// seconds (`mp4-0.14.0/src/track.rs:213`), so a file under a second comes back |
| 435 | /// `0`; and for an `mp4a` track it answers `esds.avg_bitrate` instead, a number |
| 436 | /// the encoder declared rather than one the file spends, which is `0` on any |
| 437 | /// `esds` that declared none. Bytes are what all three of these fields agree to |
| 438 | /// be measured in. |
| 439 | /// |
| 440 | /// `Mp4Track::total_sample_size` is private to that crate; this is it, off the |
| 441 | /// `stsz` fields that are not. |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | /// The file, whichever container it came in. Which one is decided by the |
| 451 | /// extension at [`Demuxer::open`] and never again: everything downstream -- |
| 452 | /// playback, export, the plugin -- speaks access units and display frames. |
| 453 | |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | |
| 497 | |
| 498 | |
| 499 | |
| 500 | |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | |
| 506 | |
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | |
| 512 | |
| 513 | |
| 514 | |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | |
| 534 | |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | |
| 575 | |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | |
| 584 | |
| 585 | /// Whether a path names a Matroska file, which is where AV1 arrives and where a |
| 586 | /// film off a disc arrives as HEVC. Extension only, like [`crate::is_audio`]: |
| 587 | /// the demuxer is what really decides, but the audio path has to know before it |
| 588 | /// opens anything that this file's sound is read by symphonia's `mkv` reader |
| 589 | /// and not by either mp4 one (see [`crate::audio::Track::open`]). |
| 590 | /// |
| 591 | /// *Every* extension Matroska states, not the two that carry a film: `.mka` is |
| 592 | /// the sound alone and `.mks` the subtitles alone -- the same bytes, the same |
| 593 | /// reader, so refusing them was this engine refusing a file it parses. The set |
| 594 | /// is the standard's own and closed by it. |
| 595 | |
| 596 | |
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | |
| 602 | |
| 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
| 611 | |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | |
| 617 | |
| 618 | |
| 619 | |
| 620 | |
| 621 | |
| 622 | |
| 623 | |
| 624 | |
| 625 | |
| 626 | |
| 627 | |
| 628 | |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | |
| 638 | |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | |
| 650 | |
| 651 | |
| 652 | |
| 653 | |
| 654 | |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | |
| 702 | |
| 703 | |
| 704 | |
| 705 | |
| 706 | |
| 707 | |
| 708 | |
| 709 | |
| 710 | |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
| 715 | |
| 716 | |
| 717 | |
| 718 | |
| 719 | |
| 720 | |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 725 | |
| 726 | |
| 727 | |
| 728 | |
| 729 | |
| 730 | |
| 731 | |
| 732 | |
| 733 | |
| 734 | |
| 735 | |
| 736 | |
| 737 | |
| 738 | |
| 739 | |
| 740 | |
| 741 | |
| 742 | |
| 743 | |
| 744 | |
| 745 | |
| 746 | |
| 747 | |
| 748 | |
| 749 | |
| 750 | |
| 751 | |
| 752 | |
| 753 | |
| 754 | |
| 755 | |
| 756 | |
| 757 | |
| 758 | |
| 759 | |
| 760 | |
| 761 | |
| 762 | |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | |
| 779 | |
| 780 | |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |
| 797 | |
| 798 | |
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | |
| 804 | |
| 805 | |
| 806 | |
| 807 | |
| 808 | |
| 809 | |
| 810 | |
| 811 | |
| 812 | |
| 813 | |
| 814 | |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | |
| 821 | |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | |
| 827 | |
| 828 | |
| 829 | |
| 830 | |
| 831 | |
| 832 | |
| 833 | |
| 834 | |
| 835 | |
| 836 | |
| 837 | |
| 838 | |
| 839 | |
| 840 | |
| 841 | |
| 842 | |
| 843 | |
| 844 | |
| 845 | |
| 846 | |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | |
| 854 | |
| 855 | |
| 856 | |
| 857 | |
| 858 | |
| 859 | |
| 860 | |
| 861 | |
| 862 | |
| 863 | |
| 864 | |
| 865 | |
| 866 | |
| 867 | |
| 868 | |
| 869 | |
| 870 | |
| 871 | |
| 872 | |
| 873 | |
| 874 | |
| 875 | |
| 876 | |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | |
| 882 | |
| 883 | |
| 884 | |
| 885 | |
| 886 | /// One Matroska block of an indexed track: where its bytes are, whether a |
| 887 | /// decoder may start on it, and when it is presented (in `TimestampScale` |
| 888 | /// ticks, which is what a sound track seeks against -- Matroska indexes no |
| 889 | /// samples either). 24 bytes an entry, so an hour of 30 fps costs ~2.6 MB of |
| 890 | /// index -- the price of knowing the frame count and the sync points of a |
| 891 | /// container that indexes neither. |
| 892 | |
| 893 | |
| 894 | |
| 895 | |
| 896 | |
| 897 | |
| 898 | |
| 899 | |
| 900 | /// AV1, HEVC or H.264 out of a Matroska file (`.mkv`/`.webm`). |
| 901 | /// |
| 902 | /// Matroska carries no sample table, so where an mp4 has an `stss` this has to |
| 903 | /// read the file. What it reads is the file's own **`Cues`**: the seek index a |
| 904 | /// muxer writes at the far end of the segment, one entry per keyframe, found |
| 905 | /// through the `SeekHead` in kilobytes rather than gigabytes. The clusters |
| 906 | /// themselves are walked **only where a caller asks to read** -- one cue |
| 907 | /// interval at a time, ten seconds of film -- and the window of [`Block`]s that |
| 908 | /// walk builds is what [`Self::next_access_unit`] hands out. |
| 909 | /// |
| 910 | /// That turned a 4.9 GB film's open from 3.2 s cold (9.9 MB of element headers, |
| 911 | /// every cluster in the file) into ~30 ms, and an open happens on every seek and |
| 912 | /// every clip span, not once per file. |
| 913 | /// |
| 914 | /// A file with no usable `Cues` -- no index at all, or a track that declares no |
| 915 | /// `DefaultDuration`, so a cue time cannot be turned into a frame number -- gets |
| 916 | /// the whole-segment walk this always did ([`mkv_blocks`]), which is also where |
| 917 | /// a cue index caught disagreeing with the blocks it names degrades to |
| 918 | /// ([`Self::cues_agree`]). Both paths answer the same questions with the same |
| 919 | /// numbers; only what they read to do it differs. |
| 920 | |
| 921 | |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
| 941 | |
| 942 | |
| 943 | |
| 944 | |
| 945 | |
| 946 | |
| 947 | |
| 948 | |
| 949 | |
| 950 | |
| 951 | |
| 952 | |
| 953 | |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | |
| 959 | |
| 960 | |
| 961 | |
| 962 | |
| 963 | |
| 964 | |
| 965 | |
| 966 | |
| 967 | |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | |
| 979 | |
| 980 | |
| 981 | |
| 982 | |
| 983 | |
| 984 | |
| 985 | |
| 986 | |
| 987 | |
| 988 | |
| 989 | |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | |
| 996 | |
| 997 | |
| 998 | |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | |
| 1015 | |
| 1016 | |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 | |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | |
| 1037 | |
| 1038 | |
| 1039 | |
| 1040 | |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | |
| 1057 | |
| 1058 | |
| 1059 | |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | |
| 1087 | |
| 1088 | |
| 1089 | |
| 1090 | |
| 1091 | |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | |
| 1096 | |
| 1097 | |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | |
| 1139 | |
| 1140 | |
| 1141 | |
| 1142 | |
| 1143 | |
| 1144 | |
| 1145 | |
| 1146 | |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | |
| 1152 | |
| 1153 | |
| 1154 | |
| 1155 | |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | |
| 1160 | |
| 1161 | |
| 1162 | |
| 1163 | |
| 1164 | |
| 1165 | |
| 1166 | |
| 1167 | |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | |
| 1174 | |
| 1175 | |
| 1176 | |
| 1177 | |
| 1178 | |
| 1179 | |
| 1180 | |
| 1181 | |
| 1182 | |
| 1183 | |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | |
| 1217 | |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | |
| 1233 | |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | |
| 1242 | |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 | |
| 1247 | |
| 1248 | |
| 1249 | |
| 1250 | |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | |
| 1299 | |
| 1300 | |
| 1301 | |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | |
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | |
| 1345 | |
| 1346 | |
| 1347 | |
| 1348 | |
| 1349 | |
| 1350 | |
| 1351 | |
| 1352 | |
| 1353 | |
| 1354 | |
| 1355 | |
| 1356 | |
| 1357 | |
| 1358 | |
| 1359 | |
| 1360 | |
| 1361 | |
| 1362 | |
| 1363 | |
| 1364 | |
| 1365 | |
| 1366 | |
| 1367 | |
| 1368 | |
| 1369 | |
| 1370 | |
| 1371 | |
| 1372 | |
| 1373 | |
| 1374 | |
| 1375 | |
| 1376 | |
| 1377 | |
| 1378 | |
| 1379 | |
| 1380 | |
| 1381 | |
| 1382 | |
| 1383 | |
| 1384 | |
| 1385 | |
| 1386 | |
| 1387 | |
| 1388 | |
| 1389 | |
| 1390 | |
| 1391 | |
| 1392 | |
| 1393 | |
| 1394 | |
| 1395 | |
| 1396 | |
| 1397 | |
| 1398 | |
| 1399 | |
| 1400 | |
| 1401 | |
| 1402 | |
| 1403 | |
| 1404 | |
| 1405 | |
| 1406 | |
| 1407 | |
| 1408 | |
| 1409 | |
| 1410 | |
| 1411 | |
| 1412 | |
| 1413 | |
| 1414 | |
| 1415 | |
| 1416 | |
| 1417 | |
| 1418 | |
| 1419 | |
| 1420 | |
| 1421 | |
| 1422 | |
| 1423 | |
| 1424 | |
| 1425 | |
| 1426 | |
| 1427 | |
| 1428 | |
| 1429 | |
| 1430 | |
| 1431 | |
| 1432 | |
| 1433 | |
| 1434 | |
| 1435 | |
| 1436 | |
| 1437 | |
| 1438 | |
| 1439 | |
| 1440 | |
| 1441 | |
| 1442 | |
| 1443 | |
| 1444 | |
| 1445 | |
| 1446 | |
| 1447 | |
| 1448 | |
| 1449 | |
| 1450 | |
| 1451 | |
| 1452 | |
| 1453 | |
| 1454 | |
| 1455 | |
| 1456 | |
| 1457 | |
| 1458 | |
| 1459 | |
| 1460 | |
| 1461 | |
| 1462 | |
| 1463 | |
| 1464 | |
| 1465 | |
| 1466 | |
| 1467 | |
| 1468 | |
| 1469 | |
| 1470 | |
| 1471 | |
| 1472 | |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | |
| 1478 | |
| 1479 | |
| 1480 | |
| 1481 | |
| 1482 | |
| 1483 | |
| 1484 | |
| 1485 | |
| 1486 | |
| 1487 | |
| 1488 | |
| 1489 | |
| 1490 | |
| 1491 | |
| 1492 | |
| 1493 | |
| 1494 | |
| 1495 | |
| 1496 | |
| 1497 | |
| 1498 | |
| 1499 | |
| 1500 | |
| 1501 | |
| 1502 | |
| 1503 | |
| 1504 | |
| 1505 | |
| 1506 | |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | |
| 1511 | |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | |
| 1525 | |
| 1526 | |
| 1527 | |
| 1528 | |
| 1529 | |
| 1530 | |
| 1531 | |
| 1532 | |
| 1533 | |
| 1534 | |
| 1535 | |
| 1536 | |
| 1537 | |
| 1538 | |
| 1539 | |
| 1540 | |
| 1541 | |
| 1542 | |
| 1543 | |
| 1544 | |
| 1545 | |
| 1546 | |
| 1547 | |
| 1548 | |
| 1549 | |
| 1550 | |
| 1551 | |
| 1552 | |
| 1553 | |
| 1554 | |
| 1555 | |
| 1556 | |
| 1557 | |
| 1558 | |
| 1559 | |
| 1560 | |
| 1561 | |
| 1562 | |
| 1563 | |
| 1564 | |
| 1565 | |
| 1566 | |
| 1567 | |
| 1568 | |
| 1569 | |
| 1570 | |
| 1571 | |
| 1572 | |
| 1573 | |
| 1574 | |
| 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
| 1579 | |
| 1580 | |
| 1581 | |
| 1582 | |
| 1583 | |
| 1584 | |
| 1585 | |
| 1586 | |
| 1587 | |
| 1588 | |
| 1589 | |
| 1590 | |
| 1591 | |
| 1592 | |
| 1593 | |
| 1594 | |
| 1595 | |
| 1596 | |
| 1597 | |
| 1598 | |
| 1599 | |
| 1600 | |
| 1601 | |
| 1602 | |
| 1603 | |
| 1604 | |
| 1605 | |
| 1606 | /// One coded picture as a file holds it, for the export's copy path |
| 1607 | /// ([`MkvDemuxer::coded_block`]): the very bytes the muxer writes back out, the |
| 1608 | /// sync flag a container states beside them, and when the picture is shown. |
| 1609 | |
| 1610 | |
| 1611 | |
| 1612 | |
| 1613 | |
| 1614 | |
| 1615 | /// Every block of `path`'s picture track a decoder may be started from, by the |
| 1616 | /// block index the whole engine counts a source's frames in -- the frames a cut |
| 1617 | /// may be placed on for the export to copy the film instead of coding it again |
| 1618 | /// ([`crate::export::planned_seats`] is the same question asked of a whole |
| 1619 | /// timeline). |
| 1620 | /// |
| 1621 | /// Empty for a file that will not open, and for a Matroska one whose clusters |
| 1622 | /// cannot be walked. |
| 1623 | /// |
| 1624 | /// An mp4 answers off its `stss` table for nothing; Matroska costs the walk, |
| 1625 | /// once per file (6.7 s on a 12.9 GB film, then a sidecar read of a few |
| 1626 | /// milliseconds -- [`MkvDemuxer::is_sync`]): ask it off a render thread. |
| 1627 | |
| 1628 | |
| 1629 | |
| 1630 | |
| 1631 | |
| 1632 | |
| 1633 | |
| 1634 | |
| 1635 | |
| 1636 | |
| 1637 | |
| 1638 | |
| 1639 | |
| 1640 | |
| 1641 | |
| 1642 | |
| 1643 | |
| 1644 | |
| 1645 | |
| 1646 | |
| 1647 | /// The codec id of `path`'s first audio track (`A_AAC`, `A_OPUS`, ...), or |
| 1648 | /// `None` for a Matroska file with no sound at all. Header only, and only worth |
| 1649 | /// calling once a session has come up silent: a Matroska file's sound is read |
| 1650 | /// by symphonia, or by the Dolby decoder where it is AC-3 ([`MkvAudio`]), and |
| 1651 | /// this exists to say which codec neither of them took. |
| 1652 | |
| 1653 | |
| 1654 | |
| 1655 | |
| 1656 | |
| 1657 | |
| 1658 | |
| 1659 | /// One audio `TrackEntry` of a Matroska file, as the header describes it. |
| 1660 | |
| 1661 | |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | |
| 1666 | |
| 1667 | |
| 1668 | |
| 1669 | |
| 1670 | |
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 | |
| 1675 | |
| 1676 | /// Every audio track of a Matroska file, in file order: the numbering |
| 1677 | /// [`crate::AudioSession::probe_streams`] hands out, and the one a dual-audio |
| 1678 | /// remux is picked from. Header only, like [`matroska_audio_codec`], and an |
| 1679 | /// empty list is a file with no sound at all rather than an error. |
| 1680 | |
| 1681 | |
| 1682 | |
| 1683 | |
| 1684 | |
| 1685 | |
| 1686 | |
| 1687 | /// The AC-3 / E-AC-3 sound of a Matroska file: every block of its first audio |
| 1688 | /// track, in storage order, with the timestamp a seek resolves against. The |
| 1689 | /// same walk the picture costs ([`MkvDemuxer`]), on the other track number, and |
| 1690 | /// the two keep their own file handle and their own index -- the sound is |
| 1691 | /// opened by the audio worker and the picture by the decoder, never together. |
| 1692 | /// |
| 1693 | /// Matroska carries no sample table, so a block's own timestamp is the only |
| 1694 | /// thing a window can be resolved against; [`Self::block_at`] is what an `stts` |
| 1695 | /// lookup is on the mp4 side. |
| 1696 | |
| 1697 | |
| 1698 | |
| 1699 | |
| 1700 | |
| 1701 | |
| 1702 | |
| 1703 | |
| 1704 | |
| 1705 | |
| 1706 | |
| 1707 | |
| 1708 | |
| 1709 | |
| 1710 | |
| 1711 | |
| 1712 | |
| 1713 | |
| 1714 | |
| 1715 | |
| 1716 | |
| 1717 | |
| 1718 | |
| 1719 | |
| 1720 | |
| 1721 | |
| 1722 | |
| 1723 | |
| 1724 | |
| 1725 | |
| 1726 | |
| 1727 | |
| 1728 | |
| 1729 | |
| 1730 | |
| 1731 | |
| 1732 | |
| 1733 | |
| 1734 | |
| 1735 | |
| 1736 | |
| 1737 | |
| 1738 | |
| 1739 | |
| 1740 | |
| 1741 | |
| 1742 | |
| 1743 | |
| 1744 | |
| 1745 | |
| 1746 | |
| 1747 | |
| 1748 | |
| 1749 | |
| 1750 | |
| 1751 | |
| 1752 | |
| 1753 | |
| 1754 | |
| 1755 | |
| 1756 | |
| 1757 | |
| 1758 | |
| 1759 | |
| 1760 | |
| 1761 | |
| 1762 | |
| 1763 | |
| 1764 | |
| 1765 | |
| 1766 | |
| 1767 | |
| 1768 | |
| 1769 | |
| 1770 | |
| 1771 | |
| 1772 | |
| 1773 | |
| 1774 | |
| 1775 | |
| 1776 | |
| 1777 | |
| 1778 | |
| 1779 | |
| 1780 | |
| 1781 | |
| 1782 | |
| 1783 | |
| 1784 | |
| 1785 | |
| 1786 | |
| 1787 | |
| 1788 | |
| 1789 | |
| 1790 | |
| 1791 | |
| 1792 | |
| 1793 | |
| 1794 | |
| 1795 | |
| 1796 | |
| 1797 | |
| 1798 | |
| 1799 | |
| 1800 | |
| 1801 | |
| 1802 | |
| 1803 | |
| 1804 | |
| 1805 | |
| 1806 | /// What the `Tracks` element says about the video track. |
| 1807 | |
| 1808 | |
| 1809 | |
| 1810 | |
| 1811 | |
| 1812 | |
| 1813 | |
| 1814 | |
| 1815 | |
| 1816 | |
| 1817 | |
| 1818 | |
| 1819 | |
| 1820 | |
| 1821 | |
| 1822 | |
| 1823 | |
| 1824 | |
| 1825 | |
| 1826 | |
| 1827 | |
| 1828 | |
| 1829 | |
| 1830 | |
| 1831 | |
| 1832 | /// What a track's `ContentEncodings` element did to every one of its frames, |
| 1833 | /// undone here on the way back out. [`Unpack::None`] is every file this project |
| 1834 | /// writes and most of what it reads; the rest is what a remuxer does on the way |
| 1835 | /// to shaving bytes off a disc rip. |
| 1836 | |
| 1837 | |
| 1838 | |
| 1839 | |
| 1840 | |
| 1841 | |
| 1842 | |
| 1843 | |
| 1844 | |
| 1845 | |
| 1846 | |
| 1847 | |
| 1848 | |
| 1849 | |
| 1850 | |
| 1851 | |
| 1852 | |
| 1853 | |
| 1854 | |
| 1855 | |
| 1856 | |
| 1857 | |
| 1858 | |
| 1859 | |
| 1860 | |
| 1861 | |
| 1862 | |
| 1863 | |
| 1864 | |
| 1865 | |
| 1866 | |
| 1867 | |
| 1868 | |
| 1869 | |
| 1870 | |
| 1871 | |
| 1872 | |
| 1873 | |
| 1874 | |
| 1875 | |
| 1876 | |
| 1877 | /// The `ContentEncodings` of one `TrackEntry`. Anything this cannot undo comes |
| 1878 | /// back as [`Unpack::Refused`] with the sentence naming the feature it wanted: a |
| 1879 | /// compressed track read as if it were plain decodes into garbage, and that is |
| 1880 | /// the one thing this must not do quietly. |
| 1881 | |
| 1882 | |
| 1883 | |
| 1884 | |
| 1885 | |
| 1886 | |
| 1887 | |
| 1888 | |
| 1889 | |
| 1890 | |
| 1891 | |
| 1892 | |
| 1893 | |
| 1894 | |
| 1895 | |
| 1896 | |
| 1897 | |
| 1898 | |
| 1899 | |
| 1900 | |
| 1901 | |
| 1902 | |
| 1903 | |
| 1904 | |
| 1905 | |
| 1906 | |
| 1907 | |
| 1908 | |
| 1909 | |
| 1910 | |
| 1911 | |
| 1912 | |
| 1913 | |
| 1914 | |
| 1915 | |
| 1916 | |
| 1917 | |
| 1918 | |
| 1919 | |
| 1920 | |
| 1921 | |
| 1922 | |
| 1923 | |
| 1924 | |
| 1925 | |
| 1926 | |
| 1927 | |
| 1928 | |
| 1929 | |
| 1930 | |
| 1931 | |
| 1932 | |
| 1933 | |
| 1934 | |
| 1935 | |
| 1936 | |
| 1937 | |
| 1938 | |
| 1939 | |
| 1940 | |
| 1941 | |
| 1942 | // Matroska element IDs, written with the leading length marker they carry in |
| 1943 | // the file, which is what `ebml_element` reads them back as. |
| 1944 | const SEGMENT: u32 = 0x1853_8067; |
| 1945 | const INFO: u32 = 0x1549_A966; |
| 1946 | const TIMESTAMP_SCALE: u32 = 0x2AD7B1; |
| 1947 | const DURATION: u32 = 0x4489; |
| 1948 | const TRACKS: u32 = 0x1654_AE6B; |
| 1949 | const TRACK_ENTRY: u32 = 0xAE; |
| 1950 | const TRACK_NUMBER: u32 = 0xD7; |
| 1951 | const TRACK_TYPE: u32 = 0x83; |
| 1952 | const CODEC_ID: u32 = 0x86; |
| 1953 | const CODEC_PRIVATE: u32 = 0x63A2; |
| 1954 | const DEFAULT_DURATION: u32 = 0x23E383; |
| 1955 | const VIDEO: u32 = 0xE0; |
| 1956 | const PIXEL_WIDTH: u32 = 0xB0; |
| 1957 | const PIXEL_HEIGHT: u32 = 0xBA; |
| 1958 | // The `Colour` element and the three of its children this reads. Byte-verified |
| 1959 | // against real files rather than taken off a spec table: published tables that |
| 1960 | // list Range as 0x55B3 are describing ChromaSubsamplingHorz. |
| 1961 | const COLOUR: u32 = 0x55B0; |
| 1962 | const MATRIX_COEFFICIENTS: u32 = 0x55B1; |
| 1963 | const RANGE: u32 = 0x55B9; |
| 1964 | const TRANSFER_CHARACTERISTICS: u32 = 0x55BA; |
| 1965 | // ...and how bright it says its pictures get: two whole-nit integers beside the |
| 1966 | // code points, and a `MasteringMetadata` container whose ten children are EBML |
| 1967 | // *floats* -- eight chromaticities nothing here reads and the two luminances it |
| 1968 | // does. Byte-verified the same way, against an ffmpeg-written HDR fixture. |
| 1969 | const MAX_CLL: u32 = 0x55BC; |
| 1970 | const MAX_FALL: u32 = 0x55BD; |
| 1971 | const MASTERING_METADATA: u32 = 0x55D0; |
| 1972 | const LUMINANCE_MAX: u32 = 0x55D9; |
| 1973 | const LUMINANCE_MIN: u32 = 0x55DA; |
| 1974 | const TRACK_LANGUAGE: u32 = 0x22B59C; |
| 1975 | /// What a modern muxer states a language with instead ([`mkv_language`]): the |
| 1976 | /// legacy element above holds an ISO 639-2 code and nothing else, this one a |
| 1977 | /// whole BCP-47 tag (`en`, `pt-BR`, `zh-Hans`). |
| 1978 | const TRACK_LANGUAGE_BCP47: u32 = 0x22B59D; |
| 1979 | const TRACK_NAME: u32 = 0x536E; |
| 1980 | const CONTENT_ENCODINGS: u32 = 0x6D80; |
| 1981 | const CONTENT_ENCODING: u32 = 0x6240; |
| 1982 | const CONTENT_ENCODING_SCOPE: u32 = 0x5032; |
| 1983 | const CONTENT_ENCODING_TYPE: u32 = 0x5033; |
| 1984 | const CONTENT_COMPRESSION: u32 = 0x5034; |
| 1985 | const CONTENT_COMP_ALGO: u32 = 0x4254; |
| 1986 | const CONTENT_COMP_SETTINGS: u32 = 0x4255; |
| 1987 | // The seek index and the table of contents that points at it. `SeekHead` is |
| 1988 | // how a file whose `Cues` sit at the far end -- which is where every muxer but |
| 1989 | // `-cues_to_front` writes them -- is found without reading what is in between. |
| 1990 | const SEEK_HEAD: u32 = 0x114D_9B74; |
| 1991 | const SEEK: u32 = 0x4DBB; |
| 1992 | const SEEK_ID: u32 = 0x53AB; |
| 1993 | const SEEK_POSITION: u32 = 0x53AC; |
| 1994 | const CUES: u32 = 0x1C53_BB6B; |
| 1995 | const CUE_POINT: u32 = 0xBB; |
| 1996 | const CUE_TIME: u32 = 0xB3; |
| 1997 | const CUE_TRACK_POSITIONS: u32 = 0xB7; |
| 1998 | const CUE_TRACK: u32 = 0xF7; |
| 1999 | const CUE_CLUSTER_POSITION: u32 = 0xF1; |
| 2000 | const CLUSTER: u32 = 0x1F43_B675; |
| 2001 | const CLUSTER_TIMESTAMP: u32 = 0xE7; |
| 2002 | const SIMPLE_BLOCK: u32 = 0xA3; |
| 2003 | const BLOCK_GROUP: u32 = 0xA0; |
| 2004 | const BLOCK: u32 = 0xA1; |
| 2005 | const REFERENCE_BLOCK: u32 = 0xFB; |
| 2006 | |
| 2007 | /// Body range of the file's `Segment` element, which everything else lives in. |
| 2008 | |
| 2009 | |
| 2010 | |
| 2011 | |
| 2012 | |
| 2013 | |
| 2014 | |
| 2015 | |
| 2016 | |
| 2017 | |
| 2018 | |
| 2019 | /// The video track of `segment`, **every** audio track in file order, the codec |
| 2020 | /// id of a video track this cannot read, and the segment's `TimestampScale` in |
| 2021 | /// nanoseconds. The audio list is what [`MkvAudio`] reads a sound track from and |
| 2022 | /// what [`matroska_audio_tracks`] hands a stream picker; it and the other codec |
| 2023 | /// id are what tell a user why a file plays silent |
| 2024 | /// ([`crate::audio::AudioSession::unsupported`]) or refuses to open at all. |
| 2025 | /// |
| 2026 | /// Header only: the walk stops at the first `Cluster`, so this costs a handful |
| 2027 | /// of seeks whatever the file weighs. |
| 2028 | |
| 2029 | |
| 2030 | |
| 2031 | |
| 2032 | |
| 2033 | |
| 2034 | |
| 2035 | |
| 2036 | |
| 2037 | |
| 2038 | |
| 2039 | |
| 2040 | |
| 2041 | |
| 2042 | |
| 2043 | |
| 2044 | |
| 2045 | |
| 2046 | |
| 2047 | |
| 2048 | |
| 2049 | |
| 2050 | |
| 2051 | |
| 2052 | |
| 2053 | |
| 2054 | |
| 2055 | |
| 2056 | |
| 2057 | |
| 2058 | |
| 2059 | |
| 2060 | |
| 2061 | |
| 2062 | |
| 2063 | |
| 2064 | |
| 2065 | |
| 2066 | |
| 2067 | |
| 2068 | |
| 2069 | |
| 2070 | |
| 2071 | |
| 2072 | |
| 2073 | |
| 2074 | |
| 2075 | |
| 2076 | |
| 2077 | |
| 2078 | |
| 2079 | |
| 2080 | |
| 2081 | |
| 2082 | |
| 2083 | |
| 2084 | |
| 2085 | |
| 2086 | |
| 2087 | |
| 2088 | /// What one `TrackEntry` turned out to be. |
| 2089 | |
| 2090 | |
| 2091 | |
| 2092 | |
| 2093 | |
| 2094 | |
| 2095 | |
| 2096 | |
| 2097 | |
| 2098 | /// What language a `TrackEntry` states, as the three-letter ISO 639-2 code the |
| 2099 | /// rest of this engine speaks -- the one the muxer writes back into |
| 2100 | /// `TRACK_LANGUAGE` and the one an mp4's `mdhd` packs into 16 bits. |
| 2101 | /// |
| 2102 | /// **`LanguageBCP47` wins**, which is the spec's own precedence and not a |
| 2103 | /// preference: a modern file states its languages there and leaves the legacy |
| 2104 | /// element out, so reading only the old one lost them. One real 4K web remux |
| 2105 | /// carries 37 `LanguageBCP47` elements against 33 legacy |
| 2106 | /// ones and every English track of it is BCP-47 only -- they all used to come in |
| 2107 | /// as `und` and export with no language at all. |
| 2108 | /// |
| 2109 | /// A tag is cut to its primary subtag and mapped by [`ISO_639_1_TO_2`], so `en` |
| 2110 | /// and `en-US` are both `eng`: the region is not the language, and neither the |
| 2111 | /// Matroska element nor the mp4 field can hold one. Three letters already |
| 2112 | /// (`fil`, and every ISO 639-3 tag) are kept as they are. Anything else -- a |
| 2113 | /// private `x-…` tag, a tag nothing maps -- falls back to the legacy element |
| 2114 | /// rather than throwing the file's word away. |
| 2115 | /// |
| 2116 | /// `und` for a track that states neither. The spec's *default* is `eng` |
| 2117 | /// (measured: ffmpeg 8.1.2 reports `eng` for a `TrackEntry` with no `Language` |
| 2118 | /// element, and reads no `LanguageBCP47` at all), but writing English into a |
| 2119 | /// track whose file never said so is this engine's claim and not the file's -- |
| 2120 | /// a Japanese film's untitled track would export labelled English. What is |
| 2121 | /// *stated* is kept; the default is left to the readers that want it. |
| 2122 | |
| 2123 | |
| 2124 | |
| 2125 | |
| 2126 | |
| 2127 | |
| 2128 | |
| 2129 | |
| 2130 | |
| 2131 | |
| 2132 | |
| 2133 | |
| 2134 | |
| 2135 | |
| 2136 | |
| 2137 | |
| 2138 | |
| 2139 | |
| 2140 | |
| 2141 | |
| 2142 | |
| 2143 | /// Every ISO 639-1 code and the 639-2 (terminology) one it names the same |
| 2144 | /// language with -- what [`mkv_language`] maps a BCP-47 primary subtag through. |
| 2145 | /// |
| 2146 | /// The whole standard and not the languages a test happened to use: generated |
| 2147 | /// from `iso-codes`' own `iso_639-2.json`, so a Kannada track is as readable as |
| 2148 | /// an English one. |
| 2149 | |
| 2150 | const ISO_639_1_TO_2: & = & |
| 2151 | |
| 2152 | |
| 2153 | |
| 2154 | |
| 2155 | |
| 2156 | |
| 2157 | |
| 2158 | |
| 2159 | |
| 2160 | |
| 2161 | |
| 2162 | |
| 2163 | |
| 2164 | |
| 2165 | |
| 2166 | |
| 2167 | |
| 2168 | |
| 2169 | |
| 2170 | |
| 2171 | |
| 2172 | |
| 2173 | |
| 2174 | |
| 2175 | |
| 2176 | |
| 2177 | |
| 2178 | |
| 2179 | |
| 2180 | |
| 2181 | |
| 2182 | |
| 2183 | |
| 2184 | |
| 2185 | |
| 2186 | |
| 2187 | |
| 2188 | |
| 2189 | |
| 2190 | |
| 2191 | |
| 2192 | |
| 2193 | |
| 2194 | |
| 2195 | |
| 2196 | |
| 2197 | ; |
| 2198 | |
| 2199 | /// One `TrackEntry`, read for what it is. |
| 2200 | |
| 2201 | |
| 2202 | |
| 2203 | |
| 2204 | |
| 2205 | |
| 2206 | |
| 2207 | |
| 2208 | |
| 2209 | |
| 2210 | |
| 2211 | |
| 2212 | |
| 2213 | |
| 2214 | |
| 2215 | |
| 2216 | |
| 2217 | |
| 2218 | |
| 2219 | |
| 2220 | |
| 2221 | |
| 2222 | |
| 2223 | |
| 2224 | |
| 2225 | |
| 2226 | |
| 2227 | |
| 2228 | |
| 2229 | |
| 2230 | |
| 2231 | |
| 2232 | |
| 2233 | |
| 2234 | |
| 2235 | |
| 2236 | |
| 2237 | |
| 2238 | |
| 2239 | |
| 2240 | |
| 2241 | |
| 2242 | |
| 2243 | |
| 2244 | |
| 2245 | |
| 2246 | |
| 2247 | |
| 2248 | |
| 2249 | |
| 2250 | |
| 2251 | |
| 2252 | |
| 2253 | |
| 2254 | |
| 2255 | |
| 2256 | |
| 2257 | |
| 2258 | |
| 2259 | |
| 2260 | |
| 2261 | |
| 2262 | |
| 2263 | |
| 2264 | |
| 2265 | |
| 2266 | |
| 2267 | |
| 2268 | |
| 2269 | |
| 2270 | |
| 2271 | |
| 2272 | |
| 2273 | |
| 2274 | |
| 2275 | |
| 2276 | |
| 2277 | |
| 2278 | |
| 2279 | |
| 2280 | |
| 2281 | |
| 2282 | |
| 2283 | |
| 2284 | |
| 2285 | |
| 2286 | |
| 2287 | |
| 2288 | |
| 2289 | |
| 2290 | |
| 2291 | |
| 2292 | |
| 2293 | |
| 2294 | |
| 2295 | |
| 2296 | |
| 2297 | |
| 2298 | |
| 2299 | |
| 2300 | |
| 2301 | |
| 2302 | |
| 2303 | |
| 2304 | |
| 2305 | |
| 2306 | |
| 2307 | |
| 2308 | |
| 2309 | |
| 2310 | |
| 2311 | |
| 2312 | |
| 2313 | |
| 2314 | |
| 2315 | |
| 2316 | |
| 2317 | |
| 2318 | |
| 2319 | |
| 2320 | |
| 2321 | |
| 2322 | |
| 2323 | |
| 2324 | |
| 2325 | |
| 2326 | |
| 2327 | |
| 2328 | |
| 2329 | |
| 2330 | |
| 2331 | |
| 2332 | |
| 2333 | |
| 2334 | |
| 2335 | |
| 2336 | |
| 2337 | |
| 2338 | |
| 2339 | |
| 2340 | |
| 2341 | |
| 2342 | |
| 2343 | |
| 2344 | |
| 2345 | |
| 2346 | |
| 2347 | |
| 2348 | |
| 2349 | |
| 2350 | |
| 2351 | |
| 2352 | |
| 2353 | |
| 2354 | |
| 2355 | |
| 2356 | |
| 2357 | |
| 2358 | |
| 2359 | |
| 2360 | |
| 2361 | |
| 2362 | |
| 2363 | |
| 2364 | |
| 2365 | /// AVCDecoderConfigurationRecord (ISO 14496-15 §5.3.3.1) -> the NAL length |
| 2366 | /// prefix width and the SPS/PPS as one Annex-B blob, which is [`parse_hvcc`]'s |
| 2367 | /// job for HEVC. The mp4 path gets both out of `mp4 0.14`'s `AvcCBox`; a |
| 2368 | /// Matroska file carries the identical record in `CodecPrivate`, unparsed. |
| 2369 | |
| 2370 | |
| 2371 | |
| 2372 | |
| 2373 | |
| 2374 | |
| 2375 | |
| 2376 | |
| 2377 | |
| 2378 | |
| 2379 | |
| 2380 | |
| 2381 | |
| 2382 | |
| 2383 | |
| 2384 | |
| 2385 | |
| 2386 | |
| 2387 | |
| 2388 | |
| 2389 | |
| 2390 | |
| 2391 | |
| 2392 | |
| 2393 | |
| 2394 | |
| 2395 | |
| 2396 | |
| 2397 | |
| 2398 | |
| 2399 | |
| 2400 | |
| 2401 | |
| 2402 | |
| 2403 | |
| 2404 | |
| 2405 | |
| 2406 | |
| 2407 | /// The configuration OBUs of an `AV1CodecConfigurationRecord` (AV1-ISOBMFF |
| 2408 | /// §2.3.3): four fixed bytes, then the sequence header OBU in the same |
| 2409 | /// low-overhead format the blocks are in, so it needs no reframing. |
| 2410 | /// |
| 2411 | /// Also the bits per luma sample, out of `high_bitdepth`/`twelve_bit` in byte 2: |
| 2412 | /// 10-bit decodes through the P010 pool HEVC Main 10 already goes through |
| 2413 | /// ([`crate::hw`]), 12-bit is refused by name because that pool is the only |
| 2414 | /// deeper one there is. |
| 2415 | /// |
| 2416 | /// An empty record is not an error -- an encoder that repeats its sequence |
| 2417 | /// header in-band needs none -- and is taken as 8-bit, which is what the depth |
| 2418 | /// defaults to everywhere else here. |
| 2419 | |
| 2420 | |
| 2421 | |
| 2422 | |
| 2423 | |
| 2424 | |
| 2425 | |
| 2426 | |
| 2427 | |
| 2428 | |
| 2429 | |
| 2430 | |
| 2431 | |
| 2432 | |
| 2433 | |
| 2434 | |
| 2435 | |
| 2436 | |
| 2437 | |
| 2438 | |
| 2439 | |
| 2440 | /// Why an mp4 came back with no picture, by the fourcc of the video track it |
| 2441 | /// does carry: `avc3` and `mp4v` are files with video in them, and telling their |
| 2442 | /// owner there is none sends them looking for a fault that is not in the file. |
| 2443 | /// [`UNSUPPORTED`]'s reason where the table has one, the fourcc itself where it |
| 2444 | /// does not. |
| 2445 | |
| 2446 | |
| 2447 | |
| 2448 | |
| 2449 | |
| 2450 | |
| 2451 | |
| 2452 | |
| 2453 | |
| 2454 | |
| 2455 | |
| 2456 | |
| 2457 | |
| 2458 | |
| 2459 | |
| 2460 | |
| 2461 | |
| 2462 | |
| 2463 | |
| 2464 | |
| 2465 | |
| 2466 | |
| 2467 | |
| 2468 | |
| 2469 | |
| 2470 | |
| 2471 | |
| 2472 | |
| 2473 | |
| 2474 | |
| 2475 | /// Bits per luma sample out of a VP9 keyframe's uncompressed header (VP9 |
| 2476 | /// bitstream spec §6.2 `uncompressed_header` and §6.4.1 `color_config`), which is |
| 2477 | /// the one place a VP9 stream states its own depth -- see |
| 2478 | /// [`Demuxer::fill_vp9_depth`] for why neither container is asked. |
| 2479 | /// |
| 2480 | /// `None` when this access unit cannot answer -- not a keyframe, a |
| 2481 | /// `show_existing_frame`, a truncated block -- which leaves the caller's 8-bit |
| 2482 | /// default standing rather than guessing; profile 0 and 1 *are* 8-bit by |
| 2483 | /// definition, and they are all a `.webm` off the web ever is. |
| 2484 | |
| 2485 | |
| 2486 | |
| 2487 | |
| 2488 | |
| 2489 | |
| 2490 | |
| 2491 | |
| 2492 | |
| 2493 | |
| 2494 | |
| 2495 | |
| 2496 | |
| 2497 | |
| 2498 | |
| 2499 | |
| 2500 | |
| 2501 | |
| 2502 | |
| 2503 | |
| 2504 | |
| 2505 | |
| 2506 | |
| 2507 | |
| 2508 | |
| 2509 | |
| 2510 | |
| 2511 | |
| 2512 | |
| 2513 | |
| 2514 | |
| 2515 | |
| 2516 | |
| 2517 | |
| 2518 | |
| 2519 | |
| 2520 | |
| 2521 | |
| 2522 | |
| 2523 | |
| 2524 | |
| 2525 | |
| 2526 | |
| 2527 | |
| 2528 | |
| 2529 | |
| 2530 | |
| 2531 | |
| 2532 | |
| 2533 | /// How many blocks past a cue's own the walk looks to count what the encoder |
| 2534 | /// reordered around it ([`MkvDemuxer::anchor`]). Wider than any real stream |
| 2535 | /// needs: H.264 and HEVC cap `max_num_reorder_frames` at 16, and what a muxer |
| 2536 | /// actually writes is two or three. |
| 2537 | /// |
| 2538 | /// corner-cut: a stream that reorders further than this would have its blocks |
| 2539 | /// numbered a frame or two off. The upgrade path is the bitstream's own |
| 2540 | /// `max_num_reorder_frames` out of the SPS, which this demuxer does not parse; |
| 2541 | /// [`MkvDemuxer::cues_agree`] is what stands between that file and a wrong seek |
| 2542 | /// in the meantime -- it degrades to the whole walk instead. |
| 2543 | const REORDER: usize = 32; |
| 2544 | |
| 2545 | /// One `CuePoint` of the picture track: the timestamp it names, which block of |
| 2546 | /// the track that timestamp *is*, and where the `Cluster` holding it starts. |
| 2547 | |
| 2548 | |
| 2549 | |
| 2550 | |
| 2551 | |
| 2552 | |
| 2553 | |
| 2554 | |
| 2555 | |
| 2556 | |
| 2557 | |
| 2558 | |
| 2559 | |
| 2560 | |
| 2561 | |
| 2562 | |
| 2563 | |
| 2564 | |
| 2565 | /// The picture track's `Cues` in index order, empty for a file carrying none |
| 2566 | /// this can use -- Matroska's own seek index, which is what a player reads |
| 2567 | /// instead of the film to know where its keyframes are. |
| 2568 | /// |
| 2569 | /// Approach referenced from `matroska-demuxer 0.8.1` (hasenbanck), which |
| 2570 | /// resolves a seek the same way: the `CueTrackPositions` of the wanted track, |
| 2571 | /// its `CueClusterPosition` off the segment, then that cluster. The parsing is |
| 2572 | /// this file's own EBML reader -- no dependency is added for four elements. |
| 2573 | /// |
| 2574 | /// `ticks_per_frame` is the track's `DefaultDuration` in `TimestampScale` |
| 2575 | /// ticks. Without it a cue time cannot become a frame number at all, which is |
| 2576 | /// why the caller keeps the whole walk for a track that declares no duration. |
| 2577 | |
| 2578 | |
| 2579 | |
| 2580 | |
| 2581 | |
| 2582 | |
| 2583 | |
| 2584 | |
| 2585 | |
| 2586 | |
| 2587 | |
| 2588 | |
| 2589 | |
| 2590 | |
| 2591 | |
| 2592 | |
| 2593 | |
| 2594 | |
| 2595 | |
| 2596 | |
| 2597 | |
| 2598 | |
| 2599 | |
| 2600 | |
| 2601 | |
| 2602 | |
| 2603 | |
| 2604 | |
| 2605 | |
| 2606 | |
| 2607 | |
| 2608 | |
| 2609 | |
| 2610 | |
| 2611 | |
| 2612 | |
| 2613 | |
| 2614 | |
| 2615 | |
| 2616 | |
| 2617 | |
| 2618 | |
| 2619 | |
| 2620 | |
| 2621 | |
| 2622 | |
| 2623 | |
| 2624 | |
| 2625 | |
| 2626 | |
| 2627 | |
| 2628 | |
| 2629 | |
| 2630 | |
| 2631 | |
| 2632 | |
| 2633 | |
| 2634 | |
| 2635 | |
| 2636 | |
| 2637 | |
| 2638 | |
| 2639 | |
| 2640 | |
| 2641 | |
| 2642 | |
| 2643 | |
| 2644 | |
| 2645 | |
| 2646 | |
| 2647 | |
| 2648 | /// Body range of the segment's `Cues` element: found among the header elements |
| 2649 | /// where a muxer wrote it in front of the clusters (`ffmpeg -cues_to_front`), |
| 2650 | /// and through the `SeekHead` where it wrote it at the far end, which is where |
| 2651 | /// nearly every file has it. `None` for a file with neither -- a live capture, |
| 2652 | /// a stream remuxed without an index -- which is the file that keeps the walk. |
| 2653 | |
| 2654 | |
| 2655 | |
| 2656 | |
| 2657 | |
| 2658 | |
| 2659 | |
| 2660 | |
| 2661 | |
| 2662 | |
| 2663 | |
| 2664 | |
| 2665 | |
| 2666 | |
| 2667 | |
| 2668 | |
| 2669 | |
| 2670 | |
| 2671 | |
| 2672 | |
| 2673 | |
| 2674 | |
| 2675 | |
| 2676 | |
| 2677 | |
| 2678 | |
| 2679 | |
| 2680 | /// Where a `SeekHead` says the element with id `want` is, relative to the start |
| 2681 | /// of the segment's payload. Only the one level: a `SeekHead` pointing at |
| 2682 | /// another `SeekHead` (what a muxer writes when it appends an index later) is |
| 2683 | /// not followed, and that file falls back to the walk rather than to a guess. |
| 2684 | |
| 2685 | |
| 2686 | |
| 2687 | |
| 2688 | |
| 2689 | |
| 2690 | |
| 2691 | |
| 2692 | |
| 2693 | |
| 2694 | |
| 2695 | |
| 2696 | |
| 2697 | |
| 2698 | |
| 2699 | |
| 2700 | |
| 2701 | |
| 2702 | |
| 2703 | |
| 2704 | |
| 2705 | |
| 2706 | |
| 2707 | |
| 2708 | |
| 2709 | |
| 2710 | |
| 2711 | |
| 2712 | |
| 2713 | |
| 2714 | |
| 2715 | /// Every block of track `number`, in storage order, with the presentation span |
| 2716 | /// (first and last timestamp in `TimestampScale` ticks) the frame-rate fallback |
| 2717 | /// needs -- and, third, how many block bytes *every* track of the file spends, |
| 2718 | /// `(TrackNumber, bytes)` in first-seen order. |
| 2719 | /// |
| 2720 | /// That third answer is why this is one pass and not two: a block's length is |
| 2721 | /// already parsed out of its header here, on the way to deciding it belongs to |
| 2722 | /// another track and skipping it, so the sound track's size costs a lookup in a |
| 2723 | /// list of two or three rather than a second walk of the segment (six seconds of |
| 2724 | /// one, on a 12 GB film). [`probe_bitrate`] is what reads it. |
| 2725 | /// |
| 2726 | /// Only element headers are read: a block's payload is seeked over and fetched |
| 2727 | /// later by [`MkvDemuxer::next_access_unit`], which is what keeps this an index |
| 2728 | /// pass rather than a read of the whole file. |
| 2729 | /// The walk itself is [`mkv_walk_blocks`]; this is the sidecar cache in front of |
| 2730 | /// it. What still reaches it is what the `Cues` cannot answer -- the sound |
| 2731 | /// track, which Matroska indexes not at all, and a picture whose index is absent |
| 2732 | /// or caught lying -- and those pay the whole walk on a file the user opens |
| 2733 | /// again and again. So the walk's answer is written beside the user's other |
| 2734 | /// caches and read back in milliseconds while the file it indexes is untouched. |
| 2735 | |
| 2736 | |
| 2737 | |
| 2738 | |
| 2739 | |
| 2740 | |
| 2741 | |
| 2742 | |
| 2743 | |
| 2744 | |
| 2745 | |
| 2746 | |
| 2747 | |
| 2748 | |
| 2749 | |
| 2750 | |
| 2751 | /// What one walk of the segment answers: the track's blocks, the span its |
| 2752 | /// timestamps cover, and every track's byte count. Named because it is also what |
| 2753 | /// the sidecar cache stores. |
| 2754 | type Index = ; |
| 2755 | |
| 2756 | |
| 2757 | |
| 2758 | |
| 2759 | |
| 2760 | |
| 2761 | |
| 2762 | |
| 2763 | |
| 2764 | |
| 2765 | |
| 2766 | |
| 2767 | |
| 2768 | |
| 2769 | |
| 2770 | |
| 2771 | |
| 2772 | |
| 2773 | |
| 2774 | |
| 2775 | |
| 2776 | |
| 2777 | |
| 2778 | |
| 2779 | |
| 2780 | |
| 2781 | |
| 2782 | |
| 2783 | |
| 2784 | |
| 2785 | |
| 2786 | |
| 2787 | |
| 2788 | |
| 2789 | |
| 2790 | |
| 2791 | |
| 2792 | |
| 2793 | |
| 2794 | |
| 2795 | |
| 2796 | /// One `Cluster`'s blocks, appended: those of track `number` to `blocks`, and |
| 2797 | /// every track's byte count to `track_bytes`. The laces met on the way are |
| 2798 | /// recorded in `laced` for [`mkv_spread_laces`], which the caller runs once its |
| 2799 | /// walk is over -- a lace's real span is measured against the block *after* it, |
| 2800 | /// which the next cluster may hold. |
| 2801 | /// |
| 2802 | /// Split out of [`mkv_blocks`] so the lazy index ([`MkvDemuxer::walk_cluster`]) |
| 2803 | /// walks a cluster by exactly the code the whole-segment walk does: two readers |
| 2804 | /// of one container that disagreed about what a block is would be two different |
| 2805 | /// files to seek in. |
| 2806 | |
| 2807 | |
| 2808 | |
| 2809 | |
| 2810 | |
| 2811 | |
| 2812 | |
| 2813 | |
| 2814 | |
| 2815 | |
| 2816 | |
| 2817 | |
| 2818 | |
| 2819 | |
| 2820 | |
| 2821 | |
| 2822 | |
| 2823 | |
| 2824 | |
| 2825 | |
| 2826 | |
| 2827 | |
| 2828 | |
| 2829 | |
| 2830 | |
| 2831 | |
| 2832 | |
| 2833 | |
| 2834 | |
| 2835 | |
| 2836 | |
| 2837 | |
| 2838 | |
| 2839 | |
| 2840 | |
| 2841 | |
| 2842 | |
| 2843 | |
| 2844 | |
| 2845 | |
| 2846 | |
| 2847 | |
| 2848 | |
| 2849 | |
| 2850 | |
| 2851 | |
| 2852 | |
| 2853 | |
| 2854 | |
| 2855 | |
| 2856 | |
| 2857 | |
| 2858 | |
| 2859 | |
| 2860 | |
| 2861 | |
| 2862 | |
| 2863 | |
| 2864 | |
| 2865 | |
| 2866 | |
| 2867 | |
| 2868 | |
| 2869 | |
| 2870 | |
| 2871 | |
| 2872 | |
| 2873 | |
| 2874 | |
| 2875 | |
| 2876 | |
| 2877 | |
| 2878 | |
| 2879 | |
| 2880 | |
| 2881 | |
| 2882 | |
| 2883 | |
| 2884 | |
| 2885 | |
| 2886 | |
| 2887 | |
| 2888 | /// The lace fixup: a laced block writes one timestamp for all its frames, and |
| 2889 | /// stacking six E-AC-3 frames on one instant is a sound track that drifts a |
| 2890 | /// fifth of a second away from the picture inside a cluster. The gap to the |
| 2891 | /// next block of the same track is what the lace really spans, so the frames |
| 2892 | /// are spread across it; the last lace of a walk has no block after it and |
| 2893 | /// keeps the step the one before it measured. |
| 2894 | |
| 2895 | |
| 2896 | |
| 2897 | |
| 2898 | |
| 2899 | |
| 2900 | |
| 2901 | |
| 2902 | |
| 2903 | |
| 2904 | |
| 2905 | |
| 2906 | |
| 2907 | |
| 2908 | |
| 2909 | |
| 2910 | |
| 2911 | /// Magic and format version of the sidecar index. The last byte is the version: |
| 2912 | /// bump it and every file an older build wrote is a miss, which is the whole |
| 2913 | /// migration story -- a sidecar is rewritten, never upgraded. |
| 2914 | /// |
| 2915 | /// **Bump it whenever the walk's output changes.** The key below binds a sidecar |
| 2916 | /// to the *file* -- its bytes, its times, its track -- and to nothing about the |
| 2917 | /// code that wrote it, so a build whose blocks, timestamps or lace spreading |
| 2918 | /// differ from the one that filled this directory will believe every stale |
| 2919 | /// record in it. This byte is the only thing standing there, and it is bumped by |
| 2920 | /// hand. |
| 2921 | const INDEX_MAGIC: & = b"EDMKVIX2"; |
| 2922 | |
| 2923 | /// What a sidecar index is valid for and nothing else: the file it was walked |
| 2924 | /// from, down to the byte and the modification time, and the track it indexes. |
| 2925 | /// Every field is written into the sidecar and compared on the way back, so a |
| 2926 | /// re-encode, an append, a truncation or a hash collision on the file name are |
| 2927 | /// all one thing -- a miss, and the walk runs. |
| 2928 | |
| 2929 | |
| 2930 | |
| 2931 | |
| 2932 | |
| 2933 | |
| 2934 | |
| 2935 | |
| 2936 | |
| 2937 | |
| 2938 | |
| 2939 | |
| 2940 | |
| 2941 | |
| 2942 | |
| 2943 | |
| 2944 | |
| 2945 | |
| 2946 | |
| 2947 | |
| 2948 | |
| 2949 | |
| 2950 | |
| 2951 | |
| 2952 | |
| 2953 | |
| 2954 | |
| 2955 | |
| 2956 | |
| 2957 | |
| 2958 | |
| 2959 | |
| 2960 | |
| 2961 | |
| 2962 | |
| 2963 | |
| 2964 | |
| 2965 | |
| 2966 | |
| 2967 | |
| 2968 | |
| 2969 | |
| 2970 | |
| 2971 | |
| 2972 | |
| 2973 | |
| 2974 | |
| 2975 | |
| 2976 | |
| 2977 | |
| 2978 | |
| 2979 | |
| 2980 | |
| 2981 | |
| 2982 | |
| 2983 | |
| 2984 | /// The path rule for one of this engine's cache directories -- `sub` names |
| 2985 | /// which (`mkvindex` here, `proxies` for [`crate::proxy`]) -- with the |
| 2986 | /// environment handed in so it can be checked, as `keymap::config_path_in` is |
| 2987 | /// on the config side. An empty `XDG_CACHE_HOME` is one the spec says to |
| 2988 | /// ignore; with no `HOME` either there is nowhere to put a cache, and `None` -- |
| 2989 | /// always walk -- beats littering the working directory. |
| 2990 | pub |
| 2991 | |
| 2992 | |
| 2993 | |
| 2994 | |
| 2995 | |
| 2996 | |
| 2997 | |
| 2998 | |
| 2999 | |
| 3000 | |
| 3001 | |
| 3002 | |
| 3003 | |
| 3004 | /// FNV-1a, 64-bit: what names a sidecar and what checks it. Not a cryptographic |
| 3005 | /// hash and not asked to be -- nothing here is adversarial. It is the guard that |
| 3006 | /// turns a half-written or scrambled file into a miss; a *name* collision is |
| 3007 | /// caught by the key inside the file, which is compared field by field. |
| 3008 | pub |
| 3009 | |
| 3010 | |
| 3011 | |
| 3012 | |
| 3013 | |
| 3014 | |
| 3015 | |
| 3016 | |
| 3017 | /// A cursor over an encoded index. Every read is bounds-checked and hands back |
| 3018 | /// `None` past the end, so a truncated file runs out of bytes rather than off |
| 3019 | /// the end of one, and one `?` per field is the whole validation. |
| 3020 | ; |
| 3021 | |
| 3022 | |
| 3023 | |
| 3024 | |
| 3025 | |
| 3026 | |
| 3027 | |
| 3028 | |
| 3029 | |
| 3030 | |
| 3031 | |
| 3032 | |
| 3033 | |
| 3034 | |
| 3035 | |
| 3036 | |
| 3037 | |
| 3038 | |
| 3039 | |
| 3040 | |
| 3041 | |
| 3042 | /// The index as bytes: the key first, then the walk's three answers. Little |
| 3043 | /// endian throughout and hand-rolled, because this tree carries no serializer |
| 3044 | /// and a flat record of fixed-width fields does not need one. |
| 3045 | |
| 3046 | |
| 3047 | |
| 3048 | |
| 3049 | |
| 3050 | |
| 3051 | |
| 3052 | |
| 3053 | |
| 3054 | |
| 3055 | |
| 3056 | |
| 3057 | |
| 3058 | |
| 3059 | |
| 3060 | |
| 3061 | |
| 3062 | |
| 3063 | |
| 3064 | |
| 3065 | |
| 3066 | |
| 3067 | |
| 3068 | |
| 3069 | |
| 3070 | |
| 3071 | |
| 3072 | |
| 3073 | |
| 3074 | |
| 3075 | |
| 3076 | |
| 3077 | |
| 3078 | /// The sidecar at `at`, if it is this key's and intact. `None` for every other |
| 3079 | /// case there is -- absent, unreadable, another format version, a checksum that |
| 3080 | /// does not match, a key that does not, a record that ends early or one with |
| 3081 | /// bytes left over -- and every one of them means the same thing to the caller: |
| 3082 | /// walk the file and write this again. |
| 3083 | |
| 3084 | |
| 3085 | |
| 3086 | |
| 3087 | |
| 3088 | |
| 3089 | |
| 3090 | |
| 3091 | |
| 3092 | |
| 3093 | |
| 3094 | |
| 3095 | |
| 3096 | |
| 3097 | |
| 3098 | |
| 3099 | |
| 3100 | |
| 3101 | |
| 3102 | |
| 3103 | |
| 3104 | |
| 3105 | |
| 3106 | |
| 3107 | |
| 3108 | |
| 3109 | |
| 3110 | |
| 3111 | |
| 3112 | |
| 3113 | |
| 3114 | |
| 3115 | |
| 3116 | |
| 3117 | |
| 3118 | |
| 3119 | |
| 3120 | |
| 3121 | |
| 3122 | |
| 3123 | |
| 3124 | |
| 3125 | |
| 3126 | /// Writes the sidecar, atomically: a temporary file of its own, fsynced, then |
| 3127 | /// renamed over the name readers look under. A reader therefore sees the whole |
| 3128 | /// index or no index -- never a half-written one, which the checksum would catch |
| 3129 | /// anyway but only after the bytes were read. |
| 3130 | |
| 3131 | |
| 3132 | |
| 3133 | |
| 3134 | |
| 3135 | |
| 3136 | |
| 3137 | |
| 3138 | |
| 3139 | |
| 3140 | |
| 3141 | |
| 3142 | |
| 3143 | |
| 3144 | |
| 3145 | |
| 3146 | |
| 3147 | |
| 3148 | |
| 3149 | |
| 3150 | |
| 3151 | |
| 3152 | |
| 3153 | |
| 3154 | |
| 3155 | |
| 3156 | |
| 3157 | |
| 3158 | |
| 3159 | /// The frames inside a laced block: one `(offset, length)` each, in order. |
| 3160 | /// |
| 3161 | /// Lacing packs several frames -- always whole ones, and only ones nothing else |
| 3162 | /// references -- into a single block behind a header of sizes, in one of the |
| 3163 | /// three shapes the spec defines. Video muxers write none, but a streaming |
| 3164 | /// service's audio is laced by the thousand: every E-AC-3 block of a WEB remux |
| 3165 | /// is fixed-laced, and a reader that refuses those is a film that plays silent. |
| 3166 | |
| 3167 | |
| 3168 | |
| 3169 | |
| 3170 | |
| 3171 | |
| 3172 | |
| 3173 | |
| 3174 | |
| 3175 | |
| 3176 | |
| 3177 | |
| 3178 | |
| 3179 | |
| 3180 | |
| 3181 | |
| 3182 | |
| 3183 | |
| 3184 | |
| 3185 | |
| 3186 | |
| 3187 | |
| 3188 | |
| 3189 | |
| 3190 | |
| 3191 | |
| 3192 | |
| 3193 | |
| 3194 | |
| 3195 | |
| 3196 | |
| 3197 | |
| 3198 | |
| 3199 | |
| 3200 | |
| 3201 | |
| 3202 | |
| 3203 | |
| 3204 | |
| 3205 | |
| 3206 | |
| 3207 | |
| 3208 | |
| 3209 | |
| 3210 | |
| 3211 | |
| 3212 | |
| 3213 | |
| 3214 | |
| 3215 | |
| 3216 | |
| 3217 | |
| 3218 | |
| 3219 | |
| 3220 | |
| 3221 | |
| 3222 | |
| 3223 | |
| 3224 | |
| 3225 | |
| 3226 | |
| 3227 | |
| 3228 | |
| 3229 | |
| 3230 | |
| 3231 | |
| 3232 | |
| 3233 | |
| 3234 | |
| 3235 | |
| 3236 | |
| 3237 | |
| 3238 | |
| 3239 | |
| 3240 | |
| 3241 | |
| 3242 | /// A `SimpleBlock`/`Block` header: track number, timestamp relative to the |
| 3243 | /// cluster's, flags, and where the frame's own bytes start. |
| 3244 | |
| 3245 | |
| 3246 | |
| 3247 | |
| 3248 | |
| 3249 | |
| 3250 | |
| 3251 | |
| 3252 | |
| 3253 | |
| 3254 | |
| 3255 | |
| 3256 | |
| 3257 | |
| 3258 | |
| 3259 | |
| 3260 | |
| 3261 | |
| 3262 | |
| 3263 | |
| 3264 | |
| 3265 | |
| 3266 | |
| 3267 | |
| 3268 | |
| 3269 | |
| 3270 | /// The EBML element at `at`: its id (marker bit and all), where its payload |
| 3271 | /// starts, and where it ends. `None` once `end` is reached. An element of |
| 3272 | /// unknown length -- what a muxer writes while it is still recording -- runs to |
| 3273 | /// the end of its parent, which is exactly how a reader is told to take it. |
| 3274 | |
| 3275 | |
| 3276 | |
| 3277 | |
| 3278 | |
| 3279 | |
| 3280 | |
| 3281 | |
| 3282 | |
| 3283 | |
| 3284 | |
| 3285 | |
| 3286 | |
| 3287 | |
| 3288 | |
| 3289 | |
| 3290 | |
| 3291 | |
| 3292 | |
| 3293 | /// EBML variable-length integer: the leading zeros of the first byte say how |
| 3294 | /// many bytes it takes. `strip` clears the marker bit, which is what a *size* |
| 3295 | /// wants and an *id* does not -- an id is written and compared with it. An |
| 3296 | /// all-ones size means unknown length, and comes back as [`u64::MAX`]. |
| 3297 | |
| 3298 | |
| 3299 | |
| 3300 | |
| 3301 | |
| 3302 | |
| 3303 | |
| 3304 | |
| 3305 | |
| 3306 | |
| 3307 | |
| 3308 | |
| 3309 | |
| 3310 | |
| 3311 | |
| 3312 | |
| 3313 | |
| 3314 | |
| 3315 | |
| 3316 | |
| 3317 | |
| 3318 | |
| 3319 | |
| 3320 | |
| 3321 | /// An EBML unsigned integer element: big-endian, as many bytes as it was |
| 3322 | /// written with, and an absent one is a zero by the spec's own default. |
| 3323 | /// The EBML element at `at` inside a slice already in memory: its id, where its |
| 3324 | /// payload starts and where the element ends. `None` at the end of the slice, |
| 3325 | /// and for a header claiming more bytes than the slice holds -- which is how a |
| 3326 | /// caller bounds a child to its parent, by handing over the parent's bytes. |
| 3327 | /// |
| 3328 | /// The file-backed [`ebml_element`] costs a `pread` an element, which is right |
| 3329 | /// for the handful a header is and wrong for the hundred thousand a film's |
| 3330 | /// `Cues` are. Same shapes, same unknown-length rule left out: a `Cues` element |
| 3331 | /// of unknown length is one nobody has finished writing. |
| 3332 | |
| 3333 | |
| 3334 | |
| 3335 | |
| 3336 | |
| 3337 | |
| 3338 | |
| 3339 | |
| 3340 | |
| 3341 | /// An unsigned EBML integer out of a slice, big-endian as they all are. |
| 3342 | |
| 3343 | |
| 3344 | |
| 3345 | |
| 3346 | |
| 3347 | |
| 3348 | |
| 3349 | |
| 3350 | |
| 3351 | |
| 3352 | |
| 3353 | |
| 3354 | /// An EBML float element: IEEE big-endian, 4 or 8 bytes wide (a Matroska muxer |
| 3355 | /// writes the luminances as doubles). Zero for any other width, which is what an |
| 3356 | /// absent one is by spec and what [`nits`] then reads as "not stated". |
| 3357 | |
| 3358 | |
| 3359 | |
| 3360 | |
| 3361 | |
| 3362 | |
| 3363 | |
| 3364 | |
| 3365 | |
| 3366 | /// A brightness a container stated, or [`None`] when it stated zero -- which is |
| 3367 | /// what a muxer writes for "unknown" and what a tone map must not read as a film |
| 3368 | /// that peaks at black. |
| 3369 | |
| 3370 | |
| 3371 | |
| 3372 | |
| 3373 | /// The payload of an element, which is only ever a header field here -- 8 bytes |
| 3374 | /// for an integer, a few hundred for a `CodecPrivate`. |
| 3375 | |
| 3376 | |
| 3377 | |
| 3378 | |
| 3379 | |
| 3380 | |
| 3381 | |
| 3382 | |
| 3383 | |
| 3384 | |
| 3385 | /// Positioned reads, so the walk never has to keep a cursor in step with itself. |
| 3386 | |
| 3387 | |
| 3388 | |
| 3389 | |
| 3390 | |
| 3391 | |
| 3392 | |
| 3393 | |
| 3394 | /// Frames per second off the sample table. `mp4 0.14`'s own |
| 3395 | /// [`Mp4Track::frame_rate`] divides the sample count by whole *milliseconds* |
| 3396 | /// before the float cast (`track.rs:166`), so 24000/1001 reads back as a flat |
| 3397 | /// 23.0 -- with the audio clock as master that is 4 % of drift, five minutes of |
| 3398 | /// it by the end of a two-hour film. |
| 3399 | |
| 3400 | |
| 3401 | |
| 3402 | |
| 3403 | /// Whole track over whole track: constant-delta tables (the common case) come |
| 3404 | /// out as exactly `timescale / delta`, and a table that spreads 3753/3754 ticks |
| 3405 | /// to average 3753.75 averages instead of truncating. All of it in `f64`, which |
| 3406 | /// is the bug the caller above exists to avoid. |
| 3407 | |
| 3408 | |
| 3409 | |
| 3410 | |
| 3411 | |
| 3412 | |
| 3413 | |
| 3414 | |
| 3415 | |
| 3416 | |
| 3417 | |
| 3418 | |
| 3419 | |
| 3420 | |
| 3421 | |
| 3422 | |
| 3423 | |
| 3424 | /// What the edit list really trims off the front, in media ticks: its |
| 3425 | /// `media_time` less the first sample's own composition offset. A stream with |
| 3426 | /// B-frames carries a `ctts` delay, and every muxer writes `media_time` equal to |
| 3427 | /// exactly that delay -- which is not a trim at all, it is the container saying |
| 3428 | /// "sample 1 is still the first picture". Reading it as one drops real frames |
| 3429 | /// (`test_high.mp4` loses two, and so did the film this bug came from). What is |
| 3430 | /// left over after the delay is the genuine trim. |
| 3431 | /// |
| 3432 | /// corner-cut: empty edits are ignored and `media_time` is otherwise taken at face |
| 3433 | /// value, which is exactly what [`crate::audio::edit_media_time`] gives the audio |
| 3434 | /// track -- symmetry between the two is the point, not a full edit-list engine. |
| 3435 | /// Their *empty* edits can differ (83 ms of video against 62 ms of audio in that |
| 3436 | /// film, so the picture stays 21 ms -- half a frame -- early); honouring those is |
| 3437 | /// the upgrade path, and it belongs to both tracks at once. |
| 3438 | |
| 3439 | |
| 3440 | |
| 3441 | |
| 3442 | |
| 3443 | |
| 3444 | |
| 3445 | |
| 3446 | |
| 3447 | |
| 3448 | |
| 3449 | |
| 3450 | |
| 3451 | /// 1-based id of the sample the presentation starts on, for a track trimmed by |
| 3452 | /// `trim` media ticks ([`trim_ticks`]). `None` (no edit list) and zero are both |
| 3453 | /// "no trim", i.e. the first sample. |
| 3454 | |
| 3455 | |
| 3456 | |
| 3457 | |
| 3458 | /// Every sync point of a track paired with the *display* index it is really at: |
| 3459 | /// `(display index, decode position)`, ascending. `times` holds each access |
| 3460 | /// unit's presentation time in **decode** order -- Matroska block timestamps, |
| 3461 | /// mp4 `stts + ctts` composition times -- and `sync` says which of them a |
| 3462 | /// decoder may be started on. |
| 3463 | /// |
| 3464 | /// A picture's index everywhere above this tier is its rank in *presentation* |
| 3465 | /// order, and a stream that codes pictures out of order does not put its sync |
| 3466 | /// points at the same rank in the two: an **open-GOP** HEVC stream (x265's |
| 3467 | /// default, so every film off a disc or a web rip) writes the RASL leading |
| 3468 | /// pictures of a GOP *after* the CRA that opens it in decode order and *before* |
| 3469 | /// it on screen, so the keyframe stored 28th is the 30th picture shown. Seeking |
| 3470 | /// by its stored position and then counting frames from there lands two |
| 3471 | /// pictures late -- and by however many leading pictures that GOP happens to |
| 3472 | /// carry elsewhere, which is why no constant can stand in for this. |
| 3473 | /// |
| 3474 | /// The sort is stable, so blocks sharing a timestamp keep decode order. |
| 3475 | |
| 3476 | |
| 3477 | |
| 3478 | |
| 3479 | |
| 3480 | |
| 3481 | |
| 3482 | |
| 3483 | |
| 3484 | |
| 3485 | |
| 3486 | /// Composition (presentation) time of every sample of an mp4 track, in decode |
| 3487 | /// order and media ticks: the `stts` decode times with the `ctts` offsets added |
| 3488 | /// on, which is the pair that says a B-frame is shown before the picture stored |
| 3489 | /// ahead of it. Both tables arrive as their `(sample_count, value)` runs, the |
| 3490 | /// shape [`stts_pairs`] already hands the `stts` over in; the `ctts` runs may |
| 3491 | /// cover fewer samples than exist, in which case the rest carry no offset. |
| 3492 | |
| 3493 | |
| 3494 | |
| 3495 | |
| 3496 | |
| 3497 | |
| 3498 | |
| 3499 | |
| 3500 | |
| 3501 | |
| 3502 | |
| 3503 | |
| 3504 | |
| 3505 | |
| 3506 | |
| 3507 | |
| 3508 | |
| 3509 | |
| 3510 | |
| 3511 | |
| 3512 | |
| 3513 | |
| 3514 | |
| 3515 | |
| 3516 | |
| 3517 | /// Rank of the sample at 0-based decode index `sample` in presentation order, |
| 3518 | /// tie-broken by decode order exactly as [`sync_display_order`]'s stable sort |
| 3519 | /// is. Used for frame 0, which an edit list can put at any sample. |
| 3520 | |
| 3521 | |
| 3522 | |
| 3523 | |
| 3524 | |
| 3525 | |
| 3526 | |
| 3527 | |
| 3528 | |
| 3529 | |
| 3530 | |
| 3531 | /// The latest sync point at or before display index `frame`, out of a |
| 3532 | /// [`sync_display_order`] table. `None` when the track's first sync point is |
| 3533 | /// already past `frame`, i.e. there is nothing decodable earlier. |
| 3534 | |
| 3535 | |
| 3536 | |
| 3537 | |
| 3538 | |
| 3539 | |
| 3540 | |
| 3541 | /// Largest entry of the ascending sync table that is `<= sample_id`. An empty |
| 3542 | /// table means every sample is a sync sample. When `sample_id` sits before the |
| 3543 | /// first sync sample there is nothing decodable earlier, so that one wins. |
| 3544 | |
| 3545 | |
| 3546 | |
| 3547 | |
| 3548 | |
| 3549 | |
| 3550 | |
| 3551 | |
| 3552 | |
| 3553 | |
| 3554 | /// Length-prefixed NALs (`avcC` or `hvcC` framing) -> Annex-B. `n` is the |
| 3555 | /// prefix width the sample entry declares, 1..=4; a wrong one misparses |
| 3556 | /// immediately, hence the check. |
| 3557 | |
| 3558 | |
| 3559 | |
| 3560 | |
| 3561 | |
| 3562 | |
| 3563 | |
| 3564 | |
| 3565 | |
| 3566 | |
| 3567 | |
| 3568 | |
| 3569 | |
| 3570 | |
| 3571 | |
| 3572 | |
| 3573 | |
| 3574 | |
| 3575 | |
| 3576 | |
| 3577 | |
| 3578 | |
| 3579 | /// The `hvcC` payload of `track_id`'s sample entry, read straight out of the |
| 3580 | /// file: `mp4 0.14`'s `HvcCBox` keeps the configuration version and skips |
| 3581 | /// everything after it (`hev1.rs:193`), so the VPS/SPS/PPS an HEVC decoder |
| 3582 | /// cannot start without are unreachable through the crate. |
| 3583 | |
| 3584 | |
| 3585 | |
| 3586 | |
| 3587 | |
| 3588 | |
| 3589 | |
| 3590 | |
| 3591 | |
| 3592 | /// The `colr` box of `track_id`'s sample entry (ISO 14496-12 §12.1.5), which is |
| 3593 | /// where an mp4 says what its picture's numbers mean. `nclx` is what every |
| 3594 | /// muxer writes now and carries a range flag; `nclc`, QuickTime's older twin, |
| 3595 | /// is the same three code points with no range byte after them. Anything else |
| 3596 | /// (`rICC`, `prof`: ICC profiles) is not a code-point description at all and is |
| 3597 | /// left to the tier below. |
| 3598 | /// |
| 3599 | /// [`None`] rather than an error for a file with no such box, which is most of |
| 3600 | /// them -- an untagged mp4 is not a broken one. |
| 3601 | |
| 3602 | |
| 3603 | |
| 3604 | |
| 3605 | |
| 3606 | |
| 3607 | |
| 3608 | |
| 3609 | |
| 3610 | |
| 3611 | |
| 3612 | |
| 3613 | |
| 3614 | |
| 3615 | |
| 3616 | |
| 3617 | |
| 3618 | |
| 3619 | |
| 3620 | |
| 3621 | |
| 3622 | /// The `clli` and `mdcv` boxes of `track_id`'s sample entry: what an mp4 says |
| 3623 | /// about how bright its pictures get, beside the `colr` that says what their |
| 3624 | /// numbers mean. Neither is a FullBox -- their payloads are the HEVC SEI |
| 3625 | /// messages of the same names, byte for byte, and are read by the same pair of |
| 3626 | /// readers ([`crate::colorspace::clli`], [`crate::colorspace::mdcv`]). |
| 3627 | /// |
| 3628 | /// Empty rather than an error for the files that carry neither, which is every |
| 3629 | /// SDR mp4 there is. |
| 3630 | |
| 3631 | |
| 3632 | |
| 3633 | |
| 3634 | |
| 3635 | |
| 3636 | |
| 3637 | |
| 3638 | |
| 3639 | |
| 3640 | |
| 3641 | |
| 3642 | |
| 3643 | /// The four-character code of `track_id`'s first `stsd` sample entry and that |
| 3644 | /// entry's payload. Read by hand for the same reason the record above is: the |
| 3645 | /// crate keeps no fourcc for a sample entry it does not recognise, so this is |
| 3646 | /// the only thing that can tell an `hvc1` track from a track in a codec nothing |
| 3647 | /// here reads. Shared with `audio`, which asks it the same question of a `soun` |
| 3648 | /// track: `mp4a` or the `ac-3` the crate drops on the floor. |
| 3649 | pub |
| 3650 | |
| 3651 | |
| 3652 | |
| 3653 | |
| 3654 | |
| 3655 | |
| 3656 | |
| 3657 | |
| 3658 | |
| 3659 | |
| 3660 | |
| 3661 | |
| 3662 | |
| 3663 | |
| 3664 | |
| 3665 | |
| 3666 | |
| 3667 | |
| 3668 | /// HEVCDecoderConfigurationRecord (ISO 14496-15 §8.3.3.1) -> the NAL length |
| 3669 | /// prefix width, the VPS/SPS/PPS arrays as one Annex-B blob, and the luma bit |
| 3670 | /// depth the plugin picks its surface pool from. |
| 3671 | |
| 3672 | |
| 3673 | |
| 3674 | |
| 3675 | |
| 3676 | |
| 3677 | |
| 3678 | |
| 3679 | |
| 3680 | |
| 3681 | |
| 3682 | |
| 3683 | |
| 3684 | |
| 3685 | |
| 3686 | |
| 3687 | |
| 3688 | |
| 3689 | |
| 3690 | |
| 3691 | |
| 3692 | |
| 3693 | |
| 3694 | |
| 3695 | |
| 3696 | |
| 3697 | |
| 3698 | |
| 3699 | |
| 3700 | |
| 3701 | |
| 3702 | |
| 3703 | |
| 3704 | |
| 3705 | |
| 3706 | |
| 3707 | |
| 3708 | |
| 3709 | |
| 3710 | |
| 3711 | |
| 3712 | |
| 3713 | |
| 3714 | |
| 3715 | |
| 3716 | |
| 3717 | |
| 3718 | |
| 3719 | |
| 3720 | |
| 3721 | |
| 3722 | /// Payload of the first top-level box of type `want`, or `None` if the file has |
| 3723 | /// none. Only the box wanted is read; the rest is seeked over, so a `moov` at |
| 3724 | /// the end of a two-hour film costs one seek and not a copy of the file. |
| 3725 | |
| 3726 | |
| 3727 | |
| 3728 | |
| 3729 | |
| 3730 | |
| 3731 | |
| 3732 | |
| 3733 | |
| 3734 | |
| 3735 | |
| 3736 | |
| 3737 | |
| 3738 | |
| 3739 | |
| 3740 | |
| 3741 | |
| 3742 | |
| 3743 | |
| 3744 | |
| 3745 | |
| 3746 | |
| 3747 | |
| 3748 | |
| 3749 | |
| 3750 | |
| 3751 | |
| 3752 | |
| 3753 | |
| 3754 | |
| 3755 | |
| 3756 | /// The ISO-BMFF boxes in `buf`, as (type, payload). Stops at the first |
| 3757 | /// malformed header rather than erroring: every caller is looking for one box |
| 3758 | /// and reports its own absence. |
| 3759 | pub |
| 3760 | |
| 3761 | |
| 3762 | |
| 3763 | |
| 3764 | |
| 3765 | |
| 3766 | |
| 3767 | |
| 3768 | |
| 3769 | |
| 3770 | |
| 3771 | |
| 3772 | |
| 3773 | |
| 3774 | |
| 3775 | |
| 3776 | |
| 3777 | |
| 3778 | |
| 3779 | |
| 3780 | /// Payload of the first child box of type `want`. |
| 3781 | |
| 3782 | |
| 3783 | |
| 3784 | |
| 3785 | /// `track_id` out of a `tkhd` payload: a FullBox whose creation and |
| 3786 | /// modification times are 32-bit in version 0 and 64-bit in version 1. |
| 3787 | |
| 3788 | |
| 3789 | |
| 3790 | |
| 3791 | |
| 3792 | |
| 3793 | |
| 3794 | /// One subtitle track of a Matroska file, exactly as its `TrackEntry` declares |
| 3795 | /// it. What the cues *mean* is [`crate::subtitle`]'s business; this is the |
| 3796 | /// walk, and it reads every track type 0x11 the file has -- including the ones |
| 3797 | /// nothing here can render, which is how a caller names what it is leaving out |
| 3798 | /// instead of quietly opening a film with no subtitles in the list. |
| 3799 | |
| 3800 | |
| 3801 | |
| 3802 | |
| 3803 | |
| 3804 | |
| 3805 | |
| 3806 | |
| 3807 | |
| 3808 | |
| 3809 | |
| 3810 | |
| 3811 | |
| 3812 | |
| 3813 | |
| 3814 | |
| 3815 | |
| 3816 | |
| 3817 | |
| 3818 | |
| 3819 | |
| 3820 | |
| 3821 | |
| 3822 | |
| 3823 | |
| 3824 | /// One subtitle block: when it shows and the bytes it shows. |
| 3825 | |
| 3826 | |
| 3827 | |
| 3828 | |
| 3829 | |
| 3830 | |
| 3831 | |
| 3832 | |
| 3833 | |
| 3834 | |
| 3835 | |
| 3836 | |
| 3837 | |
| 3838 | |
| 3839 | /// The Matroska codec id of Blu-ray bitmap subtitles: run-length pictures in |
| 3840 | /// display sets, read by [`crate::subtitle`] as [`MkvCue`]s like any other. |
| 3841 | pub const PGS: &str = "S_HDMV/PGS"; |
| 3842 | |
| 3843 | /// The subtitle tracks of a Matroska file, in file order. An mp4's are a |
| 3844 | /// different beast and are read by [`mp4_subtitles`]; anything that is not a |
| 3845 | /// Matroska file at all is an error, as it is for [`matroska_audio_codec`]. |
| 3846 | /// |
| 3847 | /// Two passes at most: the header walk stops at the first `Cluster`, and the |
| 3848 | /// cue pass runs only when there is a text track to fill. |
| 3849 | |
| 3850 | |
| 3851 | |
| 3852 | |
| 3853 | |
| 3854 | |
| 3855 | |
| 3856 | |
| 3857 | |
| 3858 | |
| 3859 | |
| 3860 | |
| 3861 | |
| 3862 | |
| 3863 | |
| 3864 | |
| 3865 | |
| 3866 | |
| 3867 | |
| 3868 | |
| 3869 | |
| 3870 | |
| 3871 | |
| 3872 | |
| 3873 | |
| 3874 | |
| 3875 | |
| 3876 | |
| 3877 | |
| 3878 | |
| 3879 | |
| 3880 | |
| 3881 | |
| 3882 | |
| 3883 | |
| 3884 | |
| 3885 | |
| 3886 | |
| 3887 | |
| 3888 | |
| 3889 | |
| 3890 | |
| 3891 | |
| 3892 | |
| 3893 | /// One timed-text subtitle track of an mp4 -- the `tx3g` sample entry ffmpeg |
| 3894 | /// calls `mov_text` -- exactly as its `trak` declares it. The mp4 half of |
| 3895 | /// [`MkvSubtitle`]: what the samples *mean* is [`crate::subtitle`]'s business, |
| 3896 | /// this is the walk. |
| 3897 | |
| 3898 | |
| 3899 | |
| 3900 | |
| 3901 | |
| 3902 | |
| 3903 | |
| 3904 | |
| 3905 | |
| 3906 | |
| 3907 | |
| 3908 | |
| 3909 | |
| 3910 | |
| 3911 | |
| 3912 | |
| 3913 | /// One timed-text sample: when it shows, when it stops, and the bytes. |
| 3914 | |
| 3915 | |
| 3916 | |
| 3917 | |
| 3918 | |
| 3919 | |
| 3920 | |
| 3921 | |
| 3922 | |
| 3923 | |
| 3924 | |
| 3925 | |
| 3926 | |
| 3927 | |
| 3928 | |
| 3929 | |
| 3930 | |
| 3931 | /// The timed-text subtitle tracks of an mp4, in track-id order -- the reader |
| 3932 | /// that makes an mp4 export of this project's own openable again, and reads a |
| 3933 | /// `mov_text` track ffmpeg muxed just the same. |
| 3934 | /// |
| 3935 | /// The samples come out of the `mp4` crate, which walks `stts`/`stsz`/`stco` |
| 3936 | /// for any track type; the *title* does not, because that crate's `TrakBox` has |
| 3937 | /// no `udta` field at all -- so the one box carrying it is read by hand out of |
| 3938 | /// the `moov`, the way [`sample_entry`] reads an `stsd` entry the crate drops. |
| 3939 | /// |
| 3940 | /// A file with no timed-text track comes back empty, never an error; a file that |
| 3941 | /// is not an mp4 at all is an error, as [`matroska_subtitles`] is for a |
| 3942 | /// non-Matroska. |
| 3943 | |
| 3944 | |
| 3945 | |
| 3946 | |
| 3947 | |
| 3948 | |
| 3949 | |
| 3950 | |
| 3951 | |
| 3952 | |
| 3953 | |
| 3954 | |
| 3955 | |
| 3956 | |
| 3957 | |
| 3958 | |
| 3959 | |
| 3960 | |
| 3961 | |
| 3962 | |
| 3963 | |
| 3964 | |
| 3965 | |
| 3966 | |
| 3967 | |
| 3968 | |
| 3969 | |
| 3970 | |
| 3971 | |
| 3972 | |
| 3973 | |
| 3974 | |
| 3975 | |
| 3976 | |
| 3977 | |
| 3978 | |
| 3979 | |
| 3980 | |
| 3981 | |
| 3982 | |
| 3983 | |
| 3984 | |
| 3985 | |
| 3986 | |
| 3987 | |
| 3988 | |
| 3989 | |
| 3990 | |
| 3991 | |
| 3992 | |
| 3993 | |
| 3994 | /// Each `trak`'s `udta/name`, by track id, for the traks that have one -- an |
| 3995 | /// mp4's word for what a track is *called*, beside the `mdhd` language it is |
| 3996 | /// in. Read by hand for the reason [`mp4_subtitles`] gives. |
| 3997 | |
| 3998 | |
| 3999 | |
| 4000 | |
| 4001 | |
| 4002 | |
| 4003 | |
| 4004 | |
| 4005 | |
| 4006 | |
| 4007 | |
| 4008 | |
| 4009 | |
| 4010 | |
| 4011 | |
| 4012 | |
| 4013 | |
| 4014 | /// One `TrackEntry`, `Some` only for track type 0x11 -- the subtitles. |
| 4015 | |
| 4016 | |
| 4017 | |
| 4018 | |
| 4019 | |
| 4020 | |
| 4021 | |
| 4022 | |
| 4023 | |
| 4024 | |
| 4025 | |
| 4026 | |
| 4027 | |
| 4028 | |
| 4029 | |
| 4030 | |
| 4031 | |
| 4032 | |
| 4033 | |
| 4034 | |
| 4035 | |
| 4036 | |
| 4037 | |
| 4038 | |
| 4039 | |
| 4040 | |
| 4041 | |
| 4042 | |
| 4043 | |
| 4044 | |
| 4045 | |
| 4046 | |
| 4047 | |
| 4048 | |
| 4049 | |
| 4050 | |
| 4051 | |
| 4052 | |
| 4053 | /// Every block of the `wanted` tracks, appended to their entries in `tracks`. |
| 4054 | /// |
| 4055 | /// A second cluster walk rather than a widening of [`mkv_blocks`]: that one |
| 4056 | /// indexes *one* video track and reads no payloads, and a subtitle needs every |
| 4057 | /// track at once, the bytes, and the `BlockDuration` beside them. |
| 4058 | |
| 4059 | |
| 4060 | |
| 4061 | |
| 4062 | |
| 4063 | |
| 4064 | |
| 4065 | |
| 4066 | |
| 4067 | |
| 4068 | |
| 4069 | |
| 4070 | |
| 4071 | |
| 4072 | |
| 4073 | |
| 4074 | |
| 4075 | |
| 4076 | |
| 4077 | |
| 4078 | |
| 4079 | |
| 4080 | |
| 4081 | |
| 4082 | |
| 4083 | |
| 4084 | |
| 4085 | |
| 4086 | |
| 4087 | |
| 4088 | |
| 4089 | |
| 4090 | |
| 4091 | |
| 4092 | |
| 4093 | |
| 4094 | |
| 4095 | |
| 4096 | |
| 4097 | |
| 4098 | |
| 4099 | |
| 4100 | |
| 4101 | |
| 4102 | |
| 4103 | |
| 4104 | |
| 4105 | |
| 4106 | |
| 4107 | |
| 4108 | |
| 4109 | |
| 4110 | |
| 4111 | |
| 4112 | |
| 4113 | |
| 4114 | |
| 4115 | |
| 4116 | |
| 4117 | |
| 4118 | |
| 4119 | |
| 4120 | |
| 4121 | |
| 4122 | |
| 4123 | |
| 4124 | |
| 4125 | |
| 4126 | |
| 4127 | |
| 4128 | |
| 4129 | |
| 4130 | |
| 4131 | |
| 4132 | |
| 4133 | |
| 4134 | |
| 4135 | |
| 4136 | |
| 4137 | |
| 4138 | |
| 4139 | |
| 4140 | |
| 4141 | |
| 4142 | /// A string element, without the trailing NULs a `Name` may be padded with. |
| 4143 | |
| 4144 | |
| 4145 | |
| 4146 | |
| 4147 | |
| 4148 | |
| 4149 | |
| 4150 | |
| 4151 | |
| 4152 | |
| 4153 | |
| 4154 | |
| 4155 | |
| 4156 | |
| 4157 | |
| 4158 | |
| 4159 | |
| 4160 | |
| 4161 | |
| 4162 | |
| 4163 | |
| 4164 | |
| 4165 | |
| 4166 | |
| 4167 | |
| 4168 | |
| 4169 | |
| 4170 | |
| 4171 | |
| 4172 | |
| 4173 | |
| 4174 | |
| 4175 | |
| 4176 | |
| 4177 | |
| 4178 | |
| 4179 | |
| 4180 | |
| 4181 | |
| 4182 | |
| 4183 | |
| 4184 | |
| 4185 | |
| 4186 | |
| 4187 | |
| 4188 | |
| 4189 | |
| 4190 | |
| 4191 | |
| 4192 | |
| 4193 | |
| 4194 | |
| 4195 | |
| 4196 | |
| 4197 | |
| 4198 | |
| 4199 | |
| 4200 | |
| 4201 | |
| 4202 | |
| 4203 | |
| 4204 | |
| 4205 | |
| 4206 | |
| 4207 | |
| 4208 | |
| 4209 | |
| 4210 | |
| 4211 | |
| 4212 | |
| 4213 | |
| 4214 | |
| 4215 | |
| 4216 | |
| 4217 | |
| 4218 | |
| 4219 | |
| 4220 | |
| 4221 | |
| 4222 | |
| 4223 | |
| 4224 | |
| 4225 | |
| 4226 | |
| 4227 | |
| 4228 | |
| 4229 | |
| 4230 | |
| 4231 | |
| 4232 | |
| 4233 | |
| 4234 | |
| 4235 | |
| 4236 | |
| 4237 | |
| 4238 | |
| 4239 | |
| 4240 | |
| 4241 | |
| 4242 | |
| 4243 | |
| 4244 | |
| 4245 | |
| 4246 | |
| 4247 | |
| 4248 | |
| 4249 | |
| 4250 | |
| 4251 | |
| 4252 | |
| 4253 | |
| 4254 | |
| 4255 | |
| 4256 | |
| 4257 | |
| 4258 | |
| 4259 | |
| 4260 | |
| 4261 | |
| 4262 | |
| 4263 | |
| 4264 | |
| 4265 | |
| 4266 | |
| 4267 | |
| 4268 | |
| 4269 | |
| 4270 | |
| 4271 | |
| 4272 | |
| 4273 | |
| 4274 | |
| 4275 | |
| 4276 | |
| 4277 | |
| 4278 | |
| 4279 | |
| 4280 | |
| 4281 | |
| 4282 | |
| 4283 | |
| 4284 | |
| 4285 | |
| 4286 | |
| 4287 | |
| 4288 | |
| 4289 | |
| 4290 | |
| 4291 | |
| 4292 | |
| 4293 | |
| 4294 | |
| 4295 | |
| 4296 | |
| 4297 | |
| 4298 | |
| 4299 | |
| 4300 | |
| 4301 | |
| 4302 | |
| 4303 | |
| 4304 | |
| 4305 | |
| 4306 | |
| 4307 | |
| 4308 | |
| 4309 | |
| 4310 | |
| 4311 | |
| 4312 | |
| 4313 | |
| 4314 | |
| 4315 | |
| 4316 | |
| 4317 | |
| 4318 | |
| 4319 | |
| 4320 | |
| 4321 | |
| 4322 | |
| 4323 | |
| 4324 | |
| 4325 | |
| 4326 | |
| 4327 | |
| 4328 | |
| 4329 | |
| 4330 | |
| 4331 | |
| 4332 | |
| 4333 | |
| 4334 | |
| 4335 | |
| 4336 | |
| 4337 | |
| 4338 | |
| 4339 | |
| 4340 | |
| 4341 | |
| 4342 | |
| 4343 | |
| 4344 | |
| 4345 | |
| 4346 | |
| 4347 | |
| 4348 | |
| 4349 | |
| 4350 | |
| 4351 | |
| 4352 | |
| 4353 | |
| 4354 | |
| 4355 | |
| 4356 | |
| 4357 | |
| 4358 | |
| 4359 | |
| 4360 | |
| 4361 | |
| 4362 | |
| 4363 | |
| 4364 | |
| 4365 | |
| 4366 | |
| 4367 | |
| 4368 | |
| 4369 | |
| 4370 | |
| 4371 | |
| 4372 | |
| 4373 | |
| 4374 | |
| 4375 | |
| 4376 | |
| 4377 | |
| 4378 | |
| 4379 | |
| 4380 | |
| 4381 | |
| 4382 | |
| 4383 | |
| 4384 | |
| 4385 | |
| 4386 | |
| 4387 | |
| 4388 | |
| 4389 | |
| 4390 | |
| 4391 | |
| 4392 | |
| 4393 | |
| 4394 | |
| 4395 | |
| 4396 | |
| 4397 | |
| 4398 | |
| 4399 | |
| 4400 | |
| 4401 | |
| 4402 | |
| 4403 | |
| 4404 | |
| 4405 | |
| 4406 | |
| 4407 | |
| 4408 | |
| 4409 | |
| 4410 | |
| 4411 | |
| 4412 | |
| 4413 | |
| 4414 | |
| 4415 | |
| 4416 | |
| 4417 | |
| 4418 | |
| 4419 | |
| 4420 | |
| 4421 | |
| 4422 | |
| 4423 | |
| 4424 | |
| 4425 | |
| 4426 | |
| 4427 | |
| 4428 | |
| 4429 | |
| 4430 | |
| 4431 | |
| 4432 | |
| 4433 | |
| 4434 | |
| 4435 | |
| 4436 | |
| 4437 | |
| 4438 | |
| 4439 | |
| 4440 | |
| 4441 | |
| 4442 | |
| 4443 | |
| 4444 | |
| 4445 | |
| 4446 | |
| 4447 | |
| 4448 | |
| 4449 | |
| 4450 | |
| 4451 | |
| 4452 | |
| 4453 | |
| 4454 | |
| 4455 | |
| 4456 | |
| 4457 | |
| 4458 | |
| 4459 | |
| 4460 | |
| 4461 | |
| 4462 | |
| 4463 | |
| 4464 | |
| 4465 | |
| 4466 | |
| 4467 | |
| 4468 | |
| 4469 | |
| 4470 | |
| 4471 | |
| 4472 | |
| 4473 | |
| 4474 | |
| 4475 | |
| 4476 | |
| 4477 | |
| 4478 | |
| 4479 | |
| 4480 | |
| 4481 | |
| 4482 | |
| 4483 | |
| 4484 | |
| 4485 | |
| 4486 | |
| 4487 | |
| 4488 | |
| 4489 | |
| 4490 | |
| 4491 | |
| 4492 | |
| 4493 | |
| 4494 | |
| 4495 | |
| 4496 | |
| 4497 | |
| 4498 | |
| 4499 | |
| 4500 | |
| 4501 | |
| 4502 | |
| 4503 | |
| 4504 | |
| 4505 | |
| 4506 | |
| 4507 | |
| 4508 | |
| 4509 | |
| 4510 | |
| 4511 | |
| 4512 | |
| 4513 | |
| 4514 | |
| 4515 | |
| 4516 | |
| 4517 | |
| 4518 | |
| 4519 | |
| 4520 | |
| 4521 | |
| 4522 | |
| 4523 | |
| 4524 | |
| 4525 | |
| 4526 | |
| 4527 | |
| 4528 | |
| 4529 | |
| 4530 | |
| 4531 | |
| 4532 | |
| 4533 | |
| 4534 | |
| 4535 | |
| 4536 | |
| 4537 | |
| 4538 | |
| 4539 | |
| 4540 | |
| 4541 | |
| 4542 | |
| 4543 | |
| 4544 | |
| 4545 | |
| 4546 | |
| 4547 | |
| 4548 | |
| 4549 | |
| 4550 | |
| 4551 | |
| 4552 | |
| 4553 | |
| 4554 | |
| 4555 | |
| 4556 | |
| 4557 | |
| 4558 | |
| 4559 | |
| 4560 | |
| 4561 | |
| 4562 | |
| 4563 | |
| 4564 | |
| 4565 | |
| 4566 | |
| 4567 | |
| 4568 | |
| 4569 | |
| 4570 | |
| 4571 | |
| 4572 | |
| 4573 | |
| 4574 | |
| 4575 | |
| 4576 | |
| 4577 | |
| 4578 | |
| 4579 | |
| 4580 | |
| 4581 | |
| 4582 | |
| 4583 | |
| 4584 | |
| 4585 | |
| 4586 | |
| 4587 | |
| 4588 | |
| 4589 | |
| 4590 | |
| 4591 | |
| 4592 | |
| 4593 | |
| 4594 | |
| 4595 | |
| 4596 | |
| 4597 | |
| 4598 | |
| 4599 | |
| 4600 | |
| 4601 | |
| 4602 | |
| 4603 | |
| 4604 | |
| 4605 | |
| 4606 | |
| 4607 | |
| 4608 | |
| 4609 | |
| 4610 | |
| 4611 | |
| 4612 | |
| 4613 | |
| 4614 | |
| 4615 | |
| 4616 | |
| 4617 | |
| 4618 | |
| 4619 | |
| 4620 | |
| 4621 | |
| 4622 | |
| 4623 | |
| 4624 | |
| 4625 | |
| 4626 | |
| 4627 | |
| 4628 | |
| 4629 | |
| 4630 | |
| 4631 | |
| 4632 | |
| 4633 | |
| 4634 | |
| 4635 | |
| 4636 | |
| 4637 | |
| 4638 | |
| 4639 | |
| 4640 | |
| 4641 | |
| 4642 | |
| 4643 | |
| 4644 | |
| 4645 | |
| 4646 | |
| 4647 | |
| 4648 | |
| 4649 | |
| 4650 | |
| 4651 | |
| 4652 | |
| 4653 | |
| 4654 | |
| 4655 | |
| 4656 | |
| 4657 | |
| 4658 | |
| 4659 | |
| 4660 | |
| 4661 | |
| 4662 | |
| 4663 | |
| 4664 | |
| 4665 | |
| 4666 | |
| 4667 | |
| 4668 | |
| 4669 | |
| 4670 | |
| 4671 | |
| 4672 | |
| 4673 | |
| 4674 | |
| 4675 | |
| 4676 | |
| 4677 | |
| 4678 | |
| 4679 | |
| 4680 | |
| 4681 | |
| 4682 | |
| 4683 | |
| 4684 | |
| 4685 | |
| 4686 | |
| 4687 | |
| 4688 | |
| 4689 | |
| 4690 | |
| 4691 | |
| 4692 | |
| 4693 | |
| 4694 | |
| 4695 | |
| 4696 | |
| 4697 | |
| 4698 | |
| 4699 | |
| 4700 | |
| 4701 | |
| 4702 | |
| 4703 | |
| 4704 | |
| 4705 | |
| 4706 | |
| 4707 | |
| 4708 | |
| 4709 | |
| 4710 | |
| 4711 | |
| 4712 | |
| 4713 | |
| 4714 | |
| 4715 | |
| 4716 | |
| 4717 | |
| 4718 | |
| 4719 | |
| 4720 | |
| 4721 | |
| 4722 | |
| 4723 | |
| 4724 | |
| 4725 | |
| 4726 | |
| 4727 | |
| 4728 | |
| 4729 | |
| 4730 | |
| 4731 | |
| 4732 | |
| 4733 | |
| 4734 | |
| 4735 | |
| 4736 | |
| 4737 | |
| 4738 | |
| 4739 | |
| 4740 | |
| 4741 | |
| 4742 | |
| 4743 | |
| 4744 | |
| 4745 | |
| 4746 | |
| 4747 | |
| 4748 | |
| 4749 | |
| 4750 | |
| 4751 | |
| 4752 | |
| 4753 | |
| 4754 | |
| 4755 | |
| 4756 | |
| 4757 | |
| 4758 | |
| 4759 | |
| 4760 | |
| 4761 | |
| 4762 | |
| 4763 | |
| 4764 | |
| 4765 | |
| 4766 | |
| 4767 | |
| 4768 | |
| 4769 | |
| 4770 | |
| 4771 | |
| 4772 | |
| 4773 | |
| 4774 | |
| 4775 | |
| 4776 | |
| 4777 | |
| 4778 | |
| 4779 | |
| 4780 | |
| 4781 | |
| 4782 | |
| 4783 | |
| 4784 | |
| 4785 | |
| 4786 | |
| 4787 | |
| 4788 | |
| 4789 | |
| 4790 | |
| 4791 | |
| 4792 | |
| 4793 | |
| 4794 | |
| 4795 | |
| 4796 | |
| 4797 | |
| 4798 | |
| 4799 | |
| 4800 | |
| 4801 | |
| 4802 | |
| 4803 | |
| 4804 | |
| 4805 | |
| 4806 | |
| 4807 | |
| 4808 | |
| 4809 | |
| 4810 | |
| 4811 | |
| 4812 | |
| 4813 | |
| 4814 | |
| 4815 | |
| 4816 | |
| 4817 | |
| 4818 | |
| 4819 | |
| 4820 | |
| 4821 | |
| 4822 | |
| 4823 | |
| 4824 | |
| 4825 | |
| 4826 | |
| 4827 | |
| 4828 | |
| 4829 | |
| 4830 | |
| 4831 | |
| 4832 | |
| 4833 | |
| 4834 | |
| 4835 | |
| 4836 | |
| 4837 | |
| 4838 | |
| 4839 | |
| 4840 | |
| 4841 | |
| 4842 | |
| 4843 | |
| 4844 | |
| 4845 | |
| 4846 | |
| 4847 | |
| 4848 | |
| 4849 | |
| 4850 | |
| 4851 | |
| 4852 | |
| 4853 | |
| 4854 | |
| 4855 | |
| 4856 | |
| 4857 | |
| 4858 | |
| 4859 | |
| 4860 | |
| 4861 | |
| 4862 | |
| 4863 | |
| 4864 | |
| 4865 | |
| 4866 | |
| 4867 | |
| 4868 | |
| 4869 | |
| 4870 | |
| 4871 | |
| 4872 | |
| 4873 | |
| 4874 | |
| 4875 | |
| 4876 | |
| 4877 | |
| 4878 | |
| 4879 | |
| 4880 | |
| 4881 | |
| 4882 | |
| 4883 | |
| 4884 | |
| 4885 | |
| 4886 | |
| 4887 | |
| 4888 | |
| 4889 | |
| 4890 | |
| 4891 | |
| 4892 | |
| 4893 | |
| 4894 | |
| 4895 | |
| 4896 | |
| 4897 | |
| 4898 | |
| 4899 | |
| 4900 | |
| 4901 | |
| 4902 | |
| 4903 | |
| 4904 | |
| 4905 | |
| 4906 | |
| 4907 | |
| 4908 | |
| 4909 | |
| 4910 | |
| 4911 | |
| 4912 | |
| 4913 | |
| 4914 | |
| 4915 | |
| 4916 | |
| 4917 | |
| 4918 | |
| 4919 | |
| 4920 | |
| 4921 | |
| 4922 | |
| 4923 | |
| 4924 | |
| 4925 | |
| 4926 | |
| 4927 | |
| 4928 | |
| 4929 | |
| 4930 | |
| 4931 | |
| 4932 | |
| 4933 | |
| 4934 | |
| 4935 | |
| 4936 | |
| 4937 | |
| 4938 | |
| 4939 | |
| 4940 | |
| 4941 | |
| 4942 | |
| 4943 | |
| 4944 | |
| 4945 | |
| 4946 | |
| 4947 | |
| 4948 | |
| 4949 | |
| 4950 | |
| 4951 | |
| 4952 | |
| 4953 | |
| 4954 | |
| 4955 | |
| 4956 | |
| 4957 | |
| 4958 | |
| 4959 | |
| 4960 | |
| 4961 | |
| 4962 | |
| 4963 | |
| 4964 | |
| 4965 | |
| 4966 |