/* * Copyright 2023 jacqueline * * SPDX-License-Identifier: GPL-3.0-only */ #pragma once #include #include #include #include #include "chunk.hpp" #include "ff.h" #include "span.hpp" #include "audio_element.hpp" #include "codec.hpp" #include "stream_info.hpp" namespace audio { /* * An audio element that accepts various kinds of encoded audio streams as * input, and converts them to uncompressed PCM output. */ class AudioDecoder { public: AudioDecoder(); ~AudioDecoder(); auto Process(const InputStream& input, OutputStream* output) -> void; AudioDecoder(const AudioDecoder&) = delete; AudioDecoder& operator=(const AudioDecoder&) = delete; private: std::unique_ptr current_codec_; std::optional current_input_format_; std::optional current_output_format_; std::optional duration_seconds_from_decoder_; std::optional seek_to_sample_; bool has_prepared_output_; bool has_samples_to_send_; bool has_input_remaining_; auto ProcessStreamInfo(const StreamInfo& info) -> bool; }; } // namespace audio