Commit de0c3e71 authored by Max Kellermann's avatar Max Kellermann

MusicChunk: split struct MusicChunkInfo from struct MusicChunk

parent 1194998c
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
#include <assert.h> #include <assert.h>
MusicChunk::MusicChunk() noexcept = default; MusicChunkInfo::MusicChunkInfo() noexcept = default;
MusicChunk::~MusicChunk() noexcept = default; MusicChunkInfo::~MusicChunkInfo() noexcept = default;
#ifndef NDEBUG #ifndef NDEBUG
bool bool
MusicChunk::CheckFormat(const AudioFormat other_format) const noexcept MusicChunkInfo::CheckFormat(const AudioFormat other_format) const noexcept
{ {
assert(other_format.IsValid()); assert(other_format.IsValid());
......
...@@ -37,12 +37,12 @@ static constexpr size_t CHUNK_SIZE = 4096; ...@@ -37,12 +37,12 @@ static constexpr size_t CHUNK_SIZE = 4096;
struct AudioFormat; struct AudioFormat;
struct Tag; struct Tag;
struct MusicChunk;
/** /**
* A chunk of music data. Its format is defined by the * Meta information for #MusicChunk.
* MusicPipe::Push() caller.
*/ */
struct MusicChunk { struct MusicChunkInfo {
/** the next chunk in a linked list */ /** the next chunk in a linked list */
MusicChunk *next; MusicChunk *next;
...@@ -94,18 +94,15 @@ struct MusicChunk { ...@@ -94,18 +94,15 @@ struct MusicChunk {
*/ */
unsigned replay_gain_serial; unsigned replay_gain_serial;
/** the data (probably PCM) */
uint8_t data[CHUNK_SIZE];
#ifndef NDEBUG #ifndef NDEBUG
AudioFormat audio_format; AudioFormat audio_format;
#endif #endif
MusicChunk() noexcept; MusicChunkInfo() noexcept;
~MusicChunk() noexcept; ~MusicChunkInfo() noexcept;
MusicChunk(const MusicChunk &) = delete; MusicChunkInfo(const MusicChunkInfo &) = delete;
MusicChunk &operator=(const MusicChunk &) = delete; MusicChunkInfo &operator=(const MusicChunkInfo &) = delete;
bool IsEmpty() const { bool IsEmpty() const {
return length == 0 && tag == nullptr; return length == 0 && tag == nullptr;
...@@ -119,6 +116,15 @@ struct MusicChunk { ...@@ -119,6 +116,15 @@ struct MusicChunk {
gcc_pure gcc_pure
bool CheckFormat(AudioFormat audio_format) const noexcept; bool CheckFormat(AudioFormat audio_format) const noexcept;
#endif #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 * Prepares appending to the music chunk. Returns a buffer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment