| 411 | } |
| 412 | |
| 413 | static void |
| 414 | dsdiff_stream_decode(DecoderClient &client, InputStream &is) |
| 415 | { |
| 416 | DsdiffMetaData metadata; |
| 417 | |
| 418 | DsdiffChunkHeader chunk_header; |
| 419 | /* check if it is is a proper DFF file */ |
| 420 | if (!dsdiff_read_metadata(&client, is, metadata, chunk_header)) |
| 421 | return; |
| 422 | |
| 423 | auto audio_format = CheckAudioFormat(metadata.sample_rate / 8, |
| 424 | SampleFormat::DSD, |
| 425 | metadata.channels); |
| 426 | |
| 427 | /* calculate song time from DSD chunk size and sample frequency */ |
| 428 | offset_type chunk_size = metadata.chunk_size; |
| 429 | |
| 430 | uint64_t n_frames = chunk_size / audio_format.channels; |
| 431 | auto songtime = SongTime::FromScale<uint64_t>(n_frames, |
| 432 | audio_format.sample_rate); |
| 433 | |
| 434 | /* success: file was recognized */ |
| 435 | client.Ready(audio_format, is.IsSeekable(), songtime); |
| 436 | |
| 437 | /* every iteration of the following loop decodes one "DSD" |
| 438 | chunk from a DFF file */ |
| 439 | |
| 440 | dsdiff_decode_chunk(client, is, |
| 441 | metadata.channels, |
| 442 | metadata.sample_rate, |
| 443 | chunk_size); |
| 444 | } |
| 445 | |
| 446 | static bool |
| 447 | dsdiff_scan_stream(InputStream &is, TagHandler &handler) |
nothing calls this directly
no test coverage detected