summaryrefslogtreecommitdiff
path: root/src/audio/audio_decoder.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-01-26 18:32:32 +1100
committerjacqueline <me@jacqueline.id.au>2023-01-26 18:32:32 +1100
commit7b60f5f864997e94895305f23ed2716ad7d9acaa (patch)
treedc1a6d0f366bcbf8ee05070765fa91ffef7720eb /src/audio/audio_decoder.cpp
parent3696512b387ceefd25c00830fb24ddd073c06e2c (diff)
downloadtangara-fw-7b60f5f864997e94895305f23ed2716ad7d9acaa.tar.gz
Make StreamInfo a PDO
Diffstat (limited to 'src/audio/audio_decoder.cpp')
-rw-r--r--src/audio/audio_decoder.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/audio/audio_decoder.cpp b/src/audio/audio_decoder.cpp
index 87959cd4..f21fb5e0 100644
--- a/src/audio/audio_decoder.cpp
+++ b/src/audio/audio_decoder.cpp
@@ -37,8 +37,8 @@ auto AudioDecoder::ProcessStreamInfo(const StreamInfo& info)
-> cpp::result<void, AudioProcessingError> {
stream_info_ = info;
- if (info.ChunkSize()) {
- chunk_reader_.emplace(info.ChunkSize().value());
+ if (info.chunk_size) {
+ chunk_reader_.emplace(*info.chunk_size);
} else {
// TODO.
}
@@ -46,14 +46,14 @@ auto AudioDecoder::ProcessStreamInfo(const StreamInfo& info)
// Reuse the existing codec if we can. This will help with gapless playback,
// since we can potentially just continue to decode as we were before,
// without any setup overhead.
- if (current_codec_->CanHandleFile(info.Path().value_or(""))) {
+ if (current_codec_->CanHandleFile(info.path.value_or(""))) {
current_codec_->ResetForNewStream();
return {};
}
- auto result = codecs::CreateCodecForFile(info.Path().value());
- if (result.has_value()) {
- current_codec_ = std::move(result.value());
+ auto result = codecs::CreateCodecForFile(*info.path);
+ if (result) {
+ current_codec_ = std::move(*result);
} else {
return cpp::fail(UNSUPPORTED_STREAM);
}
@@ -62,10 +62,10 @@ auto AudioDecoder::ProcessStreamInfo(const StreamInfo& info)
// sample rate, chunk size, etc.
auto downstream_info = StreamEvent::CreateStreamInfo(
input_events_, std::make_unique<StreamInfo>(info));
- downstream_info->stream_info->BitsPerSample(32);
- downstream_info->stream_info->SampleRate(48'000);
+ downstream_info->stream_info->bits_per_sample = 32;
+ downstream_info->stream_info->sample_rate = 48'000;
chunk_size_ = 128;
- downstream_info->stream_info->ChunkSize(chunk_size_);
+ downstream_info->stream_info->chunk_size = chunk_size_;
SendOrBufferEvent(std::move(downstream_info));