also looking at this
feat(video): add native AVC/HEVC and synchronized AAC MP4 streaming
#913
14 files
+1119
-0
| @@ -0,0 +1,25 @@ | ||
| 1 | # Header-checked native video adapter | |
| 2 | ||
| 3 | `codecs/video/native_encoder.{c,h,zig}` compiles the x264/x265 boundary against | |
| 4 | installed vendor headers. Only Home-owned scalar configuration and borrowed | |
| 5 | length-prefixed packet data cross the interface. The Zig wrapper validates input | |
| 6 | geometry, timestamps and encode/drain state. Link the C source and libx264/libx265. | |
| 7 | ||
| 8 | `Encoder.requestKeyframe()` / `home_encoder_request_keyframe` requests an IDR for | |
| 9 | the next submitted input. Requests coalesce. This supports independently decodable | |
| 10 | recording splits without waiting for the regular GOP interval. Inspect emitted | |
| 11 | packet timestamps and key flags before switching outputs: buffered AVC output | |
| 12 | can precede the newly requested IDR. Keep headers outside packet history and | |
| 13 | remux each segment with a fresh sample description and a rebased timeline. | |
| 14 | ||
| 15 | Use requests only on an active encoder before draining, serialize every operation, | |
| 16 | and consume borrowed output before another adapter call. The Zig wrapper rejects | |
| 17 | requests after drain/failure. A request neither drains nor resets the encoder. | |
| 18 | ||
| 19 | The standalone `tests/native_encoder_idr.zig` imports this module as `encoder` and | |
| 20 | links its compiled C boundary. Its regression encodes eight frames under GOP100, | |
| 21 | forces IDRs at inputs 3 and 6, checks actual AVC/HEVC IDR NAL types and packet keys, | |
| 22 | counts every delayed/flushed frame, and rejects requests after drain. It passes | |
| 23 | on Zig 0.15.2 and Home's installed 0.17 development toolchain with x264/x265. | |
| 24 | zig-camera additionally remuxes split files and pre-roll snapshots and validates | |
| 25 | them with independent decoders. No FFmpeg or Libav is used in this path. | |