From cef5dcc0a15759588fcfd079ec87592511e02df4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 10 Nov 2009 17:57:14 +0100 Subject: audio_format: added function audio_format_to_string() Unified function for converting an audio_format object to a string, for log messages and for the "status" command. --- src/audio_format.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/audio_format.h') diff --git a/src/audio_format.h b/src/audio_format.h index a4f5ba2e0..0c1e425a9 100644 --- a/src/audio_format.h +++ b/src/audio_format.h @@ -55,6 +55,13 @@ struct audio_format { uint8_t reverse_endian; }; +/** + * Buffer for audio_format_string(). + */ +struct audio_format_string { + char buffer[24]; +}; + /** * Clears the #audio_format object, i.e. sets all attributes to an * undefined (invalid) value. @@ -219,4 +226,16 @@ static inline double audio_format_time_to_size(const struct audio_format *af) return af->sample_rate * audio_format_frame_size(af); } +/** + * Renders the #audio_format object into a string, e.g. for printing + * it in a log file. + * + * @param af the #audio_format object + * @param s a buffer to print into + * @return the string, or NULL if the #audio_format object is invalid + */ +const char * +audio_format_to_string(const struct audio_format *af, + struct audio_format_string *s); + #endif -- cgit v1.2.3