summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-12-30 17:47:08 +0100
committerMax Kellermann <max@musicpd.org>2017-12-30 17:47:16 +0100
commitde0c3e717e82508499ae572cfdf7423a3e36259b (patch)
tree267977e8998a1fb00e1880e9a28c02621326de18
parent1194998ce949c5a98431103dd90e3f71271ee70f (diff)
MusicChunk: split struct MusicChunkInfo from struct MusicChunk
-rw-r--r--src/MusicChunk.cxx6
-rw-r--r--src/MusicChunk.hxx26
2 files changed, 19 insertions, 13 deletions
diff --git a/src/MusicChunk.cxx b/src/MusicChunk.cxx
index 9f33e9af5..5953196fd 100644
--- a/src/MusicChunk.cxx
+++ b/src/MusicChunk.cxx
@@ -24,12 +24,12 @@
#include <assert.h>
-MusicChunk::MusicChunk() noexcept = default;
-MusicChunk::~MusicChunk() noexcept = default;
+MusicChunkInfo::MusicChunkInfo() noexcept = default;
+MusicChunkInfo::~MusicChunkInfo() noexcept = default;
#ifndef NDEBUG
bool
-MusicChunk::CheckFormat(const AudioFormat other_format) const noexcept
+MusicChunkInfo::CheckFormat(const AudioFormat other_format) const noexcept
{
assert(other_format.IsValid());
diff --git a/src/MusicChunk.hxx b/src/MusicChunk.hxx
index 394366308..4a12931a5 100644
--- a/src/MusicChunk.hxx
+++ b/src/MusicChunk.hxx
@@ -37,12 +37,12 @@ static constexpr size_t CHUNK_SIZE = 4096;
struct AudioFormat;
struct Tag;
+struct MusicChunk;
/**
- * A chunk of music data. Its format is defined by the
- * MusicPipe::Push() caller.
+ * Meta information for #MusicChunk.
*/
-struct MusicChunk {
+struct MusicChunkInfo {
/** the next chunk in a linked list */
MusicChunk *next;
@@ -94,18 +94,15 @@ struct MusicChunk {
*/
unsigned replay_gain_serial;
- /** the data (probably PCM) */
- uint8_t data[CHUNK_SIZE];
-
#ifndef NDEBUG
AudioFormat audio_format;
#endif
- MusicChunk() noexcept;
- ~MusicChunk() noexcept;
+ MusicChunkInfo() noexcept;
+ ~MusicChunkInfo() noexcept;
- MusicChunk(const MusicChunk &) = delete;
- MusicChunk &operator=(const MusicChunk &) = delete;
+ MusicChunkInfo(const MusicChunkInfo &) = delete;
+ MusicChunkInfo &operator=(const MusicChunkInfo &) = delete;
bool IsEmpty() const {
return length == 0 && tag == nullptr;
@@ -119,6 +116,15 @@ struct MusicChunk {
gcc_pure
bool CheckFormat(AudioFormat audio_format) const noexcept;
#endif
+};
+
+/**
+ * A chunk of music data. Its format is defined by the
+ * MusicPipe::Push() caller.
+ */
+struct MusicChunk : MusicChunkInfo {
+ /** the data (probably PCM) */
+ uint8_t data[CHUNK_SIZE];
/**
* Prepares appending to the music chunk. Returns a buffer