shithub: rtmp

ref: 89e5bd16ebd6946456bc737a2c0b2796f125a5a7
dir: /amf0.h/

View raw version
enum {
	Tstr,
	Tnum,
	Tbool,
	Tarr,
	Tobj,
	Tnull,
};

typedef struct Amf0 Amf0;

struct Amf0 {
	int type;
	union {
		char *str;
		double num;
		u8int bool;
		struct {
			Amf0 **v;
			int n;
		}arr;
		struct {
			char **k;
			Amf0 **v;
			int n;
		}obj;
	};
};

u8int *amf0null(u8int *p, u8int *e);
u8int *amf0i16(u8int *p, u8int *e, s16int i);
u8int *amf0bool(u8int *p, u8int *e, int v);
u8int *amf0byte(u8int *p, u8int *e, u8int byte);
u8int *amf0i24(u8int *p, u8int *e, s32int i);
u8int *amf0i32(u8int *p, u8int *e, s32int i);
u8int *amf0num(u8int *p, u8int *e, double v);
u8int *amf0str(u8int *p, u8int *e, char *s);
u8int *amf0arr(u8int *p, u8int *e);
u8int *amf0obj(u8int *p, u8int *e);
u8int *amf0end(u8int *p, u8int *e);
u8int *amf0kvnum(u8int *p, u8int *e, char *name, double v);
u8int *amf0kvstr(u8int *p, u8int *e, char *name, char *v);
u8int *amf0kvbool(u8int *p, u8int *e, char *name, int v);

u8int *amf0byteget(u8int *p, u8int *e, u8int *byte);
u8int *amf0i16get(u8int *p, u8int *e, s16int *i);
u8int *amf0i24get(u8int *p, u8int *e, s32int *i);
u8int *amf0i32get(u8int *p, u8int *e, s32int *i);
u8int *amf0i32leget(u8int *p, u8int *e, s32int *i);

u8int *amf0parse(Amf0 **a, u8int *p, u8int *e);
void amf0free(Amf0 *a);

#pragma varargck type "A" Amf0*
int amf0fmt(Fmt *f);