mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Rollback of 427329175e
*** Original commit ***
Rollback of 76df06a7a3
*** Original commit ***
Parse and set `peakBitrate` for Dolby TrueHD(AC-3) and (E-)AC-3
#minor-release
***
***
PiperOrigin-RevId: 490707234
This commit is contained in:
parent
427329175e
commit
82711630ed
@ -158,6 +158,9 @@ public final class Ac3Util {
|
|||||||
if ((nextByte & 0x04) != 0) { // lfeon
|
if ((nextByte & 0x04) != 0) { // lfeon
|
||||||
channelCount++;
|
channelCount++;
|
||||||
}
|
}
|
||||||
|
// bit_rate_code - 5 bits. 2 bits from previous byte and 3 bits from next.
|
||||||
|
int halfFrmsizecod = ((nextByte & 0x03) << 3) | ((data.readUnsignedByte() & 0xE0) >> 5);
|
||||||
|
int constantBitrate = BITRATE_BY_HALF_FRMSIZECOD[halfFrmsizecod];
|
||||||
return new Format.Builder()
|
return new Format.Builder()
|
||||||
.setId(trackId)
|
.setId(trackId)
|
||||||
.setSampleMimeType(MimeTypes.AUDIO_AC3)
|
.setSampleMimeType(MimeTypes.AUDIO_AC3)
|
||||||
@ -165,6 +168,8 @@ public final class Ac3Util {
|
|||||||
.setSampleRate(sampleRate)
|
.setSampleRate(sampleRate)
|
||||||
.setDrmInitData(drmInitData)
|
.setDrmInitData(drmInitData)
|
||||||
.setLanguage(language)
|
.setLanguage(language)
|
||||||
|
.setAverageBitrate(constantBitrate)
|
||||||
|
.setPeakBitrate(constantBitrate)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +185,9 @@ public final class Ac3Util {
|
|||||||
*/
|
*/
|
||||||
public static Format parseEAc3AnnexFFormat(
|
public static Format parseEAc3AnnexFFormat(
|
||||||
ParsableByteArray data, String trackId, String language, @Nullable DrmInitData drmInitData) {
|
ParsableByteArray data, String trackId, String language, @Nullable DrmInitData drmInitData) {
|
||||||
data.skipBytes(2); // data_rate, num_ind_sub
|
// 13 bits for data_rate, 3 bits for num_ind_sub which are ignored.
|
||||||
|
int peakBitrate =
|
||||||
|
((data.readUnsignedByte() & 0xFF) << 5) | ((data.readUnsignedByte() & 0xF8) >> 3);
|
||||||
|
|
||||||
// Read the first independent substream.
|
// Read the first independent substream.
|
||||||
int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
|
int fscod = (data.readUnsignedByte() & 0xC0) >> 6;
|
||||||
@ -216,6 +223,7 @@ public final class Ac3Util {
|
|||||||
.setSampleRate(sampleRate)
|
.setSampleRate(sampleRate)
|
||||||
.setDrmInitData(drmInitData)
|
.setDrmInitData(drmInitData)
|
||||||
.setLanguage(language)
|
.setLanguage(language)
|
||||||
|
.setPeakBitrate(peakBitrate)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 13824
|
total output bytes = 13824
|
||||||
sample count = 9
|
sample count = 9
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
maxInputSize = 1566
|
maxInputSize = 1566
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 9216
|
total output bytes = 9216
|
||||||
sample count = 6
|
sample count = 6
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
maxInputSize = 1566
|
maxInputSize = 1566
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 4608
|
total output bytes = 4608
|
||||||
sample count = 3
|
sample count = 3
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
maxInputSize = 1566
|
maxInputSize = 1566
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 1536
|
total output bytes = 1536
|
||||||
sample count = 1
|
sample count = 1
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
maxInputSize = 1566
|
maxInputSize = 1566
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 13824
|
total output bytes = 13824
|
||||||
sample count = 9
|
sample count = 9
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
maxInputSize = 1566
|
maxInputSize = 1566
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 13824
|
total output bytes = 13824
|
||||||
sample count = 9
|
sample count = 9
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 10752
|
total output bytes = 10752
|
||||||
sample count = 7
|
sample count = 7
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 6144
|
total output bytes = 6144
|
||||||
sample count = 4
|
sample count = 4
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 1536
|
total output bytes = 1536
|
||||||
sample count = 1
|
sample count = 1
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,8 @@ track 0:
|
|||||||
total output bytes = 13824
|
total output bytes = 13824
|
||||||
sample count = 9
|
sample count = 9
|
||||||
format 0:
|
format 0:
|
||||||
|
averageBitrate = 384
|
||||||
|
peakBitrate = 384
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/ac3
|
sampleMimeType = audio/ac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 216000
|
total output bytes = 216000
|
||||||
sample count = 54
|
sample count = 54
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
maxInputSize = 4030
|
maxInputSize = 4030
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 144000
|
total output bytes = 144000
|
||||||
sample count = 36
|
sample count = 36
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
maxInputSize = 4030
|
maxInputSize = 4030
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 72000
|
total output bytes = 72000
|
||||||
sample count = 18
|
sample count = 18
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
maxInputSize = 4030
|
maxInputSize = 4030
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 4000
|
total output bytes = 4000
|
||||||
sample count = 1
|
sample count = 1
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
maxInputSize = 4030
|
maxInputSize = 4030
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 216000
|
total output bytes = 216000
|
||||||
sample count = 54
|
sample count = 54
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
maxInputSize = 4030
|
maxInputSize = 4030
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 216000
|
total output bytes = 216000
|
||||||
sample count = 54
|
sample count = 54
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 148000
|
total output bytes = 148000
|
||||||
sample count = 37
|
sample count = 37
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 76000
|
total output bytes = 76000
|
||||||
sample count = 19
|
sample count = 19
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 4000
|
total output bytes = 4000
|
||||||
sample count = 1
|
sample count = 1
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 216000
|
total output bytes = 216000
|
||||||
sample count = 54
|
sample count = 54
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 1000
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3
|
sampleMimeType = audio/eac3
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 163840
|
total output bytes = 163840
|
||||||
sample count = 64
|
sample count = 64
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
maxInputSize = 2590
|
maxInputSize = 2590
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 110080
|
total output bytes = 110080
|
||||||
sample count = 43
|
sample count = 43
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
maxInputSize = 2590
|
maxInputSize = 2590
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 56320
|
total output bytes = 56320
|
||||||
sample count = 22
|
sample count = 22
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
maxInputSize = 2590
|
maxInputSize = 2590
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 2560
|
total output bytes = 2560
|
||||||
sample count = 1
|
sample count = 1
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
maxInputSize = 2590
|
maxInputSize = 2590
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 163840
|
total output bytes = 163840
|
||||||
sample count = 64
|
sample count = 64
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
maxInputSize = 2590
|
maxInputSize = 2590
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 163840
|
total output bytes = 163840
|
||||||
sample count = 64
|
sample count = 64
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 110080
|
total output bytes = 110080
|
||||||
sample count = 43
|
sample count = 43
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 56320
|
total output bytes = 56320
|
||||||
sample count = 22
|
sample count = 22
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 2560
|
total output bytes = 2560
|
||||||
sample count = 1
|
sample count = 1
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
@ -10,6 +10,7 @@ track 0:
|
|||||||
total output bytes = 163840
|
total output bytes = 163840
|
||||||
sample count = 64
|
sample count = 64
|
||||||
format 0:
|
format 0:
|
||||||
|
peakBitrate = 640
|
||||||
id = 1
|
id = 1
|
||||||
sampleMimeType = audio/eac3-joc
|
sampleMimeType = audio/eac3-joc
|
||||||
channelCount = 6
|
channelCount = 6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user