Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alsa-utils: axfer: rewrite aplay, adding 'timer-based scheduling' option #3

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
508b077
axfer: add an entry point for this command
takaswie Nov 13, 2018
a8fb2d7
axfer: add a sub-command to print list of PCMs/devices
takaswie Nov 13, 2018
48ed244
axfer: add a common interface to handle a file with audio-specific da…
takaswie Nov 13, 2018
48d9fd6
axfer: add support for a container of Microsoft/IBM RIFF/Wave format
takaswie Nov 13, 2018
1f047bd
axfer: add support for a container of Sparc AU format
takaswie Nov 13, 2018
078f832
axfer: add support for a container of Creative Tech. voice format
takaswie Nov 13, 2018
d833e6a
axfer: add support for a container of raw data
takaswie Nov 13, 2018
43fbf48
axfer: add unit test for container interface
takaswie Nov 13, 2018
bdfb9cb
axfer: add a common interface to align data frames on different layout
takaswie Nov 13, 2018
625ccb0
axfer: add support for a mapper for single target
takaswie Nov 13, 2018
847acdb
axfer: add support for a mapper for multiple target
takaswie Nov 13, 2018
db71b68
axfer: add a unit test for mapper interface
takaswie Nov 13, 2018
8801c64
axfer: add a common interface to transfer data frames
takaswie Nov 13, 2018
ed56699
axfer: add a parser for command-line options
takaswie Nov 13, 2018
8bdb812
axfer: add support to transfer data frames by alsa-lib PCM APIs
takaswie Nov 13, 2018
a7a744b
axfer: add support for blocking data transmission operation of alsa-l…
takaswie Nov 13, 2018
d651248
axfer: add a sub-command to transfer data frames
takaswie Nov 13, 2018
a937a90
axfer: add informative output and an option to suppress it
takaswie Nov 13, 2018
4379e18
axfer: add an option to dump available hardware parameters
takaswie Nov 13, 2018
328f569
axfer: add options related to duration and obsolete '--max-file-size'…
takaswie Nov 13, 2018
43bde41
axfer: add an option to finish transmission at XRUN
takaswie Nov 13, 2018
8338234
axfer: add support for non-blocking operation
takaswie Nov 13, 2018
5089e14
axfer: add support for MMAP PCM operation
takaswie Nov 13, 2018
5699b4b
axfer: add an option to suppress event waiting
takaswie Nov 13, 2018
14174e8
axfer: add options for buffer arrangement
takaswie Nov 13, 2018
38a53b6
axfer: add options for software parameters of PCM substream
takaswie Nov 13, 2018
24c859e
axfer: add options for plugins in alsa-lib
takaswie Nov 13, 2018
c8b77f3
axfer: add a common interface of waiter for I/O event notification
takaswie Nov 13, 2018
384882c
axfer: add an option for waiter type
takaswie Nov 13, 2018
5105eaa
axfer: add an implementation of waiter for poll(2)
takaswie Nov 13, 2018
9a8e6a8
axfer: add an implementation of waiter for select(2)
takaswie Nov 13, 2018
a8e5fdd
axfer: add an implementation of waiter for epoll(7)
takaswie Nov 13, 2018
97c55ca
axfer: add support for timer-based scheduling model with MMAP operation
takaswie Nov 13, 2018
4dc1785
axfer: obsolete some unimplemented options
takaswie Nov 13, 2018
5830d7d
axfer: add support for libffado transmission backend
takaswie Nov 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
axfer: add an option for waiter type
This commit is an integration to add an option for users to choose waiter
type. Users give the type to value to '--waiter-type' ('-w') option to
choose it. Currently, 'snd_pcm_wait()' is just supported as a default.
This alsa-lib API is implemented with a call of poll(2).

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
  • Loading branch information
takaswie committed Nov 13, 2018
commit 384882c7949149221b34ce25f279696539daaec3
26 changes: 25 additions & 1 deletion axfer/xfer-libasound.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum no_short_opts {
// 200 or later belong to non us-ascii character set.
OPT_PERIOD_SIZE = 200,
OPT_BUFFER_SIZE,
OPT_WAITER_TYPE,
OPT_DISABLE_RESAMPLE,
OPT_DISABLE_CHANNELS,
OPT_DISABLE_FORMAT,
Expand All @@ -33,6 +34,7 @@ static const struct option l_opts[] = {
{"avail-min", 1, 0, 'A'},
{"start-delay", 1, 0, 'R'},
{"stop-delay", 1, 0, 'T'},
{"waiter-type", 1, 0, OPT_WAITER_TYPE},
// For plugins in alsa-lib.
{"disable-resample", 0, 0, OPT_DISABLE_RESAMPLE},
{"disable-channels", 0, 0, OPT_DISABLE_CHANNELS},
Expand Down Expand Up @@ -86,6 +88,8 @@ static int xfer_libasound_parse_opt(struct xfer_context *xfer, int key,
state->msec_for_start_threshold = arg_parse_decimal_num(optarg, &err);
else if (key == 'T')
state->msec_for_stop_threshold = arg_parse_decimal_num(optarg, &err);
else if (key == OPT_WAITER_TYPE)
state->waiter_type_literal = arg_duplicate_string(optarg, &err);
else if (key == OPT_DISABLE_RESAMPLE)
state->no_auto_resample = true;
else if (key == OPT_DISABLE_CHANNELS)
Expand Down Expand Up @@ -147,6 +151,25 @@ int xfer_libasound_validate_opts(struct xfer_context *xfer)
}
}

if (state->waiter_type_literal != NULL) {
if (state->test_nowait) {
fprintf(stderr,
"An option for waiter type should not be "
"used with nowait test option.\n");
return -EINVAL;
}
if (!state->nonblock && !state->mmap) {
fprintf(stderr,
"An option for waiter type should be used "
"with nonblock or mmap options.\n");
return -EINVAL;
}
state->waiter_type =
waiter_type_from_label(state->waiter_type_literal);
} else {
state->waiter_type = WAITER_TYPE_DEFAULT;
}

return err;
}

Expand Down Expand Up @@ -201,7 +224,6 @@ static int open_handle(struct xfer_context *xfer)

if ((state->nonblock || state->mmap) && !state->test_nowait)
state->use_waiter = true;
state->waiter_type = WAITER_TYPE_DEFAULT;

err = snd_pcm_hw_params_any(state->handle, state->hw_params);
if (err < 0)
Expand Down Expand Up @@ -751,7 +773,9 @@ static void xfer_libasound_destroy(struct xfer_context *xfer)
struct libasound_state *state = xfer->private_data;

free(state->node_literal);
free(state->waiter_type_literal);
state->node_literal = NULL;
state->waiter_type_literal = NULL;

if (state->hw_params)
snd_pcm_hw_params_free(state->hw_params);
Expand Down
1 change: 1 addition & 0 deletions axfer/xfer-libasound.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct libasound_state {
bool verbose;

char *node_literal;
char *waiter_type_literal;

unsigned int msec_per_period;
unsigned int msec_per_buffer;
Expand Down