MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / dsdiff_stream_decode

Function dsdiff_stream_decode

src/decoder/plugins/DsdiffDecoderPlugin.cxx:413–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413static void
414dsdiff_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
446static bool
447dsdiff_scan_stream(InputStream &is, TagHandler &handler)

Callers

nothing calls this directly

Calls 4

dsdiff_read_metadataFunction · 0.85
dsdiff_decode_chunkFunction · 0.85
CheckAudioFormatFunction · 0.70
ReadyMethod · 0.45

Tested by

no test coverage detected