ReviewOS

also looking at this

home-lang/home

feat(video): add native AVC/HEVC and synchronized AAC MP4 streaming

#913
Merged chris wants to merge feat/avc-hevc-mp4 into main
14 files +1119 -0
packages/video/src/codecs/video/native_encoder.hadded+18-0
Changes to packages/video/src/codecs/video/native_encoder.h
@@ -0,0 +1,18 @@
1/* Home codec bridge, MIT. Compile against installed x264.h/x265.h. */
2#ifndef HOME_NATIVE_ENCODER_H
3#define HOME_NATIVE_ENCODER_H
4#include <stddef.h>
5#include <stdint.h>
6typedef struct home_encoder home_encoder;
7typedef struct { uint32_t codec, width, height, fps_num, fps_den, bitrate, quality, gop; } home_encoder_config;
8/* Length-prefixed NAL units; borrowed until the next call. pts uses microseconds.
9 * Low latency: no B frames/lookahead; AVC VFR buffers one input for duration.
10 * Empty output means buffered. Drain flush() before close; serialize calls. */
11typedef struct { const uint8_t *data; size_t size; int64_t pts; int key; } home_packet;
12int home_encoder_open(const home_encoder_config *, home_encoder **);
13int home_encoder_headers(home_encoder *, home_packet *);
14int home_encoder_encode(home_encoder *, const uint8_t *const planes[3], const int strides[3], int64_t pts, home_packet *);
15int home_encoder_request_keyframe(home_encoder *);
16int home_encoder_flush(home_encoder *, home_packet *);
17void home_encoder_close(home_encoder *);
18#endif