aboutsummaryrefslogtreecommitdiffstats
path: root/test/FakeDecoderAPI.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'test/FakeDecoderAPI.cxx')
-rw-r--r--test/FakeDecoderAPI.cxx53
1 files changed, 38 insertions, 15 deletions
diff --git a/test/FakeDecoderAPI.cxx b/test/FakeDecoderAPI.cxx
index ca09ca982..dcc78125b 100644
--- a/test/FakeDecoderAPI.cxx
+++ b/test/FakeDecoderAPI.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2012 The Music Player Daemon Project
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,21 +18,30 @@
*/
#include "config.h"
-#include "DecoderAPI.hxx"
-#include "InputStream.hxx"
+#include "FakeDecoderAPI.hxx"
+#include "decoder/DecoderAPI.hxx"
+#include "input/InputStream.hxx"
#include "util/Error.hxx"
#include "Compiler.h"
-#include <glib.h>
-
#include <unistd.h>
void
-decoder_initialized(gcc_unused Decoder &decoder,
- gcc_unused const AudioFormat audio_format,
+decoder_initialized(Decoder &decoder,
+ const AudioFormat audio_format,
gcc_unused bool seekable,
- gcc_unused float total_time)
+ SignedSongTime duration)
{
+ struct audio_format_string af_string;
+
+ assert(!decoder.initialized);
+ assert(audio_format.IsValid());
+
+ fprintf(stderr, "audio_format=%s duration=%f\n",
+ audio_format_to_string(audio_format, &af_string),
+ duration.ToDoubleS());
+
+ decoder.initialized = true;
}
DecoderCommand
@@ -46,10 +55,16 @@ decoder_command_finished(gcc_unused Decoder &decoder)
{
}
-double
-decoder_seek_where(gcc_unused Decoder &decoder)
+SongTime
+decoder_seek_time(gcc_unused Decoder &decoder)
+{
+ return SongTime();
+}
+
+uint64_t
+decoder_seek_where_frame(gcc_unused Decoder &decoder)
{
- return 1.0;
+ return 1;
}
void
@@ -57,6 +72,12 @@ decoder_seek_error(gcc_unused Decoder &decoder)
{
}
+InputStream *
+decoder_open_uri(Decoder &decoder, const char *uri, Error &error)
+{
+ return InputStream::OpenReady(uri, decoder.mutex, decoder.cond, error);
+}
+
size_t
decoder_read(gcc_unused Decoder *decoder,
InputStream &is,
@@ -129,16 +150,18 @@ decoder_replay_gain(gcc_unused Decoder &decoder,
{
const ReplayGainTuple *tuple = &rgi->tuples[REPLAY_GAIN_ALBUM];
if (tuple->IsDefined())
- g_printerr("replay_gain[album]: gain=%f peak=%f\n",
- tuple->gain, tuple->peak);
+ fprintf(stderr, "replay_gain[album]: gain=%f peak=%f\n",
+ tuple->gain, tuple->peak);
tuple = &rgi->tuples[REPLAY_GAIN_TRACK];
if (tuple->IsDefined())
- g_printerr("replay_gain[track]: gain=%f peak=%f\n",
- tuple->gain, tuple->peak);
+ fprintf(stderr, "replay_gain[track]: gain=%f peak=%f\n",
+ tuple->gain, tuple->peak);
}
void
decoder_mixramp(gcc_unused Decoder &decoder, gcc_unused MixRampInfo &&mix_ramp)
{
+ fprintf(stderr, "MixRamp: start='%s' end='%s'\n",
+ mix_ramp.GetStart(), mix_ramp.GetEnd());
}