shithub: treason

ref: 325e635966381744f324b92c740a20c71dbae95c
dir: /stream.h/

View raw version
typedef struct Stream Stream;
typedef struct Streamhdr Streamhdr;
typedef struct Streamframe Streamframe;
typedef struct Streaminfo Streaminfo;
typedef struct Streamops Streamops;
#pragma incomplete Stream

enum {
	FmtAV1,
};

struct Streamframe {
	u8int *buf;
	int sz;
	uvlong offset;
	uvlong timestamp;
};

struct Streamops {
	Stream *(*open)(char *filename, Streaminfo *info, int *failed);
	u8int *(*alloc)(void *aux, int sz);
	void (*close)(Stream *s);
	vlong (*offset)(Stream *s);
	int (*read)(Stream *s, Streamframe *f);

	void *aux;
};

struct Streamhdr {
	Streamops ops;
};

struct Streaminfo {
	struct {
		uvlong denum, num;
	}timebase;
	int fmt;
	int w;
	int h;
};

Stream *Sopen(char *filename, Streaminfo *info);
vlong Soffset(Stream *s);
void Sclose(Stream *s);
int Sread(Stream *s, Streamframe *f);