Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
c32a809d
Commit
c32a809d
authored
Oct 16, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/opus: convert field `output_gain` to float
parent
14061442
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
OpusDecoderPlugin.cxx
src/decoder/plugins/OpusDecoderPlugin.cxx
+8
-4
No files found.
src/decoder/plugins/OpusDecoderPlugin.cxx
View file @
c32a809d
...
...
@@ -79,7 +79,7 @@ class MPDOpusDecoder final : public OggDecoder {
* The output gain from the Opus header. Initialized by
* OnOggBeginning().
*/
signed
output_gain
;
float
output_gain
;
/**
* The pre-skip value from the Opus header. Initialized by
...
...
@@ -170,10 +170,14 @@ MPDOpusDecoder::OnOggBeginning(const ogg_packet &packet)
throw
std
::
runtime_error
(
"BOS packet must be OpusHead"
);
unsigned
channels
;
if
(
!
ScanOpusHeader
(
packet
.
packet
,
packet
.
bytes
,
channels
,
output_gain
,
pre_skip
)
||
signed
output_gain_i
;
if
(
!
ScanOpusHeader
(
packet
.
packet
,
packet
.
bytes
,
channels
,
output_gain_i
,
pre_skip
)
||
!
audio_valid_channel_count
(
channels
))
throw
std
::
runtime_error
(
"Malformed BOS packet"
);
/* convert Q7.8 fixed-point to float */
output_gain
=
float
(
output_gain_i
)
/
256.0
f
;
granulepos
=
0
;
skip
=
pre_skip
;
...
...
@@ -251,8 +255,8 @@ MPDOpusDecoder::HandleTags(const ogg_packet &packet)
* ReplayGain. Add 5dB to compensate for the different
* reference levels between ReplayGain (89dB) and EBU R128 (-23 LUFS).
*/
rgi
.
track
.
gain
=
float
(
output_gain
)
/
256.0
f
+
5
;
rgi
.
album
.
gain
=
float
(
output_gain
)
/
256.0
f
+
5
;
rgi
.
track
.
gain
=
output_gain
+
5
;
rgi
.
album
.
gain
=
output_gain
+
5
;
TagBuilder
tag_builder
;
AddTagHandler
h
(
tag_builder
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment