From 02c227f7ea167ec111e121c55c40ceae21ccf67c Mon Sep 17 00:00:00 2001 From: ratchov Date: Thu, 14 Aug 2008 09:47:51 +0000 Subject: [PATCH] add an "AUTOQUIT" flag to mix and sub aprocs. If the flag is set, the mix aproc will exit once there are no more input streams, similarly the sub aproc will exit once there are no more ouput streams. If the flag is not set, the mix aproc will generate silence, and the sub aproc will drop samples. By default this flag is set, so no behaviour change. ok jakemsr --- usr.bin/aucat/aproc.c | 6 +++--- usr.bin/aucat/aproc.h | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/usr.bin/aucat/aproc.c b/usr.bin/aucat/aproc.c index f780d456e18..aa358a71052 100644 --- a/usr.bin/aucat/aproc.c +++ b/usr.bin/aucat/aproc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aproc.c,v 1.8 2008/08/14 09:45:23 ratchov Exp $ */ +/* $OpenBSD: aproc.c,v 1.9 2008/08/14 09:47:51 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -395,7 +395,7 @@ mix_out(struct aproc *p, struct abuf *obuf) } if (ocount == 0) return 0; - if (LIST_EMPTY(&p->ibuflist)) { + if (LIST_EMPTY(&p->ibuflist) && (p->u.mix.flags & MIX_AUTOQUIT)) { DPRINTF("mix_out: nothing more to do...\n"); obuf->wproc = NULL; aproc_del(p); @@ -600,7 +600,7 @@ sub_hup(struct aproc *p, struct abuf *obuf) DPRINTF("sub_hup: %s: detached\n", p->name); sub_rm(p, obuf); - if (LIST_EMPTY(&p->obuflist)) { + if (LIST_EMPTY(&p->obuflist) && (p->u.sub.flags & SUB_AUTOQUIT)) { abuf_hup(ibuf); aproc_del(p); } else diff --git a/usr.bin/aucat/aproc.h b/usr.bin/aucat/aproc.h index 51dac1155ac..26cd5a77136 100644 --- a/usr.bin/aucat/aproc.h +++ b/usr.bin/aucat/aproc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: aproc.h,v 1.3 2008/08/14 09:45:23 ratchov Exp $ */ +/* $OpenBSD: aproc.h,v 1.4 2008/08/14 09:47:51 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -136,11 +136,13 @@ struct aproc { struct aconv ist, ost; } conv; struct { -#define MIX_DROP 1 +#define MIX_DROP 1 +#define MIX_AUTOQUIT 2 unsigned flags; } mix; struct { -#define SUB_DROP 1 +#define SUB_DROP 1 +#define SUB_AUTOQUIT 2 unsigned flags; } sub; } u; -- 2.20.1