use of com.google.android.exoplayer2.audio.Ac4Util.SyncFrameInfo in project ExoPlayer by google.
the class Ac3Reader method parseHeader.
/**
* Parses the sample header.
*/
@RequiresNonNull("output")
private void parseHeader() {
headerScratchBits.setPosition(0);
SyncFrameInfo frameInfo = Ac3Util.parseAc3SyncframeInfo(headerScratchBits);
if (format == null || frameInfo.channelCount != format.channelCount || frameInfo.sampleRate != format.sampleRate || !Util.areEqual(frameInfo.mimeType, format.sampleMimeType)) {
format = new Format.Builder().setId(formatId).setSampleMimeType(frameInfo.mimeType).setChannelCount(frameInfo.channelCount).setSampleRate(frameInfo.sampleRate).setLanguage(language).build();
output.format(format);
}
sampleSize = frameInfo.frameSize;
// In this class a sample is an access unit (syncframe in AC-3), but Format#sampleRate
// specifies the number of PCM audio samples per second.
sampleDurationUs = C.MICROS_PER_SECOND * frameInfo.sampleCount / format.sampleRate;
}
use of com.google.android.exoplayer2.audio.Ac4Util.SyncFrameInfo in project ExoPlayer by google.
the class Ac4Reader method parseHeader.
/**
* Parses the sample header.
*/
@RequiresNonNull("output")
private void parseHeader() {
headerScratchBits.setPosition(0);
SyncFrameInfo frameInfo = Ac4Util.parseAc4SyncframeInfo(headerScratchBits);
if (format == null || frameInfo.channelCount != format.channelCount || frameInfo.sampleRate != format.sampleRate || !MimeTypes.AUDIO_AC4.equals(format.sampleMimeType)) {
format = new Format.Builder().setId(formatId).setSampleMimeType(MimeTypes.AUDIO_AC4).setChannelCount(frameInfo.channelCount).setSampleRate(frameInfo.sampleRate).setLanguage(language).build();
output.format(format);
}
sampleSize = frameInfo.frameSize;
// In this class a sample is an AC-4 sync frame, but Format#sampleRate specifies the number of
// PCM audio samples per second.
sampleDurationUs = C.MICROS_PER_SECOND * frameInfo.sampleCount / format.sampleRate;
}
Aggregations