diff options
author | Max Kellermann <max@duempel.org> | 2014-08-12 15:56:41 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-12 15:56:41 +0200 |
commit | c94b4466d52c3c625467312ea565a4685184c517 (patch) | |
tree | 940116e9613eacca9746c7f1dfa729048d34f628 | |
parent | 61f9e79ec9921ccf5a5cd53707b8ae161c380bc4 (diff) |
MusicChunk: rename struct to MusicChunk
-rw-r--r-- | src/MusicBuffer.cxx | 4 | ||||
-rw-r--r-- | src/MusicBuffer.hxx | 12 | ||||
-rw-r--r-- | src/MusicChunk.cxx | 10 | ||||
-rw-r--r-- | src/MusicChunk.hxx | 14 | ||||
-rw-r--r-- | src/MusicPipe.cxx | 14 | ||||
-rw-r--r-- | src/MusicPipe.hxx | 18 | ||||
-rw-r--r-- | src/PlayerThread.cxx | 12 | ||||
-rw-r--r-- | src/PlayerThread.hxx | 4 | ||||
-rw-r--r-- | src/decoder/DecoderAPI.cxx | 4 | ||||
-rw-r--r-- | src/decoder/DecoderControl.hxx | 2 | ||||
-rw-r--r-- | src/decoder/DecoderInternal.cxx | 2 | ||||
-rw-r--r-- | src/decoder/DecoderInternal.hxx | 5 | ||||
-rw-r--r-- | src/output/Internal.hxx | 10 | ||||
-rw-r--r-- | src/output/MultipleOutputs.cxx | 12 | ||||
-rw-r--r-- | src/output/MultipleOutputs.hxx | 16 | ||||
-rw-r--r-- | src/output/OutputThread.cxx | 10 |
16 files changed, 75 insertions, 74 deletions
diff --git a/src/MusicBuffer.cxx b/src/MusicBuffer.cxx index 26dc11591..709b40413 100644 --- a/src/MusicBuffer.cxx +++ b/src/MusicBuffer.cxx @@ -30,7 +30,7 @@ MusicBuffer::MusicBuffer(unsigned num_chunks) FatalError("Failed to allocate buffer"); } -music_chunk * +MusicChunk * MusicBuffer::Allocate() { const ScopeLock protect(mutex); @@ -38,7 +38,7 @@ MusicBuffer::Allocate() } void -MusicBuffer::Return(music_chunk *chunk) +MusicBuffer::Return(MusicChunk *chunk) { assert(chunk != nullptr); diff --git a/src/MusicBuffer.hxx b/src/MusicBuffer.hxx index 84e2af1d1..cf7c90f91 100644 --- a/src/MusicBuffer.hxx +++ b/src/MusicBuffer.hxx @@ -23,22 +23,22 @@ #include "util/SliceBuffer.hxx" #include "thread/Mutex.hxx" -struct music_chunk; +struct MusicChunk; /** - * An allocator for #music_chunk objects. + * An allocator for #MusicChunk objects. */ class MusicBuffer { /** a mutex which protects #buffer */ Mutex mutex; - SliceBuffer<music_chunk> buffer; + SliceBuffer<MusicChunk> buffer; public: /** * Creates a new #MusicBuffer object. * - * @param num_chunks the number of #music_chunk reserved in + * @param num_chunks the number of #MusicChunk reserved in * this buffer */ MusicBuffer(unsigned num_chunks); @@ -71,13 +71,13 @@ public: * @return an empty chunk or nullptr if there are no chunks * available */ - music_chunk *Allocate(); + MusicChunk *Allocate(); /** * Returns a chunk to the buffer. It can be reused by * Allocate() then. */ - void Return(music_chunk *chunk); + void Return(MusicChunk *chunk); }; #endif diff --git a/src/MusicChunk.cxx b/src/MusicChunk.cxx index 899163485..91856709e 100644 --- a/src/MusicChunk.cxx +++ b/src/MusicChunk.cxx @@ -24,14 +24,14 @@ #include <assert.h> -music_chunk::~music_chunk() +MusicChunk::~MusicChunk() { delete tag; } #ifndef NDEBUG bool -music_chunk::CheckFormat(const AudioFormat other_format) const +MusicChunk::CheckFormat(const AudioFormat other_format) const { assert(other_format.IsValid()); @@ -40,8 +40,8 @@ music_chunk::CheckFormat(const AudioFormat other_format) const #endif WritableBuffer<void> -music_chunk::Write(const AudioFormat af, - float data_time, uint16_t _bit_rate) +MusicChunk::Write(const AudioFormat af, + float data_time, uint16_t _bit_rate) { assert(CheckFormat(af)); assert(length == 0 || audio_format.IsValid()); @@ -67,7 +67,7 @@ music_chunk::Write(const AudioFormat af, } bool -music_chunk::Expand(const AudioFormat af, size_t _length) +MusicChunk::Expand(const AudioFormat af, size_t _length) { const size_t frame_size = af.GetFrameSize(); diff --git a/src/MusicChunk.hxx b/src/MusicChunk.hxx index dddcfa269..835221233 100644 --- a/src/MusicChunk.hxx +++ b/src/MusicChunk.hxx @@ -39,15 +39,15 @@ struct Tag; * A chunk of music data. Its format is defined by the * MusicPipe::Push() caller. */ -struct music_chunk { +struct MusicChunk { /** the next chunk in a linked list */ - struct music_chunk *next; + MusicChunk *next; /** * An optional chunk which should be mixed into this chunk. * This is used for cross-fading. */ - struct music_chunk *other; + MusicChunk *other; /** * The current mix ratio for cross-fading: 1.0 means play 100% @@ -92,13 +92,13 @@ struct music_chunk { AudioFormat audio_format; #endif - music_chunk() + MusicChunk() :other(nullptr), length(0), tag(nullptr), replay_gain_serial(0) {} - ~music_chunk(); + ~MusicChunk(); bool IsEmpty() const { return length == 0 && tag == nullptr; @@ -118,7 +118,7 @@ struct music_chunk { * where you may write into. After you are finished, call * Expand(). * - * @param chunk the music_chunk object + * @param chunk the MusicChunk object * @param audio_format the audio format for the appended data; * must stay the same for the life cycle of this chunk * @param data_time the time within the song @@ -134,7 +134,7 @@ struct music_chunk { * Increases the length of the chunk after the caller has written to * the buffer returned by Write(). * - * @param chunk the music_chunk object + * @param chunk the MusicChunk object * @param audio_format the audio format for the appended data; must * stay the same for the life cycle of this chunk * @param length the number of bytes which were appended diff --git a/src/MusicPipe.cxx b/src/MusicPipe.cxx index d7e36f2a4..43ce2dbb2 100644 --- a/src/MusicPipe.cxx +++ b/src/MusicPipe.cxx @@ -25,11 +25,11 @@ #ifndef NDEBUG bool -MusicPipe::Contains(const music_chunk *chunk) const +MusicPipe::Contains(const MusicChunk *chunk) const { const ScopeLock protect(mutex); - for (const struct music_chunk *i = head; i != nullptr; i = i->next) + for (const MusicChunk *i = head; i != nullptr; i = i->next) if (i == chunk) return true; @@ -38,12 +38,12 @@ MusicPipe::Contains(const music_chunk *chunk) const #endif -music_chunk * +MusicChunk * MusicPipe::Shift() { const ScopeLock protect(mutex); - music_chunk *chunk = head; + MusicChunk *chunk = head; if (chunk != nullptr) { assert(!chunk->IsEmpty()); @@ -62,7 +62,7 @@ MusicPipe::Shift() #ifndef NDEBUG /* poison the "next" reference */ - chunk->next = (music_chunk *)(void *)0x01010101; + chunk->next = (MusicChunk *)(void *)0x01010101; if (size == 0) audio_format.Clear(); @@ -75,14 +75,14 @@ MusicPipe::Shift() void MusicPipe::Clear(MusicBuffer &buffer) { - music_chunk *chunk; + MusicChunk *chunk; while ((chunk = Shift()) != nullptr) buffer.Return(chunk); } void -MusicPipe::Push(music_chunk *chunk) +MusicPipe::Push(MusicChunk *chunk) { assert(!chunk->IsEmpty()); assert(chunk->length == 0 || chunk->audio_format.IsValid()); diff --git a/src/MusicPipe.hxx b/src/MusicPipe.hxx index 3af77e60f..4f29d0728 100644 --- a/src/MusicPipe.hxx +++ b/src/MusicPipe.hxx @@ -29,19 +29,19 @@ #include <assert.h> -struct music_chunk; +struct MusicChunk; class MusicBuffer; /** - * A queue of #music_chunk objects. One party appends chunks at the + * A queue of #MusicChunk objects. One party appends chunks at the * tail, and the other consumes them from the head. */ class MusicPipe { /** the first chunk */ - music_chunk *head; + MusicChunk *head; /** a pointer to the tail of the chunk */ - music_chunk **tail_r; + MusicChunk **tail_r; /** the current number of chunks */ unsigned size; @@ -87,22 +87,22 @@ public: * Checks if the specified chunk is enqueued in the music pipe. */ gcc_pure - bool Contains(const music_chunk *chunk) const; + bool Contains(const MusicChunk *chunk) const; #endif /** - * Returns the first #music_chunk from the pipe. Returns + * Returns the first #MusicChunk from the pipe. Returns * nullptr if the pipe is empty. */ gcc_pure - const music_chunk *Peek() const { + const MusicChunk *Peek() const { return head; } /** * Removes the first chunk from the head, and returns it. */ - music_chunk *Shift(); + MusicChunk *Shift(); /** * Clears the whole pipe and returns the chunks to the buffer. @@ -114,7 +114,7 @@ public: /** * Pushes a chunk to the tail of the pipe. */ - void Push(music_chunk *chunk); + void Push(MusicChunk *chunk); /** * Returns the number of chunks currently in this pipe. diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx index 9f342ad5d..00f8b5f78 100644 --- a/src/PlayerThread.cxx +++ b/src/PlayerThread.cxx @@ -484,7 +484,7 @@ Player::SendSilence() assert(output_open); assert(play_audio_format.IsDefined()); - struct music_chunk *chunk = buffer.Allocate(); + MusicChunk *chunk = buffer.Allocate(); if (chunk == nullptr) { LogError(player_domain, "Failed to allocate silence buffer"); return false; @@ -704,7 +704,7 @@ update_song_tag(PlayerControl &pc, DetachedSong &song, const Tag &new_tag) } /** - * Plays a #music_chunk object (after applying software volume). If + * Plays a #MusicChunk object (after applying software volume). If * it contains a (stream) tag, copy it to the current song, so MPD's * playlist reflects the new stream tag. * @@ -712,7 +712,7 @@ update_song_tag(PlayerControl &pc, DetachedSong &song, const Tag &new_tag) */ static bool play_chunk(PlayerControl &pc, - DetachedSong &song, struct music_chunk *chunk, + DetachedSong &song, MusicChunk *chunk, MusicBuffer &buffer, const AudioFormat format, Error &error) @@ -750,11 +750,11 @@ Player::PlayNextChunk() return true; unsigned cross_fade_position; - struct music_chunk *chunk = nullptr; + MusicChunk *chunk = nullptr; if (xfade_state == CrossFadeState::ENABLED && IsDecoderAtNextSong() && (cross_fade_position = pipe->GetSize()) <= cross_fade_chunks) { /* perform cross fade */ - music_chunk *other_chunk = dc.pipe->Shift(); + MusicChunk *other_chunk = dc.pipe->Shift(); if (!cross_fading) { /* beginning of the cross fade - adjust @@ -786,7 +786,7 @@ Player::PlayNextChunk() } if (other_chunk->IsEmpty()) { - /* the "other" chunk was a music_chunk + /* the "other" chunk was a MusicChunk which had only a tag, but no music data - we cannot cross-fade that; but since this happens only at the diff --git a/src/PlayerThread.hxx b/src/PlayerThread.hxx index 7e4150252..2fb0b1430 100644 --- a/src/PlayerThread.hxx +++ b/src/PlayerThread.hxx @@ -21,7 +21,7 @@ * * The player thread controls the playback. It acts as a bridge * between the decoder thread and the output thread(s): it receives - * #music_chunk objects from the decoder, optionally mixes them + * #MusicChunk objects from the decoder, optionally mixes them * (cross-fading), applies software volume, and sends them to the * audio outputs via audio_output_all_play(). * @@ -31,7 +31,7 @@ * * The player thread itself does not do any I/O. It synchronizes with * other threads via #GMutex and #GCond objects, and passes - * #music_chunk instances around in #MusicPipe objects. + * #MusicChunk instances around in #MusicPipe objects. */ #ifndef MPD_PLAYER_THREAD_HXX diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx index 5c4822804..b214b91a8 100644 --- a/src/decoder/DecoderAPI.cxx +++ b/src/decoder/DecoderAPI.cxx @@ -387,7 +387,7 @@ decoder_timestamp(Decoder &decoder, double t) static DecoderCommand do_send_tag(Decoder &decoder, const Tag &tag) { - struct music_chunk *chunk; + MusicChunk *chunk; if (decoder.chunk != nullptr) { /* there is a partial chunk - flush it, we want the @@ -487,7 +487,7 @@ decoder_data(Decoder &decoder, } while (length > 0) { - struct music_chunk *chunk; + MusicChunk *chunk; bool full; chunk = decoder.GetChunk(); diff --git a/src/decoder/DecoderControl.hxx b/src/decoder/DecoderControl.hxx index 4e5c43b5a..f78ce1a31 100644 --- a/src/decoder/DecoderControl.hxx +++ b/src/decoder/DecoderControl.hxx @@ -144,7 +144,7 @@ struct DecoderControl { float total_time; - /** the #music_chunk allocator */ + /** the #MusicChunk allocator */ MusicBuffer *buffer; /** diff --git a/src/decoder/DecoderInternal.cxx b/src/decoder/DecoderInternal.cxx index b50fee185..416a75b75 100644 --- a/src/decoder/DecoderInternal.cxx +++ b/src/decoder/DecoderInternal.cxx @@ -56,7 +56,7 @@ need_chunks(DecoderControl &dc) return dc.command; } -struct music_chunk * +MusicChunk * Decoder::GetChunk() { DecoderCommand cmd; diff --git a/src/decoder/DecoderInternal.hxx b/src/decoder/DecoderInternal.hxx index bef6f6c13..e6c30d071 100644 --- a/src/decoder/DecoderInternal.hxx +++ b/src/decoder/DecoderInternal.hxx @@ -24,6 +24,7 @@ #include "util/Error.hxx" class PcmConvert; +struct MusicChunk; struct DecoderControl; struct Tag; @@ -76,7 +77,7 @@ struct Decoder { Tag *decoder_tag; /** the chunk currently being written to */ - struct music_chunk *chunk; + MusicChunk *chunk; ReplayGainInfo replay_gain_info; @@ -112,7 +113,7 @@ struct Decoder { * * @return the chunk, or NULL if we have received a decoder command */ - music_chunk *GetChunk(); + MusicChunk *GetChunk(); /** * Flushes the current chunk. diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index 266930448..658ebd4e1 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -35,7 +35,7 @@ class MusicPipe; class EventLoop; class Mixer; class MixerListener; -struct music_chunk; +struct MusicChunk; struct config_param; struct PlayerControl; struct AudioOutputPlugin; @@ -257,12 +257,12 @@ struct AudioOutput { PlayerControl *player_control; /** - * The #music_chunk which is currently being played. All + * The #MusicChunk which is currently being played. All * chunks before this one may be returned to the * #music_buffer, because they are not going to be used by * this output anymore. */ - const music_chunk *current_chunk; + const MusicChunk *current_chunk; /** * Has the output finished playing #current_chunk? @@ -395,9 +395,9 @@ private: bool WaitForDelay(); gcc_pure - const music_chunk *GetNextChunk() const; + const MusicChunk *GetNextChunk() const; - bool PlayChunk(const music_chunk *chunk); + bool PlayChunk(const MusicChunk *chunk); /** * Plays all remaining chunks, until the tail of the pipe has diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index 6cd2c9fa6..fe51c6100 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -187,7 +187,7 @@ MultipleOutputs::SetReplayGainMode(ReplayGainMode mode) } bool -MultipleOutputs::Play(music_chunk *chunk, Error &error) +MultipleOutputs::Play(MusicChunk *chunk, Error &error) { assert(buffer != nullptr); assert(pipe != nullptr); @@ -265,7 +265,7 @@ gcc_pure static bool chunk_is_consumed_in(const AudioOutput *ao, gcc_unused const MusicPipe *pipe, - const struct music_chunk *chunk) + const MusicChunk *chunk) { if (!ao->open) return true; @@ -285,7 +285,7 @@ chunk_is_consumed_in(const AudioOutput *ao, } bool -MultipleOutputs::IsChunkConsumed(const music_chunk *chunk) const +MultipleOutputs::IsChunkConsumed(const MusicChunk *chunk) const { for (auto ao : outputs) { const ScopeLock protect(ao->mutex); @@ -297,7 +297,7 @@ MultipleOutputs::IsChunkConsumed(const music_chunk *chunk) const } inline void -MultipleOutputs::ClearTailChunk(gcc_unused const struct music_chunk *chunk, +MultipleOutputs::ClearTailChunk(gcc_unused const MusicChunk *chunk, bool *locked) { assert(chunk->next == nullptr); @@ -325,9 +325,9 @@ MultipleOutputs::ClearTailChunk(gcc_unused const struct music_chunk *chunk, unsigned MultipleOutputs::Check() { - const struct music_chunk *chunk; + const MusicChunk *chunk; bool is_tail; - struct music_chunk *shifted; + MusicChunk *shifted; bool locked[outputs.size()]; assert(buffer != nullptr); diff --git a/src/output/MultipleOutputs.hxx b/src/output/MultipleOutputs.hxx index 296b9815e..f8482037c 100644 --- a/src/output/MultipleOutputs.hxx +++ b/src/output/MultipleOutputs.hxx @@ -39,7 +39,7 @@ class MusicBuffer; class MusicPipe; class EventLoop; class MixerListener; -struct music_chunk; +struct MusicChunk; struct PlayerControl; struct AudioOutput; class Error; @@ -119,7 +119,7 @@ public: * Opens all audio outputs which are not disabled. * * @param audio_format the preferred audio format - * @param buffer the #music_buffer where consumed #music_chunk objects + * @param buffer the #music_buffer where consumed #MusicChunk objects * should be returned * @return true on success, false on failure */ @@ -140,14 +140,14 @@ public: void SetReplayGainMode(ReplayGainMode mode); /** - * Enqueue a #music_chunk object for playing, i.e. pushes it to a + * Enqueue a #MusicChunk object for playing, i.e. pushes it to a * #MusicPipe. * - * @param chunk the #music_chunk object to be played + * @param chunk the #MusicChunk object to be played * @return true on success, false if no audio output was able to play * (all closed then) */ - bool Play(music_chunk *chunk, Error &error); + bool Play(MusicChunk *chunk, Error &error); /** * Checks if the output devices have drained their music pipe, and @@ -160,7 +160,7 @@ public: /** * Checks if the size of the #MusicPipe is below the #threshold. If * not, it attempts to synchronize with all output threads, and waits - * until another #music_chunk is finished. + * until another #MusicChunk is finished. * * @param threshold the maximum number of chunks in the pipe * @return true if there are less than #threshold chunks in the pipe @@ -262,14 +262,14 @@ private: /** * Has this chunk been consumed by all audio outputs? */ - bool IsChunkConsumed(const music_chunk *chunk) const; + bool IsChunkConsumed(const MusicChunk *chunk) const; /** * There's only one chunk left in the pipe (#pipe), and all * audio outputs have consumed it already. Clear the * reference. */ - void ClearTailChunk(const struct music_chunk *chunk, bool *locked); + void ClearTailChunk(const MusicChunk *chunk, bool *locked); }; #endif diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index a7fb2b87f..1986d2e1b 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -307,7 +307,7 @@ AudioOutput::WaitForDelay() } static const void * -ao_chunk_data(AudioOutput *ao, const struct music_chunk *chunk, +ao_chunk_data(AudioOutput *ao, const MusicChunk *chunk, Filter *replay_gain_filter, unsigned *replay_gain_serial_p, size_t *length_r) @@ -347,7 +347,7 @@ ao_chunk_data(AudioOutput *ao, const struct music_chunk *chunk, } static const void * -ao_filter_chunk(AudioOutput *ao, const struct music_chunk *chunk, +ao_filter_chunk(AudioOutput *ao, const MusicChunk *chunk, size_t *length_r) { size_t length; @@ -417,7 +417,7 @@ ao_filter_chunk(AudioOutput *ao, const struct music_chunk *chunk, } inline bool -AudioOutput::PlayChunk(const music_chunk *chunk) +AudioOutput::PlayChunk(const MusicChunk *chunk) { assert(filter != nullptr); @@ -478,7 +478,7 @@ AudioOutput::PlayChunk(const music_chunk *chunk) return true; } -inline const music_chunk * +inline const MusicChunk * AudioOutput::GetNextChunk() const { return current_chunk != nullptr @@ -493,7 +493,7 @@ AudioOutput::Play() { assert(pipe != nullptr); - const music_chunk *chunk = GetNextChunk(); + const MusicChunk *chunk = GetNextChunk(); if (chunk == nullptr) /* no chunk available */ return false; |