summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-08 11:13:49 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:20:59 +0100
commita4d88ae13bc60e3f6269334d633495668af0c640 (patch)
treeaeb67ac686b957bf5653dcec39279997c7fa3fc5
parent6831ebd958d2d1a66689e8adf9fc6f1d753c1544 (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;
}