edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBc327308Tahinli25 days ago1014 commits
| 1 | //! The MPEG-1/2 video software seat: one span of `ec-mpeg2` through the same |
| 2 | //! [`Render`] door every other seat's pictures go through. Export reads the same |
| 3 | //! [`Stream`] to decode its sources. Always software: no GPU path exists for it here. |
| 4 | //! |
| 5 | //! `ec-mpeg2` takes one coded picture per packet (what the transport-stream demuxer |
| 6 | //! hands out, with the sequence header in front of a keyframe that lacks one) and |
| 7 | //! releases frames in display order, I and P one reference late and B at once; the |
| 8 | //! last ones wait in it until the stream is flushed. |
| 9 | //! |
| 10 | //! **Seeking.** A span starts on the keyframe at or before the target: a sequence |
| 11 | //! header or an I picture. A B picture of an open GOP that follows it and needs the |
| 12 | //! reference before it has none, so `ec-mpeg2` drops it, as ffmpeg does; those |
| 13 | //! pictures sit *before* the landing I picture in display order, so the display index |
| 14 | //! counts from the I picture, where the demuxer put it. |
| 15 | //! |
| 16 | //! **Interlace.** Field pictures come out woven, with the field order in the frame. An |
| 17 | //! interlaced sequence (`progressive_sequence` 0) goes through the same deinterlacer |
| 18 | //! H.264 does ([`crate::deinterlace`]), picture by picture: a picture coded |
| 19 | //! progressive (`progressive_frame` 1, a film cadence inside an interlaced sequence) |
| 20 | //! is left exactly as it was. As for H.264 the stage runs one picture behind, so a |
| 21 | //! seek lands one picture earlier and the target is filtered from the same neighbours |
| 22 | //! a sequential decode gave it. |
| 23 | //! |
| 24 | //! **Chroma.** 4:2:2 (the 4:2:2 profile) has its chroma averaged down a pair of rows |
| 25 | //! to 4:2:0 as H.264 and HEVC 4:2:2 do ([`Deep`]). |
| 26 | //! |
| 27 | //! `repeat_first_field` (3:2 pulldown) is not applied: the timeline is frame-locked |
| 28 | //! and the demuxer counts one frame per coded picture. |
| 29 | |
| 30 | use SyncSender; |
| 31 | |
| 32 | use ; |
| 33 | use ; |
| 34 | use ; |
| 35 | use Mpeg2Decoder; |
| 36 | |
| 37 | use ; |
| 38 | use crateDeinterlacer; |
| 39 | use crateDemuxer; |
| 40 | use crate; |
| 41 | |
| 42 | /// One MPEG-1/2 decode, pulled a picture at a time. |
| 43 | pub |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 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 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | /// The MPEG-1/2 software seat over `[start_frame, end_frame)`. A span decodes from |
| 168 | /// the keyframe at or before `start_frame`; pictures before the target are decoded |
| 169 | /// (the target references them) but never sent. |
| 170 | /// |
| 171 | /// A refusal out of `ec-mpeg2` fails the span in words: named on stderr, the pictures |
| 172 | /// decoded so far stand, and no garbage is sent. |
| 173 | // The eight inputs every software span takes (`run_hevc` has the same shape); a |
| 174 | // one-off struct would only ever be built and taken apart here. |
| 175 | |
| 176 | pub |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 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 | /// Queues one picture through the shared [`Render`]. `true` when the consumer went |
| 224 | /// away, so the span stops rather than keeps decoding into a void. |
| 225 | |
| 226 | |
| 227 | |
| 228 |