shithub: treason

ref: 339de1879aec67a053cc0bdf11bb47d3eaf290a2
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);