Skip to content

Commit

Permalink
Add DialNorm reporting to DD+ streams.
Browse files Browse the repository at this point in the history
Implements partly #13
  • Loading branch information
UniqProject committed Dec 25, 2018
1 parent 6cbfe5f commit 877d31d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions BDInfo/BDROM/TSCodecAC3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public static void Scan(TSAudioStream stream, TSStreamBuffer buffer, ref string
uint frameSizeCode = 0;
uint channelMode;
uint lfeOn;
uint dialNorm;
uint dialNorm = 0;
uint dialNormExt = 0;
uint numBlocks = 0;

byte[] hdr = buffer.ReadBytes(4);
Expand Down Expand Up @@ -190,7 +191,7 @@ public static void Scan(TSAudioStream stream, TSStreamBuffer buffer, ref string
channelMode = buffer.ReadBits2(3);
lfeOn = buffer.ReadBits2(1);
bsid = buffer.ReadBits2(5);
dialNorm = buffer.ReadBits2(5);
dialNormExt = buffer.ReadBits2(5);

if (buffer.ReadBool())
{
Expand Down Expand Up @@ -342,10 +343,15 @@ public static void Scan(TSAudioStream stream, TSStreamBuffer buffer, ref string
}

stream.LFE = (int) lfeOn;
if (stream.StreamType != TSStreamType.AC3_PLUS_AUDIO &&
stream.StreamType != TSStreamType.AC3_PLUS_SECONDARY_AUDIO)
if (stream.StreamType != TSStreamType.AC3_PLUS_SECONDARY_AUDIO)
{
stream.DialNorm = (int) (dialNorm - 31);
if ((stream.StreamType == TSStreamType.AC3_PLUS_AUDIO && bsid == 6) ||
(stream.StreamType == TSStreamType.AC3_AUDIO))
stream.DialNorm = (int) dialNorm * -1;
else if (stream.StreamType == TSStreamType.AC3_PLUS_AUDIO && secondFrame)
{
stream.DialNorm = (int) dialNormExt * -1;
}
}
stream.IsVBR = false;
if (stream.StreamType == TSStreamType.AC3_PLUS_AUDIO && bsid == 6 && !secondFrame)
Expand Down

0 comments on commit 877d31d

Please sign in to comment.