diff options
Diffstat (limited to 'src/codecs/opus.cpp')
| -rw-r--r-- | src/codecs/opus.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/codecs/opus.cpp b/src/codecs/opus.cpp index e4917a33..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) +auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input, + uint32_t offset) -> cpp::result<OutputFormat, Error> { input_ = input; @@ -128,6 +129,10 @@ auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input) length = l * 2; } + if (offset && op_pcm_seek(opus_, offset * 48000) != 0) { + return cpp::fail(Error::kInternalError); + } + return OutputFormat{ .num_channels = 2, .sample_rate_hz = 48000, @@ -151,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 |
