diff options
Diffstat (limited to '')
-rw-r--r-- | src/OutputThread.cxx (renamed from src/output_thread.c) | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/output_thread.c b/src/OutputThread.cxx index 4eef2ccdd..3d0d96f7a 100644 --- a/src/output_thread.c +++ b/src/OutputThread.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,18 +18,23 @@ */ #include "config.h" -#include "output_thread.h" +#include "OutputThread.hxx" + +extern "C" { #include "output_api.h" #include "output_internal.h" -#include "chunk.h" -#include "pipe.h" -#include "player_control.h" #include "pcm_mix.h" #include "filter_plugin.h" #include "filter/convert_filter_plugin.h" #include "filter/replay_gain_filter_plugin.h" -#include "mpd_error.h" #include "notify.h" +} + +#include "PlayerControl.hxx" +#include "MusicPipe.hxx" +#include "MusicChunk.hxx" + +#include "mpd_error.h" #include "gcc.h" #include <glib.h> @@ -315,17 +320,17 @@ ao_wait(struct audio_output *ao) } } -static const char * +static const void * ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk, struct filter *replay_gain_filter, unsigned *replay_gain_serial_p, size_t *length_r) { assert(chunk != NULL); - assert(!music_chunk_is_empty(chunk)); - assert(music_chunk_check_format(chunk, &ao->in_audio_format)); + assert(!chunk->IsEmpty()); + assert(chunk->CheckFormat(ao->in_audio_format)); - const char *data = chunk->data; + const void *data = chunk->data; size_t length = chunk->length; (void)ao; @@ -356,14 +361,14 @@ ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk, return data; } -static const char * +static const void * ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk, size_t *length_r) { GError *error = NULL; size_t length; - const char *data = ao_chunk_data(ao, chunk, ao->replay_gain_filter, + const void *data = ao_chunk_data(ao, chunk, ao->replay_gain_filter, &ao->replay_gain_serial, &length); if (data == NULL) return NULL; @@ -378,7 +383,7 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk, if (chunk->other != NULL) { size_t other_length; - const char *other_data = + const void *other_data = ao_chunk_data(ao, chunk->other, ao->other_replay_gain_filter, &ao->other_replay_gain_serial, @@ -399,13 +404,14 @@ ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk, if (length > other_length) length = other_length; - char *dest = pcm_buffer_get(&ao->cross_fade_buffer, + void *dest = pcm_buffer_get(&ao->cross_fade_buffer, other_length); memcpy(dest, other_data, other_length); - if (!pcm_mix(dest, data, length, ao->in_audio_format.format, + if (!pcm_mix(dest, data, length, + sample_format(ao->in_audio_format.format), 1.0 - chunk->mix_ratio)) { g_warning("Cannot cross-fade format %s", - sample_format_to_string(ao->in_audio_format.format)); + sample_format_to_string(sample_format(ao->in_audio_format.format))); return NULL; } @@ -435,7 +441,7 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk) assert(ao != NULL); assert(ao->filter != NULL); - if (chunk->tag != NULL) { + if (ao->tags && gcc_unlikely(chunk->tag != NULL)) { g_mutex_unlock(ao->mutex); ao_plugin_send_tag(ao, chunk->tag); g_mutex_lock(ao->mutex); @@ -446,7 +452,7 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk) /* workaround -Wmaybe-uninitialized false positive */ size = 0; #endif - const char *data = ao_filter_chunk(ao, chunk, &size); + const char *data = (const char *)ao_filter_chunk(ao, chunk, &size); if (data == NULL) { ao_close(ao, false); @@ -578,7 +584,7 @@ static void ao_pause(struct audio_output *ao) static gpointer audio_output_task(gpointer arg) { - struct audio_output *ao = arg; + struct audio_output *ao = (struct audio_output *)arg; g_mutex_lock(ao->mutex); |