ref: d23c026cbb1ff3faf38b518cddb128012142515b
parent: 0a8b65bdc3e24922fb611cbc5ac0f590a11189a3
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Jul 8 10:53:01 EDT 2021
leave empty files if no audio (or video) stream is available
--- a/nvi.c
+++ b/nvi.c
@@ -137,17 +137,17 @@
if(oa != nil){
if((afd = open(oa, OWRITE|OTRUNC)) < 0 && (afd = create(oa, OWRITE|OTRUNC, 0644)) < 0)
sysfatal("%r");
- if(hget(fa->url, afd) < 0)
+ if(fa != nil && ++i && hget(fa->url, afd) < 0)
sysfatal("%r");
- i++;
}
if(ov != nil){
if((vfd = open(ov, OWRITE|OTRUNC)) < 0 && (vfd = create(ov, OWRITE|OTRUNC, 0644)) < 0)
sysfatal("%r");
- if(hget(fv->url, vfd) < 0)
+ if(fv != nil && ++i && hget(fv->url, vfd) < 0)
sysfatal("%r");
- i++;
}
+ if(i == 0)
+ sysfatal("no streams found");
while(i-- > 0)
procwait();