test/FakeDecoderAPI: rename to DumpDecoderClient
This commit is contained in:
parent
34d14df297
commit
88bbd847e0
@ -2056,7 +2056,7 @@ test_run_decoder_LDADD = \
|
|||||||
libsystem.a \
|
libsystem.a \
|
||||||
libutil.a
|
libutil.a
|
||||||
test_run_decoder_SOURCES = test/run_decoder.cxx \
|
test_run_decoder_SOURCES = test/run_decoder.cxx \
|
||||||
test/FakeDecoderAPI.cxx test/FakeDecoderAPI.hxx \
|
test/DumpDecoderClient.cxx test/DumpDecoderClient.hxx \
|
||||||
src/DetachedSong.cxx \
|
src/DetachedSong.cxx \
|
||||||
src/Log.cxx src/LogBackend.cxx \
|
src/Log.cxx src/LogBackend.cxx \
|
||||||
src/ReplayGainInfo.cxx
|
src/ReplayGainInfo.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
|
* http://www.musicpd.org
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "FakeDecoderAPI.hxx"
|
#include "DumpDecoderClient.hxx"
|
||||||
#include "decoder/DecoderAPI.hxx"
|
#include "decoder/DecoderAPI.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "util/StringBuffer.hxx"
|
#include "util/StringBuffer.hxx"
|
||||||
@ -28,9 +28,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
FakeDecoder::Ready(const AudioFormat audio_format,
|
DumpDecoderClient::Ready(const AudioFormat audio_format,
|
||||||
gcc_unused bool seekable,
|
gcc_unused bool seekable,
|
||||||
SignedSongTime duration)
|
SignedSongTime duration)
|
||||||
{
|
{
|
||||||
assert(!initialized);
|
assert(!initialized);
|
||||||
assert(audio_format.IsValid());
|
assert(audio_format.IsValid());
|
||||||
@ -43,41 +43,41 @@ FakeDecoder::Ready(const AudioFormat audio_format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DecoderCommand
|
DecoderCommand
|
||||||
FakeDecoder::GetCommand() noexcept
|
DumpDecoderClient::GetCommand() noexcept
|
||||||
{
|
{
|
||||||
return DecoderCommand::NONE;
|
return DecoderCommand::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FakeDecoder::CommandFinished()
|
DumpDecoderClient::CommandFinished()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SongTime
|
SongTime
|
||||||
FakeDecoder::GetSeekTime() noexcept
|
DumpDecoderClient::GetSeekTime() noexcept
|
||||||
{
|
{
|
||||||
return SongTime();
|
return SongTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
FakeDecoder::GetSeekFrame() noexcept
|
DumpDecoderClient::GetSeekFrame() noexcept
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FakeDecoder::SeekError()
|
DumpDecoderClient::SeekError()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStreamPtr
|
InputStreamPtr
|
||||||
FakeDecoder::OpenUri(const char *uri)
|
DumpDecoderClient::OpenUri(const char *uri)
|
||||||
{
|
{
|
||||||
return InputStream::OpenReady(uri, mutex, cond);
|
return InputStream::OpenReady(uri, mutex, cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
FakeDecoder::Read(InputStream &is, void *buffer, size_t length)
|
DumpDecoderClient::Read(InputStream &is, void *buffer, size_t length)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return is.LockRead(buffer, length);
|
return is.LockRead(buffer, length);
|
||||||
@ -87,14 +87,14 @@ FakeDecoder::Read(InputStream &is, void *buffer, size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FakeDecoder::SubmitTimestamp(gcc_unused double t)
|
DumpDecoderClient::SubmitTimestamp(gcc_unused double t)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DecoderCommand
|
DecoderCommand
|
||||||
FakeDecoder::SubmitData(gcc_unused InputStream *is,
|
DumpDecoderClient::SubmitData(gcc_unused InputStream *is,
|
||||||
const void *data, size_t datalen,
|
const void *data, size_t datalen,
|
||||||
gcc_unused uint16_t kbit_rate)
|
gcc_unused uint16_t kbit_rate)
|
||||||
{
|
{
|
||||||
static uint16_t prev_kbit_rate;
|
static uint16_t prev_kbit_rate;
|
||||||
if (kbit_rate != prev_kbit_rate) {
|
if (kbit_rate != prev_kbit_rate) {
|
||||||
@ -107,8 +107,8 @@ FakeDecoder::SubmitData(gcc_unused InputStream *is,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DecoderCommand
|
DecoderCommand
|
||||||
FakeDecoder::SubmitTag(gcc_unused InputStream *is,
|
DumpDecoderClient::SubmitTag(gcc_unused InputStream *is,
|
||||||
Tag &&tag)
|
Tag &&tag)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "TAG: duration=%f\n", tag.duration.ToDoubleS());
|
fprintf(stderr, "TAG: duration=%f\n", tag.duration.ToDoubleS());
|
||||||
|
|
||||||
@ -134,14 +134,14 @@ DumpReplayGainInfo(const ReplayGainInfo &info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FakeDecoder::SubmitReplayGain(const ReplayGainInfo *rgi)
|
DumpDecoderClient::SubmitReplayGain(const ReplayGainInfo *rgi)
|
||||||
{
|
{
|
||||||
if (rgi != nullptr)
|
if (rgi != nullptr)
|
||||||
DumpReplayGainInfo(*rgi);
|
DumpReplayGainInfo(*rgi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FakeDecoder::SubmitMixRamp(gcc_unused MixRampInfo &&mix_ramp)
|
DumpDecoderClient::SubmitMixRamp(gcc_unused MixRampInfo &&mix_ramp)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "MixRamp: start='%s' end='%s'\n",
|
fprintf(stderr, "MixRamp: start='%s' end='%s'\n",
|
||||||
mix_ramp.GetStart(), mix_ramp.GetEnd());
|
mix_ramp.GetStart(), mix_ramp.GetEnd());
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2003-2017 The Music Player Daemon Project
|
* Copyright 2003-2018 The Music Player Daemon Project
|
||||||
* http://www.musicpd.org
|
* http://www.musicpd.org
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FAKE_DECODER_API_HXX
|
#ifndef DUMP_DECODER_CLIENT_HXX
|
||||||
#define FAKE_DECODER_API_HXX
|
#define DUMP_DECODER_CLIENT_HXX
|
||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "decoder/Client.hxx"
|
#include "decoder/Client.hxx"
|
||||||
#include "thread/Mutex.hxx"
|
#include "thread/Mutex.hxx"
|
||||||
#include "thread/Cond.hxx"
|
#include "thread/Cond.hxx"
|
||||||
|
|
||||||
struct FakeDecoder final : DecoderClient {
|
struct DumpDecoderClient final : DecoderClient {
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
Cond cond;
|
Cond cond;
|
||||||
|
|
@ -22,7 +22,7 @@
|
|||||||
#include "event/Thread.hxx"
|
#include "event/Thread.hxx"
|
||||||
#include "decoder/DecoderList.hxx"
|
#include "decoder/DecoderList.hxx"
|
||||||
#include "decoder/DecoderPlugin.hxx"
|
#include "decoder/DecoderPlugin.hxx"
|
||||||
#include "FakeDecoderAPI.hxx"
|
#include "DumpDecoderClient.hxx"
|
||||||
#include "input/Init.hxx"
|
#include "input/Init.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
@ -119,19 +119,19 @@ try {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FakeDecoder decoder;
|
DumpDecoderClient client;
|
||||||
if (plugin->file_decode != nullptr) {
|
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) {
|
} else if (plugin->stream_decode != nullptr) {
|
||||||
auto is = InputStream::OpenReady(c.uri, decoder.mutex,
|
auto is = InputStream::OpenReady(c.uri, client.mutex,
|
||||||
decoder.cond);
|
client.cond);
|
||||||
plugin->StreamDecode(decoder, *is);
|
plugin->StreamDecode(client, *is);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Decoder plugin is not usable\n");
|
fprintf(stderr, "Decoder plugin is not usable\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!decoder.initialized) {
|
if (!client.initialized) {
|
||||||
fprintf(stderr, "Decoding failed\n");
|
fprintf(stderr, "Decoding failed\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user