output: rename "chunk" to "current_chunk"
This commit is contained in:
parent
4657a3bd0f
commit
af71605769
@ -32,6 +32,7 @@
|
||||
class Error;
|
||||
class Filter;
|
||||
class MusicPipe;
|
||||
struct music_chunk;
|
||||
struct config_param;
|
||||
struct PlayerControl;
|
||||
struct AudioOutputPlugin;
|
||||
@ -235,8 +236,8 @@ struct AudioOutput {
|
||||
const MusicPipe *pipe;
|
||||
|
||||
/**
|
||||
* This mutex protects #open, #fail_timer, #chunk and
|
||||
* #chunk_finished.
|
||||
* This mutex protects #open, #fail_timer, #current_chunk and
|
||||
* #current_chunk_finished.
|
||||
*/
|
||||
Mutex mutex;
|
||||
|
||||
@ -258,12 +259,12 @@ struct AudioOutput {
|
||||
* #music_buffer, because they are not going to be used by
|
||||
* this output anymore.
|
||||
*/
|
||||
const struct music_chunk *chunk;
|
||||
const music_chunk *current_chunk;
|
||||
|
||||
/**
|
||||
* Has the output finished playing #chunk?
|
||||
* Has the output finished playing #current_chunk?
|
||||
*/
|
||||
bool chunk_finished;
|
||||
bool current_chunk_finished;
|
||||
|
||||
AudioOutput(const AudioOutputPlugin &_plugin);
|
||||
~AudioOutput();
|
||||
|
@ -264,17 +264,18 @@ chunk_is_consumed_in(const AudioOutput *ao,
|
||||
if (!ao->open)
|
||||
return true;
|
||||
|
||||
if (ao->chunk == nullptr)
|
||||
if (ao->current_chunk == nullptr)
|
||||
return false;
|
||||
|
||||
assert(chunk == ao->chunk || pipe->Contains(ao->chunk));
|
||||
assert(chunk == ao->current_chunk ||
|
||||
pipe->Contains(ao->current_chunk));
|
||||
|
||||
if (chunk != ao->chunk) {
|
||||
if (chunk != ao->current_chunk) {
|
||||
assert(chunk->next != nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
return ao->chunk_finished && chunk->next == nullptr;
|
||||
return ao->current_chunk_finished && chunk->next == nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -309,9 +310,9 @@ MultipleOutputs::ClearTailChunk(gcc_unused const struct music_chunk *chunk,
|
||||
continue;
|
||||
}
|
||||
|
||||
assert(ao->chunk == chunk);
|
||||
assert(ao->chunk_finished);
|
||||
ao->chunk = nullptr;
|
||||
assert(ao->current_chunk == chunk);
|
||||
assert(ao->current_chunk_finished);
|
||||
ao->current_chunk = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
|
||||
assert(pipe == &mp || (always_on && pause));
|
||||
|
||||
if (pause) {
|
||||
chunk = nullptr;
|
||||
current_chunk = nullptr;
|
||||
pipe = ∓
|
||||
|
||||
/* unpause with the CANCEL command; this is a
|
||||
@ -141,7 +141,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
|
||||
}
|
||||
|
||||
in_audio_format = audio_format;
|
||||
chunk = nullptr;
|
||||
current_chunk = nullptr;
|
||||
|
||||
pipe = ∓
|
||||
|
||||
|
@ -139,7 +139,7 @@ ao_open(AudioOutput *ao)
|
||||
|
||||
assert(!ao->open);
|
||||
assert(ao->pipe != nullptr);
|
||||
assert(ao->chunk == nullptr);
|
||||
assert(ao->current_chunk == nullptr);
|
||||
assert(ao->in_audio_format.IsValid());
|
||||
|
||||
ao->fail_timer.Reset();
|
||||
@ -212,7 +212,7 @@ ao_close(AudioOutput *ao, bool drain)
|
||||
|
||||
ao->pipe = nullptr;
|
||||
|
||||
ao->chunk = nullptr;
|
||||
ao->current_chunk = nullptr;
|
||||
ao->open = false;
|
||||
|
||||
ao->mutex.unlock();
|
||||
@ -252,7 +252,7 @@ ao_reopen_filter(AudioOutput *ao)
|
||||
|
||||
ao->pipe = nullptr;
|
||||
|
||||
ao->chunk = nullptr;
|
||||
ao->current_chunk = nullptr;
|
||||
ao->open = false;
|
||||
ao->fail_timer.Update();
|
||||
|
||||
@ -486,9 +486,9 @@ ao_play_chunk(AudioOutput *ao, const struct music_chunk *chunk)
|
||||
static const struct music_chunk *
|
||||
ao_next_chunk(AudioOutput *ao)
|
||||
{
|
||||
return ao->chunk != nullptr
|
||||
return ao->current_chunk != nullptr
|
||||
/* continue the previous play() call */
|
||||
? ao->chunk->next
|
||||
? ao->current_chunk->next
|
||||
/* get the first chunk from the pipe */
|
||||
: ao->pipe->Peek();
|
||||
}
|
||||
@ -514,30 +514,30 @@ ao_play(AudioOutput *ao)
|
||||
/* no chunk available */
|
||||
return false;
|
||||
|
||||
ao->chunk_finished = false;
|
||||
ao->current_chunk_finished = false;
|
||||
|
||||
assert(!ao->in_playback_loop);
|
||||
ao->in_playback_loop = true;
|
||||
|
||||
while (chunk != nullptr && ao->command == AO_COMMAND_NONE) {
|
||||
assert(!ao->chunk_finished);
|
||||
assert(!ao->current_chunk_finished);
|
||||
|
||||
ao->chunk = chunk;
|
||||
ao->current_chunk = chunk;
|
||||
|
||||
success = ao_play_chunk(ao, chunk);
|
||||
if (!success) {
|
||||
assert(ao->chunk == nullptr);
|
||||
assert(ao->current_chunk == nullptr);
|
||||
break;
|
||||
}
|
||||
|
||||
assert(ao->chunk == chunk);
|
||||
assert(ao->current_chunk == chunk);
|
||||
chunk = chunk->next;
|
||||
}
|
||||
|
||||
assert(ao->in_playback_loop);
|
||||
ao->in_playback_loop = false;
|
||||
|
||||
ao->chunk_finished = true;
|
||||
ao->current_chunk_finished = true;
|
||||
|
||||
ao->mutex.unlock();
|
||||
ao->player_control->LockSignal();
|
||||
@ -637,7 +637,7 @@ audio_output_task(void *arg)
|
||||
|
||||
case AO_COMMAND_DRAIN:
|
||||
if (ao->open) {
|
||||
assert(ao->chunk == nullptr);
|
||||
assert(ao->current_chunk == nullptr);
|
||||
assert(ao->pipe->Peek() == nullptr);
|
||||
|
||||
ao->mutex.unlock();
|
||||
@ -649,7 +649,7 @@ audio_output_task(void *arg)
|
||||
continue;
|
||||
|
||||
case AO_COMMAND_CANCEL:
|
||||
ao->chunk = nullptr;
|
||||
ao->current_chunk = nullptr;
|
||||
|
||||
if (ao->open) {
|
||||
ao->mutex.unlock();
|
||||
@ -661,7 +661,7 @@ audio_output_task(void *arg)
|
||||
continue;
|
||||
|
||||
case AO_COMMAND_KILL:
|
||||
ao->chunk = nullptr;
|
||||
ao->current_chunk = nullptr;
|
||||
ao_command_finished(ao);
|
||||
ao->mutex.unlock();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user