aboutsummaryrefslogtreecommitdiffstats
path: root/src/OutputAll.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-09-26 21:51:45 +0200
committerMax Kellermann <max@duempel.org>2013-09-26 21:51:45 +0200
commitce1d8975751251d49581129193e09490ca650a8b (patch)
tree27eda9989e35a74ccdade4924c47391ce2ee56b6 /src/OutputAll.cxx
parent17e108a10a79a5cfb44981323442c92e35813e98 (diff)
downloadmpd-ce1d8975751251d49581129193e09490ca650a8b.tar.gz
mpd-ce1d8975751251d49581129193e09490ca650a8b.tar.xz
mpd-ce1d8975751251d49581129193e09490ca650a8b.zip
MusicPipe: expose the C++ API
Diffstat (limited to 'src/OutputAll.cxx')
-rw-r--r--src/OutputAll.cxx37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/OutputAll.cxx b/src/OutputAll.cxx
index 49505323c..928a64a91 100644
--- a/src/OutputAll.cxx
+++ b/src/OutputAll.cxx
@@ -50,10 +50,10 @@ static unsigned int num_audio_outputs;
static struct music_buffer *g_music_buffer;
/**
- * The #music_pipe object which feeds all audio outputs. It is filled
+ * The #MusicPipe object which feeds all audio outputs. It is filled
* by audio_output_all_play().
*/
-static struct music_pipe *g_mp;
+static MusicPipe *g_mp;
/**
* The "elapsed_time" stamp of the most recently finished chunk.
@@ -262,7 +262,7 @@ audio_output_all_update(void)
for (i = 0; i < num_audio_outputs; ++i)
ret = audio_output_update(audio_outputs[i],
- input_audio_format, g_mp) || ret;
+ input_audio_format, *g_mp) || ret;
return ret;
}
@@ -292,7 +292,7 @@ audio_output_all_play(struct music_chunk *chunk, Error &error)
return false;
}
- music_pipe_push(g_mp, chunk);
+ g_mp->Push(chunk);
for (i = 0; i < num_audio_outputs; ++i)
audio_output_play(audio_outputs[i]);
@@ -316,15 +316,14 @@ audio_output_all_open(const AudioFormat audio_format,
/* the audio format must be the same as existing chunks in the
pipe */
- assert(g_mp == NULL || music_pipe_check_format(g_mp, audio_format));
+ assert(g_mp == NULL || g_mp->CheckFormat(audio_format));
if (g_mp == NULL)
- g_mp = music_pipe_new();
+ g_mp = new MusicPipe();
else
/* if the pipe hasn't been cleared, the the audio
format must not have changed */
- assert(music_pipe_empty(g_mp) ||
- audio_format == input_audio_format);
+ assert(g_mp->IsEmpty() || audio_format == input_audio_format);
input_audio_format = audio_format;
@@ -366,7 +365,7 @@ chunk_is_consumed_in(const struct audio_output *ao,
if (ao->chunk == NULL)
return false;
- assert(chunk == ao->chunk || music_pipe_contains(g_mp, ao->chunk));
+ assert(chunk == ao->chunk || g_mp->Contains(ao->chunk));
if (chunk != ao->chunk) {
assert(chunk->next != NULL);
@@ -401,7 +400,7 @@ static void
clear_tail_chunk(gcc_unused const struct music_chunk *chunk, bool *locked)
{
assert(chunk->next == NULL);
- assert(music_pipe_contains(g_mp, chunk));
+ assert(g_mp->Contains(chunk));
for (unsigned i = 0; i < num_audio_outputs; ++i) {
struct audio_output *ao = audio_outputs[i];
@@ -433,13 +432,13 @@ audio_output_all_check(void)
assert(g_music_buffer != NULL);
assert(g_mp != NULL);
- while ((chunk = music_pipe_peek(g_mp)) != NULL) {
- assert(!music_pipe_empty(g_mp));
+ while ((chunk = g_mp->Peek()) != nullptr) {
+ assert(!g_mp->IsEmpty());
if (!chunk_is_consumed(chunk))
/* at least one output is not finished playing
this chunk */
- return music_pipe_size(g_mp);
+ return g_mp->GetSize();
if (chunk->length > 0 && chunk->times >= 0.0)
/* only update elapsed_time if the chunk
@@ -453,7 +452,7 @@ audio_output_all_check(void)
clear_tail_chunk(chunk, locked);
/* remove the chunk from the pipe */
- shifted = music_pipe_shift(g_mp);
+ shifted = g_mp->Shift();
assert(shifted == chunk);
if (is_tail)
@@ -523,7 +522,7 @@ audio_output_all_cancel(void)
/* clear the music pipe and return all chunks to the buffer */
if (g_mp != NULL)
- music_pipe_clear(g_mp, g_music_buffer);
+ g_mp->Clear(g_music_buffer);
/* the audio outputs are now waiting for a signal, to
synchronize the cleared music pipe */
@@ -546,8 +545,8 @@ audio_output_all_close(void)
if (g_mp != NULL) {
assert(g_music_buffer != NULL);
- music_pipe_clear(g_mp, g_music_buffer);
- music_pipe_free(g_mp);
+ g_mp->Clear(g_music_buffer);
+ delete g_mp;
g_mp = NULL;
}
@@ -569,8 +568,8 @@ audio_output_all_release(void)
if (g_mp != NULL) {
assert(g_music_buffer != NULL);
- music_pipe_clear(g_mp, g_music_buffer);
- music_pipe_free(g_mp);
+ g_mp->Clear(g_music_buffer);
+ delete g_mp;
g_mp = NULL;
}