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

Function dsf_stream_decode

src/decoder/plugins/DsfDecoderPlugin.cxx:288–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288static void
289dsf_stream_decode(DecoderClient &client, InputStream &is)
290{
291 /* check if it is a proper DSF file */
292 DsfMetaData metadata;
293 if (!dsf_read_metadata(&client, is, &metadata))
294 return;
295
296 auto audio_format = CheckAudioFormat(metadata.sample_rate / 8,
297 SampleFormat::DSD,
298 metadata.channels);
299
300 /* Calculate song time from DSD chunk size and sample frequency */
301 const auto n_blocks = metadata.n_blocks;
302 auto songtime = SongTime::FromScale<uint64_t>(n_blocks * DSF_BLOCK_SIZE,
303 audio_format.sample_rate);
304
305 /* success: file was recognized */
306 client.Ready(audio_format, is.IsSeekable(), songtime);
307
308 dsf_decode_chunk(client, is, metadata.channels,
309 metadata.sample_rate,
310 n_blocks,
311 metadata.bitreverse);
312}
313
314static bool
315dsf_scan_stream(InputStream &is, TagHandler &handler)

Callers

nothing calls this directly

Calls 4

dsf_read_metadataFunction · 0.85
dsf_decode_chunkFunction · 0.85
CheckAudioFormatFunction · 0.70
ReadyMethod · 0.45

Tested by

no test coverage detected