aboutsummaryrefslogtreecommitdiffstats
path: root/src/chunk.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-08 13:45:24 +0100
committerMax Kellermann <max@duempel.org>2009-03-08 13:45:24 +0100
commit94d1a87d0432d885756f9d23cfba1f8229cfe453 (patch)
tree1c5358045a47e07556c8476cefb8c33181e567fd /src/chunk.h
parent359f9871b230b0f3e986ea7fb30e93b9730b683b (diff)
downloadmpd-94d1a87d0432d885756f9d23cfba1f8229cfe453.tar.gz
mpd-94d1a87d0432d885756f9d23cfba1f8229cfe453.tar.xz
mpd-94d1a87d0432d885756f9d23cfba1f8229cfe453.zip
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.
Diffstat (limited to '')
-rw-r--r--src/chunk.h18
1 files changed, 18 insertions, 0 deletions
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 <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -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().