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