From de0c3e717e82508499ae572cfdf7423a3e36259b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 30 Dec 2017 17:47:08 +0100 Subject: MusicChunk: split struct MusicChunkInfo from struct MusicChunk --- src/MusicChunk.cxx | 6 +++--- src/MusicChunk.hxx | 26 ++++++++++++++++---------- 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 -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 -- cgit v1.2.3