| 82 | } |
| 83 | |
| 84 | bool AudioDecoderOpus::open(IFileStream* stream) |
| 85 | { |
| 86 | static OpusFileCallbacks OP_CALLBACKS_POSIX = {op_fread_r, op_fseek_r, op_ftell_r, op_fclose_r}; |
| 87 | _of = op_open_callbacks(stream, &OP_CALLBACKS_POSIX, 0, 0, nullptr); |
| 88 | if (_of) |
| 89 | { |
| 90 | auto vi = op_head(_of, -1); |
| 91 | _sampleRate = 48000; // opus always 48K hz |
| 92 | _channelCount = vi->channel_count; |
| 93 | _bytesPerBlock = vi->channel_count * sizeof(short); |
| 94 | _totalFrames = static_cast<uint32_t>(op_pcm_total(_of, -1)); |
| 95 | _isOpened = true; |
| 96 | } |
| 97 | |
| 98 | return _isOpened; |
| 99 | } |
| 100 | |
| 101 | bool AudioDecoderOpus::open(std::string_view fullPath) |
| 102 | { |
nothing calls this directly
no test coverage detected