aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-08 11:13:49 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2017-09-08 11:13:49 +0300
commit15fa605576a81803c57a144231e9e9720aa133a1 (patch)
tree624dc07e4ec8e1e42e946f43ed34c9821c036b18
parenta9f3a4fb5ac57fb50898eec8a61333bc034c087d (diff)
osmo-gapk: fix I/O combinations check
Previously both ALSA source and sink were out of attention.
-rw-r--r--src/app_osmo_gapk.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/app_osmo_gapk.c b/src/app_osmo_gapk.c
index 16a614d..720e08b 100644
--- a/src/app_osmo_gapk.c
+++ b/src/app_osmo_gapk.c
@@ -332,15 +332,27 @@ check_options(struct gapk_state *gs)
}
}
- /* Input combinations */
- if (gs->opts.fname_in && gs->opts.rtp_in.port) {
- LOGP(DAPP, LOGL_ERROR, "You have to decide on either file or RTP input\n");
- return -EINVAL;
- }
-
- /* Output combinations */
- if (gs->opts.fname_out && gs->opts.rtp_out.port) {
- LOGP(DAPP, LOGL_ERROR, "You have to decide on either file or RTP output\n");
+ /* Check I/O combinations */
+ int src_count = 0;
+ int sink_count = 0;
+
+ if (gs->opts.fname_in)
+ src_count++;
+ if (gs->opts.rtp_in.port)
+ src_count++;
+ if (gs->opts.alsa_in)
+ src_count++;
+
+ if (gs->opts.fname_out)
+ sink_count++;
+ if (gs->opts.rtp_out.port)
+ sink_count++;
+ if (gs->opts.alsa_out)
+ sink_count++;
+
+ if (src_count != 1 || sink_count != 1) {
+ LOGP(DAPP, LOGL_ERROR, "You have to decide on "
+ "a single input and a single output\n");
return -EINVAL;
}