osmo-gapk: fix I/O combinations check

Previously both ALSA source and sink were out of attention.
This commit is contained in:
Vadim Yanitskiy 2017-09-08 11:13:49 +03:00
parent 6831ebd958
commit a4d88ae13b
1 changed files with 20 additions and 8 deletions

View File

@ -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;
}
/* Check I/O combinations */
int src_count = 0;
int sink_count = 0;
/* 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");
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;
}