2014-05-22 11:24:40 +02:00
|
|
|
/*
|
2021-01-01 19:54:25 +01:00
|
|
|
* Copyright 2003-2021 The Music Player Daemon Project
|
2014-05-22 11:24:40 +02:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
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;
|
2016-11-18 08:27:30 +01:00
|
|
|
DecoderCommand SubmitData(InputStream *is,
|
|
|
|
const void *data, size_t length,
|
2019-04-05 08:47:43 +02:00
|
|
|
uint16_t kbit_rate) noexcept override;
|
|
|
|
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
|