@@ 14,7 14,8 @@ enum {
FmtVorbis = 0x766f7262u,
FmtSrt = 0x00737274u, /* srt subtitles */
FmtMp3 = 0x006d7033u,
- FmtTheora = 0x74687261,
+ FmtTheora = 0x74687261u,
+ FmtFlac = 0x666c6163u,
};
#define min(a,b) ((a)<=(b)?(a):(b))
@@ 102,12 102,16 @@ format(Ebml *e)
}
static int
-asispacket(Biobuf *out, Packetctx *, Packet *p, int np, uvlong, int)
+asispacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong, int)
{
int i;
+ if(ctx->frid == 0)
+ Bwrite(out, ctx->codec.priv.data, ctx->codec.priv.sz);
+
for(i = 0; i < np; i++, p++)
Bwrite(out, p->data, p->sz);
+ ctx->frid++;
return 0;
}
@@ 147,6 151,9 @@ initctx(Ebml *e, double duration)
}else if(strcmp(c, "aac") == 0){
e->fmt = FmtMp4a;
e->fpacket = aacpacket;
+ }else if(strcmp(c, "flac") == 0){
+ e->fmt = FmtFlac;
+ e->fpacket = asispacket;
}else
goto err;
return 0;