[pulseaudio-discuss] [PATCH 4/4] pacmd: Add functions to handle the latency offset

Tanu Kaskinen tanuk at iki.fi
Tue Jun 19 10:17:59 PDT 2012


On Sun, 2012-06-17 at 14:47 +0200, poljar (Damir Jelic) wrote:
> From: poljar <poljarinho at gmail.com>
> 
> pacmd was extended so it can handle the new latency offset.
> 
> Two new functions were introduced which enable setting and printing the
> latency offset for a specified port.
> ---
>  src/pulsecore/cli-command.c |   87 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 87 insertions(+)
> 
> diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
> index fc9465b..c346920 100644
> --- a/src/pulsecore/cli-command.c
> +++ b/src/pulsecore/cli-command.c
> @@ -135,6 +135,8 @@ static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer
>  static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
>  static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
>  static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
> +static int pa_cli_command_set_latency_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
> +static int pa_cli_command_get_latency_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
>  static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail);
>  
>  /* A method table for all available commands */
> @@ -168,6 +170,8 @@ static const struct command commands[] = {
>      { "set-card-profile",        pa_cli_command_card_profile,       "Change the profile of a card (args: index|name, profile-name)", 3},
>      { "set-sink-port",           pa_cli_command_sink_port,          "Change the port of a sink (args: index|name, port-name)", 3},
>      { "set-source-port",         pa_cli_command_source_port,        "Change the port of a source (args: index|name, port-name)", 3},
> +    { "set-latency-offset",      pa_cli_command_set_latency_offset, "Change the latency of a port (args: index|name, port-name, latency-offset)", 4},

I think "set-port-latency-offset" would be more consistent with the
other commands.

"index|name" doesn't clearly indicate what index or name the user should
give. "card-index|card-name" would be better in this regard.

> +    { "get-latency-offset",      pa_cli_command_get_latency_offset, "Show the latency of a port (args: index|name, port-name)", 3},

For consistency reasons, I'm inclined to say that get-latency-offset
shouldn't exist. There are no other "get-foo" commands. Instead, the
latency offset should be visible in the "list" command output.

>      { "suspend-sink",            pa_cli_command_suspend_sink,       "Suspend sink (args: index|name, bool)", 3},
>      { "suspend-source",          pa_cli_command_suspend_source,     "Suspend source (args: index|name, bool)", 3},
>      { "suspend",                 pa_cli_command_suspend,            "Suspend all sinks and all sources (args: bool)", 2},
> @@ -1723,6 +1727,89 @@ static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *bu
>      return 0;
>  }
>  
> +static int pa_cli_command_set_latency_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
> +    const char *n, *p, *l;
> +    pa_device_port *port;
> +    pa_card *card;
> +    uint32_t latency;

Like I said in an earlier patch review, if you want to condense "latency
offset" into one word, I think "offset" is better than "latency".

-- 
Tanu



More information about the pulseaudio-discuss mailing list