shithub: mcfs

Download patch

ref: a29584a82088c3b29dec73124283bb8671e5f5db
parent: 6d2552a35e42a7fb6397b361a0ffa3a330711731
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Dec 14 17:50:54 EST 2020

ebml: unit aac and mp3 packet funcs into one

--- a/aac.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include "common.h"
-
-int
-aacpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts)
-{
-	int i;
-
-	USED(ctx); USED(ts);
-	for(i = 0; i < np; i++, p++)
-		Bwrite(out, p->data, p->sz);
-
-	return 0;
-}
--- a/common.h
+++ b/common.h
@@ -91,8 +91,6 @@
 int ivfpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts);
 int oggpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts);
 int srtpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts);
-int mp3packet(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts);
-int aacpacket(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts);
 
 int ebmlint(Biobuf *f, vlong *out, int isid);
 vlong ebmlel(Biobuf *f, vlong sz, vlong *id, vlong *esz);
--- a/ebml.c
+++ b/ebml.c
@@ -169,6 +169,17 @@
 }
 
 static int
+asispacket(Biobuf *out, Packetctx *, Packet *p, int np, uvlong)
+{
+	int i;
+
+	for(i = 0; i < np; i++, p++)
+		Bwrite(out, p->data, p->sz);
+
+	return 0;
+}
+
+static int
 initctx(Ebml *e, double duration)
 {
 	char *c;
@@ -196,10 +207,10 @@
 			e->fpacket = oggpacket;
 		}else if(strcmp(c, "mp3") == 0){
 			e->fmt = FmtMp3;
-			e->fpacket = mp3packet;
+			e->fpacket = asispacket;
 		}else if(strcmp(c, "aac") == 0){
 			e->fmt = FmtMp4a;
-			e->fpacket = aacpacket;
+			e->fpacket = asispacket;
 		}else
 			goto err;
 		return 0;
--- a/mkfile
+++ b/mkfile
@@ -6,13 +6,11 @@
 BIN=/$objtype/bin
 
 OFILES=\
-	aac.$O\
 	crc32.$O\
 	ebml.$O\
 	iso.$O\
 	ivf.$O\
 	main.$O\
-	mp3.$O\
 	ogg.$O\
 	srt.$O\
 
--- a/mp3.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include "common.h"
-
-int
-mp3packet(Biobuf *out, Packetctx *ctx, Packet *p, int np, uvlong ts)
-{
-	USED(out, ctx, p, np, ts);
-	werrstr("mp3packet not implemented");
-	return -1;
-}