shithub: treason

Download patch

ref: f0995408d985a0939fc6cf3536702876a2ce9e9b
parent: 7d665518cc6455ac12ad0c1f12fde2d7b353e0c4
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Tue Feb 23 15:06:57 EST 2021

audio: opusdec does not need special args anymore

--- a/misc.c
+++ b/misc.c
@@ -6,14 +6,15 @@
 
 int nproc, debug;
 
-static char *fmts[] = {
+static char *fmts[Numfmt] = {
+	[FmtAAC]  = "aac",
 	[FmtAV1]  = "av1",
-	[FmtVP9]  = "vp9",
-	[FmtVP8]  = "vp8",
+	[FmtFlac] = "flac",
 	[FmtH264] = "h264",
-	[FmtAAC]  = "aac",
-	[FmtOpus] = "opus",
 	[FmtMp3]  = "mp3",
+	[FmtOpus] = "opus",
+	[FmtVP8]  = "vp8",
+	[FmtVP9]  = "vp9",
 };
 
 int
@@ -21,9 +22,12 @@
 {
 	int i;
 
-	for(i = 0; i < nelem(fmts) && fmts[i] != nil && strcmp(fmts[i], s) != 0; i++);
+	for(i = 0; i < nelem(fmts); i++){
+		if(fmts[i] != nil && strcmp(fmts[i], s) == 0)
+			return i;
+	}
 
-	return i < nelem(fmts) ? i : -1;
+	return -1;
 }
 
 char *
--- a/stream.h
+++ b/stream.h
@@ -19,6 +19,9 @@
 	FmtMp3,
 	FmtOpus,
 	FmtVorbis,
+	FmtFlac,
+
+	Numfmt,
 };
 
 struct Streamframe {
--- a/stream_audio.c
+++ b/stream_audio.c
@@ -48,11 +48,7 @@
 			dup(fd = open("/dev/null", OWRITE), 2);
 			close(fd);
 		}
-		/* FIXME why oh why */
-		if(s->fmt == FmtOpus)
-			execl(prog, prog, "--rate", "44100", "--force-stereo", "-", "-", nil);
-		else
-			execl(prog, prog, nil);
+		execl(prog, prog, nil);
 		sysfatal("exec: %r");
 	}
 	close(p[1]);