diff options
Diffstat (limited to 'src/codecs/opus.cpp')
| -rw-r--r-- | src/codecs/opus.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/codecs/opus.cpp b/src/codecs/opus.cpp index ec587bc7..a5220c4b 100644 --- a/src/codecs/opus.cpp +++ b/src/codecs/opus.cpp @@ -78,7 +78,8 @@ XiphOpusDecoder::~XiphOpusDecoder() { } } -auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input,uint32_t offset) +auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input, + uint32_t offset) -> cpp::result<OutputFormat, Error> { input_ = input; @@ -128,8 +129,8 @@ auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input,uint32_t offset) length = l * 2; } - if (offset) { - SeekTo(offset * 48000); + if (offset && op_pcm_seek(opus_, offset * 48000) != 0) { + return cpp::fail(Error::kInternalError); } return OutputFormat{ @@ -155,11 +156,4 @@ auto XiphOpusDecoder::DecodeTo(cpp::span<sample::Sample> output) }; } -auto XiphOpusDecoder::SeekTo(size_t target) -> cpp::result<void, Error> { - if (op_pcm_seek(opus_, target) != 0) { - return cpp::fail(Error::kInternalError); - } - return {}; -} - } // namespace codecs |
