| 193 | |
| 194 | |
| 195 | AudioMetadata GenericAudioDecoder::OpenImpl(span<const char> encoded) { |
| 196 | assert(!encoded.empty()); |
| 197 | mem_stream_ = {encoded.data(), static_cast<int64_t>(encoded.size())}; |
| 198 | SF_VIRTUAL_IO sf_virtual_io = { |
| 199 | &GetFileLen, |
| 200 | &Seek, |
| 201 | &Read, |
| 202 | nullptr, // No writing |
| 203 | &Tell |
| 204 | }; |
| 205 | sndfile_handle_.reset( |
| 206 | sf_open_virtual(&sf_virtual_io, SFM_READ, &sf_info_, &mem_stream_)); |
| 207 | if (!sndfile_handle_) { |
| 208 | DALI_FAIL("Failed to open encoded data: ", sf_strerror(sndfile_handle_)); |
| 209 | } |
| 210 | return GetAudioMetadata(sf_info_); |
| 211 | } |
| 212 | |
| 213 | AudioMetadata GenericAudioDecoder::OpenFromFileImpl(const std::string &filepath) { |
| 214 | DALI_ENFORCE(!filepath.empty(), "filepath is empty"); |
nothing calls this directly
no test coverage detected