decoder/HybridDSD: calculate bit rate

This commit is contained in:
Max Kellermann 2018-02-13 09:41:07 +01:00
parent 58bb866e2d
commit 60dbf1bea0
1 changed files with 4 additions and 1 deletions

View File

@ -179,6 +179,7 @@ HybridDsdDecode(DecoderClient &client, InputStream &input)
offset_type remaining_bytes; offset_type remaining_bytes;
size_t frame_size; size_t frame_size;
unsigned kbit_rate;
try { try {
auto result = FindHybridDsdData(client, input); auto result = FindHybridDsdData(client, input);
@ -187,6 +188,8 @@ HybridDsdDecode(DecoderClient &client, InputStream &input)
/* TODO: implement seeking */ false, /* TODO: implement seeking */ false,
duration); duration);
frame_size = result.first.GetFrameSize(); frame_size = result.first.GetFrameSize();
kbit_rate = frame_size * result.first.sample_rate /
(1024u / 8u);
remaining_bytes = result.second; remaining_bytes = result.second;
} catch (UnsupportedFile) { } catch (UnsupportedFile) {
/* not a Hybrid-DSD file; let the next decoder plugin /* not a Hybrid-DSD file; let the next decoder plugin
@ -233,7 +236,7 @@ HybridDsdDecode(DecoderClient &client, InputStream &input)
if (n_frames > 0) { if (n_frames > 0) {
cmd = client.SubmitData(input, r.data, cmd = client.SubmitData(input, r.data,
n_frames * frame_size, n_frames * frame_size,
0); kbit_rate);
buffer.Consume(n_frames * frame_size); buffer.Consume(n_frames * frame_size);
} }
} }