Report bitrate for DSF and DSDIFF DSD decoders

This commit is contained in:
Jurgen Kramer 2014-04-04 12:43:54 +02:00 committed by Max Kellermann
parent 880ce080b7
commit 7c3af4f56f
3 changed files with 9 additions and 4 deletions

1
NEWS
View File

@ -39,6 +39,7 @@ ver 0.19 (not yet released)
- vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song - vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song
- audiofile: support scanning remote files - audiofile: support scanning remote files
- audiofile: log libaudiofile errors - audiofile: log libaudiofile errors
- dsdiff, dsf: report bit rate
- sndfile: support scanning remote files - sndfile: support scanning remote files
- sndfile: support tags "comment", "album", "track", "genre" - sndfile: support tags "comment", "album", "track", "genre"
- mp4v2: support playback of MP4 files. - mp4v2: support playback of MP4 files.

View File

@ -355,7 +355,7 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
*/ */
static bool static bool
dsdiff_decode_chunk(Decoder &decoder, InputStream &is, dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
unsigned channels, unsigned channels, unsigned sample_rate,
uint64_t chunk_size) uint64_t chunk_size)
{ {
uint8_t buffer[8192]; uint8_t buffer[8192];
@ -385,7 +385,8 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
if (lsbitfirst) if (lsbitfirst)
bit_reverse_buffer(buffer, buffer + nbytes); bit_reverse_buffer(buffer, buffer + nbytes);
const auto cmd = decoder_data(decoder, is, buffer, nbytes, 0); const auto cmd = decoder_data(decoder, is, buffer, nbytes,
sample_rate / 1000);
switch (cmd) { switch (cmd) {
case DecoderCommand::NONE: case DecoderCommand::NONE:
break; break;
@ -440,6 +441,7 @@ dsdiff_stream_decode(Decoder &decoder, InputStream &is)
if (chunk_header.id.Equals("DSD ")) { if (chunk_header.id.Equals("DSD ")) {
if (!dsdiff_decode_chunk(decoder, is, if (!dsdiff_decode_chunk(decoder, is,
metadata.channels, metadata.channels,
metadata.sample_rate,
chunk_size)) chunk_size))
break; break;
} else { } else {

View File

@ -219,7 +219,7 @@ dsf_to_pcm_order(uint8_t *dest, uint8_t *scratch, size_t nrbytes)
*/ */
static bool static bool
dsf_decode_chunk(Decoder &decoder, InputStream &is, dsf_decode_chunk(Decoder &decoder, InputStream &is,
unsigned channels, unsigned channels, unsigned sample_rate,
uint64_t chunk_size, uint64_t chunk_size,
bool bitreverse) bool bitreverse)
{ {
@ -256,7 +256,8 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
dsf_to_pcm_order(buffer, dsf_scratch_buffer, nbytes); dsf_to_pcm_order(buffer, dsf_scratch_buffer, nbytes);
const auto cmd = decoder_data(decoder, is, buffer, nbytes, 0); const auto cmd = decoder_data(decoder, is, buffer, nbytes,
sample_rate / 1000);
switch (cmd) { switch (cmd) {
case DecoderCommand::NONE: case DecoderCommand::NONE:
break; break;
@ -300,6 +301,7 @@ dsf_stream_decode(Decoder &decoder, InputStream &is)
decoder_initialized(decoder, audio_format, false, songtime); decoder_initialized(decoder, audio_format, false, songtime);
if (!dsf_decode_chunk(decoder, is, metadata.channels, if (!dsf_decode_chunk(decoder, is, metadata.channels,
metadata.sample_rate,
chunk_size, chunk_size,
metadata.bitreverse)) metadata.bitreverse))
return; return;