2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2014-05-22 11:24:40 +02:00
|
|
|
|
2018-02-17 08:27:03 +01:00
|
|
|
#ifndef DUMP_DECODER_CLIENT_HXX
|
|
|
|
#define DUMP_DECODER_CLIENT_HXX
|
2014-05-22 11:24:40 +02:00
|
|
|
|
2016-11-18 07:13:35 +01:00
|
|
|
#include "decoder/Client.hxx"
|
2014-05-22 11:10:41 +02:00
|
|
|
#include "thread/Mutex.hxx"
|
2014-05-22 11:24:40 +02:00
|
|
|
|
2018-02-17 08:30:12 +01:00
|
|
|
/**
|
|
|
|
* A #DecoderClient implementation which dumps metadata to stderr and
|
|
|
|
* decoded data to stdout.
|
|
|
|
*/
|
2020-02-04 21:55:21 +01:00
|
|
|
class DumpDecoderClient : public DecoderClient {
|
2018-02-17 08:31:19 +01:00
|
|
|
bool initialized = false;
|
|
|
|
|
2018-02-17 08:32:16 +01:00
|
|
|
uint16_t prev_kbit_rate = 0;
|
|
|
|
|
2018-02-17 08:31:19 +01:00
|
|
|
public:
|
2014-05-22 11:10:41 +02:00
|
|
|
Mutex mutex;
|
|
|
|
|
2018-02-17 08:31:19 +01:00
|
|
|
bool IsInitialized() const noexcept {
|
|
|
|
return initialized;
|
|
|
|
}
|
2016-11-18 07:59:01 +01:00
|
|
|
|
|
|
|
/* virtual methods from DecoderClient */
|
|
|
|
void Ready(AudioFormat audio_format,
|
2019-07-05 08:35:39 +02:00
|
|
|
bool seekable, SignedSongTime duration) noexcept override;
|
2017-06-03 21:33:44 +02:00
|
|
|
DecoderCommand GetCommand() noexcept override;
|
2019-04-05 08:47:43 +02:00
|
|
|
void CommandFinished() noexcept override;
|
2017-06-03 21:33:44 +02:00
|
|
|
SongTime GetSeekTime() noexcept override;
|
|
|
|
uint64_t GetSeekFrame() noexcept override;
|
2019-04-05 08:47:43 +02:00
|
|
|
void SeekError() noexcept override;
|
2016-11-18 12:34:04 +01:00
|
|
|
InputStreamPtr OpenUri(const char *uri) override;
|
2019-07-05 08:35:39 +02:00
|
|
|
size_t Read(InputStream &is,
|
|
|
|
void *buffer, size_t length) noexcept override;
|
2019-04-05 08:47:43 +02:00
|
|
|
void SubmitTimestamp(FloatDuration t) noexcept override;
|
2022-07-11 18:03:06 +02:00
|
|
|
DecoderCommand SubmitAudio(InputStream *is,
|
|
|
|
std::span<const std::byte> audio,
|
|
|
|
uint16_t kbit_rate) noexcept override;
|
2019-04-05 08:47:43 +02:00
|
|
|
DecoderCommand SubmitTag(InputStream *is, Tag &&tag) noexcept override;
|
|
|
|
void SubmitReplayGain(const ReplayGainInfo *replay_gain_info) noexcept override;
|
|
|
|
void SubmitMixRamp(MixRampInfo &&mix_ramp) noexcept override;
|
2014-05-22 11:24:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|