mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 22:56:31 +01:00
axfer: enable each backend to print own help
This commit adds an operation for xfer backend to print help text. In this time, content of the help is not implemented yet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
908ff69be2
commit
97fe7b550c
5 changed files with 25 additions and 0 deletions
|
@ -880,6 +880,11 @@ static void xfer_libasound_destroy(struct xfer_context *xfer)
|
|||
state->log = NULL;
|
||||
}
|
||||
|
||||
static void xfer_libasound_help(struct xfer_context *xfer)
|
||||
{
|
||||
printf(" (placeholder)\n");
|
||||
}
|
||||
|
||||
const struct xfer_data xfer_libasound = {
|
||||
.s_opts = S_OPTS,
|
||||
.l_opts = l_opts,
|
||||
|
@ -893,6 +898,7 @@ const struct xfer_data xfer_libasound = {
|
|||
.pause = xfer_libasound_pause,
|
||||
.post_process = xfer_libasound_post_process,
|
||||
.destroy = xfer_libasound_destroy,
|
||||
.help = xfer_libasound_help,
|
||||
},
|
||||
.private_size = sizeof(struct libasound_state),
|
||||
};
|
||||
|
|
|
@ -537,6 +537,11 @@ static void xfer_libffado_destroy(struct xfer_context *xfer)
|
|||
state->guid_literal = NULL;
|
||||
}
|
||||
|
||||
static void xfer_libffado_help(struct xfer_context *xfer)
|
||||
{
|
||||
printf(" (placeholder)\n");
|
||||
}
|
||||
|
||||
const struct xfer_data xfer_libffado = {
|
||||
.s_opts = S_OPTS,
|
||||
.l_opts = l_opts,
|
||||
|
@ -550,6 +555,7 @@ const struct xfer_data xfer_libffado = {
|
|||
.pause = xfer_libffado_pause,
|
||||
.post_process = xfer_libffado_post_process,
|
||||
.destroy = xfer_libffado_destroy,
|
||||
.help = xfer_libffado_help,
|
||||
},
|
||||
.private_size = sizeof(struct libffado_state),
|
||||
};
|
||||
|
|
|
@ -373,6 +373,12 @@ int xfer_options_parse_args(struct xfer_context *xfer,
|
|||
|
||||
if (xfer->help) {
|
||||
print_help();
|
||||
if (xfer->ops->help) {
|
||||
printf("\n");
|
||||
printf(" BACKEND-OPTIONS (%s) =\n",
|
||||
xfer_label_from_type(xfer->type));
|
||||
xfer->ops->help(xfer);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,11 @@ enum xfer_type xfer_type_from_label(const char *label)
|
|||
return XFER_TYPE_UNSUPPORTED;
|
||||
}
|
||||
|
||||
const char *xfer_label_from_type(enum xfer_type type)
|
||||
{
|
||||
return xfer_type_labels[type];
|
||||
}
|
||||
|
||||
int xfer_context_init(struct xfer_context *xfer, enum xfer_type type,
|
||||
snd_pcm_stream_t direction, int argc, char *const *argv)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ struct xfer_context {
|
|||
};
|
||||
|
||||
enum xfer_type xfer_type_from_label(const char *label);
|
||||
const char *xfer_label_from_type(enum xfer_type type);
|
||||
|
||||
int xfer_context_init(struct xfer_context *xfer, enum xfer_type type,
|
||||
snd_pcm_stream_t direction, int argc, char *const *argv);
|
||||
|
@ -96,6 +97,7 @@ struct xfer_ops {
|
|||
void (*post_process)(struct xfer_context *xfer);
|
||||
void (*destroy)(struct xfer_context *xfer);
|
||||
void (*pause)(struct xfer_context *xfer, bool enable);
|
||||
void (*help)(struct xfer_context *xfer);
|
||||
};
|
||||
|
||||
struct xfer_data {
|
||||
|
|
Loading…
Reference in a new issue