diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2025-01-09 04:52:38 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2025-01-09 04:52:38 +0000 |
| commit | faf52c162f98fb78907ab7028e997ef3d316f393 (patch) | |
| tree | cd0631b047e8b09fbd61ea85ad1a67aa55929a25 /src/codecs/vorbis.cpp | |
| parent | 829d033a448107f1bc610cf735ce9f7222de564b (diff) | |
| parent | faa62e0c60d51a9df88002a59825b427323259c0 (diff) | |
| download | tangara-fw-faf52c162f98fb78907ab7028e997ef3d316f393.tar.gz | |
Merge pull request 'Add bitrate info' (#172) from tjk/tangara-fw:bitrate into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/172
Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org>
Diffstat (limited to 'src/codecs/vorbis.cpp')
| -rw-r--r-- | src/codecs/vorbis.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/codecs/vorbis.cpp b/src/codecs/vorbis.cpp index ea33a2af..464aa4a2 100644 --- a/src/codecs/vorbis.cpp +++ b/src/codecs/vorbis.cpp @@ -118,6 +118,12 @@ auto TremorVorbisDecoder::OpenStream(std::shared_ptr<IStream> input, length = l * info->channels; } + auto b = ov_bitrate(vorbis_.get(), -1); + std::optional<uint32_t> bitrate_kbps; + if (b > 0) { + bitrate_kbps = b / 1024; + } + if (offset && ov_time_seek(vorbis_.get(), offset * 1000) != 0) { return cpp::fail(Error::kInternalError); } @@ -126,6 +132,7 @@ auto TremorVorbisDecoder::OpenStream(std::shared_ptr<IStream> input, .num_channels = static_cast<uint8_t>(info->channels), .sample_rate_hz = static_cast<uint32_t>(info->rate), .total_samples = length, + .bitrate_kbps = bitrate_kbps, }; } |
