[pulseaudio-discuss] [PATCH] format: Expose pa_format_info convenience getters in API

Tanu Kaskinen tanuk at iki.fi
Fri Jun 1 08:45:03 UTC 2018


On Sat, 2018-05-26 at 08:58 +0530, Arun Raghavan wrote:
> diff --git a/src/pulse/format.h b/src/pulse/format.h
> index 584032fb6..812454b9c 100644
> --- a/src/pulse/format.h
> +++ b/src/pulse/format.h
> @@ -213,6 +213,22 @@ int pa_format_info_get_prop_string_array(const pa_format_info *f, const char *ke
>  /** Frees a string array returned by \ref pa_format_info_get_prop_string_array. \since 2.0 */
>  void pa_format_info_free_string_array(char **values, int n_values);
>  
> +/** Gets the sample format stored in the format info. Returns a negative error code on failure. If the sample format property is
> + * not set at all, returns a negative integer. \since 13.0 */
> +int pa_format_info_get_sample_format(const pa_format_info *f, pa_sample_format_t *sf);
> +
> +/** Gets the sample rate stored in the format info. Returns a negative error code on failure. If the sample rate property is not
> + * set at all, returns a negative integer. \since 13.0 */
> +int pa_format_info_get_rate(const pa_format_info *f, uint32_t *rate);
> +
> +/** Gets the channel count stored in the format info. Returns a negative error code on failure. If the channels property is not
> + * set at all, returns a negative integer. \since 13.0 */
> +int pa_format_info_get_channels(const pa_format_info *f, uint8_t *channels);
> +
> +/** Gets the channel map stored in the format info. Returns a negative error code on failure. If the channel map property is not
> + * set at all, returns a negative integer. \since 13.0 */
> +int pa_format_info_get_channel_map(const pa_format_info *f, pa_channel_map *map);

It could be nice if you could keep the comment lines under 80 chars
(it's not just my preference, this is in our coding style document).
Otherwise looks good to me.

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list