ref: acc732ac0da6a971337d857b2789f05eb1a4aab4
dir: /stream.h/
typedef struct Stream Stream; typedef struct Streamhdr Streamhdr; typedef struct Streamframe Streamframe; typedef struct Streaminfo Streaminfo; typedef struct Streamops Streamops; #pragma incomplete Stream enum { Svideo, Saudio, Ssubtitles, /* video */ FmtAV1 = 0, FmtH264, FmtVP8, FmtVP9, /* audio */ FmtAAC, FmtMp3, FmtOpus, FmtVorbis, FmtFlac, /* subtitles */ FmtSrt, Numfmt, }; struct Streamframe { uvlong timestamp; uvlong dt; union { struct { /* video/audio */ u8int *buf; int sz; }; struct { /* subtitles */ char *lines[16]; int nlines; }; }; }; struct Streamops { Stream *(*open)(char *path, int *num, int *failed); u8int *(*alloc)(void *aux, int sz); void (*close)(Stream *s); int (*read)(Stream *s, Streamframe *f); void *aux; }; struct Streaminfo { int type; int fmt; struct { uvlong denum, num; }timebase; union { struct { int w, h; }video; struct { int nchan; int srate; }audio; }; char info[128]; }; #define Zt₀ (~0ULL) struct Stream { Streaminfo; Streamops ops; /* private stuff */ uvlong timestamp; uvlong t₀; void *b; u8int *buf; int bufsz; void *aux; void (*freeaux)(void *); }; Stream *Sopen(char *filename, int *num); void Sclose(Stream *s); int Sread(Stream *s, Streamframe *f); int ivfopenb(void *bio, Stream *s, int *failed); int audopenfd(int fd, Stream *s, int *failed); int subopenfd(int fd, Stream *s, int *failed); Stream *subopen(char *path, int *num, int *failed);