shithub: mcfs

ref: b1c20b110bb60ffba60baa27d7c076055438b8e2
dir: /packet.h/

View raw version
typedef struct Packet Packet;
typedef struct Packetctx Packetctx;

typedef int (*packet_f)(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts, int key);

struct Packet {
	uchar *data;
	int sz;
};

struct Packetctx {
	uvlong frid;
	uvlong duration;
	uvlong seekpreroll;
	vlong discardpad;
	vlong blockdur;
	struct {
		char name[16];
		vlong delay;
		struct {
			uchar *data;
			int sz;
		}priv;
	}codec;
	struct {
		uchar *data;
		int sz;
		int algo;
	}comp;
	u32int trackuid;
	u32int fmt;

	int key;

	struct {
		int width;
		int height;
	}video;
	struct {
		float samplerate;
		float outsamplerate;
		int channels;
		int bps;
	}audio;

	/* private stuff for packet_f functions */
	uchar adts[7];
	struct {
		uchar *p;
		int n;
	}ps[16];
	int nps;
};

int aacpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts, int key);
int asspacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts, int key);
int ivfpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts, int key);
int oggpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts, int key);
int srtpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts, int key);