|
|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
* Один publisher и один viewer, TX <=2MB/128 records, RX <=4MB/256 records. |
|
|
|
|
* Data принимает полные H.264 Annex B кадры (KEY содержит SPS/PPS/IDR) и Opus 48k mono/20ms. |
|
|
|
|
* pull передаёт владение u_malloc-буфером: kind:1,flags:1,width:2,height:2,rotation:2,PTS_us:8,length:4,data. |
|
|
|
|
* kinds: video=1,audio=2,gap=3,opened=4,ended=5,error=6. Числа big-endian. |
|
|
|
|
* kinds: video=1,audio=2,gap=3,opened=4,ended=5,error=6; error.flags = stream_close_reason. Числа big-endian. |
|
|
|
|
* Медиаданные передаются через pull, не через общий чатовый event bus. */ |
|
|
|
|
#ifndef ANDROID_STREAM_BRIDGE_H |
|
|
|
|
#define ANDROID_STREAM_BRIDGE_H |
|
|
|
|
@ -15,11 +15,11 @@ struct UTUN_INSTANCE;
|
|
|
|
|
/* 0 attached, -1 invalid/busy: нельзя передать singleton другому ядру до detach старого. */ |
|
|
|
|
int android_stream_attach(struct UTUN_INSTANCE *inst); |
|
|
|
|
void android_stream_detach(struct UTUN_INSTANCE *inst); |
|
|
|
|
/* source=0 — publisher; source!=0 — viewer с обязательным expected_epoch. Команда принята=0, результат через pull. */ |
|
|
|
|
int android_stream_open(uint64_t id, uint64_t group, uint64_t source, unsigned width, unsigned height, |
|
|
|
|
unsigned rotation, int audio, uint64_t expected_epoch); |
|
|
|
|
/* Наблюдение выбранного канала через CHAT_EVT_STREAM_SOURCES; group=0 снимает его. */ |
|
|
|
|
int android_stream_watch(uint64_t group); |
|
|
|
|
/* source=0 — publisher; source!=0 — viewer. 0 означает, что команда принята, результат приходит через pull. */ |
|
|
|
|
int android_stream_feed(uint64_t id, int video, uint64_t pts, int key, const uint8_t *data, size_t length); |
|
|
|
|
/* feed: 1 accepted, 0 dropped (video: запросить KEY), -1 detached/stopped/invalid. */ |
|
|
|
|
void android_stream_stop(uint64_t id); |
|
|
|
|
|