Commit de0c3e71 authored by Max Kellermann's avatar Max Kellermann

MusicChunk: split struct MusicChunkInfo from struct MusicChunk

parent 1194998c
......@@ -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());
......
......@@ -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
......
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