diff options
Diffstat (limited to 'src/output_all.c')
-rw-r--r-- | src/output_all.c | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/src/output_all.c b/src/output_all.c index f56cd04e..bf80a159 100644 --- a/src/output_all.c +++ b/src/output_all.c @@ -24,7 +24,6 @@ #include "chunk.h" #include "conf.h" #include "pipe.h" -#include "buffer.h" #include "player_control.h" #include "mpd_error.h" #include "notify.h" @@ -45,11 +44,6 @@ static struct audio_output **audio_outputs; static unsigned int num_audio_outputs; /** - * The #music_buffer object where consumed chunks are returned. - */ -static struct music_buffer *g_music_buffer; - -/** * The #music_pipe object which feeds all audio outputs. It is filled * by audio_output_all_play(). */ @@ -275,7 +269,6 @@ audio_output_all_play(struct music_chunk *chunk) bool ret; unsigned int i; - assert(g_music_buffer != NULL); assert(g_mp != NULL); assert(chunk != NULL); assert(music_chunk_check_format(chunk, &input_audio_format)); @@ -293,18 +286,12 @@ audio_output_all_play(struct music_chunk *chunk) } bool -audio_output_all_open(const struct audio_format *audio_format, - struct music_buffer *buffer) +audio_output_all_open(const struct audio_format *audio_format) { bool ret = false, enabled = false; unsigned int i; assert(audio_format != NULL); - assert(buffer != NULL); - assert(g_music_buffer == NULL || g_music_buffer == buffer); - assert((g_mp == NULL) == (g_music_buffer == NULL)); - - g_music_buffer = buffer; /* the audio format must be the same as existing chunks in the pipe */ @@ -424,7 +411,6 @@ audio_output_all_check(void) struct music_chunk *shifted; bool locked[num_audio_outputs]; - assert(g_music_buffer != NULL); assert(g_mp != NULL); while ((chunk = music_pipe_peek(g_mp)) != NULL) { @@ -435,7 +421,7 @@ audio_output_all_check(void) this chunk */ return music_pipe_size(g_mp); - if (chunk->length > 0 && chunk->times >= 0.0) + if (chunk->frame && chunk->times >= 0.0) /* only update elapsed_time if the chunk provides a defined value */ audio_output_all_elapsed_time = chunk->times; @@ -457,8 +443,7 @@ audio_output_all_check(void) if (locked[i]) g_mutex_unlock(audio_outputs[i]->mutex); - /* return the chunk to the buffer */ - music_buffer_return(g_music_buffer, shifted); + music_chunk_free(shifted); } return 0; @@ -514,10 +499,9 @@ audio_output_all_cancel(void) audio_output_wait_all(); - /* clear the music pipe and return all chunks to the buffer */ - - if (g_mp != NULL) - music_pipe_clear(g_mp, g_music_buffer); + /* clear the music pipe */ + if (g_mp != NULL) + music_pipe_clear(g_mp); /* the audio outputs are now waiting for a signal, to synchronize the cleared music pipe */ @@ -538,15 +522,11 @@ audio_output_all_close(void) audio_output_close(audio_outputs[i]); if (g_mp != NULL) { - assert(g_music_buffer != NULL); - - music_pipe_clear(g_mp, g_music_buffer); + music_pipe_clear(g_mp); music_pipe_free(g_mp); g_mp = NULL; } - g_music_buffer = NULL; - audio_format_clear(&input_audio_format); audio_output_all_elapsed_time = -1.0; @@ -561,15 +541,11 @@ audio_output_all_release(void) audio_output_release(audio_outputs[i]); if (g_mp != NULL) { - assert(g_music_buffer != NULL); - - music_pipe_clear(g_mp, g_music_buffer); + music_pipe_clear(g_mp); music_pipe_free(g_mp); g_mp = NULL; } - g_music_buffer = NULL; - audio_format_clear(&input_audio_format); audio_output_all_elapsed_time = -1.0; |