DumpDecoderClient.hxx 2.09 KB
Newer Older
1
/*
Max Kellermann's avatar
Max Kellermann committed
2
 * Copyright 2003-2021 The Music Player Daemon Project
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 * 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.
 */

20 21
#ifndef DUMP_DECODER_CLIENT_HXX
#define DUMP_DECODER_CLIENT_HXX
22

23
#include "decoder/Client.hxx"
24
#include "thread/Mutex.hxx"
25

26 27 28 29
/**
 * A #DecoderClient implementation which dumps metadata to stderr and
 * decoded data to stdout.
 */
30
class DumpDecoderClient : public DecoderClient {
31 32
	bool initialized = false;

33 34
	uint16_t prev_kbit_rate = 0;

35
public:
36 37
	Mutex mutex;

38 39 40
	bool IsInitialized() const noexcept {
		return initialized;
	}
41 42 43

	/* virtual methods from DecoderClient */
	void Ready(AudioFormat audio_format,
44
		   bool seekable, SignedSongTime duration) noexcept override;
45
	DecoderCommand GetCommand() noexcept override;
46
	void CommandFinished() noexcept override;
47 48
	SongTime GetSeekTime() noexcept override;
	uint64_t GetSeekFrame() noexcept override;
49
	void SeekError() noexcept override;
50
	InputStreamPtr OpenUri(const char *uri) override;
51 52
	size_t Read(InputStream &is,
		    void *buffer, size_t length) noexcept override;
53
	void SubmitTimestamp(FloatDuration t) noexcept override;
54 55
	DecoderCommand SubmitData(InputStream *is,
				  const void *data, size_t length,
56 57 58 59
				  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;
60 61 62
};

#endif