diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-19 15:36:43 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-19 15:36:43 +1000 |
| commit | acccd822f0147147dd8b16f059578df073c088c2 (patch) | |
| tree | 59a96429e6be01d8fdceabed5b1ea5786429e995 /src/audio/stream_info.cpp | |
| parent | 0c81c3e1f6768dc2c024ea81aecc2abc6dbe9fe9 (diff) | |
| download | tangara-fw-acccd822f0147147dd8b16f059578df073c088c2.tar.gz | |
back to back flac playback is working :)
Diffstat (limited to 'src/audio/stream_info.cpp')
| -rw-r--r-- | src/audio/stream_info.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/audio/stream_info.cpp b/src/audio/stream_info.cpp index 8fc31530..2337b3a3 100644 --- a/src/audio/stream_info.cpp +++ b/src/audio/stream_info.cpp @@ -28,8 +28,12 @@ void InputStream::consume(std::size_t bytes) const { raw_->info->bytes_in_stream = new_data.size_bytes(); } -void InputStream::mark_incomplete() const { - raw_->is_incomplete = true; +void InputStream::mark_consumer_finished() const { + raw_->info->is_consumer_finished = true; +} + +bool InputStream::is_producer_finished() const { + return raw_->info->is_producer_finished; } const StreamInfo& InputStream::info() const { @@ -46,17 +50,12 @@ void OutputStream::add(std::size_t bytes) const { } bool OutputStream::prepare(const StreamInfo::Format& new_format) { - if (std::holds_alternative<std::monostate>(raw_->info->format)) { - raw_->info->format = new_format; - raw_->info->bytes_in_stream = 0; - return true; - } - if (new_format == raw_->info->format) { - return true; - } - if (raw_->is_incomplete) { + if (std::holds_alternative<std::monostate>(raw_->info->format) || + raw_->info->is_consumer_finished) { raw_->info->format = new_format; raw_->info->bytes_in_stream = 0; + raw_->info->is_producer_finished = false; + raw_->info->is_consumer_finished = false; return true; } return false; @@ -70,8 +69,12 @@ cpp::span<std::byte> OutputStream::data() const { return raw_->data.subspan(raw_->info->bytes_in_stream); } -bool OutputStream::is_incomplete() const { - return raw_->is_incomplete; +void OutputStream::mark_producer_finished() const { + raw_->info->is_producer_finished = true; +} + +bool OutputStream::is_consumer_finished() const { + return raw_->info->is_consumer_finished; } } // namespace audio |
