aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio_format.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 17:57:14 +0100
committerMax Kellermann <max@duempel.org>2009-11-14 01:15:26 +0100
commitcef5dcc0a15759588fcfd079ec87592511e02df4 (patch)
treeea594056a9f0b786a0fe55090d8c13a5b0e0bcff /src/audio_format.h
parente5b119a3243bf688879d601bce431d24227679c9 (diff)
downloadmpd-cef5dcc0a15759588fcfd079ec87592511e02df4.tar.gz
mpd-cef5dcc0a15759588fcfd079ec87592511e02df4.tar.xz
mpd-cef5dcc0a15759588fcfd079ec87592511e02df4.zip
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.
Diffstat (limited to 'src/audio_format.h')
-rw-r--r--src/audio_format.h19
1 files changed, 19 insertions, 0 deletions
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
@@ -56,6 +56,13 @@ struct audio_format {
};
/**
+ * 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