ref: 523b8ff86604d789c92481c9588d72c91d7ef9bb
parent: c5d4cd0d1a217b849ecbe219d11145c872941d2b
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Tue Feb 23 14:50:23 EST 2021
matroska: write flac as is; prepend codec private data when writing as-is data
--- a/common.h
+++ b/common.h
@@ -14,7 +14,8 @@
FmtVorbis = 0x766f7262u,
FmtSrt = 0x00737274u, /* srt subtitles */
FmtMp3 = 0x006d7033u,
- FmtTheora = 0x74687261,
+ FmtTheora = 0x74687261u,
+ FmtFlac = 0x666c6163u,
};
#define min(a,b) ((a)<=(b)?(a):(b))
--- a/matroska.c
+++ b/matroska.c
@@ -102,12 +102,16 @@
}
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 @@
}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;