| 41 | namespace |
| 42 | { |
| 43 | FLAC__StreamDecoderReadStatus streamRead( |
| 44 | const FLAC__StreamDecoder*, |
| 45 | FLAC__byte buffer[], // NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays) |
| 46 | std::size_t* bytes, |
| 47 | void* clientData) |
| 48 | { |
| 49 | auto* data = static_cast<sf::priv::SoundFileReaderFlac::ClientData*>(clientData); |
| 50 | |
| 51 | if (const std::optional count = data->stream->read(buffer, *bytes)) |
| 52 | { |
| 53 | if (*count > 0) |
| 54 | { |
| 55 | *bytes = *count; |
| 56 | return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; |
| 57 | } |
| 58 | |
| 59 | return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; |
| 60 | } |
| 61 | |
| 62 | return FLAC__STREAM_DECODER_READ_STATUS_ABORT; |
| 63 | } |
| 64 | |
| 65 | FLAC__StreamDecoderSeekStatus streamSeek(const FLAC__StreamDecoder*, FLAC__uint64 absoluteByteOffset, void* clientData) |
| 66 | { |