ref: c9a45262d2655e843fcc0ad7382f08efcc523926
parent: 7d4898f6656fd7c060bb27c0b10d6735a1f76337
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sat Aug 21 18:48:01 EDT 2021
add -A option to specify audio offset (-200 for audio delayed by 200ms)
--- a/main.c
+++ b/main.c
@@ -21,6 +21,7 @@
static Conn *cs;
static int ncs;
static uvlong ns₀, vms;
+static vlong aoff;
static uvlong
ns2ms(uvlong z, uvlong ns)
@@ -49,6 +50,8 @@
if(af.sz == 0) /* eof */
break;
ms = ns2ms(af.ns₀, af.ns);
+ if((vlong)ms+aoff >= 0)
+ ms += aoff;
for(c = cs, i = 0; i < ncs; i++, c++){
if(rtmpdata(c->r, c->sid, ms, Taudio, af.buf, af.sz) != 0){
@@ -70,7 +73,7 @@
static void
usage(void)
{
- fprint(2, "usage: %s [-a AUDIO] URL [URL...]\n", argv0);
+ fprint(2, "usage: %s [-A AUDIOOFF] [-a AUDIO] URL [URL...]\n", argv0);
threadexitsall("usage");
}
@@ -92,6 +95,9 @@
case 'a':
if((a = Bopen(EARGF(usage()), OREAD)) == nil)
sysfatal("%r");
+ break;
+ case 'A':
+ aoff = atoll(EARGF(usage()));
break;
default:
usage();