From 94d1a87d0432d885756f9d23cfba1f8229cfe453 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 8 Mar 2009 13:45:24 +0100 Subject: music_chunk: added assertions on the audio format In !NDEBUG, remember which audio_format is stored in every chunk and every pipe. Check the audio_format of every new data block appended to the music_chunk, and the format of every new chunk appended to the music_pipe. --- src/chunk.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/chunk.h') diff --git a/src/chunk.h b/src/chunk.h index 2136c9349..7d39ebdf7 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -19,6 +19,10 @@ #ifndef MPD_CHUNK_H #define MPD_CHUNK_H +#ifndef NDEBUG +#include "audio_format.h" +#endif + #include #include #include @@ -57,6 +61,10 @@ struct music_chunk { /** the data (probably PCM) */ char data[CHUNK_SIZE]; + +#ifndef NDEBUG + struct audio_format audio_format; +#endif }; void @@ -71,6 +79,16 @@ music_chunk_is_empty(const struct music_chunk *chunk) return chunk->length == 0 && chunk->tag == NULL; } +#ifndef NDEBUG +/** + * Checks if the audio format if the chunk is equal to the specified + * audio_format. + */ +bool +music_chunk_check_format(const struct music_chunk *chunk, + const struct audio_format *audio_format); +#endif + /** * Prepares appending to the music chunk. Returns a buffer where you * may write into. After you are finished, call music_chunk_expand(). -- cgit v1.2.3