edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB8c7bf80Tahinli3 months ago114 commits
| 1 | //! HEVC import: the second source codec that is not H.264, and the first whose |
| 2 | //! parameter sets have to be dug out of the container by hand (`mp4 0.14` reads |
| 3 | //! one byte of `hvcC` and skips the rest). |
| 4 | //! |
| 5 | //! The container and refusal checks need nothing installed. The decode and |
| 6 | //! export twins need a built `libengine_hw.so` and a VA-API driver with an HEVC |
| 7 | //! decode entrypoint (`vainfo | grep HEVC`), so they are `#[ignore]`d: |
| 8 | //! |
| 9 | //! ```text |
| 10 | //! cargo build -p engine -p engine-hw --release |
| 11 | //! LD_LIBRARY_PATH=target/release \ |
| 12 | //! cargo test -p engine --release --test hevc -- --include-ignored --nocapture --test-threads=1 |
| 13 | //! ``` |
| 14 | //! |
| 15 | //! `VE_SW` is process-wide, hence `--test-threads=1`: the refusal test sets it |
| 16 | //! and puts it back so the hardware twins below really are hardware. |
| 17 | |
| 18 | use PathBuf; |
| 19 | use ; |
| 20 | |
| 21 | use ; |
| 22 | use ExportSettings; |
| 23 | use ; |
| 24 | |
| 25 | /// 1280x720@30, 2 s -- see `scripts/gen_fixtures.sh`. |
| 26 | const FRAMES: u32 = 60; |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | /// The container half: a hev1 track is found, described and named as HEVC, and |
| 35 | /// its AAC track is read exactly as any other file's. |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | /// The part `mp4 0.14` cannot do: every access unit is Annex-B framed, and the |
| 61 | /// sync ones carry the VPS, SPS and PPS read out of `hvcC` by hand. Without |
| 62 | /// those three a hardware decoder has nothing to configure itself from, so this |
| 63 | /// is the check that says the box was really parsed and not merely found. |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | /// There is no software HEVC decoder, so the software path must refuse by name |
| 94 | /// rather than feed HEVC bytes to `rusty_h264` -- and it must refuse where a |
| 95 | /// caller can still show it, i.e. out of `open`, not from inside the worker. |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | /// A timeline is refused a source coded differently, in the same words a |
| 116 | /// resolution mismatch is refused in: a front-end shows the string as it is. |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | /// The end-to-end user path: opening the file yields pictures, all of them, |
| 129 | /// through the plugin. |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | /// Export re-encodes to H.264 whatever the source was coded with: the packet |
| 159 | /// copy path is audio-only, so no HEVC byte can reach an `avc1` track. |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 |