Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tangara-fw/src/codecs/include/mad.hpp

47 lines
983 B

/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#pragma once
2 years ago
#include <cstddef>
#include <cstdint>
#include <string>
#include <utility>
2 years ago
#include "mad.h"
#include "span.hpp"
2 years ago
#include "codec.hpp"
namespace codecs {
class MadMp3Decoder : public ICodec {
public:
MadMp3Decoder();
~MadMp3Decoder();
auto CanHandleType(StreamType type) -> bool override;
2 years ago
auto GetOutputFormat() -> OutputFormat override;
auto ResetForNewStream() -> void override;
auto SetInput(cpp::span<const std::byte> input) -> void override;
2 years ago
auto GetInputPosition() -> std::size_t override;
auto ProcessNextFrame() -> cpp::result<bool, ProcessingError> override;
auto WriteOutputSamples(cpp::span<std::byte> output)
2 years ago
-> std::pair<std::size_t, bool> override;
private:
mad_stream stream_;
mad_frame frame_;
mad_synth synth_;
mad_header header_;
bool has_decoded_header_;
2 years ago
int current_sample_;
};
} // namespace codecs