From 88bbd847e0e99735f607fbf8ea8d12c6d20bbfcc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 17 Feb 2018 08:27:03 +0100 Subject: [PATCH] test/FakeDecoderAPI: rename to DumpDecoderClient --- Makefile.am | 2 +- ...keDecoderAPI.cxx => DumpDecoderClient.cxx} | 40 +++++++++---------- ...keDecoderAPI.hxx => DumpDecoderClient.hxx} | 8 ++-- test/run_decoder.cxx | 14 +++---- 4 files changed, 32 insertions(+), 32 deletions(-) rename test/{FakeDecoderAPI.cxx => DumpDecoderClient.cxx} (72%) rename test/{FakeDecoderAPI.hxx => DumpDecoderClient.hxx} (91%) diff --git a/Makefile.am b/Makefile.am index 4ca016f83..5b5caa766 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2056,7 +2056,7 @@ test_run_decoder_LDADD = \ libsystem.a \ libutil.a test_run_decoder_SOURCES = test/run_decoder.cxx \ - test/FakeDecoderAPI.cxx test/FakeDecoderAPI.hxx \ + test/DumpDecoderClient.cxx test/DumpDecoderClient.hxx \ src/DetachedSong.cxx \ src/Log.cxx src/LogBackend.cxx \ src/ReplayGainInfo.cxx diff --git a/test/FakeDecoderAPI.cxx b/test/DumpDecoderClient.cxx similarity index 72% rename from test/FakeDecoderAPI.cxx rename to test/DumpDecoderClient.cxx index c9256708f..a007e0b5c 100644 --- a/test/FakeDecoderAPI.cxx +++ b/test/DumpDecoderClient.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2017 The Music Player Daemon Project + * Copyright 2003-2018 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ */ #include "config.h" -#include "FakeDecoderAPI.hxx" +#include "DumpDecoderClient.hxx" #include "decoder/DecoderAPI.hxx" #include "input/InputStream.hxx" #include "util/StringBuffer.hxx" @@ -28,9 +28,9 @@ #include void -FakeDecoder::Ready(const AudioFormat audio_format, - gcc_unused bool seekable, - SignedSongTime duration) +DumpDecoderClient::Ready(const AudioFormat audio_format, + gcc_unused bool seekable, + SignedSongTime duration) { assert(!initialized); assert(audio_format.IsValid()); @@ -43,41 +43,41 @@ FakeDecoder::Ready(const AudioFormat audio_format, } DecoderCommand -FakeDecoder::GetCommand() noexcept +DumpDecoderClient::GetCommand() noexcept { return DecoderCommand::NONE; } void -FakeDecoder::CommandFinished() +DumpDecoderClient::CommandFinished() { } SongTime -FakeDecoder::GetSeekTime() noexcept +DumpDecoderClient::GetSeekTime() noexcept { return SongTime(); } uint64_t -FakeDecoder::GetSeekFrame() noexcept +DumpDecoderClient::GetSeekFrame() noexcept { return 1; } void -FakeDecoder::SeekError() +DumpDecoderClient::SeekError() { } InputStreamPtr -FakeDecoder::OpenUri(const char *uri) +DumpDecoderClient::OpenUri(const char *uri) { return InputStream::OpenReady(uri, mutex, cond); } size_t -FakeDecoder::Read(InputStream &is, void *buffer, size_t length) +DumpDecoderClient::Read(InputStream &is, void *buffer, size_t length) { try { return is.LockRead(buffer, length); @@ -87,14 +87,14 @@ FakeDecoder::Read(InputStream &is, void *buffer, size_t length) } void -FakeDecoder::SubmitTimestamp(gcc_unused double t) +DumpDecoderClient::SubmitTimestamp(gcc_unused double t) { } DecoderCommand -FakeDecoder::SubmitData(gcc_unused InputStream *is, - const void *data, size_t datalen, - gcc_unused uint16_t kbit_rate) +DumpDecoderClient::SubmitData(gcc_unused InputStream *is, + const void *data, size_t datalen, + gcc_unused uint16_t kbit_rate) { static uint16_t prev_kbit_rate; if (kbit_rate != prev_kbit_rate) { @@ -107,8 +107,8 @@ FakeDecoder::SubmitData(gcc_unused InputStream *is, } DecoderCommand -FakeDecoder::SubmitTag(gcc_unused InputStream *is, - Tag &&tag) +DumpDecoderClient::SubmitTag(gcc_unused InputStream *is, + Tag &&tag) { fprintf(stderr, "TAG: duration=%f\n", tag.duration.ToDoubleS()); @@ -134,14 +134,14 @@ DumpReplayGainInfo(const ReplayGainInfo &info) } void -FakeDecoder::SubmitReplayGain(const ReplayGainInfo *rgi) +DumpDecoderClient::SubmitReplayGain(const ReplayGainInfo *rgi) { if (rgi != nullptr) DumpReplayGainInfo(*rgi); } void -FakeDecoder::SubmitMixRamp(gcc_unused MixRampInfo &&mix_ramp) +DumpDecoderClient::SubmitMixRamp(gcc_unused MixRampInfo &&mix_ramp) { fprintf(stderr, "MixRamp: start='%s' end='%s'\n", mix_ramp.GetStart(), mix_ramp.GetEnd()); diff --git a/test/FakeDecoderAPI.hxx b/test/DumpDecoderClient.hxx similarity index 91% rename from test/FakeDecoderAPI.hxx rename to test/DumpDecoderClient.hxx index 2f6b8d9d3..df7fc2054 100644 --- a/test/FakeDecoderAPI.hxx +++ b/test/DumpDecoderClient.hxx @@ -1,5 +1,5 @@ /* - * Copyright 2003-2017 The Music Player Daemon Project + * Copyright 2003-2018 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -17,15 +17,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef FAKE_DECODER_API_HXX -#define FAKE_DECODER_API_HXX +#ifndef DUMP_DECODER_CLIENT_HXX +#define DUMP_DECODER_CLIENT_HXX #include "check.h" #include "decoder/Client.hxx" #include "thread/Mutex.hxx" #include "thread/Cond.hxx" -struct FakeDecoder final : DecoderClient { +struct DumpDecoderClient final : DecoderClient { Mutex mutex; Cond cond; diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index c88625a9d..c4d47c804 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -22,7 +22,7 @@ #include "event/Thread.hxx" #include "decoder/DecoderList.hxx" #include "decoder/DecoderPlugin.hxx" -#include "FakeDecoderAPI.hxx" +#include "DumpDecoderClient.hxx" #include "input/Init.hxx" #include "input/InputStream.hxx" #include "fs/Path.hxx" @@ -119,19 +119,19 @@ try { return EXIT_FAILURE; } - FakeDecoder decoder; + DumpDecoderClient client; if (plugin->file_decode != nullptr) { - plugin->FileDecode(decoder, Path::FromFS(c.uri)); + plugin->FileDecode(client, Path::FromFS(c.uri)); } else if (plugin->stream_decode != nullptr) { - auto is = InputStream::OpenReady(c.uri, decoder.mutex, - decoder.cond); - plugin->StreamDecode(decoder, *is); + auto is = InputStream::OpenReady(c.uri, client.mutex, + client.cond); + plugin->StreamDecode(client, *is); } else { fprintf(stderr, "Decoder plugin is not usable\n"); return EXIT_FAILURE; } - if (!decoder.initialized) { + if (!client.initialized) { fprintf(stderr, "Decoding failed\n"); return EXIT_FAILURE; }