aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-05 23:33:11 +0200
committerMax Kellermann <max@duempel.org>2015-08-05 23:33:11 +0200
commit3e9738dc6669ad91d4140fb485742b9cf57842f9 (patch)
tree5a046d88202f36d0b5e8931f6957e1016b657313
parent2ecf57cdd922781f76c13136c55d8ab79c4ad141 (diff)
downloadmpd-3e9738dc6669ad91d4140fb485742b9cf57842f9.tar.gz
mpd-3e9738dc6669ad91d4140fb485742b9cf57842f9.tar.xz
mpd-3e9738dc6669ad91d4140fb485742b9cf57842f9.zip
decoder/mpcdec: read the bit rate
This was lost in commit 8ead8f7ea, because this was never implemented for the new API.
-rw-r--r--NEWS1
-rw-r--r--src/decoder/plugins/MpcdecDecoderPlugin.cxx6
2 files changed, 3 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 56533ff6a..98f1ccd6c 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ ver 0.20 (not yet released)
* decoder
- ffmpeg: support ReplayGain and MixRamp
- ffmpeg: support stream tags
+ - mpcdec: read the bit rate
* output
- jack: reduce CPU usage
- pulse: set channel map to WAVE-EX
diff --git a/src/decoder/plugins/MpcdecDecoderPlugin.cxx b/src/decoder/plugins/MpcdecDecoderPlugin.cxx
index 4be9e1498..e1ddd05f0 100644
--- a/src/decoder/plugins/MpcdecDecoderPlugin.cxx
+++ b/src/decoder/plugins/MpcdecDecoderPlugin.cxx
@@ -193,8 +193,6 @@ mpcdec_decode(Decoder &mpd_decoder, InputStream &is)
decoder_seek_error(mpd_decoder);
}
- mpc_uint32_t vbr_update_bits = 0;
-
MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH];
mpc_frame_info frame;
frame.buffer = (MPC_SAMPLE_FORMAT *)sample_buffer;
@@ -214,8 +212,8 @@ mpcdec_decode(Decoder &mpd_decoder, InputStream &is)
MpcdecSampleTraits::value_type chunk[ARRAY_SIZE(sample_buffer)];
mpc_to_mpd_buffer(chunk, sample_buffer, ret);
- long bit_rate = vbr_update_bits * audio_format.sample_rate
- / 1152 / 1000;
+ long bit_rate = unsigned(frame.bits) * audio_format.sample_rate
+ / (1000 * frame.samples);
cmd = decoder_data(mpd_decoder, is,
chunk, ret * sizeof(chunk[0]),