also looking at this
feat(video): add native AVC/HEVC and synchronized AAC MP4 streaming
#913
14 files
+1119
-0
| @@ -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> | |
| 6 | typedef struct home_encoder home_encoder; | |
| 7 | typedef 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. */ | |
| 11 | typedef struct { const uint8_t *data; size_t size; int64_t pts; int key; } home_packet; | |
| 12 | int home_encoder_open(const home_encoder_config *, home_encoder **); | |
| 13 | int home_encoder_headers(home_encoder *, home_packet *); | |
| 14 | int home_encoder_encode(home_encoder *, const uint8_t *const planes[3], const int strides[3], int64_t pts, home_packet *); | |
| 15 | int home_encoder_request_keyframe(home_encoder *); | |
| 16 | int home_encoder_flush(home_encoder *, home_packet *); | |
| 17 | void home_encoder_close(home_encoder *); | |
| 18 | #endif | |